@needle-tools/engine 3.37.10-alpha.4 → 3.37.10-alpha.5
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/CHANGELOG.md +6 -0
- package/dist/needle-engine.js +1295 -1264
- package/dist/needle-engine.light.js +44 -13
- package/dist/needle-engine.light.min.js +102 -102
- package/dist/needle-engine.light.umd.cjs +6 -6
- package/dist/needle-engine.min.js +6 -6
- package/dist/needle-engine.umd.cjs +147 -147
- package/lib/engine/engine_loaders.d.ts +7 -1
- package/lib/engine/engine_loaders.js +7 -0
- package/lib/engine/engine_loaders.js.map +1 -1
- package/lib/engine-components/ContactShadows.js +15 -8
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +20 -2
- package/lib/engine-components/OrbitControls.js +30 -2
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.js +4 -0
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_loaders.ts +8 -1
- package/src/engine-components/ContactShadows.ts +14 -6
- package/src/engine-components/OrbitControls.ts +33 -5
- package/src/engine-components/ReflectionProbe.ts +5 -0
|
@@ -4340,7 +4340,7 @@ void main() {
|
|
|
4340
4340
|
}`),r(js,"blipMaterial"),r(js,"mesh");function tH(t){return js.copyTexture(t)}function CiA(t,A=!1){return js.textureToCanvas(t,A)}function aiA(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function OU(t,A=[]){const e=new St;e.makeEmpty();const i=[];function g(o){let s=!0;if(o.visible&&ZY(o)!==!1&&!(o.type==="TransformControlsGizmo"||o.type==="TransformControlsPlane")&&(o instanceof vR&&(s=!1),o instanceof Py&&(s=!1),o instanceof jY&&(s=!1),o.material instanceof Ny&&(s=!1),o instanceof dA||(s=!1),!(A!=null&&A.includes(o))&&o.isUI!==!0)){if(s){const C=o.children;o.children=i;const a=o.position,n=o.scale;if(Number.isNaN(a.x)||Number.isNaN(a.y)||Number.isNaN(a.z)){console.warn(`Object "${o.name}" has NaN values in position or scale.... will ignore it`,a,n);return}e.expandByObject(o,!0),o.children=C}for(const C of o.children)g(C)}}let I=!1;for(const o of t)o&&(I=!0,o.updateMatrixWorld(),g(o));return I||console.warn("No objects to fit camera to..."),e}let d0=!1;t$((...t)=>{var A;Be()&&(A=Bt.Current)!=null&&A.isInXR&&(mh(!0),iH("error",...t))});function mh(t){if(t){if(d0)return;d0=!0,riA()}else{if(!d0)return;d0=!1,BiA()}}const xd={log:void 0,warn:void 0,error:void 0};class niA{constructor(){r(this,"familyName","needle-xr"),r(this,"root",null),r(this,"context",null),r(this,"defaultFontSize",.06),r(this,"targetObject",new wA),r(this,"userForwardViewPoint",new f),r(this,"oneEuroFilter",new FU(90,.8)),r(this,"_lastElementRemoveTime",0),r(this,"onBeforeRender",()=>{var A,e;const i=(A=this.context)==null?void 0:A.mainCamera;if(this.context&&i instanceof xe){const g=this.getRoot();Number.isNaN(g.position.x)&&g.position.set(0,0,0),Number.isNaN(g.quaternion.x)&&g.quaternion.set(0,0,0,1),this.context.scene.add(this.targetObject);const I=((e=this.context.xr)==null?void 0:e.rigScale)??1,o=3.5*I,s=i.worldForward;s.y=0,s.normalize().multiplyScalar(o),this.userForwardViewPoint.copy(i.worldPosition).sub(s),this.targetObject.position.distanceTo(this.userForwardViewPoint)>2*I&&(this.targetObject.position.copy(this.userForwardViewPoint),Kd(this.targetObject,i,!0,!0),this.targetObject.rotateY(Math.PI)),this.oneEuroFilter.filter(this.targetObject.position,g.position,this.context.time.time);const C=this.context.time.deltaTime;if(g.quaternion.slerp(this.targetObject.quaternion,C*5),g.scale.setScalar(I),this.targetObject.removeFromParent(),this.context.scene.add(g),this.context.time.time-this._lastElementRemoveTime>.1){this._lastElementRemoveTime=this.context.time.time;const a=Date.now();for(let n=0;n<this._activeTexts.length;n++){const B=this._activeTexts[n];if(B instanceof qt.Text&&a-B._activatedTime>2e4){B.removeFromParent(),this._textBuffer.push(B),this._activeTexts.splice(n,1);break}}}}}),r(this,"textOptions",{fontSize:this.defaultFontSize,fontFamily:this.familyName,padding:.03,margin:.005,color:0,backgroundColor:16777215,backgroundOpacity:.4,borderRadius:.03,offset:.025}),r(this,"_textBuffer",[]),r(this,"_activeTexts",[]),this.ensureFont()}onEnable(){this.context=Bt.Current||Bt.All[0],this.context.pre_render_callbacks.push(this.onBeforeRender)}onDisable(){var A,e,i;(e=this.context)==null||e.pre_render_callbacks.splice((A=this.context)==null?void 0:A.pre_render_callbacks.indexOf(this.onBeforeRender),1),(i=this.root)==null||i.removeFromParent()}addLog(A,e){const i=this.getRoot(),g=this.getText();let I=16777215,o=0;switch(A){case"log":I=16777215,o=0;break;case"warn":I=16772761,o=4465152;break;case"error":I=16755370,o=7798784;break}e.length>1e3&&(e=e.substring(0,1e3)+"...");const s=new Date().toISOString().split("T")[1].split(".")[0];g.textContent="["+s+"] "+e,g.visible=!0,g._activatedTime=Date.now(),i.add(g),this._activeTexts.push(g),this.context&&this.context.scene.add(i),g.set({backgroundColor:I,color:o}),qt.update()}ensureFont(){let A=qt.FontLibrary.getFontFamily(this.familyName);if(!A){A=qt.FontLibrary.addFontFamily(this.familyName);const e=A.addVariant("normal","normal","./include/needle/arial-msdf.json","./include/needle/arial.png");e?.addEventListener("ready",()=>{qt.update()})}}getText(){const A=this.getRoot();if(this._textBuffer.length>0){const i=this._textBuffer.pop();return i.visible=!0,setTimeout(()=>this.disableDepthTestRecursive(i),100),i}if(A.children.length>20&&this._activeTexts.length>0)return this._activeTexts.shift();const e=new qt.Text(this.textOptions);return setTimeout(()=>this.disableDepthTestRecursive(e),500),setTimeout(()=>this.disableDepthTestRecursive(e),1500),e}disableDepthTestRecursive(A,e=0){for(let g=0;g<A.children.length;g++){const I=A.children[g];I instanceof wA&&this.disableDepthTestRecursive(I,e+1)}A.renderOrder=10*e,A.layers.set(2);const i=A.material;i&&(i.depthWrite=!1,i.depthTest=!1,i.transparent=!0),e===0&&qt.update()}getRoot(){if(this.root)return this.root;const A=this.defaultFontSize,e={boxSizing:"border-box",fontFamily:this.familyName,width:"2.6",fontSize:A,color:0,lineHeight:1,backgroundColor:16777215,backgroundOpacity:0,whiteSpace:"pre-wrap",flexDirection:"column-reverse"};return this.root=new qt.Block(e),this.root}}let Ws=null;function riA(){Ws||(Ws=new niA),Ws.onEnable();for(const t in xd){xd[t]=console[t];let A=!1;console[t]=function(){var e;if((e=xd[t])==null||e.apply(console,arguments),!A)try{A=!0,iH(t,...arguments)}finally{A=!1}}}}function BiA(){Ws?.onDisable();for(const t in xd)console[t]=xd[t]}const Ld=new Map;function iH(t,...A){try{switch(Ld.clear(),t){case"log":Ws?.addLog("log",e());break;case"warn":Ws?.addLog("warn",e());break;case"error":Ws?.addLog("error",e());break}}catch(I){console.error("Error in spatial console",I)}finally{Ld.clear()}function e(){let I="";for(let o=0;o<A.length;o++){const s=A[o];I+=i(s),o<A.length-1&&(I+=", ")}return I}function i(I,o=0){if(typeof I=="string")return'"'+I+'"';if(typeof I=="number"){if(I%1!==0){const s=I.toFixed(5),C=s.indexOf(".");let a=s.length-1;for(;a>C&&s[a]==="0";)a--;return s.substring(0,a+1)}return I.toString()}else if(Array.isArray(I)){let s="[";for(let C=0;C<I.length;C++){const a=I[C];s+=i(a,o+1),C<I.length-1&&(s+=", ")}return s+="]",s}else{if(I===null)return"null";if(I===void 0)return"undefined";if(typeof I=="function")return I.name+"()"}if(I instanceof eA)return`(${i(I.x)}, ${i(I.y)})`;if(I instanceof f)return`(${i(I.x)}, ${i(I.y)}, ${i(I.z)})`;if(I instanceof Ae)return`(${i(I.x)}, ${i(I.y)}, ${i(I.z)}, ${i(I.w)})`;if(I instanceof UA)return`(${i(I.x)}, ${i(I.y)}, ${i(I.z)}, ${i(I.w)})`;if(I instanceof qe||I instanceof He)return I.name;if(I instanceof Je)return`[${I.elements.join(", ")}]`;if(I instanceof NA)return`[${I.elements.join(", ")}]`;if(I instanceof rI)return I.mask.toString();if(typeof I=="object"){if(Ld.has(I))return"*";let s=`{
|
|
4341
4341
|
`;s+=g(o);const C=Object.keys(I);let a="";for(let n=0;n<C.length;n++){const B=C[n],Q=I[B];if(Ld.has(Q)){a+="";continue}Ld.set(Q,!0),a+=B+":"+i(Q,o+1),n<C.length-1&&(a+=", "),a.length>=60&&(a+=`
|
|
4342
4342
|
`,a+=g(o),s+=a,a="")}return s+=a,s+=`
|
|
4343
|
-
}`,s}return I}function g(I){let o="";for(let s=0;s<I;s++)o+=" ";return o}}const QiA=tA("nodevlogs");function ri(t,A=So.Log){MC(A,t)}function Bi(t){ri(t,So.Warn)}function PU(t){ri(t,So.Error)}let jU;function Be(){return QiA?!1:jU!==void 0?jU:ho()}function EiA(t){jU=t}const gH=tA("debugdefines");fh('if(!globalThis[""3.37.10-alpha.
|
|
4343
|
+
}`,s}return I}function g(I){let o="";for(let s=0;s<I;s++)o+=" ";return o}}const QiA=tA("nodevlogs");function ri(t,A=So.Log){MC(A,t)}function Bi(t){ri(t,So.Warn)}function PU(t){ri(t,So.Error)}let jU;function Be(){return QiA?!1:jU!==void 0?jU:ho()}function EiA(t){jU=t}const gH=tA("debugdefines");fh('if(!globalThis[""3.37.10-alpha.5""]) globalThis[""3.37.10-alpha.5""] = "0.0.0";'),fh('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),fh('if(!globalThis[""Mon May 13 2024 17:50:15 GMT+0200 (Central European Summer Time)""]) globalThis[""Mon May 13 2024 17:50:15 GMT+0200 (Central European Summer Time)""] = "unknown";'),fh('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.10-alpha.5";'),fh('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),fh('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon May 13 2024 17:50:15 GMT+0200 (Central European Summer Time)";');const La="3.37.10-alpha.5",u0="undefined",WU="Mon May 13 2024 17:50:15 GMT+0200 (Central European Summer Time)";gH&&console.log(`Engine version: ${La} (generator: ${u0})
|
|
4344
4344
|
Project built at ${WU}`);const _a="needle_isActiveInHierarchy",oQ="builtin_components",_d="needle_editor_guid";function fh(t){try{(0,eval)(t)}catch(A){gH&&console.error(A)}}const hiA='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',ciA=btoa(hiA),liA="data:image/svg+xml;base64,"+ciA,diA=liA,uiA=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(uiA);const piA='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',DiA=btoa(piA),wiA="data:image/svg+xml;charset=utf-8;base64,"+DiA,yiA=wiA,ns=tA("debuglicense");let sQ="basic";ns&&console.log("License Type: "+sQ);function Zs(){switch(sQ){case"pro":case"enterprise":return!0}return!1}function ZU(){switch(sQ){case"indie":return!0}return!1}function kh(){return Zs()||ZU()}const IH=[];function SiA(t){if(Zs()||ZU())return t(!0);IH.push(t)}function miA(t){for(const A of IH)try{A(t)}catch{}}Bt.registerCallback(ki.ContextRegistered,t=>{GiA(t.context),RiA(),kiA(t.context)});let CQ,VU=!1,p0="";async function fiA(){if(CQ)return CQ;if(sQ==="basic")try{const t="https://engine.needle.tools/licensing/check?location="+encodeURIComponent(window.location.href)+"&version="+La+"&generator="+encodeURIComponent(u0),A=await fetch(t,{method:"GET"}).catch(e=>{ns&&console.error("License check failed",e)});A?.status===200?(VU=!1,ns&&console.log("License check succeeded"),sQ="pro",miA(!0)):A?.status===403?(VU=!0,p0=await A.text()):ns&&console.log("License check failed with status "+A?.status)}catch(t){ns&&console.error("License check failed",t)}else ns&&console.log('Runtime license check is skipped because license is already applied as "'+sQ+'"')}CQ=fiA();async function kiA(t){function A(){const g=document.createElement("div");g.className="needle-forbidden",g.style.cssText=`
|
|
4345
4345
|
position: fixed;
|
|
4346
4346
|
top: 0;
|
|
@@ -4407,7 +4407,7 @@ CLICK HERE TO GET A LICENSE`,e.style.cursor="pointer",e.style.userSelect="none",
|
|
|
4407
4407
|
`,I.appendChild(o),Hd&&console.log("Created fallback close button",I,A)}appendElement(A,e){return e.shadowRoot?e.shadowRoot.appendChild(A):e.appendChild(A)}}var biA=function(){var t="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",A="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var g=WebAssembly.validate(e)?A:t,I,o=WebAssembly.instantiate(s(g),{}).then(function(c){I=c.instance,I.exports.__wasm_call_ctors()});function s(c){for(var u=new Uint8Array(c.length),p=0;p<c.length;++p){var D=c.charCodeAt(p);u[p]=D>96?D-97:D>64?D-39:D+4}for(var m=0,p=0;p<c.length;++p)u[m++]=u[p]<60?i[u[p]]:(u[p]-60)*64+u[++p];return u.buffer.slice(0,m)}function C(c,u,p,D,m,M){var k=I.exports.sbrk,R=p+3&-4,F=k(R*D),S=k(m.length),U=new Uint8Array(I.exports.memory.buffer);U.set(m,S);var T=c(F,p,D,S,m.length);if(T==0&&M&&M(F,R,D),u.set(U.subarray(F,F+p*D)),k(F-k(0)),T!=0)throw new Error("Malformed buffer data: "+T)}var a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},B=[],Q=0;function E(c){var u={object:new Worker(c),pending:0,requests:{}};return u.object.onmessage=function(p){var D=p.data;u.pending-=D.count,u.requests[D.id][D.action](D.value),delete u.requests[D.id]},u}function h(c){for(var u="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(g))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+C.toString()+d.toString(),p=new Blob([u],{type:"text/javascript"}),D=URL.createObjectURL(p),m=0;m<c;++m)B[m]=E(D);URL.revokeObjectURL(D)}function l(c,u,p,D,m){for(var M=B[0],k=1;k<B.length;++k)B[k].pending<M.pending&&(M=B[k]);return new Promise(function(R,F){var S=new Uint8Array(p),U=Q++;M.pending+=c,M.requests[U]={resolve:R,reject:F},M.object.postMessage({id:U,count:c,size:u,source:S,mode:D,filter:m},[S.buffer])})}function d(c){o.then(function(){var u=c.data;try{var p=new Uint8Array(u.count*u.size);C(I.exports[u.mode],p,u.count,u.size,u.source,I.exports[u.filter]),self.postMessage({id:u.id,count:u.count,action:"resolve",value:p},[p.buffer])}catch(D){self.postMessage({id:u.id,count:u.count,action:"reject",value:D})}})}return{ready:o,supported:!0,useWorkers:function(c){h(c)},decodeVertexBuffer:function(c,u,p,D,m){C(I.exports.meshopt_decodeVertexBuffer,c,u,p,D,I.exports[a[m]])},decodeIndexBuffer:function(c,u,p,D){C(I.exports.meshopt_decodeIndexBuffer,c,u,p,D)},decodeIndexSequence:function(c,u,p,D){C(I.exports.meshopt_decodeIndexSequence,c,u,p,D)},decodeGltfBuffer:function(c,u,p,D,m,M){C(I.exports[n[m]],c,u,p,D,I.exports[a[M]])},decodeGltfBufferAsync:function(c,u,p,D,m){return B.length>0?l(c,u,p,n[D],a[m]):o.then(function(){var M=new Uint8Array(c*u);return C(I.exports[n[D]],M,c,u,p,I.exports[a[m]]),M})}}}();const eN=new WeakMap;let tN=class extends Jg{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,A,e,i){const g=new ag(this.manager);g.setPath(this.path),g.setResponseType("arraybuffer"),g.setRequestHeader(this.requestHeader),g.setWithCredentials(this.withCredentials),g.load(t,I=>{this.parse(I,A,i)},e,i)}parse(t,A,e=()=>{}){this.decodeDracoFile(t,A,null,null,he).catch(e)}decodeDracoFile(t,A,e,i,g=Dt,I=()=>{}){const o={attributeIDs:e||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!e,vertexColorSpace:g};return this.decodeGeometry(t,o).then(A).catch(I)}decodeGeometry(t,A){const e=JSON.stringify(A);if(eN.has(t)){const s=eN.get(t);if(s.key===e)return s.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const g=this.workerNextTaskID++,I=t.byteLength,o=this._getWorker(g,I).then(s=>(i=s,new Promise((C,a)=>{i._callbacks[g]={resolve:C,reject:a},i.postMessage({type:"decode",id:g,taskConfig:A,buffer:t},[t])}))).then(s=>this._createGeometry(s.geometry));return o.catch(()=>!0).then(()=>{i&&g&&this._releaseTask(i,g)}),eN.set(t,{key:e,promise:o}),o}_createGeometry(t){const A=new De;t.index&&A.setIndex(new te(t.index.array,1));for(let e=0;e<t.attributes.length;e++){const i=t.attributes[e],g=i.name,I=i.array,o=i.itemSize,s=new te(I,o);g==="color"&&(this._assignVertexColorSpace(s,i.vertexColorSpace),s.normalized=!(I instanceof Float32Array)),A.setAttribute(g,s)}return A}_assignVertexColorSpace(t,A){if(A!==he)return;const e=new MA;for(let i=0,g=t.count;i<g;i++)e.fromBufferAttribute(t,i).convertSRGBToLinear(),t.setXYZ(i,e.r,e.g,e.b)}_loadLibrary(t,A){const e=new ag(this.manager);return e.setPath(this.decoderPath),e.setResponseType(A),e.setWithCredentials(this.withCredentials),new Promise((i,g)=>{e.load(t,i,void 0,g)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",A=[];return t?A.push(this._loadLibrary("draco_decoder.js","text")):(A.push(this._loadLibrary("draco_wasm_wrapper.js","text")),A.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(A).then(e=>{const i=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const g=KiA.toString(),I=["/* draco decoder */",i,"","/* worker */",g.substring(g.indexOf("{")+1,g.lastIndexOf("}"))].join(`
|
|
4408
4408
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([I]))}),this.decoderPending}_getWorker(t,A){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(g){const I=g.data;switch(I.type){case"decode":i._callbacks[I.id].resolve(I);break;case"error":i._callbacks[I.id].reject(I);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+I.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,g){return i._taskLoad>g._taskLoad?-1:1});const e=this.workerPool[this.workerPool.length-1];return e._taskCosts[t]=A,e._taskLoad+=A,e})}_releaseTask(t,A){t._taskLoad-=t._taskCosts[A],delete t._callbacks[A],delete t._taskCosts[A]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}};function KiA(){let t,A;onmessage=function(o){const s=o.data;switch(s.type){case"init":t=s.decoderConfig,A=new Promise(function(n){t.onModuleLoaded=function(B){n({draco:B})},DracoDecoderModule(t)});break;case"decode":const C=s.buffer,a=s.taskConfig;A.then(n=>{const B=n.draco,Q=new B.Decoder;try{const E=e(B,Q,new Int8Array(C),a),h=E.attributes.map(l=>l.array.buffer);E.index&&h.push(E.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:E},h)}catch(E){console.error(E),self.postMessage({type:"error",id:s.id,error:E.message})}finally{B.destroy(Q)}});break}};function e(o,s,C,a){const n=a.attributeIDs,B=a.attributeTypes;let Q,E;const h=s.GetEncodedGeometryType(C);if(h===o.TRIANGULAR_MESH)Q=new o.Mesh,E=s.DecodeArrayToMesh(C,C.byteLength,Q);else if(h===o.POINT_CLOUD)Q=new o.PointCloud,E=s.DecodeArrayToPointCloud(C,C.byteLength,Q);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!E.ok()||Q.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+E.error_msg());const l={index:null,attributes:[]};for(const d in n){const c=self[B[d]];let u,p;if(a.useUniqueIDs)p=n[d],u=s.GetAttributeByUniqueId(Q,p);else{if(p=s.GetAttributeId(Q,o[n[d]]),p===-1)continue;u=s.GetAttribute(Q,p)}const D=g(o,s,Q,d,c,u);d==="color"&&(D.vertexColorSpace=a.vertexColorSpace),l.attributes.push(D)}return h===o.TRIANGULAR_MESH&&(l.index=i(o,s,Q)),o.destroy(Q),l}function i(o,s,C){const a=C.num_faces()*3,n=a*4,B=o._malloc(n);s.GetTrianglesUInt32Array(C,n,B);const Q=new Uint32Array(o.HEAPF32.buffer,B,a).slice();return o._free(B),{array:Q,itemSize:1}}function g(o,s,C,a,n,B){const Q=B.num_components(),E=C.num_points()*Q,h=E*n.BYTES_PER_ELEMENT,l=I(o,n),d=o._malloc(h);s.GetAttributeDataArrayForAllPoints(C,B,l,h,d);const c=new n(o.HEAPF32.buffer,d,E).slice();return o._free(d),{name:a,array:c,itemSize:Q}}function I(o,s){switch(s){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}let viA=class{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const A=this.workerCreator();A.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=A}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,A){const e=this.workersResolve[t];if(e&&e(A),this.queue.length){const{resolve:i,msg:g,transfer:I}=this.queue.shift();this.workersResolve[t]=i,this.workers[t].postMessage(g,I)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,A){return new Promise(e=>{const i=this._getIdleWorker();i!==-1?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=e,this.workers[i].postMessage(t,A)):this.queue.push({resolve:e,msg:t,transfer:A})})}dispose(){this.workers.forEach(t=>t.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}};const JiA=0,nH=2,qiA=1,rH=2,xiA=0,LiA=1,_iA=10,TiA=0,BH=9,QH=15,EH=16,hH=22,cH=37,lH=43,dH=76,uH=83,pH=97,DH=100,wH=103,yH=109,SH=165,mH=166;let YiA=class{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}},Od=class{constructor(t,A,e,i){this._dataView=new DataView(t.buffer,t.byteOffset+A,e),this._littleEndian=i,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_skip(t){return this._offset+=t,this}_scan(t,A=0){const e=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==A&&i<t;)i++,this._offset++;return i<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+e,i)}};const qI=[171,75,84,88,32,50,48,187,13,10,26,10];function fH(t){return typeof TextDecoder<"u"?new TextDecoder().decode(t):Buffer.from(t).toString("utf8")}function HiA(t){const A=new Uint8Array(t.buffer,t.byteOffset,qI.length);if(A[0]!==qI[0]||A[1]!==qI[1]||A[2]!==qI[2]||A[3]!==qI[3]||A[4]!==qI[4]||A[5]!==qI[5]||A[6]!==qI[6]||A[7]!==qI[7]||A[8]!==qI[8]||A[9]!==qI[9]||A[10]!==qI[10]||A[11]!==qI[11])throw new Error("Missing KTX 2.0 identifier.");const e=new YiA,i=17*Uint32Array.BYTES_PER_ELEMENT,g=new Od(t,qI.length,i,!0);e.vkFormat=g._nextUint32(),e.typeSize=g._nextUint32(),e.pixelWidth=g._nextUint32(),e.pixelHeight=g._nextUint32(),e.pixelDepth=g._nextUint32(),e.layerCount=g._nextUint32(),e.faceCount=g._nextUint32();const I=g._nextUint32();e.supercompressionScheme=g._nextUint32();const o=g._nextUint32(),s=g._nextUint32(),C=g._nextUint32(),a=g._nextUint32(),n=g._nextUint64(),B=g._nextUint64(),Q=new Od(t,qI.length+i,3*I*8,!0);for(let v=0;v<I;v++)e.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+Q._nextUint64(),Q._nextUint64()),uncompressedByteLength:Q._nextUint64()});const E=new Od(t,o,s,!0),h={vendorId:E._skip(4)._nextUint16(),descriptorType:E._nextUint16(),versionNumber:E._nextUint16(),descriptorBlockSize:E._nextUint16(),colorModel:E._nextUint8(),colorPrimaries:E._nextUint8(),transferFunction:E._nextUint8(),flags:E._nextUint8(),texelBlockDimension:[E._nextUint8(),E._nextUint8(),E._nextUint8(),E._nextUint8()],bytesPlane:[E._nextUint8(),E._nextUint8(),E._nextUint8(),E._nextUint8(),E._nextUint8(),E._nextUint8(),E._nextUint8(),E._nextUint8()],samples:[]},l=(h.descriptorBlockSize/4-6)/4;for(let v=0;v<l;v++){const _={bitOffset:E._nextUint16(),bitLength:E._nextUint8(),channelType:E._nextUint8(),samplePosition:[E._nextUint8(),E._nextUint8(),E._nextUint8(),E._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&_.channelType?(_.sampleLower=E._nextInt32(),_.sampleUpper=E._nextInt32()):(_.sampleLower=E._nextUint32(),_.sampleUpper=E._nextUint32()),h.samples[v]=_}e.dataFormatDescriptor.length=0,e.dataFormatDescriptor.push(h);const d=new Od(t,C,a,!0);for(;d._offset<a;){const v=d._nextUint32(),_=d._scan(v),X=fH(_),Z=d._scan(v-_.byteLength);e.keyValue[X]=X.match(/^ktx/i)?fH(Z):Z,d._offset%4&&d._skip(4-d._offset%4)}if(B<=0)return e;const c=new Od(t,n,B,!0),u=c._nextUint16(),p=c._nextUint16(),D=c._nextUint32(),m=c._nextUint32(),M=c._nextUint32(),k=c._nextUint32(),R=[];for(let v=0;v<I;v++)R.push({imageFlags:c._nextUint32(),rgbSliceByteOffset:c._nextUint32(),rgbSliceByteLength:c._nextUint32(),alphaSliceByteOffset:c._nextUint32(),alphaSliceByteLength:c._nextUint32()});const F=n+c._offset,S=F+D,U=S+m,T=U+M,Y=new Uint8Array(t.buffer,t.byteOffset+F,D),K=new Uint8Array(t.buffer,t.byteOffset+S,m),O=new Uint8Array(t.buffer,t.byteOffset+U,M),J=new Uint8Array(t.buffer,t.byteOffset+T,k);return e.globalData={endpointCount:u,selectorCount:p,imageDescs:R,endpointsData:Y,selectorsData:K,tablesData:O,extendedData:J},e}let iN,Ta,gN;const IN={env:{emscripten_notify_memory_growth:function(t){gN=new Uint8Array(Ta.exports.memory.buffer)}}};let OiA=class{init(){return iN||(iN=typeof fetch<"u"?fetch("data:application/wasm;base64,"+kH).then(t=>t.arrayBuffer()).then(t=>WebAssembly.instantiate(t,IN)).then(this._init):WebAssembly.instantiate(Buffer.from(kH,"base64"),IN).then(this._init),iN)}_init(t){Ta=t.instance,IN.env.emscripten_notify_memory_growth(0)}decode(t,A=0){if(!Ta)throw new Error("ZSTDDecoder: Await .init() before decoding.");const e=t.byteLength,i=Ta.exports.malloc(e);gN.set(t,i),A=A||Number(Ta.exports.ZSTD_findDecompressedSize(i,e));const g=Ta.exports.malloc(A),I=Ta.exports.ZSTD_decompress(g,A,i,e),o=gN.slice(g,g+I);return Ta.exports.free(i),Ta.exports.free(g),o}};const kH="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/Dwsg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AAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYh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KAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiC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AYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASAC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AABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",oN=new WeakMap;let sN=0,CN,Gh=class XD extends Jg{constructor(A){super(A),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new viA,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(A){return this.transcoderPath=A,this}setWorkerLimit(A){return this.workerPool.setWorkerLimit(A),this}async detectSupportAsync(A){return this.workerConfig={astcSupported:await A.hasFeatureAsync("texture-compression-astc"),etc1Supported:await A.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await A.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await A.hasFeatureAsync("texture-compression-bc"),bptcSupported:await A.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await A.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(A){return A.isWebGPURenderer===!0?this.workerConfig={astcSupported:A.hasFeature("texture-compression-astc"),etc1Supported:A.hasFeature("texture-compression-etc1"),etc2Supported:A.hasFeature("texture-compression-etc2"),dxtSupported:A.hasFeature("texture-compression-bc"),bptcSupported:A.hasFeature("texture-compression-bptc"),pvrtcSupported:A.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:A.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:A.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:A.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:A.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:A.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:A.extensions.has("WEBGL_compressed_texture_pvrtc")||A.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},A.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}init(){if(!this.transcoderPending){const A=new ag(this.manager);A.setPath(this.transcoderPath),A.setWithCredentials(this.withCredentials);const e=A.loadAsync("basis_transcoder.js"),i=new ag(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const g=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,g]).then(([I,o])=>{const s=XD.BasisWorker.toString(),C=["/* constants */","let _EngineFormat = "+JSON.stringify(XD.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(XD.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(XD.BasisFormat),"/* basis_transcoder.js */",I,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4409
4409
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([C])),this.transcoderBinary=o,this.workerPool.setWorkerCreator(()=>{const a=new Worker(this.workerSourceURL),n=this.transcoderBinary.slice(0);return a.postMessage({type:"init",config:this.workerConfig,transcoderBinary:n},[n]),a})}),sN>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),sN++}return this.transcoderPending}load(A,e,i,g){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const I=new ag(this.manager);I.setResponseType("arraybuffer"),I.setWithCredentials(this.withCredentials),I.load(A,o=>{if(oN.has(o))return oN.get(o).promise.then(e).catch(g);this._createTexture(o).then(s=>e?e(s):null).catch(g)},i,g)}_createTextureFrom(A,e){const{faces:i,width:g,height:I,format:o,type:s,error:C,dfdFlags:a}=A;if(s==="error")return Promise.reject(C);let n;if(e.faceCount===6)n=new y_(i,o,ct);else{const B=i[0].mipmaps;n=e.layerCount>1?new w_(B,g,I,e.layerCount,o,ct):new mC(B,g,I,o,ct)}return n.minFilter=i[0].mipmaps.length===1?fe:RI,n.magFilter=fe,n.generateMipmaps=!1,n.needsUpdate=!0,n.colorSpace=GH(e),n.premultiplyAlpha=!!(a&qiA),n}async _createTexture(A,e={}){const i=HiA(new Uint8Array(A));if(i.vkFormat!==TiA)return jiA(i);const g=e,I=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:A,taskConfig:g},[A])).then(o=>this._createTextureFrom(o.data,i));return oN.set(A,{promise:I}),I}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),sN--,this}};Gh.BasisFormat={ETC1S:0,UASTC_4x4:1},Gh.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Gh.EngineFormat={RGBAFormat:pt,RGBA_ASTC_4x4_Format:kw,RGBA_BPTC_Format:Ol,RGBA_ETC2_EAC_Format:fw,RGBA_PVRTC_4BPPV1_Format:yw,RGBA_S3TC_DXT5_Format:Yl,RGB_ETC1_Format:Sw,RGB_ETC2_Format:mw,RGB_PVRTC_4BPPV1_Format:ww,RGB_S3TC_DXT1_Format:Tl},Gh.BasisWorker=function(){let t,A,e;const i=_EngineFormat,g=_TranscoderFormat,I=_BasisFormat;self.addEventListener("message",function(h){const l=h.data;switch(l.type){case"init":t=l.config,o(l.transcoderBinary);break;case"transcode":A.then(()=>{try{const{faces:d,buffers:c,width:u,height:p,hasAlpha:D,format:m,dfdFlags:M}=s(l.buffer);self.postMessage({type:"transcode",id:l.id,faces:d,width:u,height:p,hasAlpha:D,format:m,dfdFlags:M},c)}catch(d){console.error(d),self.postMessage({type:"error",id:l.id,error:d.message})}});break}});function o(h){A=new Promise(l=>{e={wasmBinary:h,onRuntimeInitialized:l},BASIS(e)}).then(()=>{e.initializeBasis(),e.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function s(h){const l=new e.KTX2File(new Uint8Array(h));function d(){l.close(),l.delete()}if(!l.isValid())throw d(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");const c=l.isUASTC()?I.UASTC_4x4:I.ETC1S,u=l.getWidth(),p=l.getHeight(),D=l.getLayers()||1,m=l.getLevels(),M=l.getFaces(),k=l.getHasAlpha(),R=l.getDFDFlags(),{transcoderFormat:F,engineFormat:S}=B(c,u,p,k);if(!u||!p||!m)throw d(),new Error("THREE.KTX2Loader: Invalid texture");if(!l.startTranscoding())throw d(),new Error("THREE.KTX2Loader: .startTranscoding failed");const U=[],T=[];for(let Y=0;Y<M;Y++){const K=[];for(let O=0;O<m;O++){const J=[];let v,_;for(let Z=0;Z<D;Z++){const IA=l.getImageLevelInfo(O,Z,Y);Y===0&&O===0&&Z===0&&(IA.origWidth%4!==0||IA.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),m>1?(v=IA.origWidth,_=IA.origHeight):(v=IA.width,_=IA.height);const yA=new Uint8Array(l.getImageTranscodedSizeInBytes(O,Z,0,F));if(!l.transcodeImage(yA,O,Z,Y,F,0,-1,-1))throw d(),new Error("THREE.KTX2Loader: .transcodeImage failed.");J.push(yA)}const X=E(J);K.push({data:X,width:v,height:_}),T.push(X.buffer)}U.push({mipmaps:K,width:u,height:p,format:S})}return d(),{faces:U,buffers:T,width:u,height:p,hasAlpha:k,format:S,dfdFlags:R}}const C=[{if:"astcSupported",basisFormat:[I.UASTC_4x4],transcoderFormat:[g.ASTC_4x4,g.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[I.ETC1S,I.UASTC_4x4],transcoderFormat:[g.BC7_M5,g.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[I.ETC1S,I.UASTC_4x4],transcoderFormat:[g.BC1,g.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[I.ETC1S,I.UASTC_4x4],transcoderFormat:[g.ETC1,g.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[I.ETC1S,I.UASTC_4x4],transcoderFormat:[g.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[I.ETC1S,I.UASTC_4x4],transcoderFormat:[g.PVRTC1_4_RGB,g.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=C.sort(function(h,l){return h.priorityETC1S-l.priorityETC1S}),n=C.sort(function(h,l){return h.priorityUASTC-l.priorityUASTC});function B(h,l,d,c){let u,p;const D=h===I.ETC1S?a:n;for(let m=0;m<D.length;m++){const M=D[m];if(t[M.if]&&M.basisFormat.includes(h)&&!(c&&M.transcoderFormat.length<2)&&!(M.needsPowerOfTwo&&!(Q(l)&&Q(d))))return u=M.transcoderFormat[c?1:0],p=M.engineFormat[c?1:0],{transcoderFormat:u,engineFormat:p}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),u=g.RGBA32,p=i.RGBAFormat,{transcoderFormat:u,engineFormat:p}}function Q(h){return h<=2?!0:(h&h-1)===0&&h!==0}function E(h){if(h.length===1)return h[0];let l=0;for(let u=0;u<h.length;u++){const p=h[u];l+=p.byteLength}const d=new Uint8Array(l);let c=0;for(let u=0;u<h.length;u++){const p=h[u];d.set(p,c),c+=p.byteLength}return d}};const PiA=new Set([pt,jn,Ls]),aN={[yH]:pt,[pH]:pt,[cH]:pt,[lH]:pt,[wH]:jn,[uH]:jn,[EH]:jn,[hH]:jn,[DH]:Ls,[dH]:Ls,[QH]:Ls,[BH]:Ls,[mH]:Hl,[SH]:Hl},nN={[yH]:jt,[pH]:Ci,[cH]:ct,[lH]:ct,[wH]:jt,[uH]:Ci,[EH]:ct,[hH]:ct,[DH]:jt,[dH]:Ci,[QH]:ct,[BH]:ct,[mH]:ct,[SH]:ct};async function jiA(t){const{vkFormat:A}=t;if(aN[A]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let e;t.supercompressionScheme===nH&&(CN||(CN=new Promise(async I=>{const o=new OiA;await o.init(),I(o)})),e=await CN);const i=[];for(let I=0;I<t.levels.length;I++){const o=Math.max(1,t.pixelWidth>>I),s=Math.max(1,t.pixelHeight>>I),C=t.pixelDepth?Math.max(1,t.pixelDepth>>I):0,a=t.levels[I];let n;if(t.supercompressionScheme===JiA)n=a.levelData;else if(t.supercompressionScheme===nH)n=e.decode(a.levelData,a.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let B;nN[A]===jt?B=new Float32Array(n.buffer,n.byteOffset,n.byteLength/Float32Array.BYTES_PER_ELEMENT):nN[A]===Ci?B=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/Uint16Array.BYTES_PER_ELEMENT):B=n,i.push({data:B,width:o,height:s,depth:C})}let g;if(PiA.has(aN[A]))g=t.pixelDepth===0?new oo(i[0].data,t.pixelWidth,t.pixelHeight):new qw(i[0].data,t.pixelWidth,t.pixelHeight,t.pixelDepth);else{if(t.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");g=new mC(i,t.pixelWidth,t.pixelHeight)}return g.mipmaps=i,g.type=nN[A],g.format=aN[A],g.colorSpace=GH(t),g.needsUpdate=!0,Promise.resolve(g)}function GH(t){const A=t.dataFormatDescriptor[0];return A.colorPrimaries===LiA?A.transferFunction===rH?he:Dt:A.colorPrimaries===_iA?A.transferFunction===rH?Wl:LE:(A.colorPrimaries===xiA||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${A.colorPrimaries}"`),UI)}const Mh=tA("debugdecoders");let Pd="https://www.gstatic.com/draco/versioned/decoders/1.4.1/",rN="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";fetch(Pd+"draco_decoder.js",{method:"head"}).catch(t=>{Be()&&console.warn('Failed to load draco decoder from "'+Pd+`".
|
|
4410
|
-
Falling back to local version at "./include/draco"`),Pd="./include/draco/",rN="./include/ktx2/"});let Vs,BN,nr;function MH(t){t!==void 0&&typeof t=="string"&&(Vs||(Vs=new tN),Mh&&console.log("Setting draco decoder path to",t),Vs.setDecoderPath(t))}function RH(t){t!==void 0&&typeof t=="string"&&(Vs||(Vs=new tN),Mh&&console.log("Setting draco decoder type to",t),Vs.setDecoderConfig({type:t}))}function UH(t){t!==void 0&&typeof t=="string"&&(nr||(nr=new Gh),Mh&&console.log("Setting ktx2 transcoder path to",t),nr.setTranscoderPath(t))}function D0(t,A){Vs||(Vs=new tN,Vs.setDecoderPath(Pd),Vs.setDecoderConfig({type:"js"}),Mh&&console.log("Setting draco decoder path to",Pd)),nr||(nr=new Gh,nr.setTranscoderPath(rN),Mh&&console.log("Setting ktx2 transcoder path to",rN)),BN||(BN=biA,Mh&&console.log("Using the default meshopt decoder")),A.renderer?nr.detectSupport(A.renderer):console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures will probably fail"),t.dracoLoader||t.setDRACOLoader(Vs),t.ktx2Loader||t.setKTX2Loader(nr),t.meshoptDecoder||t.setMeshoptDecoder(BN)}function WiA(t,A=1e-4){A=Math.max(A,Number.EPSILON);const e={},i=t.getIndex(),g=t.getAttribute("position"),I=i?i.count:g.count;let o=0;const s=Object.keys(t.attributes),C={},a={},n=[],B=["getX","getY","getZ","getW"],Q=["setX","setY","setZ","setW"];for(let u=0,p=s.length;u<p;u++){const D=s[u],m=t.attributes[D];C[D]=new te(new m.array.constructor(m.count*m.itemSize),m.itemSize,m.normalized);const M=t.morphAttributes[D];M&&(a[D]=new te(new M.array.constructor(M.count*M.itemSize),M.itemSize,M.normalized))}const E=A*.5,h=Math.log10(1/A),l=Math.pow(10,h),d=E*l;for(let u=0;u<I;u++){const p=i?i.getX(u):u;let D="";for(let m=0,M=s.length;m<M;m++){const k=s[m],R=t.getAttribute(k),F=R.itemSize;for(let S=0;S<F;S++)D+=`${~~(R[B[S]](p)*l+d)},`}if(D in e)n.push(e[D]);else{for(let m=0,M=s.length;m<M;m++){const k=s[m],R=t.getAttribute(k),F=t.morphAttributes[k],S=R.itemSize,U=C[k],T=a[k];for(let Y=0;Y<S;Y++){const K=B[Y],O=Q[Y];if(U[O](o,R[K](p)),F)for(let J=0,v=F.length;J<v;J++)T[J][O](o,F[J][K](p))}}e[D]=o,n.push(o),o++}}const c=t.clone();for(const u in t.attributes){const p=C[u];if(c.setAttribute(u,new te(p.array.slice(0,o*p.itemSize),p.itemSize,p.normalized)),u in a)for(let D=0;D<a[u].length;D++){const m=a[u][D];c.morphAttributes[u][D]=new te(m.array.slice(0,o*m.itemSize),m.itemSize,m.normalized)}}return c.setIndex(n),c}function NH(t,A){if(A===Rx)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(A===Rw||A===gM){let e=t.getIndex();if(e===null){const o=[],s=t.getAttribute("position");if(s!==void 0){for(let C=0;C<s.count;C++)o.push(C);t.setIndex(o),e=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const i=e.count-2,g=[];if(A===Rw)for(let o=1;o<=i;o++)g.push(e.getX(0)),g.push(e.getX(o)),g.push(e.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(g.push(e.getX(o)),g.push(e.getX(o+1)),g.push(e.getX(o+2))):(g.push(e.getX(o+2)),g.push(e.getX(o+1)),g.push(e.getX(o)));g.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const I=t.clone();return I.setIndex(g),I.clearGroups(),I}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",A),t}let jd=class extends Jg{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(A){return new $iA(A)}),this.register(function(A){return new CgA(A)}),this.register(function(A){return new agA(A)}),this.register(function(A){return new ngA(A)}),this.register(function(A){return new egA(A)}),this.register(function(A){return new tgA(A)}),this.register(function(A){return new igA(A)}),this.register(function(A){return new ggA(A)}),this.register(function(A){return new XiA(A)}),this.register(function(A){return new IgA(A)}),this.register(function(A){return new AgA(A)}),this.register(function(A){return new sgA(A)}),this.register(function(A){return new ogA(A)}),this.register(function(A){return new ViA(A)}),this.register(function(A){return new rgA(A)}),this.register(function(A){return new BgA(A)})}load(t,A,e,i){const g=this;let I;if(this.resourcePath!=="")I=this.resourcePath;else if(this.path!==""){const C=or.extractUrlBase(t);I=or.resolveURL(C,this.path)}else I=or.extractUrlBase(t);this.manager.itemStart(t);const o=function(C){i?i(C):console.error(C),g.manager.itemError(t),g.manager.itemEnd(t)},s=new ag(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(C){try{g.parse(C,I,function(a){A(a),g.manager.itemEnd(t)},o)}catch(a){o(a)}},e,o)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,A,e,i){let g;const I={},o={},s=new TextDecoder;if(typeof t=="string")g=JSON.parse(t);else if(t instanceof ArrayBuffer)if(s.decode(new Uint8Array(t,0,4))===FH){try{I[at.KHR_BINARY_GLTF]=new QgA(t)}catch(a){i&&i(a);return}g=JSON.parse(I[at.KHR_BINARY_GLTF].content)}else g=JSON.parse(s.decode(t));else g=t;if(g.asset===void 0||g.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const C=new fgA(g,{path:A||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});C.fileLoader.setRequestHeader(this.requestHeader);for(let a=0;a<this.pluginCallbacks.length;a++){const n=this.pluginCallbacks[a](C);n.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[n.name]=n,I[n.name]=!0}if(g.extensionsUsed)for(let a=0;a<g.extensionsUsed.length;++a){const n=g.extensionsUsed[a],B=g.extensionsRequired||[];switch(n){case at.KHR_MATERIALS_UNLIT:I[n]=new ziA;break;case at.KHR_DRACO_MESH_COMPRESSION:I[n]=new EgA(g,this.dracoLoader);break;case at.KHR_TEXTURE_TRANSFORM:I[n]=new hgA;break;case at.KHR_MESH_QUANTIZATION:I[n]=new cgA;break;default:B.indexOf(n)>=0&&o[n]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+n+'".')}}C.setExtensions(I),C.setPlugins(o),C.parse(e,i)}parseAsync(t,A){const e=this;return new Promise(function(i,g){e.parse(t,A,i,g)})}};function ZiA(){let t={};return{get:function(A){return t[A]},add:function(A,e){t[A]=e},remove:function(A){delete t[A]},removeAll:function(){t={}}}}const at={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};let ViA=class{constructor(t){this.parser=t,this.name=at.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,A=this.parser.json.nodes||[];for(let e=0,i=A.length;e<i;e++){const g=A[e];g.extensions&&g.extensions[this.name]&&g.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,g.extensions[this.name].light)}}_loadLight(t){const A=this.parser,e="light:"+t;let i=A.cache.get(e);if(i)return i;const g=A.json,I=((g.extensions&&g.extensions[this.name]||{}).lights||[])[t];let o;const s=new MA(16777215);I.color!==void 0&&s.setRGB(I.color[0],I.color[1],I.color[2],Dt);const C=I.range!==void 0?I.range:0;switch(I.type){case"directional":o=new uh(s),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new fd(s),o.distance=C;break;case"spot":o=new Jy(s),o.distance=C,I.spot=I.spot||{},I.spot.innerConeAngle=I.spot.innerConeAngle!==void 0?I.spot.innerConeAngle:0,I.spot.outerConeAngle=I.spot.outerConeAngle!==void 0?I.spot.outerConeAngle:Math.PI/4,o.angle=I.spot.outerConeAngle,o.penumbra=1-I.spot.innerConeAngle/I.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+I.type)}return o.position.set(0,0,0),o.decay=2,Br(o,I),I.intensity!==void 0&&(o.intensity=I.intensity),o.name=A.createUniqueName(I.name||"light_"+t),i=Promise.resolve(o),A.cache.add(e,i),i}getDependency(t,A){if(t==="light")return this._loadLight(A)}createNodeAttachment(t){const A=this,e=this.parser,i=e.json.nodes[t],g=(i.extensions&&i.extensions[this.name]||{}).light;return g===void 0?null:this._loadLight(g).then(function(I){return e._getNodeRef(A.cache,g,I)})}},ziA=class{constructor(){this.name=at.KHR_MATERIALS_UNLIT}getMaterialType(){return st}extendParams(t,A,e){const i=[];t.color=new MA(1,1,1),t.opacity=1;const g=A.pbrMetallicRoughness;if(g){if(Array.isArray(g.baseColorFactor)){const I=g.baseColorFactor;t.color.setRGB(I[0],I[1],I[2],Dt),t.opacity=I[3]}g.baseColorTexture!==void 0&&i.push(e.assignTexture(t,"map",g.baseColorTexture,he))}return Promise.all(i)}},XiA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,A){const e=this.parser.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();const i=e.extensions[this.name].emissiveStrength;return i!==void 0&&(A.emissiveIntensity=i),Promise.resolve()}},$iA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];if(I.clearcoatFactor!==void 0&&(A.clearcoat=I.clearcoatFactor),I.clearcoatTexture!==void 0&&g.push(e.assignTexture(A,"clearcoatMap",I.clearcoatTexture)),I.clearcoatRoughnessFactor!==void 0&&(A.clearcoatRoughness=I.clearcoatRoughnessFactor),I.clearcoatRoughnessTexture!==void 0&&g.push(e.assignTexture(A,"clearcoatRoughnessMap",I.clearcoatRoughnessTexture)),I.clearcoatNormalTexture!==void 0&&(g.push(e.assignTexture(A,"clearcoatNormalMap",I.clearcoatNormalTexture)),I.clearcoatNormalTexture.scale!==void 0)){const o=I.clearcoatNormalTexture.scale;A.clearcoatNormalScale=new eA(o,o)}return Promise.all(g)}},AgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return I.iridescenceFactor!==void 0&&(A.iridescence=I.iridescenceFactor),I.iridescenceTexture!==void 0&&g.push(e.assignTexture(A,"iridescenceMap",I.iridescenceTexture)),I.iridescenceIor!==void 0&&(A.iridescenceIOR=I.iridescenceIor),A.iridescenceThicknessRange===void 0&&(A.iridescenceThicknessRange=[100,400]),I.iridescenceThicknessMinimum!==void 0&&(A.iridescenceThicknessRange[0]=I.iridescenceThicknessMinimum),I.iridescenceThicknessMaximum!==void 0&&(A.iridescenceThicknessRange[1]=I.iridescenceThicknessMaximum),I.iridescenceThicknessTexture!==void 0&&g.push(e.assignTexture(A,"iridescenceThicknessMap",I.iridescenceThicknessTexture)),Promise.all(g)}},egA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_SHEEN}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[];A.sheenColor=new MA(0,0,0),A.sheenRoughness=0,A.sheen=1;const I=i.extensions[this.name];if(I.sheenColorFactor!==void 0){const o=I.sheenColorFactor;A.sheenColor.setRGB(o[0],o[1],o[2],Dt)}return I.sheenRoughnessFactor!==void 0&&(A.sheenRoughness=I.sheenRoughnessFactor),I.sheenColorTexture!==void 0&&g.push(e.assignTexture(A,"sheenColorMap",I.sheenColorTexture,he)),I.sheenRoughnessTexture!==void 0&&g.push(e.assignTexture(A,"sheenRoughnessMap",I.sheenRoughnessTexture)),Promise.all(g)}},tgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return I.transmissionFactor!==void 0&&(A.transmission=I.transmissionFactor),I.transmissionTexture!==void 0&&g.push(e.assignTexture(A,"transmissionMap",I.transmissionTexture)),Promise.all(g)}},igA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_VOLUME}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];A.thickness=I.thicknessFactor!==void 0?I.thicknessFactor:0,I.thicknessTexture!==void 0&&g.push(e.assignTexture(A,"thicknessMap",I.thicknessTexture)),A.attenuationDistance=I.attenuationDistance||1/0;const o=I.attenuationColor||[1,1,1];return A.attenuationColor=new MA().setRGB(o[0],o[1],o[2],Dt),Promise.all(g)}},ggA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_IOR}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();const i=e.extensions[this.name];return A.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}},IgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_SPECULAR}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];A.specularIntensity=I.specularFactor!==void 0?I.specularFactor:1,I.specularTexture!==void 0&&g.push(e.assignTexture(A,"specularIntensityMap",I.specularTexture));const o=I.specularColorFactor||[1,1,1];return A.specularColor=new MA().setRGB(o[0],o[1],o[2],Dt),I.specularColorTexture!==void 0&&g.push(e.assignTexture(A,"specularColorMap",I.specularColorTexture,he)),Promise.all(g)}},ogA=class{constructor(t){this.parser=t,this.name=at.EXT_MATERIALS_BUMP}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return A.bumpScale=I.bumpFactor!==void 0?I.bumpFactor:1,I.bumpTexture!==void 0&&g.push(e.assignTexture(A,"bumpMap",I.bumpTexture)),Promise.all(g)}},sgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return I.anisotropyStrength!==void 0&&(A.anisotropy=I.anisotropyStrength),I.anisotropyRotation!==void 0&&(A.anisotropyRotation=I.anisotropyRotation),I.anisotropyTexture!==void 0&&g.push(e.assignTexture(A,"anisotropyMap",I.anisotropyTexture)),Promise.all(g)}},CgA=class{constructor(t){this.parser=t,this.name=at.KHR_TEXTURE_BASISU}loadTexture(t){const A=this.parser,e=A.json,i=e.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const g=i.extensions[this.name],I=A.options.ktx2Loader;if(!I){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return A.loadTextureImage(t,g.source,I)}},agA=class{constructor(t){this.parser=t,this.name=at.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const A=this.name,e=this.parser,i=e.json,g=i.textures[t];if(!g.extensions||!g.extensions[A])return null;const I=g.extensions[A],o=i.images[I.source];let s=e.textureLoader;if(o.uri){const C=e.options.manager.getHandler(o.uri);C!==null&&(s=C)}return this.detectSupport().then(function(C){if(C)return e.loadTextureImage(t,I.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(A)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return e.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const A=new Image;A.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",A.onload=A.onerror=function(){t(A.height===1)}})),this.isSupported}},ngA=class{constructor(t){this.parser=t,this.name=at.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const A=this.name,e=this.parser,i=e.json,g=i.textures[t];if(!g.extensions||!g.extensions[A])return null;const I=g.extensions[A],o=i.images[I.source];let s=e.textureLoader;if(o.uri){const C=e.options.manager.getHandler(o.uri);C!==null&&(s=C)}return this.detectSupport().then(function(C){if(C)return e.loadTextureImage(t,I.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(A)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return e.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const A=new Image;A.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",A.onload=A.onerror=function(){t(A.height===1)}})),this.isSupported}},rgA=class{constructor(t){this.name=at.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const A=this.parser.json,e=A.bufferViews[t];if(e.extensions&&e.extensions[this.name]){const i=e.extensions[this.name],g=this.parser.getDependency("buffer",i.buffer),I=this.parser.options.meshoptDecoder;if(!I||!I.supported){if(A.extensionsRequired&&A.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return g.then(function(o){const s=i.byteOffset||0,C=i.byteLength||0,a=i.count,n=i.byteStride,B=new Uint8Array(o,s,C);return I.decodeGltfBufferAsync?I.decodeGltfBufferAsync(a,n,B,i.mode,i.filter).then(function(Q){return Q.buffer}):I.ready.then(function(){const Q=new ArrayBuffer(a*n);return I.decodeGltfBuffer(new Uint8Array(Q),a,n,B,i.mode,i.filter),Q})})}else return null}},BgA=class{constructor(t){this.name=at.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const A=this.parser.json,e=A.nodes[t];if(!e.extensions||!e.extensions[this.name]||e.mesh===void 0)return null;const i=A.meshes[e.mesh];for(const s of i.primitives)if(s.mode!==rs.TRIANGLES&&s.mode!==rs.TRIANGLE_STRIP&&s.mode!==rs.TRIANGLE_FAN&&s.mode!==void 0)return null;const g=e.extensions[this.name].attributes,I=[],o={};for(const s in g)I.push(this.parser.getDependency("accessor",g[s]).then(C=>(o[s]=C,o[s])));return I.length<1?null:(I.push(this.parser.createNodeMesh(t)),Promise.all(I).then(s=>{const C=s.pop(),a=C.isGroup?C.children:[C],n=s[0].count,B=[];for(const Q of a){const E=new NA,h=new f,l=new UA,d=new f(1,1,1),c=new VM(Q.geometry,Q.material,n);for(let u=0;u<n;u++)o.TRANSLATION&&h.fromBufferAttribute(o.TRANSLATION,u),o.ROTATION&&l.fromBufferAttribute(o.ROTATION,u),o.SCALE&&d.fromBufferAttribute(o.SCALE,u),c.setMatrixAt(u,E.compose(h,l,d));for(const u in o)if(u==="_COLOR_0"){const p=o[u];c.instanceColor=new so(p.array,p.itemSize,p.normalized)}else u!=="TRANSLATION"&&u!=="ROTATION"&&u!=="SCALE"&&Q.geometry.setAttribute(u,o[u]);wA.prototype.copy.call(c,Q),this.parser.assignFinalMaterial(c),B.push(c)}return C.isGroup?(C.clear(),C.add(...B),C):B[0]}))}};const FH="glTF",Wd=12,bH={JSON:1313821514,BIN:5130562};let QgA=class{constructor(t){this.name=at.KHR_BINARY_GLTF,this.content=null,this.body=null;const A=new DataView(t,0,Wd),e=new TextDecoder;if(this.header={magic:e.decode(new Uint8Array(t.slice(0,4))),version:A.getUint32(4,!0),length:A.getUint32(8,!0)},this.header.magic!==FH)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Wd,g=new DataView(t,Wd);let I=0;for(;I<i;){const o=g.getUint32(I,!0);I+=4;const s=g.getUint32(I,!0);if(I+=4,s===bH.JSON){const C=new Uint8Array(t,Wd+I,o);this.content=e.decode(C)}else if(s===bH.BIN){const C=Wd+I;this.body=t.slice(C,C+o)}I+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},EgA=class{constructor(t,A){if(!A)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=at.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=A,this.dracoLoader.preload()}decodePrimitive(t,A){const e=this.json,i=this.dracoLoader,g=t.extensions[this.name].bufferView,I=t.extensions[this.name].attributes,o={},s={},C={};for(const a in I){const n=EN[a]||a.toLowerCase();o[n]=I[a]}for(const a in t.attributes){const n=EN[a]||a.toLowerCase();if(I[a]!==void 0){const B=e.accessors[t.attributes[a]],Q=Rh[B.componentType];C[n]=Q.name,s[n]=B.normalized===!0}}return A.getDependency("bufferView",g).then(function(a){return new Promise(function(n,B){i.decodeDracoFile(a,function(Q){for(const E in Q.attributes){const h=Q.attributes[E],l=s[E];l!==void 0&&(h.normalized=l)}n(Q)},o,C,Dt,B)})})}},hgA=class{constructor(){this.name=at.KHR_TEXTURE_TRANSFORM}extendTexture(t,A){return(A.texCoord===void 0||A.texCoord===t.channel)&&A.offset===void 0&&A.rotation===void 0&&A.scale===void 0||(t=t.clone(),A.texCoord!==void 0&&(t.channel=A.texCoord),A.offset!==void 0&&t.offset.fromArray(A.offset),A.rotation!==void 0&&(t.rotation=A.rotation),A.scale!==void 0&&t.repeat.fromArray(A.scale),t.needsUpdate=!0),t}},cgA=class{constructor(){this.name=at.KHR_MESH_QUANTIZATION}},KH=class extends dh{constructor(t,A,e,i){super(t,A,e,i)}copySampleValue_(t){const A=this.resultBuffer,e=this.sampleValues,i=this.valueSize,g=t*i*3+i;for(let I=0;I!==i;I++)A[I]=e[g+I];return A}interpolate_(t,A,e,i){const g=this.resultBuffer,I=this.sampleValues,o=this.valueSize,s=o*2,C=o*3,a=i-A,n=(e-A)/a,B=n*n,Q=B*n,E=t*C,h=E-C,l=-2*Q+3*B,d=Q-B,c=1-l,u=d-B+n;for(let p=0;p!==o;p++){const D=I[h+p+o],m=I[h+p+s]*a,M=I[E+p+o],k=I[E+p]*a;g[p]=c*D+u*m+l*M+d*k}return g}};const lgA=new UA;let dgA=class extends KH{interpolate_(t,A,e,i){const g=super.interpolate_(t,A,e,i);return lgA.fromArray(g).normalize().toArray(g),g}};const rs={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Rh={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},vH={9728:ve,9729:fe,9984:xE,9985:GB,9986:wa,9987:RI},JH={33071:dg,33648:kB,10497:es},QN={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},EN={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},rr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ugA={CUBICSPLINE:void 0,LINEAR:yC,STEP:Wn},hN={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function pgA(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new vI({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:lg})),t.DefaultMaterial}function nQ(t,A,e){for(const i in e.extensions)t[i]===void 0&&(A.userData.gltfExtensions=A.userData.gltfExtensions||{},A.userData.gltfExtensions[i]=e.extensions[i])}function Br(t,A){A.extras!==void 0&&(typeof A.extras=="object"?Object.assign(t.userData,A.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+A.extras))}function DgA(t,A,e){let i=!1,g=!1,I=!1;for(let a=0,n=A.length;a<n;a++){const B=A[a];if(B.POSITION!==void 0&&(i=!0),B.NORMAL!==void 0&&(g=!0),B.COLOR_0!==void 0&&(I=!0),i&&g&&I)break}if(!i&&!g&&!I)return Promise.resolve(t);const o=[],s=[],C=[];for(let a=0,n=A.length;a<n;a++){const B=A[a];if(i){const Q=B.POSITION!==void 0?e.getDependency("accessor",B.POSITION):t.attributes.position;o.push(Q)}if(g){const Q=B.NORMAL!==void 0?e.getDependency("accessor",B.NORMAL):t.attributes.normal;s.push(Q)}if(I){const Q=B.COLOR_0!==void 0?e.getDependency("accessor",B.COLOR_0):t.attributes.color;C.push(Q)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(C)]).then(function(a){const n=a[0],B=a[1],Q=a[2];return i&&(t.morphAttributes.position=n),g&&(t.morphAttributes.normal=B),I&&(t.morphAttributes.color=Q),t.morphTargetsRelative=!0,t})}function wgA(t,A){if(t.updateMorphTargets(),A.weights!==void 0)for(let e=0,i=A.weights.length;e<i;e++)t.morphTargetInfluences[e]=A.weights[e];if(A.extras&&Array.isArray(A.extras.targetNames)){const e=A.extras.targetNames;if(t.morphTargetInfluences.length===e.length){t.morphTargetDictionary={};for(let i=0,g=e.length;i<g;i++)t.morphTargetDictionary[e[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ygA(t){let A;const e=t.extensions&&t.extensions[at.KHR_DRACO_MESH_COMPRESSION];if(e?A="draco:"+e.bufferView+":"+e.indices+":"+cN(e.attributes):A=t.indices+":"+cN(t.attributes)+":"+t.mode,t.targets!==void 0)for(let i=0,g=t.targets.length;i<g;i++)A+=":"+cN(t.targets[i]);return A}function cN(t){let A="";const e=Object.keys(t).sort();for(let i=0,g=e.length;i<g;i++)A+=e[i]+":"+t[e[i]]+";";return A}function lN(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function SgA(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const mgA=new NA;let fgA=class{constructor(t={},A={}){this.json=t,this.extensions={},this.plugins={},this.options=A,this.cache=new ZiA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let e=!1,i=!1,g=-1;typeof navigator<"u"&&(e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,g=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||e||i&&g<98?this.textureLoader=new Ja(this.options.manager):this.textureLoader=new gT(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ag(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,A){const e=this,i=this.json,g=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(I){return I._markDefs&&I._markDefs()}),Promise.all(this._invokeAll(function(I){return I.beforeRoot&&I.beforeRoot()})).then(function(){return Promise.all([e.getDependencies("scene"),e.getDependencies("animation"),e.getDependencies("camera")])}).then(function(I){const o={scene:I[0][i.scene||0],scenes:I[0],animations:I[1],cameras:I[2],asset:i.asset,parser:e,userData:{}};return nQ(g,o,i),Br(o,i),Promise.all(e._invokeAll(function(s){return s.afterRoot&&s.afterRoot(o)})).then(function(){t(o)})}).catch(A)}_markDefs(){const t=this.json.nodes||[],A=this.json.skins||[],e=this.json.meshes||[];for(let i=0,g=A.length;i<g;i++){const I=A[i].joints;for(let o=0,s=I.length;o<s;o++)t[I[o]].isBone=!0}for(let i=0,g=t.length;i<g;i++){const I=t[i];I.mesh!==void 0&&(this._addNodeRef(this.meshCache,I.mesh),I.skin!==void 0&&(e[I.mesh].isSkinnedMesh=!0)),I.camera!==void 0&&this._addNodeRef(this.cameraCache,I.camera)}}_addNodeRef(t,A){A!==void 0&&(t.refs[A]===void 0&&(t.refs[A]=t.uses[A]=0),t.refs[A]++)}_getNodeRef(t,A,e){if(t.refs[A]<=1)return e;const i=e.clone(),g=(I,o)=>{const s=this.associations.get(I);s!=null&&this.associations.set(o,s);for(const[C,a]of I.children.entries())g(a,o.children[C])};return g(e,i),i.name+="_instance_"+t.uses[A]++,i}_invokeOne(t){const A=Object.values(this.plugins);A.push(this);for(let e=0;e<A.length;e++){const i=t(A[e]);if(i)return i}return null}_invokeAll(t){const A=Object.values(this.plugins);A.unshift(this);const e=[];for(let i=0;i<A.length;i++){const g=t(A[i]);g&&e.push(g)}return e}getDependency(t,A){const e=t+":"+A;let i=this.cache.get(e);if(!i){switch(t){case"scene":i=this.loadScene(A);break;case"node":i=this._invokeOne(function(g){return g.loadNode&&g.loadNode(A)});break;case"mesh":i=this._invokeOne(function(g){return g.loadMesh&&g.loadMesh(A)});break;case"accessor":i=this.loadAccessor(A);break;case"bufferView":i=this._invokeOne(function(g){return g.loadBufferView&&g.loadBufferView(A)});break;case"buffer":i=this.loadBuffer(A);break;case"material":i=this._invokeOne(function(g){return g.loadMaterial&&g.loadMaterial(A)});break;case"texture":i=this._invokeOne(function(g){return g.loadTexture&&g.loadTexture(A)});break;case"skin":i=this.loadSkin(A);break;case"animation":i=this._invokeOne(function(g){return g.loadAnimation&&g.loadAnimation(A)});break;case"camera":i=this.loadCamera(A);break;default:if(i=this._invokeOne(function(g){return g!=this&&g.getDependency&&g.getDependency(t,A)}),!i)throw new Error("Unknown type: "+t);break}this.cache.add(e,i)}return i}getDependencies(t){let A=this.cache.get(t);if(!A){const e=this,i=this.json[t+(t==="mesh"?"es":"s")]||[];A=Promise.all(i.map(function(g,I){return e.getDependency(t,I)})),this.cache.add(t,A)}return A}loadBuffer(t){const A=this.json.buffers[t],e=this.fileLoader;if(A.type&&A.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+A.type+" buffer type is not supported.");if(A.uri===void 0&&t===0)return Promise.resolve(this.extensions[at.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(g,I){e.load(or.resolveURL(A.uri,i.path),g,void 0,function(){I(new Error('THREE.GLTFLoader: Failed to load buffer "'+A.uri+'".'))})})}loadBufferView(t){const A=this.json.bufferViews[t];return this.getDependency("buffer",A.buffer).then(function(e){const i=A.byteLength||0,g=A.byteOffset||0;return e.slice(g,g+i)})}loadAccessor(t){const A=this,e=this.json,i=this.json.accessors[t];if(i.bufferView===void 0&&i.sparse===void 0){const I=QN[i.type],o=Rh[i.componentType],s=i.normalized===!0,C=new o(i.count*I);return Promise.resolve(new te(C,I,s))}const g=[];return i.bufferView!==void 0?g.push(this.getDependency("bufferView",i.bufferView)):g.push(null),i.sparse!==void 0&&(g.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),g.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(g).then(function(I){const o=I[0],s=QN[i.type],C=Rh[i.componentType],a=C.BYTES_PER_ELEMENT,n=a*s,B=i.byteOffset||0,Q=i.bufferView!==void 0?e.bufferViews[i.bufferView].byteStride:void 0,E=i.normalized===!0;let h,l;if(Q&&Q!==n){const d=Math.floor(B/Q),c="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+d+":"+i.count;let u=A.cache.get(c);u||(h=new C(o,d*Q,i.count*Q/a),u=new nd(h,Q/a),A.cache.add(c,u)),l=new po(u,s,B%Q/a,E)}else o===null?h=new C(i.count*s):h=new C(o,B,i.count*s),l=new te(h,s,E);if(i.sparse!==void 0){const d=QN.SCALAR,c=Rh[i.sparse.indices.componentType],u=i.sparse.indices.byteOffset||0,p=i.sparse.values.byteOffset||0,D=new c(I[1],u,i.sparse.count*d),m=new C(I[2],p,i.sparse.count*s);o!==null&&(l=new te(l.array.slice(),l.itemSize,l.normalized));for(let M=0,k=D.length;M<k;M++){const R=D[M];if(l.setX(R,m[M*s]),s>=2&&l.setY(R,m[M*s+1]),s>=3&&l.setZ(R,m[M*s+2]),s>=4&&l.setW(R,m[M*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return l})}loadTexture(t){const A=this.json,e=this.options,i=A.textures[t].source,g=A.images[i];let I=this.textureLoader;if(g.uri){const o=e.manager.getHandler(g.uri);o!==null&&(I=o)}return this.loadTextureImage(t,i,I)}loadTextureImage(t,A,e){const i=this,g=this.json,I=g.textures[t],o=g.images[A],s=(o.uri||o.bufferView)+":"+I.sampler;if(this.textureCache[s])return this.textureCache[s];const C=this.loadImageSource(A,e).then(function(a){a.flipY=!1,a.name=I.name||o.name||"",a.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(a.name=o.uri);const n=(g.samplers||{})[I.sampler]||{};return a.magFilter=vH[n.magFilter]||fe,a.minFilter=vH[n.minFilter]||RI,a.wrapS=JH[n.wrapS]||es,a.wrapT=JH[n.wrapT]||es,a.anisotropy=4,i.associations.set(a,{textures:t}),a}).catch(function(){return null});return this.textureCache[s]=C,C}loadImageSource(t,A){const e=this,i=this.json,g=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(n=>n.clone());const I=i.images[t],o=self.URL||self.webkitURL;let s=I.uri||"",C=!1;if(I.bufferView!==void 0)s=e.getDependency("bufferView",I.bufferView).then(function(n){C=!0;const B=new Blob([n],{type:I.mimeType});return s=o.createObjectURL(B),s});else if(I.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const a=Promise.resolve(s).then(function(n){return new Promise(function(B,Q){let E=B;A.isImageBitmapLoader===!0&&(E=function(h){const l=new He(h);l.needsUpdate=!0,B(l)}),A.load(or.resolveURL(n,g.path),E,void 0,Q)})}).then(function(n){return C===!0&&o.revokeObjectURL(s),n.userData.mimeType=I.mimeType||SgA(I.uri),n}).catch(function(n){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),n});return this.sourceCache[t]=a,a}assignTexture(t,A,e,i){const g=this;return this.getDependency("texture",e.index).then(function(I){if(!I)return null;if(e.texCoord!==void 0&&e.texCoord>0&&(I=I.clone(),I.channel=e.texCoord),g.extensions[at.KHR_TEXTURE_TRANSFORM]){const o=e.extensions!==void 0?e.extensions[at.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const s=g.associations.get(I);I=g.extensions[at.KHR_TEXTURE_TRANSFORM].extendTexture(I,o),g.associations.set(I,s)}}return i!==void 0&&(I.colorSpace=i),t[A]=I,I})}assignFinalMaterial(t){const A=t.geometry;let e=t.material;const i=A.attributes.tangent===void 0,g=A.attributes.color!==void 0,I=A.attributes.normal===void 0;if(t.isPoints){const o="PointsMaterial:"+e.uuid;let s=this.cache.get(o);s||(s=new py,qe.prototype.copy.call(s,e),s.color.copy(e.color),s.map=e.map,s.sizeAttenuation=!1,this.cache.add(o,s)),e=s}else if(t.isLine){const o="LineBasicMaterial:"+e.uuid;let s=this.cache.get(o);s||(s=new Ki,qe.prototype.copy.call(s,e),s.color.copy(e.color),s.map=e.map,this.cache.add(o,s)),e=s}if(i||g||I){let o="ClonedMaterial:"+e.uuid+":";i&&(o+="derivative-tangents:"),g&&(o+="vertex-colors:"),I&&(o+="flat-shading:");let s=this.cache.get(o);s||(s=e.clone(),g&&(s.vertexColors=!0),I&&(s.flatShading=!0),i&&(s.normalScale&&(s.normalScale.y*=-1),s.clearcoatNormalScale&&(s.clearcoatNormalScale.y*=-1)),this.cache.add(o,s),this.associations.set(s,this.associations.get(e))),e=s}t.material=e}getMaterialType(){return vI}loadMaterial(t){const A=this,e=this.json,i=this.extensions,g=e.materials[t];let I;const o={},s=g.extensions||{},C=[];if(s[at.KHR_MATERIALS_UNLIT]){const n=i[at.KHR_MATERIALS_UNLIT];I=n.getMaterialType(),C.push(n.extendParams(o,g,A))}else{const n=g.pbrMetallicRoughness||{};if(o.color=new MA(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const B=n.baseColorFactor;o.color.setRGB(B[0],B[1],B[2],Dt),o.opacity=B[3]}n.baseColorTexture!==void 0&&C.push(A.assignTexture(o,"map",n.baseColorTexture,he)),o.metalness=n.metallicFactor!==void 0?n.metallicFactor:1,o.roughness=n.roughnessFactor!==void 0?n.roughnessFactor:1,n.metallicRoughnessTexture!==void 0&&(C.push(A.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),C.push(A.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),I=this._invokeOne(function(B){return B.getMaterialType&&B.getMaterialType(t)}),C.push(Promise.all(this._invokeAll(function(B){return B.extendMaterialParams&&B.extendMaterialParams(t,o)})))}g.doubleSided===!0&&(o.side=ht);const a=g.alphaMode||hN.OPAQUE;if(a===hN.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,a===hN.MASK&&(o.alphaTest=g.alphaCutoff!==void 0?g.alphaCutoff:.5)),g.normalTexture!==void 0&&I!==st&&(C.push(A.assignTexture(o,"normalMap",g.normalTexture)),o.normalScale=new eA(1,1),g.normalTexture.scale!==void 0)){const n=g.normalTexture.scale;o.normalScale.set(n,n)}if(g.occlusionTexture!==void 0&&I!==st&&(C.push(A.assignTexture(o,"aoMap",g.occlusionTexture)),g.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=g.occlusionTexture.strength)),g.emissiveFactor!==void 0&&I!==st){const n=g.emissiveFactor;o.emissive=new MA().setRGB(n[0],n[1],n[2],Dt)}return g.emissiveTexture!==void 0&&I!==st&&C.push(A.assignTexture(o,"emissiveMap",g.emissiveTexture,he)),Promise.all(C).then(function(){const n=new I(o);return g.name&&(n.name=g.name),Br(n,g),A.associations.set(n,{materials:t}),g.extensions&&nQ(i,n,g),n})}createUniqueName(t){const A=Ct.sanitizeNodeName(t||"");return A in this.nodeNamesUsed?A+"_"+ ++this.nodeNamesUsed[A]:(this.nodeNamesUsed[A]=0,A)}loadGeometries(t){const A=this,e=this.extensions,i=this.primitiveCache;function g(o){return e[at.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,A).then(function(s){return qH(s,o,A)})}const I=[];for(let o=0,s=t.length;o<s;o++){const C=t[o],a=ygA(C),n=i[a];if(n)I.push(n.promise);else{let B;C.extensions&&C.extensions[at.KHR_DRACO_MESH_COMPRESSION]?B=g(C):B=qH(new De,C,A),i[a]={primitive:C,promise:B},I.push(B)}}return Promise.all(I)}loadMesh(t){const A=this,e=this.json,i=this.extensions,g=e.meshes[t],I=g.primitives,o=[];for(let s=0,C=I.length;s<C;s++){const a=I[s].material===void 0?pgA(this.cache):this.getDependency("material",I[s].material);o.push(a)}return o.push(A.loadGeometries(I)),Promise.all(o).then(function(s){const C=s.slice(0,s.length-1),a=s[s.length-1],n=[];for(let Q=0,E=a.length;Q<E;Q++){const h=a[Q],l=I[Q];let d;const c=C[Q];if(l.mode===rs.TRIANGLES||l.mode===rs.TRIANGLE_STRIP||l.mode===rs.TRIANGLE_FAN||l.mode===void 0)d=g.isSkinnedMesh===!0?new Do(h,c):new dA(h,c),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),l.mode===rs.TRIANGLE_STRIP?d.geometry=NH(d.geometry,gM):l.mode===rs.TRIANGLE_FAN&&(d.geometry=NH(d.geometry,Rw));else if(l.mode===rs.LINES)d=new wo(h,c);else if(l.mode===rs.LINE_STRIP)d=new vi(h,c);else if(l.mode===rs.LINE_LOOP)d=new AR(h,c);else if(l.mode===rs.POINTS)d=new tR(h,c);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);Object.keys(d.geometry.morphAttributes).length>0&&wgA(d,g),d.name=A.createUniqueName(g.name||"mesh_"+t),Br(d,g),l.extensions&&nQ(i,d,l),A.assignFinalMaterial(d),n.push(d)}for(let Q=0,E=n.length;Q<E;Q++)A.associations.set(n[Q],{meshes:t,primitives:Q});if(n.length===1)return g.extensions&&nQ(i,n[0],g),n[0];const B=new Io;g.extensions&&nQ(i,B,g),A.associations.set(B,{meshes:t});for(let Q=0,E=n.length;Q<E;Q++)B.add(n[Q]);return B})}loadCamera(t){let A;const e=this.json.cameras[t],i=e[e.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return e.type==="perspective"?A=new xe(og.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):e.type==="orthographic"&&(A=new Na(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),e.name&&(A.name=this.createUniqueName(e.name)),Br(A,e),Promise.resolve(A)}loadSkin(t){const A=this.json.skins[t],e=[];for(let i=0,g=A.joints.length;i<g;i++)e.push(this._loadNodeShallow(A.joints[i]));return A.inverseBindMatrices!==void 0?e.push(this.getDependency("accessor",A.inverseBindMatrices)):e.push(null),Promise.all(e).then(function(i){const g=i.pop(),I=i,o=[],s=[];for(let C=0,a=I.length;C<a;C++){const n=I[C];if(n){o.push(n);const B=new NA;g!==null&&B.fromArray(g.array,C*16),s.push(B)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',A.joints[C])}return new Ey(o,s)})}loadAnimation(t){const A=this.json,e=this,i=A.animations[t],g=i.name?i.name:"animation_"+t,I=[],o=[],s=[],C=[],a=[];let n=0,B=i.channels.length;for(n=0,B=i.channels.length;n<B;n++){const Q=i.channels[n],E=i.samplers[Q.sampler],h=Q.target,l=h.node,d=i.parameters!==void 0?i.parameters[E.input]:E.input,c=i.parameters!==void 0?i.parameters[E.output]:E.output;h.node!==void 0&&(I.push(this.getDependency("node",l)),o.push(this.getDependency("accessor",d)),s.push(this.getDependency("accessor",c)),C.push(E),a.push(h))}return Promise.all([Promise.all(I),Promise.all(o),Promise.all(s),Promise.all(C),Promise.all(a)]).then(function(Q){const E=Q[0],h=Q[1],l=Q[2],d=Q[3],c=Q[4],u=[];for(n=0,B=E.length;n<B;n++){const p=E[n],D=h[n],m=l[n],M=d[n],k=c[n];if(p===void 0)continue;p.updateMatrix&&p.updateMatrix();const R=e._createAnimationTracks(p,D,m,M,k);if(R)for(let F=0;F<R.length;F++)u.push(R[F])}return new JI(g,void 0,u)})}createNodeMesh(t){const A=this.json,e=this,i=A.nodes[t];return i.mesh===void 0?null:e.getDependency("mesh",i.mesh).then(function(g){const I=e._getNodeRef(e.meshCache,i.mesh,g);return i.weights!==void 0&&I.traverse(function(o){if(o.isMesh)for(let s=0,C=i.weights.length;s<C;s++)o.morphTargetInfluences[s]=i.weights[s]}),I})}loadNode(t){const A=this.json,e=this,i=A.nodes[t],g=e._loadNodeShallow(t),I=[],o=i.children||[];for(let C=0,a=o.length;C<a;C++)I.push(e.getDependency("node",o[C]));const s=i.skin===void 0?Promise.resolve(null):e.getDependency("skin",i.skin);return Promise.all([g,Promise.all(I),s]).then(function(C){const a=C[0],n=C[1],B=C[2];B!==null&&a.traverse(function(Q){Q.isSkinnedMesh&&Q.bind(B,mgA)});for(let Q=0,E=n.length;Q<E;Q++)a.add(n[Q]);return a})}_loadNodeShallow(t){const A=this.json,e=this.extensions,i=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const g=A.nodes[t],I=g.name?i.createUniqueName(g.name):"",o=[],s=i._invokeOne(function(C){return C.createNodeMesh&&C.createNodeMesh(t)});return s&&o.push(s),g.camera!==void 0&&o.push(i.getDependency("camera",g.camera).then(function(C){return i._getNodeRef(i.cameraCache,g.camera,C)})),i._invokeAll(function(C){return C.createNodeAttachment&&C.createNodeAttachment(t)}).forEach(function(C){o.push(C)}),this.nodeCache[t]=Promise.all(o).then(function(C){let a;if(g.isBone===!0?a=new Ed:C.length>1?a=new Io:C.length===1?a=C[0]:a=new wA,a!==C[0])for(let n=0,B=C.length;n<B;n++)a.add(C[n]);if(g.name&&(a.userData.name=g.name,a.name=I),Br(a,g),g.extensions&&nQ(e,a,g),g.matrix!==void 0){const n=new NA;n.fromArray(g.matrix),a.applyMatrix4(n)}else g.translation!==void 0&&a.position.fromArray(g.translation),g.rotation!==void 0&&a.quaternion.fromArray(g.rotation),g.scale!==void 0&&a.scale.fromArray(g.scale);return i.associations.has(a)||i.associations.set(a,{}),i.associations.get(a).nodes=t,a}),this.nodeCache[t]}loadScene(t){const A=this.extensions,e=this.json.scenes[t],i=this,g=new Io;e.name&&(g.name=i.createUniqueName(e.name)),Br(g,e),e.extensions&&nQ(A,g,e);const I=e.nodes||[],o=[];for(let s=0,C=I.length;s<C;s++)o.push(i.getDependency("node",I[s]));return Promise.all(o).then(function(s){for(let a=0,n=s.length;a<n;a++)g.add(s[a]);const C=a=>{const n=new Map;for(const[B,Q]of i.associations)(B instanceof qe||B instanceof He)&&n.set(B,Q);return a.traverse(B=>{const Q=i.associations.get(B);Q!=null&&n.set(B,Q)}),n};return i.associations=C(g),g})}_createAnimationTracks(t,A,e,i,g){const I=[],o=t.name?t.name:t.uuid,s=[];rr[g.path]===rr.weights?t.traverse(function(B){B.morphTargetInfluences&&s.push(B.name?B.name:B.uuid)}):s.push(o);let C;switch(rr[g.path]){case rr.weights:C=gr;break;case rr.rotation:C=fC;break;case rr.position:case rr.scale:C=ba;break;default:switch(e.itemSize){case 1:C=gr;break;case 2:case 3:default:C=ba;break}break}const a=i.interpolation!==void 0?ugA[i.interpolation]:yC,n=this._getArrayFromAccessor(e);for(let B=0,Q=s.length;B<Q;B++){const E=new C(s[B]+"."+rr[g.path],A.array,n,a);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(E),I.push(E)}return I}_getArrayFromAccessor(t){let A=t.array;if(t.normalized){const e=lN(A.constructor),i=new Float32Array(A.length);for(let g=0,I=A.length;g<I;g++)i[g]=A[g]*e;A=i}return A}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(A){const e=this instanceof fC?dgA:KH;return new e(this.times,this.values,this.getValueSize()/3,A)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function kgA(t,A,e){const i=A.attributes,g=new St;if(i.POSITION!==void 0){const s=e.json.accessors[i.POSITION],C=s.min,a=s.max;if(C!==void 0&&a!==void 0){if(g.set(new f(C[0],C[1],C[2]),new f(a[0],a[1],a[2])),s.normalized){const n=lN(Rh[s.componentType]);g.min.multiplyScalar(n),g.max.multiplyScalar(n)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const I=A.targets;if(I!==void 0){const s=new f,C=new f;for(let a=0,n=I.length;a<n;a++){const B=I[a];if(B.POSITION!==void 0){const Q=e.json.accessors[B.POSITION],E=Q.min,h=Q.max;if(E!==void 0&&h!==void 0){if(C.setX(Math.max(Math.abs(E[0]),Math.abs(h[0]))),C.setY(Math.max(Math.abs(E[1]),Math.abs(h[1]))),C.setZ(Math.max(Math.abs(E[2]),Math.abs(h[2]))),Q.normalized){const l=lN(Rh[Q.componentType]);C.multiplyScalar(l)}s.max(C)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}g.expandByVector(s)}t.boundingBox=g;const o=new mi;g.getCenter(o.center),o.radius=g.min.distanceTo(g.max)/2,t.boundingSphere=o}function qH(t,A,e){const i=A.attributes,g=[];function I(o,s){return e.getDependency("accessor",o).then(function(C){t.setAttribute(s,C)})}for(const o in i){const s=EN[o]||o.toLowerCase();s in t.attributes||g.push(I(i[o],s))}if(A.indices!==void 0&&!t.index){const o=e.getDependency("accessor",A.indices).then(function(s){t.setIndex(s)});g.push(o)}return wt.workingColorSpace!==Dt&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${wt.workingColorSpace}" not supported.`),Br(t,A),kgA(t,A,e),Promise.all(g).then(function(){return A.targets!==void 0?DgA(t,A.targets,e):t})}const dN=tA("debugtypes");class GgA{constructor(){r(this,"_types",{}),dN&&console.warn("TypeStore: Created",this)}add(A,e){dN&&console.warn("ADD TYPE",A);const i=this._types[A];i===void 0?this._types[A]=e:dN&&i!==e&&console.warn("Type name exists multiple times in your project and may lead to runtime errors:",A)}get(A){return this._types[A]}}const MgA=Symbol("BuiltInType"),W=new GgA,RgA=function(t){W.get(t.name)||W.add(t.name,t)};typeof globalThis!==void 0&&!("OffscreenCanvas"in globalThis)&&(globalThis.OffscreenCanvas=class{constructor(t,A){return r(this,"canvas"),this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=A,this.canvas.convertToBlob=(e,i)=>new Promise(g=>{this.canvas.toBlob(g,e,i)}),this.canvas}});/*!
|
|
4410
|
+
Falling back to local version at "./include/draco"`),Pd="./include/draco/",rN="./include/ktx2/"});let Vs,BN,nr;function MH(t){t!==void 0&&typeof t=="string"&&(Vs||(Vs=new tN),Mh&&console.log("Setting draco decoder path to",t),Vs.setDecoderPath(t))}function RH(t){t!==void 0&&typeof t=="string"&&(Vs||(Vs=new tN),Mh&&console.log("Setting draco decoder type to",t),Vs.setDecoderConfig({type:t}))}function UH(t){t!==void 0&&typeof t=="string"&&(nr||(nr=new Gh),Mh&&console.log("Setting ktx2 transcoder path to",t),nr.setTranscoderPath(t))}function D0(t,A){return Vs||(Vs=new tN,Vs.setDecoderPath(Pd),Vs.setDecoderConfig({type:"js"}),Mh&&console.log("Setting draco decoder path to",Pd)),nr||(nr=new Gh,nr.setTranscoderPath(rN),Mh&&console.log("Setting ktx2 transcoder path to",rN)),BN||(BN=biA,Mh&&console.log("Using the default meshopt decoder")),A.renderer?nr.detectSupport(A.renderer):console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures will probably fail"),t.dracoLoader||t.setDRACOLoader(Vs),t.ktx2Loader||t.setKTX2Loader(nr),t.meshoptDecoder||t.setMeshoptDecoder(BN),t}function WiA(t,A=1e-4){A=Math.max(A,Number.EPSILON);const e={},i=t.getIndex(),g=t.getAttribute("position"),I=i?i.count:g.count;let o=0;const s=Object.keys(t.attributes),C={},a={},n=[],B=["getX","getY","getZ","getW"],Q=["setX","setY","setZ","setW"];for(let u=0,p=s.length;u<p;u++){const D=s[u],m=t.attributes[D];C[D]=new te(new m.array.constructor(m.count*m.itemSize),m.itemSize,m.normalized);const M=t.morphAttributes[D];M&&(a[D]=new te(new M.array.constructor(M.count*M.itemSize),M.itemSize,M.normalized))}const E=A*.5,h=Math.log10(1/A),l=Math.pow(10,h),d=E*l;for(let u=0;u<I;u++){const p=i?i.getX(u):u;let D="";for(let m=0,M=s.length;m<M;m++){const k=s[m],R=t.getAttribute(k),F=R.itemSize;for(let S=0;S<F;S++)D+=`${~~(R[B[S]](p)*l+d)},`}if(D in e)n.push(e[D]);else{for(let m=0,M=s.length;m<M;m++){const k=s[m],R=t.getAttribute(k),F=t.morphAttributes[k],S=R.itemSize,U=C[k],T=a[k];for(let Y=0;Y<S;Y++){const K=B[Y],O=Q[Y];if(U[O](o,R[K](p)),F)for(let J=0,v=F.length;J<v;J++)T[J][O](o,F[J][K](p))}}e[D]=o,n.push(o),o++}}const c=t.clone();for(const u in t.attributes){const p=C[u];if(c.setAttribute(u,new te(p.array.slice(0,o*p.itemSize),p.itemSize,p.normalized)),u in a)for(let D=0;D<a[u].length;D++){const m=a[u][D];c.morphAttributes[u][D]=new te(m.array.slice(0,o*m.itemSize),m.itemSize,m.normalized)}}return c.setIndex(n),c}function NH(t,A){if(A===Rx)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(A===Rw||A===gM){let e=t.getIndex();if(e===null){const o=[],s=t.getAttribute("position");if(s!==void 0){for(let C=0;C<s.count;C++)o.push(C);t.setIndex(o),e=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const i=e.count-2,g=[];if(A===Rw)for(let o=1;o<=i;o++)g.push(e.getX(0)),g.push(e.getX(o)),g.push(e.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(g.push(e.getX(o)),g.push(e.getX(o+1)),g.push(e.getX(o+2))):(g.push(e.getX(o+2)),g.push(e.getX(o+1)),g.push(e.getX(o)));g.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const I=t.clone();return I.setIndex(g),I.clearGroups(),I}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",A),t}let jd=class extends Jg{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(A){return new $iA(A)}),this.register(function(A){return new CgA(A)}),this.register(function(A){return new agA(A)}),this.register(function(A){return new ngA(A)}),this.register(function(A){return new egA(A)}),this.register(function(A){return new tgA(A)}),this.register(function(A){return new igA(A)}),this.register(function(A){return new ggA(A)}),this.register(function(A){return new XiA(A)}),this.register(function(A){return new IgA(A)}),this.register(function(A){return new AgA(A)}),this.register(function(A){return new sgA(A)}),this.register(function(A){return new ogA(A)}),this.register(function(A){return new ViA(A)}),this.register(function(A){return new rgA(A)}),this.register(function(A){return new BgA(A)})}load(t,A,e,i){const g=this;let I;if(this.resourcePath!=="")I=this.resourcePath;else if(this.path!==""){const C=or.extractUrlBase(t);I=or.resolveURL(C,this.path)}else I=or.extractUrlBase(t);this.manager.itemStart(t);const o=function(C){i?i(C):console.error(C),g.manager.itemError(t),g.manager.itemEnd(t)},s=new ag(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(C){try{g.parse(C,I,function(a){A(a),g.manager.itemEnd(t)},o)}catch(a){o(a)}},e,o)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,A,e,i){let g;const I={},o={},s=new TextDecoder;if(typeof t=="string")g=JSON.parse(t);else if(t instanceof ArrayBuffer)if(s.decode(new Uint8Array(t,0,4))===FH){try{I[at.KHR_BINARY_GLTF]=new QgA(t)}catch(a){i&&i(a);return}g=JSON.parse(I[at.KHR_BINARY_GLTF].content)}else g=JSON.parse(s.decode(t));else g=t;if(g.asset===void 0||g.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const C=new fgA(g,{path:A||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});C.fileLoader.setRequestHeader(this.requestHeader);for(let a=0;a<this.pluginCallbacks.length;a++){const n=this.pluginCallbacks[a](C);n.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[n.name]=n,I[n.name]=!0}if(g.extensionsUsed)for(let a=0;a<g.extensionsUsed.length;++a){const n=g.extensionsUsed[a],B=g.extensionsRequired||[];switch(n){case at.KHR_MATERIALS_UNLIT:I[n]=new ziA;break;case at.KHR_DRACO_MESH_COMPRESSION:I[n]=new EgA(g,this.dracoLoader);break;case at.KHR_TEXTURE_TRANSFORM:I[n]=new hgA;break;case at.KHR_MESH_QUANTIZATION:I[n]=new cgA;break;default:B.indexOf(n)>=0&&o[n]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+n+'".')}}C.setExtensions(I),C.setPlugins(o),C.parse(e,i)}parseAsync(t,A){const e=this;return new Promise(function(i,g){e.parse(t,A,i,g)})}};function ZiA(){let t={};return{get:function(A){return t[A]},add:function(A,e){t[A]=e},remove:function(A){delete t[A]},removeAll:function(){t={}}}}const at={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};let ViA=class{constructor(t){this.parser=t,this.name=at.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,A=this.parser.json.nodes||[];for(let e=0,i=A.length;e<i;e++){const g=A[e];g.extensions&&g.extensions[this.name]&&g.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,g.extensions[this.name].light)}}_loadLight(t){const A=this.parser,e="light:"+t;let i=A.cache.get(e);if(i)return i;const g=A.json,I=((g.extensions&&g.extensions[this.name]||{}).lights||[])[t];let o;const s=new MA(16777215);I.color!==void 0&&s.setRGB(I.color[0],I.color[1],I.color[2],Dt);const C=I.range!==void 0?I.range:0;switch(I.type){case"directional":o=new uh(s),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new fd(s),o.distance=C;break;case"spot":o=new Jy(s),o.distance=C,I.spot=I.spot||{},I.spot.innerConeAngle=I.spot.innerConeAngle!==void 0?I.spot.innerConeAngle:0,I.spot.outerConeAngle=I.spot.outerConeAngle!==void 0?I.spot.outerConeAngle:Math.PI/4,o.angle=I.spot.outerConeAngle,o.penumbra=1-I.spot.innerConeAngle/I.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+I.type)}return o.position.set(0,0,0),o.decay=2,Br(o,I),I.intensity!==void 0&&(o.intensity=I.intensity),o.name=A.createUniqueName(I.name||"light_"+t),i=Promise.resolve(o),A.cache.add(e,i),i}getDependency(t,A){if(t==="light")return this._loadLight(A)}createNodeAttachment(t){const A=this,e=this.parser,i=e.json.nodes[t],g=(i.extensions&&i.extensions[this.name]||{}).light;return g===void 0?null:this._loadLight(g).then(function(I){return e._getNodeRef(A.cache,g,I)})}},ziA=class{constructor(){this.name=at.KHR_MATERIALS_UNLIT}getMaterialType(){return st}extendParams(t,A,e){const i=[];t.color=new MA(1,1,1),t.opacity=1;const g=A.pbrMetallicRoughness;if(g){if(Array.isArray(g.baseColorFactor)){const I=g.baseColorFactor;t.color.setRGB(I[0],I[1],I[2],Dt),t.opacity=I[3]}g.baseColorTexture!==void 0&&i.push(e.assignTexture(t,"map",g.baseColorTexture,he))}return Promise.all(i)}},XiA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,A){const e=this.parser.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();const i=e.extensions[this.name].emissiveStrength;return i!==void 0&&(A.emissiveIntensity=i),Promise.resolve()}},$iA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];if(I.clearcoatFactor!==void 0&&(A.clearcoat=I.clearcoatFactor),I.clearcoatTexture!==void 0&&g.push(e.assignTexture(A,"clearcoatMap",I.clearcoatTexture)),I.clearcoatRoughnessFactor!==void 0&&(A.clearcoatRoughness=I.clearcoatRoughnessFactor),I.clearcoatRoughnessTexture!==void 0&&g.push(e.assignTexture(A,"clearcoatRoughnessMap",I.clearcoatRoughnessTexture)),I.clearcoatNormalTexture!==void 0&&(g.push(e.assignTexture(A,"clearcoatNormalMap",I.clearcoatNormalTexture)),I.clearcoatNormalTexture.scale!==void 0)){const o=I.clearcoatNormalTexture.scale;A.clearcoatNormalScale=new eA(o,o)}return Promise.all(g)}},AgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return I.iridescenceFactor!==void 0&&(A.iridescence=I.iridescenceFactor),I.iridescenceTexture!==void 0&&g.push(e.assignTexture(A,"iridescenceMap",I.iridescenceTexture)),I.iridescenceIor!==void 0&&(A.iridescenceIOR=I.iridescenceIor),A.iridescenceThicknessRange===void 0&&(A.iridescenceThicknessRange=[100,400]),I.iridescenceThicknessMinimum!==void 0&&(A.iridescenceThicknessRange[0]=I.iridescenceThicknessMinimum),I.iridescenceThicknessMaximum!==void 0&&(A.iridescenceThicknessRange[1]=I.iridescenceThicknessMaximum),I.iridescenceThicknessTexture!==void 0&&g.push(e.assignTexture(A,"iridescenceThicknessMap",I.iridescenceThicknessTexture)),Promise.all(g)}},egA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_SHEEN}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[];A.sheenColor=new MA(0,0,0),A.sheenRoughness=0,A.sheen=1;const I=i.extensions[this.name];if(I.sheenColorFactor!==void 0){const o=I.sheenColorFactor;A.sheenColor.setRGB(o[0],o[1],o[2],Dt)}return I.sheenRoughnessFactor!==void 0&&(A.sheenRoughness=I.sheenRoughnessFactor),I.sheenColorTexture!==void 0&&g.push(e.assignTexture(A,"sheenColorMap",I.sheenColorTexture,he)),I.sheenRoughnessTexture!==void 0&&g.push(e.assignTexture(A,"sheenRoughnessMap",I.sheenRoughnessTexture)),Promise.all(g)}},tgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return I.transmissionFactor!==void 0&&(A.transmission=I.transmissionFactor),I.transmissionTexture!==void 0&&g.push(e.assignTexture(A,"transmissionMap",I.transmissionTexture)),Promise.all(g)}},igA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_VOLUME}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];A.thickness=I.thicknessFactor!==void 0?I.thicknessFactor:0,I.thicknessTexture!==void 0&&g.push(e.assignTexture(A,"thicknessMap",I.thicknessTexture)),A.attenuationDistance=I.attenuationDistance||1/0;const o=I.attenuationColor||[1,1,1];return A.attenuationColor=new MA().setRGB(o[0],o[1],o[2],Dt),Promise.all(g)}},ggA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_IOR}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser.json.materials[t];if(!e.extensions||!e.extensions[this.name])return Promise.resolve();const i=e.extensions[this.name];return A.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}},IgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_SPECULAR}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];A.specularIntensity=I.specularFactor!==void 0?I.specularFactor:1,I.specularTexture!==void 0&&g.push(e.assignTexture(A,"specularIntensityMap",I.specularTexture));const o=I.specularColorFactor||[1,1,1];return A.specularColor=new MA().setRGB(o[0],o[1],o[2],Dt),I.specularColorTexture!==void 0&&g.push(e.assignTexture(A,"specularColorMap",I.specularColorTexture,he)),Promise.all(g)}},ogA=class{constructor(t){this.parser=t,this.name=at.EXT_MATERIALS_BUMP}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return A.bumpScale=I.bumpFactor!==void 0?I.bumpFactor:1,I.bumpTexture!==void 0&&g.push(e.assignTexture(A,"bumpMap",I.bumpTexture)),Promise.all(g)}},sgA=class{constructor(t){this.parser=t,this.name=at.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const A=this.parser.json.materials[t];return!A.extensions||!A.extensions[this.name]?null:yo}extendMaterialParams(t,A){const e=this.parser,i=e.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const g=[],I=i.extensions[this.name];return I.anisotropyStrength!==void 0&&(A.anisotropy=I.anisotropyStrength),I.anisotropyRotation!==void 0&&(A.anisotropyRotation=I.anisotropyRotation),I.anisotropyTexture!==void 0&&g.push(e.assignTexture(A,"anisotropyMap",I.anisotropyTexture)),Promise.all(g)}},CgA=class{constructor(t){this.parser=t,this.name=at.KHR_TEXTURE_BASISU}loadTexture(t){const A=this.parser,e=A.json,i=e.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const g=i.extensions[this.name],I=A.options.ktx2Loader;if(!I){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return A.loadTextureImage(t,g.source,I)}},agA=class{constructor(t){this.parser=t,this.name=at.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const A=this.name,e=this.parser,i=e.json,g=i.textures[t];if(!g.extensions||!g.extensions[A])return null;const I=g.extensions[A],o=i.images[I.source];let s=e.textureLoader;if(o.uri){const C=e.options.manager.getHandler(o.uri);C!==null&&(s=C)}return this.detectSupport().then(function(C){if(C)return e.loadTextureImage(t,I.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(A)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return e.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const A=new Image;A.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",A.onload=A.onerror=function(){t(A.height===1)}})),this.isSupported}},ngA=class{constructor(t){this.parser=t,this.name=at.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const A=this.name,e=this.parser,i=e.json,g=i.textures[t];if(!g.extensions||!g.extensions[A])return null;const I=g.extensions[A],o=i.images[I.source];let s=e.textureLoader;if(o.uri){const C=e.options.manager.getHandler(o.uri);C!==null&&(s=C)}return this.detectSupport().then(function(C){if(C)return e.loadTextureImage(t,I.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(A)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return e.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const A=new Image;A.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",A.onload=A.onerror=function(){t(A.height===1)}})),this.isSupported}},rgA=class{constructor(t){this.name=at.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const A=this.parser.json,e=A.bufferViews[t];if(e.extensions&&e.extensions[this.name]){const i=e.extensions[this.name],g=this.parser.getDependency("buffer",i.buffer),I=this.parser.options.meshoptDecoder;if(!I||!I.supported){if(A.extensionsRequired&&A.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return g.then(function(o){const s=i.byteOffset||0,C=i.byteLength||0,a=i.count,n=i.byteStride,B=new Uint8Array(o,s,C);return I.decodeGltfBufferAsync?I.decodeGltfBufferAsync(a,n,B,i.mode,i.filter).then(function(Q){return Q.buffer}):I.ready.then(function(){const Q=new ArrayBuffer(a*n);return I.decodeGltfBuffer(new Uint8Array(Q),a,n,B,i.mode,i.filter),Q})})}else return null}},BgA=class{constructor(t){this.name=at.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const A=this.parser.json,e=A.nodes[t];if(!e.extensions||!e.extensions[this.name]||e.mesh===void 0)return null;const i=A.meshes[e.mesh];for(const s of i.primitives)if(s.mode!==rs.TRIANGLES&&s.mode!==rs.TRIANGLE_STRIP&&s.mode!==rs.TRIANGLE_FAN&&s.mode!==void 0)return null;const g=e.extensions[this.name].attributes,I=[],o={};for(const s in g)I.push(this.parser.getDependency("accessor",g[s]).then(C=>(o[s]=C,o[s])));return I.length<1?null:(I.push(this.parser.createNodeMesh(t)),Promise.all(I).then(s=>{const C=s.pop(),a=C.isGroup?C.children:[C],n=s[0].count,B=[];for(const Q of a){const E=new NA,h=new f,l=new UA,d=new f(1,1,1),c=new VM(Q.geometry,Q.material,n);for(let u=0;u<n;u++)o.TRANSLATION&&h.fromBufferAttribute(o.TRANSLATION,u),o.ROTATION&&l.fromBufferAttribute(o.ROTATION,u),o.SCALE&&d.fromBufferAttribute(o.SCALE,u),c.setMatrixAt(u,E.compose(h,l,d));for(const u in o)if(u==="_COLOR_0"){const p=o[u];c.instanceColor=new so(p.array,p.itemSize,p.normalized)}else u!=="TRANSLATION"&&u!=="ROTATION"&&u!=="SCALE"&&Q.geometry.setAttribute(u,o[u]);wA.prototype.copy.call(c,Q),this.parser.assignFinalMaterial(c),B.push(c)}return C.isGroup?(C.clear(),C.add(...B),C):B[0]}))}};const FH="glTF",Wd=12,bH={JSON:1313821514,BIN:5130562};let QgA=class{constructor(t){this.name=at.KHR_BINARY_GLTF,this.content=null,this.body=null;const A=new DataView(t,0,Wd),e=new TextDecoder;if(this.header={magic:e.decode(new Uint8Array(t.slice(0,4))),version:A.getUint32(4,!0),length:A.getUint32(8,!0)},this.header.magic!==FH)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Wd,g=new DataView(t,Wd);let I=0;for(;I<i;){const o=g.getUint32(I,!0);I+=4;const s=g.getUint32(I,!0);if(I+=4,s===bH.JSON){const C=new Uint8Array(t,Wd+I,o);this.content=e.decode(C)}else if(s===bH.BIN){const C=Wd+I;this.body=t.slice(C,C+o)}I+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},EgA=class{constructor(t,A){if(!A)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=at.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=A,this.dracoLoader.preload()}decodePrimitive(t,A){const e=this.json,i=this.dracoLoader,g=t.extensions[this.name].bufferView,I=t.extensions[this.name].attributes,o={},s={},C={};for(const a in I){const n=EN[a]||a.toLowerCase();o[n]=I[a]}for(const a in t.attributes){const n=EN[a]||a.toLowerCase();if(I[a]!==void 0){const B=e.accessors[t.attributes[a]],Q=Rh[B.componentType];C[n]=Q.name,s[n]=B.normalized===!0}}return A.getDependency("bufferView",g).then(function(a){return new Promise(function(n,B){i.decodeDracoFile(a,function(Q){for(const E in Q.attributes){const h=Q.attributes[E],l=s[E];l!==void 0&&(h.normalized=l)}n(Q)},o,C,Dt,B)})})}},hgA=class{constructor(){this.name=at.KHR_TEXTURE_TRANSFORM}extendTexture(t,A){return(A.texCoord===void 0||A.texCoord===t.channel)&&A.offset===void 0&&A.rotation===void 0&&A.scale===void 0||(t=t.clone(),A.texCoord!==void 0&&(t.channel=A.texCoord),A.offset!==void 0&&t.offset.fromArray(A.offset),A.rotation!==void 0&&(t.rotation=A.rotation),A.scale!==void 0&&t.repeat.fromArray(A.scale),t.needsUpdate=!0),t}},cgA=class{constructor(){this.name=at.KHR_MESH_QUANTIZATION}},KH=class extends dh{constructor(t,A,e,i){super(t,A,e,i)}copySampleValue_(t){const A=this.resultBuffer,e=this.sampleValues,i=this.valueSize,g=t*i*3+i;for(let I=0;I!==i;I++)A[I]=e[g+I];return A}interpolate_(t,A,e,i){const g=this.resultBuffer,I=this.sampleValues,o=this.valueSize,s=o*2,C=o*3,a=i-A,n=(e-A)/a,B=n*n,Q=B*n,E=t*C,h=E-C,l=-2*Q+3*B,d=Q-B,c=1-l,u=d-B+n;for(let p=0;p!==o;p++){const D=I[h+p+o],m=I[h+p+s]*a,M=I[E+p+o],k=I[E+p]*a;g[p]=c*D+u*m+l*M+d*k}return g}};const lgA=new UA;let dgA=class extends KH{interpolate_(t,A,e,i){const g=super.interpolate_(t,A,e,i);return lgA.fromArray(g).normalize().toArray(g),g}};const rs={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Rh={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},vH={9728:ve,9729:fe,9984:xE,9985:GB,9986:wa,9987:RI},JH={33071:dg,33648:kB,10497:es},QN={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},EN={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},rr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ugA={CUBICSPLINE:void 0,LINEAR:yC,STEP:Wn},hN={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function pgA(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new vI({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:lg})),t.DefaultMaterial}function nQ(t,A,e){for(const i in e.extensions)t[i]===void 0&&(A.userData.gltfExtensions=A.userData.gltfExtensions||{},A.userData.gltfExtensions[i]=e.extensions[i])}function Br(t,A){A.extras!==void 0&&(typeof A.extras=="object"?Object.assign(t.userData,A.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+A.extras))}function DgA(t,A,e){let i=!1,g=!1,I=!1;for(let a=0,n=A.length;a<n;a++){const B=A[a];if(B.POSITION!==void 0&&(i=!0),B.NORMAL!==void 0&&(g=!0),B.COLOR_0!==void 0&&(I=!0),i&&g&&I)break}if(!i&&!g&&!I)return Promise.resolve(t);const o=[],s=[],C=[];for(let a=0,n=A.length;a<n;a++){const B=A[a];if(i){const Q=B.POSITION!==void 0?e.getDependency("accessor",B.POSITION):t.attributes.position;o.push(Q)}if(g){const Q=B.NORMAL!==void 0?e.getDependency("accessor",B.NORMAL):t.attributes.normal;s.push(Q)}if(I){const Q=B.COLOR_0!==void 0?e.getDependency("accessor",B.COLOR_0):t.attributes.color;C.push(Q)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(C)]).then(function(a){const n=a[0],B=a[1],Q=a[2];return i&&(t.morphAttributes.position=n),g&&(t.morphAttributes.normal=B),I&&(t.morphAttributes.color=Q),t.morphTargetsRelative=!0,t})}function wgA(t,A){if(t.updateMorphTargets(),A.weights!==void 0)for(let e=0,i=A.weights.length;e<i;e++)t.morphTargetInfluences[e]=A.weights[e];if(A.extras&&Array.isArray(A.extras.targetNames)){const e=A.extras.targetNames;if(t.morphTargetInfluences.length===e.length){t.morphTargetDictionary={};for(let i=0,g=e.length;i<g;i++)t.morphTargetDictionary[e[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ygA(t){let A;const e=t.extensions&&t.extensions[at.KHR_DRACO_MESH_COMPRESSION];if(e?A="draco:"+e.bufferView+":"+e.indices+":"+cN(e.attributes):A=t.indices+":"+cN(t.attributes)+":"+t.mode,t.targets!==void 0)for(let i=0,g=t.targets.length;i<g;i++)A+=":"+cN(t.targets[i]);return A}function cN(t){let A="";const e=Object.keys(t).sort();for(let i=0,g=e.length;i<g;i++)A+=e[i]+":"+t[e[i]]+";";return A}function lN(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function SgA(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const mgA=new NA;let fgA=class{constructor(t={},A={}){this.json=t,this.extensions={},this.plugins={},this.options=A,this.cache=new ZiA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let e=!1,i=!1,g=-1;typeof navigator<"u"&&(e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,g=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||e||i&&g<98?this.textureLoader=new Ja(this.options.manager):this.textureLoader=new gT(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ag(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,A){const e=this,i=this.json,g=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(I){return I._markDefs&&I._markDefs()}),Promise.all(this._invokeAll(function(I){return I.beforeRoot&&I.beforeRoot()})).then(function(){return Promise.all([e.getDependencies("scene"),e.getDependencies("animation"),e.getDependencies("camera")])}).then(function(I){const o={scene:I[0][i.scene||0],scenes:I[0],animations:I[1],cameras:I[2],asset:i.asset,parser:e,userData:{}};return nQ(g,o,i),Br(o,i),Promise.all(e._invokeAll(function(s){return s.afterRoot&&s.afterRoot(o)})).then(function(){t(o)})}).catch(A)}_markDefs(){const t=this.json.nodes||[],A=this.json.skins||[],e=this.json.meshes||[];for(let i=0,g=A.length;i<g;i++){const I=A[i].joints;for(let o=0,s=I.length;o<s;o++)t[I[o]].isBone=!0}for(let i=0,g=t.length;i<g;i++){const I=t[i];I.mesh!==void 0&&(this._addNodeRef(this.meshCache,I.mesh),I.skin!==void 0&&(e[I.mesh].isSkinnedMesh=!0)),I.camera!==void 0&&this._addNodeRef(this.cameraCache,I.camera)}}_addNodeRef(t,A){A!==void 0&&(t.refs[A]===void 0&&(t.refs[A]=t.uses[A]=0),t.refs[A]++)}_getNodeRef(t,A,e){if(t.refs[A]<=1)return e;const i=e.clone(),g=(I,o)=>{const s=this.associations.get(I);s!=null&&this.associations.set(o,s);for(const[C,a]of I.children.entries())g(a,o.children[C])};return g(e,i),i.name+="_instance_"+t.uses[A]++,i}_invokeOne(t){const A=Object.values(this.plugins);A.push(this);for(let e=0;e<A.length;e++){const i=t(A[e]);if(i)return i}return null}_invokeAll(t){const A=Object.values(this.plugins);A.unshift(this);const e=[];for(let i=0;i<A.length;i++){const g=t(A[i]);g&&e.push(g)}return e}getDependency(t,A){const e=t+":"+A;let i=this.cache.get(e);if(!i){switch(t){case"scene":i=this.loadScene(A);break;case"node":i=this._invokeOne(function(g){return g.loadNode&&g.loadNode(A)});break;case"mesh":i=this._invokeOne(function(g){return g.loadMesh&&g.loadMesh(A)});break;case"accessor":i=this.loadAccessor(A);break;case"bufferView":i=this._invokeOne(function(g){return g.loadBufferView&&g.loadBufferView(A)});break;case"buffer":i=this.loadBuffer(A);break;case"material":i=this._invokeOne(function(g){return g.loadMaterial&&g.loadMaterial(A)});break;case"texture":i=this._invokeOne(function(g){return g.loadTexture&&g.loadTexture(A)});break;case"skin":i=this.loadSkin(A);break;case"animation":i=this._invokeOne(function(g){return g.loadAnimation&&g.loadAnimation(A)});break;case"camera":i=this.loadCamera(A);break;default:if(i=this._invokeOne(function(g){return g!=this&&g.getDependency&&g.getDependency(t,A)}),!i)throw new Error("Unknown type: "+t);break}this.cache.add(e,i)}return i}getDependencies(t){let A=this.cache.get(t);if(!A){const e=this,i=this.json[t+(t==="mesh"?"es":"s")]||[];A=Promise.all(i.map(function(g,I){return e.getDependency(t,I)})),this.cache.add(t,A)}return A}loadBuffer(t){const A=this.json.buffers[t],e=this.fileLoader;if(A.type&&A.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+A.type+" buffer type is not supported.");if(A.uri===void 0&&t===0)return Promise.resolve(this.extensions[at.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(g,I){e.load(or.resolveURL(A.uri,i.path),g,void 0,function(){I(new Error('THREE.GLTFLoader: Failed to load buffer "'+A.uri+'".'))})})}loadBufferView(t){const A=this.json.bufferViews[t];return this.getDependency("buffer",A.buffer).then(function(e){const i=A.byteLength||0,g=A.byteOffset||0;return e.slice(g,g+i)})}loadAccessor(t){const A=this,e=this.json,i=this.json.accessors[t];if(i.bufferView===void 0&&i.sparse===void 0){const I=QN[i.type],o=Rh[i.componentType],s=i.normalized===!0,C=new o(i.count*I);return Promise.resolve(new te(C,I,s))}const g=[];return i.bufferView!==void 0?g.push(this.getDependency("bufferView",i.bufferView)):g.push(null),i.sparse!==void 0&&(g.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),g.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(g).then(function(I){const o=I[0],s=QN[i.type],C=Rh[i.componentType],a=C.BYTES_PER_ELEMENT,n=a*s,B=i.byteOffset||0,Q=i.bufferView!==void 0?e.bufferViews[i.bufferView].byteStride:void 0,E=i.normalized===!0;let h,l;if(Q&&Q!==n){const d=Math.floor(B/Q),c="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+d+":"+i.count;let u=A.cache.get(c);u||(h=new C(o,d*Q,i.count*Q/a),u=new nd(h,Q/a),A.cache.add(c,u)),l=new po(u,s,B%Q/a,E)}else o===null?h=new C(i.count*s):h=new C(o,B,i.count*s),l=new te(h,s,E);if(i.sparse!==void 0){const d=QN.SCALAR,c=Rh[i.sparse.indices.componentType],u=i.sparse.indices.byteOffset||0,p=i.sparse.values.byteOffset||0,D=new c(I[1],u,i.sparse.count*d),m=new C(I[2],p,i.sparse.count*s);o!==null&&(l=new te(l.array.slice(),l.itemSize,l.normalized));for(let M=0,k=D.length;M<k;M++){const R=D[M];if(l.setX(R,m[M*s]),s>=2&&l.setY(R,m[M*s+1]),s>=3&&l.setZ(R,m[M*s+2]),s>=4&&l.setW(R,m[M*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return l})}loadTexture(t){const A=this.json,e=this.options,i=A.textures[t].source,g=A.images[i];let I=this.textureLoader;if(g.uri){const o=e.manager.getHandler(g.uri);o!==null&&(I=o)}return this.loadTextureImage(t,i,I)}loadTextureImage(t,A,e){const i=this,g=this.json,I=g.textures[t],o=g.images[A],s=(o.uri||o.bufferView)+":"+I.sampler;if(this.textureCache[s])return this.textureCache[s];const C=this.loadImageSource(A,e).then(function(a){a.flipY=!1,a.name=I.name||o.name||"",a.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(a.name=o.uri);const n=(g.samplers||{})[I.sampler]||{};return a.magFilter=vH[n.magFilter]||fe,a.minFilter=vH[n.minFilter]||RI,a.wrapS=JH[n.wrapS]||es,a.wrapT=JH[n.wrapT]||es,a.anisotropy=4,i.associations.set(a,{textures:t}),a}).catch(function(){return null});return this.textureCache[s]=C,C}loadImageSource(t,A){const e=this,i=this.json,g=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(n=>n.clone());const I=i.images[t],o=self.URL||self.webkitURL;let s=I.uri||"",C=!1;if(I.bufferView!==void 0)s=e.getDependency("bufferView",I.bufferView).then(function(n){C=!0;const B=new Blob([n],{type:I.mimeType});return s=o.createObjectURL(B),s});else if(I.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const a=Promise.resolve(s).then(function(n){return new Promise(function(B,Q){let E=B;A.isImageBitmapLoader===!0&&(E=function(h){const l=new He(h);l.needsUpdate=!0,B(l)}),A.load(or.resolveURL(n,g.path),E,void 0,Q)})}).then(function(n){return C===!0&&o.revokeObjectURL(s),n.userData.mimeType=I.mimeType||SgA(I.uri),n}).catch(function(n){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),n});return this.sourceCache[t]=a,a}assignTexture(t,A,e,i){const g=this;return this.getDependency("texture",e.index).then(function(I){if(!I)return null;if(e.texCoord!==void 0&&e.texCoord>0&&(I=I.clone(),I.channel=e.texCoord),g.extensions[at.KHR_TEXTURE_TRANSFORM]){const o=e.extensions!==void 0?e.extensions[at.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const s=g.associations.get(I);I=g.extensions[at.KHR_TEXTURE_TRANSFORM].extendTexture(I,o),g.associations.set(I,s)}}return i!==void 0&&(I.colorSpace=i),t[A]=I,I})}assignFinalMaterial(t){const A=t.geometry;let e=t.material;const i=A.attributes.tangent===void 0,g=A.attributes.color!==void 0,I=A.attributes.normal===void 0;if(t.isPoints){const o="PointsMaterial:"+e.uuid;let s=this.cache.get(o);s||(s=new py,qe.prototype.copy.call(s,e),s.color.copy(e.color),s.map=e.map,s.sizeAttenuation=!1,this.cache.add(o,s)),e=s}else if(t.isLine){const o="LineBasicMaterial:"+e.uuid;let s=this.cache.get(o);s||(s=new Ki,qe.prototype.copy.call(s,e),s.color.copy(e.color),s.map=e.map,this.cache.add(o,s)),e=s}if(i||g||I){let o="ClonedMaterial:"+e.uuid+":";i&&(o+="derivative-tangents:"),g&&(o+="vertex-colors:"),I&&(o+="flat-shading:");let s=this.cache.get(o);s||(s=e.clone(),g&&(s.vertexColors=!0),I&&(s.flatShading=!0),i&&(s.normalScale&&(s.normalScale.y*=-1),s.clearcoatNormalScale&&(s.clearcoatNormalScale.y*=-1)),this.cache.add(o,s),this.associations.set(s,this.associations.get(e))),e=s}t.material=e}getMaterialType(){return vI}loadMaterial(t){const A=this,e=this.json,i=this.extensions,g=e.materials[t];let I;const o={},s=g.extensions||{},C=[];if(s[at.KHR_MATERIALS_UNLIT]){const n=i[at.KHR_MATERIALS_UNLIT];I=n.getMaterialType(),C.push(n.extendParams(o,g,A))}else{const n=g.pbrMetallicRoughness||{};if(o.color=new MA(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const B=n.baseColorFactor;o.color.setRGB(B[0],B[1],B[2],Dt),o.opacity=B[3]}n.baseColorTexture!==void 0&&C.push(A.assignTexture(o,"map",n.baseColorTexture,he)),o.metalness=n.metallicFactor!==void 0?n.metallicFactor:1,o.roughness=n.roughnessFactor!==void 0?n.roughnessFactor:1,n.metallicRoughnessTexture!==void 0&&(C.push(A.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),C.push(A.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),I=this._invokeOne(function(B){return B.getMaterialType&&B.getMaterialType(t)}),C.push(Promise.all(this._invokeAll(function(B){return B.extendMaterialParams&&B.extendMaterialParams(t,o)})))}g.doubleSided===!0&&(o.side=ht);const a=g.alphaMode||hN.OPAQUE;if(a===hN.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,a===hN.MASK&&(o.alphaTest=g.alphaCutoff!==void 0?g.alphaCutoff:.5)),g.normalTexture!==void 0&&I!==st&&(C.push(A.assignTexture(o,"normalMap",g.normalTexture)),o.normalScale=new eA(1,1),g.normalTexture.scale!==void 0)){const n=g.normalTexture.scale;o.normalScale.set(n,n)}if(g.occlusionTexture!==void 0&&I!==st&&(C.push(A.assignTexture(o,"aoMap",g.occlusionTexture)),g.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=g.occlusionTexture.strength)),g.emissiveFactor!==void 0&&I!==st){const n=g.emissiveFactor;o.emissive=new MA().setRGB(n[0],n[1],n[2],Dt)}return g.emissiveTexture!==void 0&&I!==st&&C.push(A.assignTexture(o,"emissiveMap",g.emissiveTexture,he)),Promise.all(C).then(function(){const n=new I(o);return g.name&&(n.name=g.name),Br(n,g),A.associations.set(n,{materials:t}),g.extensions&&nQ(i,n,g),n})}createUniqueName(t){const A=Ct.sanitizeNodeName(t||"");return A in this.nodeNamesUsed?A+"_"+ ++this.nodeNamesUsed[A]:(this.nodeNamesUsed[A]=0,A)}loadGeometries(t){const A=this,e=this.extensions,i=this.primitiveCache;function g(o){return e[at.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,A).then(function(s){return qH(s,o,A)})}const I=[];for(let o=0,s=t.length;o<s;o++){const C=t[o],a=ygA(C),n=i[a];if(n)I.push(n.promise);else{let B;C.extensions&&C.extensions[at.KHR_DRACO_MESH_COMPRESSION]?B=g(C):B=qH(new De,C,A),i[a]={primitive:C,promise:B},I.push(B)}}return Promise.all(I)}loadMesh(t){const A=this,e=this.json,i=this.extensions,g=e.meshes[t],I=g.primitives,o=[];for(let s=0,C=I.length;s<C;s++){const a=I[s].material===void 0?pgA(this.cache):this.getDependency("material",I[s].material);o.push(a)}return o.push(A.loadGeometries(I)),Promise.all(o).then(function(s){const C=s.slice(0,s.length-1),a=s[s.length-1],n=[];for(let Q=0,E=a.length;Q<E;Q++){const h=a[Q],l=I[Q];let d;const c=C[Q];if(l.mode===rs.TRIANGLES||l.mode===rs.TRIANGLE_STRIP||l.mode===rs.TRIANGLE_FAN||l.mode===void 0)d=g.isSkinnedMesh===!0?new Do(h,c):new dA(h,c),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),l.mode===rs.TRIANGLE_STRIP?d.geometry=NH(d.geometry,gM):l.mode===rs.TRIANGLE_FAN&&(d.geometry=NH(d.geometry,Rw));else if(l.mode===rs.LINES)d=new wo(h,c);else if(l.mode===rs.LINE_STRIP)d=new vi(h,c);else if(l.mode===rs.LINE_LOOP)d=new AR(h,c);else if(l.mode===rs.POINTS)d=new tR(h,c);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);Object.keys(d.geometry.morphAttributes).length>0&&wgA(d,g),d.name=A.createUniqueName(g.name||"mesh_"+t),Br(d,g),l.extensions&&nQ(i,d,l),A.assignFinalMaterial(d),n.push(d)}for(let Q=0,E=n.length;Q<E;Q++)A.associations.set(n[Q],{meshes:t,primitives:Q});if(n.length===1)return g.extensions&&nQ(i,n[0],g),n[0];const B=new Io;g.extensions&&nQ(i,B,g),A.associations.set(B,{meshes:t});for(let Q=0,E=n.length;Q<E;Q++)B.add(n[Q]);return B})}loadCamera(t){let A;const e=this.json.cameras[t],i=e[e.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return e.type==="perspective"?A=new xe(og.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):e.type==="orthographic"&&(A=new Na(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),e.name&&(A.name=this.createUniqueName(e.name)),Br(A,e),Promise.resolve(A)}loadSkin(t){const A=this.json.skins[t],e=[];for(let i=0,g=A.joints.length;i<g;i++)e.push(this._loadNodeShallow(A.joints[i]));return A.inverseBindMatrices!==void 0?e.push(this.getDependency("accessor",A.inverseBindMatrices)):e.push(null),Promise.all(e).then(function(i){const g=i.pop(),I=i,o=[],s=[];for(let C=0,a=I.length;C<a;C++){const n=I[C];if(n){o.push(n);const B=new NA;g!==null&&B.fromArray(g.array,C*16),s.push(B)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',A.joints[C])}return new Ey(o,s)})}loadAnimation(t){const A=this.json,e=this,i=A.animations[t],g=i.name?i.name:"animation_"+t,I=[],o=[],s=[],C=[],a=[];let n=0,B=i.channels.length;for(n=0,B=i.channels.length;n<B;n++){const Q=i.channels[n],E=i.samplers[Q.sampler],h=Q.target,l=h.node,d=i.parameters!==void 0?i.parameters[E.input]:E.input,c=i.parameters!==void 0?i.parameters[E.output]:E.output;h.node!==void 0&&(I.push(this.getDependency("node",l)),o.push(this.getDependency("accessor",d)),s.push(this.getDependency("accessor",c)),C.push(E),a.push(h))}return Promise.all([Promise.all(I),Promise.all(o),Promise.all(s),Promise.all(C),Promise.all(a)]).then(function(Q){const E=Q[0],h=Q[1],l=Q[2],d=Q[3],c=Q[4],u=[];for(n=0,B=E.length;n<B;n++){const p=E[n],D=h[n],m=l[n],M=d[n],k=c[n];if(p===void 0)continue;p.updateMatrix&&p.updateMatrix();const R=e._createAnimationTracks(p,D,m,M,k);if(R)for(let F=0;F<R.length;F++)u.push(R[F])}return new JI(g,void 0,u)})}createNodeMesh(t){const A=this.json,e=this,i=A.nodes[t];return i.mesh===void 0?null:e.getDependency("mesh",i.mesh).then(function(g){const I=e._getNodeRef(e.meshCache,i.mesh,g);return i.weights!==void 0&&I.traverse(function(o){if(o.isMesh)for(let s=0,C=i.weights.length;s<C;s++)o.morphTargetInfluences[s]=i.weights[s]}),I})}loadNode(t){const A=this.json,e=this,i=A.nodes[t],g=e._loadNodeShallow(t),I=[],o=i.children||[];for(let C=0,a=o.length;C<a;C++)I.push(e.getDependency("node",o[C]));const s=i.skin===void 0?Promise.resolve(null):e.getDependency("skin",i.skin);return Promise.all([g,Promise.all(I),s]).then(function(C){const a=C[0],n=C[1],B=C[2];B!==null&&a.traverse(function(Q){Q.isSkinnedMesh&&Q.bind(B,mgA)});for(let Q=0,E=n.length;Q<E;Q++)a.add(n[Q]);return a})}_loadNodeShallow(t){const A=this.json,e=this.extensions,i=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const g=A.nodes[t],I=g.name?i.createUniqueName(g.name):"",o=[],s=i._invokeOne(function(C){return C.createNodeMesh&&C.createNodeMesh(t)});return s&&o.push(s),g.camera!==void 0&&o.push(i.getDependency("camera",g.camera).then(function(C){return i._getNodeRef(i.cameraCache,g.camera,C)})),i._invokeAll(function(C){return C.createNodeAttachment&&C.createNodeAttachment(t)}).forEach(function(C){o.push(C)}),this.nodeCache[t]=Promise.all(o).then(function(C){let a;if(g.isBone===!0?a=new Ed:C.length>1?a=new Io:C.length===1?a=C[0]:a=new wA,a!==C[0])for(let n=0,B=C.length;n<B;n++)a.add(C[n]);if(g.name&&(a.userData.name=g.name,a.name=I),Br(a,g),g.extensions&&nQ(e,a,g),g.matrix!==void 0){const n=new NA;n.fromArray(g.matrix),a.applyMatrix4(n)}else g.translation!==void 0&&a.position.fromArray(g.translation),g.rotation!==void 0&&a.quaternion.fromArray(g.rotation),g.scale!==void 0&&a.scale.fromArray(g.scale);return i.associations.has(a)||i.associations.set(a,{}),i.associations.get(a).nodes=t,a}),this.nodeCache[t]}loadScene(t){const A=this.extensions,e=this.json.scenes[t],i=this,g=new Io;e.name&&(g.name=i.createUniqueName(e.name)),Br(g,e),e.extensions&&nQ(A,g,e);const I=e.nodes||[],o=[];for(let s=0,C=I.length;s<C;s++)o.push(i.getDependency("node",I[s]));return Promise.all(o).then(function(s){for(let a=0,n=s.length;a<n;a++)g.add(s[a]);const C=a=>{const n=new Map;for(const[B,Q]of i.associations)(B instanceof qe||B instanceof He)&&n.set(B,Q);return a.traverse(B=>{const Q=i.associations.get(B);Q!=null&&n.set(B,Q)}),n};return i.associations=C(g),g})}_createAnimationTracks(t,A,e,i,g){const I=[],o=t.name?t.name:t.uuid,s=[];rr[g.path]===rr.weights?t.traverse(function(B){B.morphTargetInfluences&&s.push(B.name?B.name:B.uuid)}):s.push(o);let C;switch(rr[g.path]){case rr.weights:C=gr;break;case rr.rotation:C=fC;break;case rr.position:case rr.scale:C=ba;break;default:switch(e.itemSize){case 1:C=gr;break;case 2:case 3:default:C=ba;break}break}const a=i.interpolation!==void 0?ugA[i.interpolation]:yC,n=this._getArrayFromAccessor(e);for(let B=0,Q=s.length;B<Q;B++){const E=new C(s[B]+"."+rr[g.path],A.array,n,a);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(E),I.push(E)}return I}_getArrayFromAccessor(t){let A=t.array;if(t.normalized){const e=lN(A.constructor),i=new Float32Array(A.length);for(let g=0,I=A.length;g<I;g++)i[g]=A[g]*e;A=i}return A}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(A){const e=this instanceof fC?dgA:KH;return new e(this.times,this.values,this.getValueSize()/3,A)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function kgA(t,A,e){const i=A.attributes,g=new St;if(i.POSITION!==void 0){const s=e.json.accessors[i.POSITION],C=s.min,a=s.max;if(C!==void 0&&a!==void 0){if(g.set(new f(C[0],C[1],C[2]),new f(a[0],a[1],a[2])),s.normalized){const n=lN(Rh[s.componentType]);g.min.multiplyScalar(n),g.max.multiplyScalar(n)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const I=A.targets;if(I!==void 0){const s=new f,C=new f;for(let a=0,n=I.length;a<n;a++){const B=I[a];if(B.POSITION!==void 0){const Q=e.json.accessors[B.POSITION],E=Q.min,h=Q.max;if(E!==void 0&&h!==void 0){if(C.setX(Math.max(Math.abs(E[0]),Math.abs(h[0]))),C.setY(Math.max(Math.abs(E[1]),Math.abs(h[1]))),C.setZ(Math.max(Math.abs(E[2]),Math.abs(h[2]))),Q.normalized){const l=lN(Rh[Q.componentType]);C.multiplyScalar(l)}s.max(C)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}g.expandByVector(s)}t.boundingBox=g;const o=new mi;g.getCenter(o.center),o.radius=g.min.distanceTo(g.max)/2,t.boundingSphere=o}function qH(t,A,e){const i=A.attributes,g=[];function I(o,s){return e.getDependency("accessor",o).then(function(C){t.setAttribute(s,C)})}for(const o in i){const s=EN[o]||o.toLowerCase();s in t.attributes||g.push(I(i[o],s))}if(A.indices!==void 0&&!t.index){const o=e.getDependency("accessor",A.indices).then(function(s){t.setIndex(s)});g.push(o)}return wt.workingColorSpace!==Dt&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${wt.workingColorSpace}" not supported.`),Br(t,A),kgA(t,A,e),Promise.all(g).then(function(){return A.targets!==void 0?DgA(t,A.targets,e):t})}const dN=tA("debugtypes");class GgA{constructor(){r(this,"_types",{}),dN&&console.warn("TypeStore: Created",this)}add(A,e){dN&&console.warn("ADD TYPE",A);const i=this._types[A];i===void 0?this._types[A]=e:dN&&i!==e&&console.warn("Type name exists multiple times in your project and may lead to runtime errors:",A)}get(A){return this._types[A]}}const MgA=Symbol("BuiltInType"),W=new GgA,RgA=function(t){W.get(t.name)||W.add(t.name,t)};typeof globalThis!==void 0&&!("OffscreenCanvas"in globalThis)&&(globalThis.OffscreenCanvas=class{constructor(t,A){return r(this,"canvas"),this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=A,this.canvas.convertToBlob=(e,i)=>new Promise(g=>{this.canvas.toBlob(g,e,i)}),this.canvas}});/*!
|
|
4411
4411
|
fflate - fast JavaScript compression/decompression
|
|
4412
4412
|
<https://101arrowz.github.io/fflate>
|
|
4413
4413
|
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
@@ -5516,7 +5516,7 @@ ${e.path}! : AssetReference;
|
|
|
5516
5516
|
Could not find method ${n.method} on object ${Q.name}. Please rename ${n.method} to ${u}?
|
|
5517
5517
|
`,Q[u],`
|
|
5518
5518
|
in script: `,Q),Bi("EventList methods must start with lowercase letter, see console for details");return}else console.warn(`EventList method:
|
|
5519
|
-
Could not find method ${n.method} on object ${Q.name}`,Q,typeof Q[n.method])};if(typeof Q[n.method]!="function"){let u=!1,p=Q;for(;p;){const D=Object.getOwnPropertyDescriptor(p,n.method);if(D&&(D.writable===!0||D.set)){u=!0;break}p=Object.getPrototypeOf(p)}!u&&(Be()||Hg)&&c()}}let h=n.argument;h!==void 0?h=B(h):n.arguments!==void 0&&(h=n.arguments.map(B));const l=E?this.createEventMethod(Q,n.method,h):void 0,d=new Mc(l,n.enabled);if(d.method||(d[yQA]=(o=e.object)==null?void 0:o.name),!Q||!d.method){const c=e.object?"Current object: "+e.object.name+", "+e.object.guid:null;Q?console.warn('EventList method not found: "'+n.method+'" on',Q):console.warn("EventList is missing target - will be ignored",n.target,c,A)}else s.push(d)}const C=new rg(s);Hg&&console.log(C);const a=e.target;return a!==void 0&&e.path!==void 0&&C.setEventTarget(e.path,a),C}}createEventMethod(A,e,i){return(...g)=>{const I=A[e];typeof I=="function"?i!==void 0?Array.isArray(i)?I?.call(A,...i):I?.call(A,i):I?.call(A,...g):A[e]=i}}}const mQA=new SQA;class tj extends bC{constructor(){super([kc,Pe])}onSerialize(A,e){}onDeserialize(A,e){if(A instanceof He&&e.type===kc){const i=A,g=new kc(i.image.width,i.image.height,{colorSpace:Dt});return g.texture=i,i.isRenderTargetTexture=!0,i.flipY=!0,i.offset.y=1,i.repeat.y=-1,i.needsUpdate=!0,i.mipmaps=[],i instanceof mC&&(i.isCompressedTexture=!1,i.format=RGBAFormat),g}}}new tj;class ij extends bC{constructor(){super([URL])}onSerialize(A,e){return null}onDeserialize(A,e){if(typeof A=="string"&&A.length>0)return Cr(e.gltfId,A)}}new ij;var fQA=Object.defineProperty,kQA=Object.getOwnPropertyDescriptor,GQA=(t,A,e,i)=>{for(var g=i>1?void 0:i?kQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&fQA(A,e,g),g};class np extends bA{awake(){ys.createIfNoneExists(this.context)}onEnable(){var A;(A=ys.get(this.context))==null||A.register(this)}onDisable(){var A;(A=ys.get(this.context))==null||A.unregister(this)}}class bo extends np{constructor(){super(...arguments),r(this,"targets",null),r(this,"raycastHits",[]),r(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(A=null){if(!this.targets)return null;A??(A=new ps),A.targets=this.targets,A.results=this.raycastHits;const e=A.testObject;this.ignoreSkinnedMeshes&&(A.testObject=g=>g instanceof Do?"continue in children":e?e(g):!0);const i=this.context.physics.raycast(A);return A.testObject=e,i}}GQA([w()],bo.prototype,"ignoreSkinnedMeshes",2);class mm extends bo{constructor(){super(),this.ignoreSkinnedMeshes=!0}}class rp extends np{performRaycast(A){if(!pe.active||!(A!=null&&A.ray))return null;const e=A.ray.origin,i=.01;return this.context.physics.sphereOverlap(e,i)}}class fm{static getObject(A){const e=A[ws];return e&&(e.isComponent===!0?A=e.gameObject:A=e),A}static isInteractable(A,e){if(e&&(e.canvasGroup=void 0,e.graphic=void 0),A==null||!A.visible||(A=this.getObject(A),!A.visible))return!1;const i=this.tryFindCanvasGroup(A);if(i?.isCanvasGroup===!0&&(e&&(e.canvasGroup=i),i.blocksRaycasts===!1||i.interactable===!1))return!1;const g=KQ(A,I=>{if(I.isGraphic===!0)return I},!1);return e&&g?.isGraphic===!0&&(e.graphic=g),!(g?.raycastTarget===!1||g?.layer===2)}static tryFindCanvasGroup(A){if(!A)return null;const e=KQ(A,i=>{const g=i;if(g.blocksRaycasts!==void 0&&g.interactable!==void 0)return g},!1);return e!==void 0?e:this.tryFindCanvasGroup(A.parent)}}function UK(t){return t[ws]||(t.parent?UK(t.parent):null)}function MQA(t){return t.isUI===!0||typeof t[ws]=="object"}function km(t,A){if(!t)return;const e=t.material;if(e?.isMaterial===!0){const i=t.parent;i&&i.isText,e.side=A.doubleSided??!0?ht:lg,e.shadowSide=A.doubleSided?ht:lg,t.castShadow=A.castShadows?A.castShadows:!1,t.receiveShadow=A.receiveShadows?A.receiveShadows:!1}for(const i of t.children)km(i,A)}function Rc(t,A,e){t[A]===void 0&&console.warn("Field",A,"is undefined on",t);const i=Proxy.revocable(t[A],{set(o,s,C,a){const n=o[s],B=Reflect.set(o,s,C,a);return e(C,n),B}}),g=i.revoke,I=t[A];return i.revoke=()=>{t[A]=I,g()},t[A]=i.proxy,i}const gj=Symbol("Scheduled action");function RQA(t,A,e=Zt.OnBeforeRender){let i=t[gj];i||(i=t[gj]={});const g=A.name;i[e]||(i[e]={});const I=i[e];if(I[g])return;function*o(){A?.call(t),I[g]=null}const s=t.startCoroutine(o(),e);I[g]=s}const an=tA("debugeventsystem");var NK=(t=>(t.BeforeHandleInput="BeforeHandleInput",t.AfterHandleInput="AfterHandleInput",t))(NK||{});const nn=class extends bA{constructor(){super(),r(this,"raycaster",[]),r(this,"_handleInputFn"),r(this,"pressedByID",new Map),r(this,"hoveredByID",new Map),r(this,"_sortedHits",[]),r(this,"_testObjectsCache",new Map),r(this,"_currentlyActiveRaycaster",null),r(this,"_currentPointerEventName",null),r(this,"shouldRaycastObject",t=>{var A;let e=null;if(MQA(t)&&(e=(A=t[ws])==null?void 0:A.gameObject),this._testObjectsCache.has(t)||e&&this._testObjectsCache.has(e))return this._testObjectsCache.get(t)===!1?"continue in children":!0;{let i=RK(t,this._currentPointerEventName);if(!i&&e&&(i=RK(e,this._currentPointerEventName)),i){this._testObjectsCache.set(t,!0);for(const g of t.children)this.shouldRaycastObject_AddToYesCache(g);return!0}return this._testObjectsCache.set(t,!1),"continue in children"}}),r(this,"_sortingBuffer",[]),r(this,"_noDepthTestingResults",[]),r(this,"out",{}),r(this,"_capturedPointer",{}),r(this,"pointerEnterSymbol",Symbol("pointerEnter")),r(this,"pointerExitSymbol",Symbol("pointerExit")),r(this,"currentActiveMeshUIComponents",[]),nn.systems.push(this)}static createIfNoneExists(t){this.didSearchEventSystem||(this.didSearchEventSystem=!0,nn.systems.length<=0&&nn.systems.push(...aA.findObjectsOfType(nn,t)));for(const e of nn.systems)if(e.context===t)return;const A=new wA;aA.addNewComponent(A,nn),t.scene.add(A)}static get systems(){const t=Ke.Current;return this._eventSystemMap.has(t)||this._eventSystemMap.set(t,[]),this._eventSystemMap.get(t)}static get(t){const A=this._eventSystemMap.get(t);return A&&A.length>0?A[0]:null}static get instance(){return this.systems[0]}static ensureUpdateMeshUI(t,A,e=!1){jr.update(t,A,e)}static markUIDirty(t){jr.markDirty()}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}onDestroy(){nn.systems.splice(nn.systems.indexOf(this),1)}start(){if(this.raycaster.length<=0&&!aA.findObjectOfType(np,this.context)){const t=aA.addNewComponent(this.context.scene,bo);this.raycaster.push(t),(Be()||an)&&console.warn("Added an ObjectRaycaster to the scene because no raycaster was found.")}}register(t){var A;t&&this.raycaster&&!this.raycaster.includes(t)&&((A=this.raycaster)==null||A.push(t))}unregister(t){var A,e;const i=(A=this.raycaster)==null?void 0:A.indexOf(t);i!==void 0&&i!==-1&&((e=this.raycaster)==null||e.splice(i,1))}onEnable(){this._handleInputFn??(this._handleInputFn=this.onPointerEvent.bind(this)),this.context.input.addEventListener(ii.PointerDown,this._handleInputFn),this.context.input.addEventListener(ii.PointerUp,this._handleInputFn),this.context.input.addEventListener(ii.PointerMove,this._handleInputFn)}onDisable(){this.context.input.removeEventListener(ii.PointerDown,this._handleInputFn),this.context.input.removeEventListener(ii.PointerUp,this._handleInputFn),this.context.input.removeEventListener(ii.PointerMove,this._handleInputFn)}onBeforeRender(){this.resetMeshUIStates()}onPointerEvent(t){if(t===void 0||t.propagationStopped)return;const A=new Ml(this.context.input,t);this._currentPointerEventName=t.type,A.inputSource=this.context.input,A.isClick=t.isClick,A.isDoubleClick=t.isDoubleClick,A.isDown=t.type==ii.PointerDown,A.isUp=t.type==ii.PointerUp,A.isPressed=this.context.input.getPointerPressed(t.pointerId),an&&(A.isDown?console.log("DOWN",A.pointerId):A.isUp&&console.log("UP",A.pointerId),A.isClick&&console.log("CLICK",A.pointerId));const e=new ps;t.hasRay?e.ray=t.ray:e.screenPoint=this.context.input.getPointerPositionRC(t.pointerId);const i=this.performRaycast(e);if(i)for(const I of i)I.event=t,t.intersections.push(I);an&&A.isClick&&ri("EventSystem: "+A.pointerId+" - "+this.context.time.frame+" - Up:"+A.isUp+", Down:"+A.isDown);const g={sender:this,args:A,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:g})),this.handleIntersections(i,A),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:g}))}shouldRaycastObject_AddToYesCache(t){this._testObjectsCache.set(t,!0);for(const A of t.children)this.shouldRaycastObject_AddToYesCache(A)}performRaycast(t){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,t||(t=new ps),t.testObject=this.shouldRaycastObject;for(const A of this.raycaster){if(!A.activeAndEnabled)continue;this._currentlyActiveRaycaster=A;const e=A.performRaycast(t);this._currentlyActiveRaycaster=null,e&&e.length>0&&this._sortedHits.push(...e)}return this._sortedHits.sort((A,e)=>A.distance-e.distance),this._sortedHits}assignHitInformation(t,A){A?(t.intersection=A,t.point=A.point,t.normal=A.normal,t.face=A.face,t.distance=A.distance,t.instanceId=A.instanceId):(t.intersection=void 0,t.point=void 0,t.normal=void 0,t.face=void 0,t.distance=void 0,t.instanceId=void 0)}handleIntersections(t,A){var e;if(t!=null&&t.length){t=this.sortCandidates(t);for(const g of t){if(A.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(A,g),this.handleEventOnObject(g.object,A))return!0}}this.assignHitInformation(A,t?.[0]),this.invokePointerCapture(A);const i=this.hoveredByID.get(A.pointerId);return i&&this.propagatePointerExit(i.obj,i.data,null),this.hoveredByID.delete(A.pointerId),A.isUp&&((e=this.pressedByID.get(A.pointerId))==null||e.handlers.forEach(g=>this.invokeOnPointerUp(A,g)),this.pressedByID.delete(A.pointerId)),!1}sortCandidates(t){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let A=0;A<t.length;A++){const e=t[A],i=e.object;if(i.material&&i.material.depthTest===!1){this._noDepthTestingResults.push(e);continue}this._sortingBuffer.push(e)}for(const A of this._sortingBuffer)this._noDepthTestingResults.push(A);return this._noDepthTestingResults}handleEventOnObject(t,A){if(!this.testIsVisible(t))return A.isClick&&an&&console.log("not allowed",t),!1;if(A.pointerId===void 0)return an&&console.error("Event without pointer can't be handled",A),!1;A.object=t;const e=t.parent,i=A.isClick??!1;let g=null;if(e&&e.isUI){const C=(A.isPressed||A.isClick)??!1;if(e[ws]){const a=e[ws].gameObject;if(a){if(!fm.isInteractable(a,this.out))return!1;g=this.out.canvasGroup??null,this.handleMeshUIIntersection(t,C),t=a}}}i&&an&&console.log(this.context.time.frame,t);const I=this.hoveredByID.get(A.pointerId),o=I?.obj;o!==t&&o&&this.propagatePointerExit(o,I.data,t);const s=this.hoveredByID.get(A.pointerId);if(s?(s.obj=t,s.data=A):this.hoveredByID.set(A.pointerId,{obj:t,data:A}),A.isDown){const C=this.pressedByID.get(A.pointerId);C?(C.obj=t,C.data=A):this.pressedByID.set(A.pointerId,{obj:t,data:A,handlers:new Set})}return(g===null||g.interactable)&&this.handleMainInteraction(t,A,o??null),!0}propagate(t,A){for(;t;)aA.foreachComponent(t,e=>{A(e)},!1),t=t.parent}handleMainInteraction(t,A,e){const i=this.pressedByID.get(A.pointerId),g=e!==t;let I=!0;switch(A.event.pointerType){case"mouse":case"touch":const o=this.context.input.getPointerPositionLastFrame(A.pointerId),s=this.context.input.getPointerPosition(A.pointerId);I=o&&!ee.approximately(o,s);break}this.propagate(t,o=>{var s;const C=o;C.interactable!==!1&&(!C.activeAndEnabled||!C.enabled||(C.onPointerEnter&&g&&this.handlePointerEnter(C,A),A.isDown&&C.onPointerDown&&(C.onPointerDown(A),i?.handlers.add(C),this.handlePointerCapture(A,C)),C.onPointerMove&&(I&&C.onPointerMove(A),this.handlePointerCapture(A,C)),A.isUp&&(C.onPointerUp&&(this.invokeOnPointerUp(A,C),i?.handlers.delete(C)),C.onPointerExit&&((s=A.event)==null?void 0:s.pointerType)===gS.Touch&&(this.handlePointerExit(C,A),this.hoveredByID.delete(A.pointerId))),A.isClick&&C.onPointerClick&&C.onPointerClick(A)))}),A.isUp&&(i?.handlers.forEach(o=>{this.invokeOnPointerUp(A,o)}),this.pressedByID.delete(A.pointerId))}propagatePointerExit(t,A,e){this.propagate(t,i=>{if(!i.gameObject||i.destroyed)return;const g=i;if(g.onPointerExit){if(e&&this.isChild(e,i.gameObject))return;this.handlePointerExit(g,A)}})}invokeOnPointerUp(t,A){var e;(e=A.onPointerUp)==null||e.call(A,t),this.releasePointerCapture(t,A)}handlePointerEnter(t,A){t.onPointerEnter&&this.updatePointerState(t,A.pointerId,this.pointerEnterSymbol,!0)&&t.onPointerEnter(A),this.updatePointerState(t,A.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(t,A){t.onPointerExit&&this.updatePointerState(t,A.pointerId,this.pointerExitSymbol,!0)&&t.onPointerExit(A),this.updatePointerState(t,A.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(t,A,e,i){let g=t[e];if(i)return g&&g.includes(A)?!1:(g=g||[],g.push(A),t[e]=g,!0);{if(!g||!g.includes(A))return!1;const I=g.indexOf(A);return I!==-1&&g.splice(I,1),!0}}handlePointerCapture(t,A){if(t.z__pointer_ctured){t.z__pointer_ctured=!1;const e=t.pointerId;if(A.onPointerMove){const i=this._capturedPointer[e]||[];i.push(A),this._capturedPointer[e]=i}else Be()&&!A.z__warned_no_pointermove&&(A.z__warned_no_pointermove=!0,console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"))}else t.z__pointer_cture_rleased&&(t.z__pointer_cture_rleased=!1,this.releasePointerCapture(t,A))}releasePointerCapture(t,A){const e=t.pointerId;if(this._capturedPointer[e]){const i=this._capturedPointer[e].indexOf(A);i!==-1&&(this._capturedPointer[e].splice(i,1),an&&console.log("released pointer capture",e,A,this._capturedPointer))}}invokePointerCapture(t){var A;if(t.event.type===ii.PointerMove){const e=t.pointerId,i=this._capturedPointer[e];if(i){an&&console.log("Captured",e,i);for(let g=0;g<i.length;g++){const I=i[g];if(I.destroyed){i.splice(g,1),g--;continue}(A=I.onPointerMove)==null||A.call(I,t)}}}}isChild(t,A){return!t||!A?!1:t===A?!0:t.parent?this.isChild(t.parent,A):!1}handleMeshUiObjectWithoutShadowDom(t,A){return!t||!t.isUI?!0:this.handleMeshUIIntersection(t,A)}handleMeshUIIntersection(t,A){const e=jr.updateState(t,A);return e&&this.currentActiveMeshUIComponents.push(e),e!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&jr.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let t=0;t<this.currentActiveMeshUIComponents.length;t++){const A=this.currentActiveMeshUIComponents[t];jr.resetState(A)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(t){return t?aA.isActiveSelf(t)?this.testIsVisible(t.parent):!1:!0}};let ys=nn;r(ys,"_eventSystemMap",new Map),r(ys,"didSearchEventSystem",!1);class jr{static markDirty(){this.needsUpdate=!0}static update(A,e,i=!1){if(i){A.update();return}const g=e.time.frameCount;for(const I of this.lastUpdateFrame)if(I.context===e){if(g===I.frame)return;I.frame=g;let o=this.needsUpdate||g<1;I.nextUpdate===e.time.frameCount&&(o=!0),o&&(an&&console.log("Update threemeshui"),this.needsUpdate=!1,A.update());return}this.lastUpdateFrame=[{context:e,frame:g,nextUpdate:g}],A.update()}static updateState(A,e){let i=null;if(A&&(i=this.findBlockInParent(A),i&&i!==this.lastSelected)){if(i.interactable===!1)return null;this.needsUpdate=!0}return i}static resetLastSelected(){const A=this.lastSelected;A&&(this.lastSelected=null,this.resetState(A))}static resetState(A){A&&(this.needsUpdate=!0)}static findBlockInParent(A){return A?A.isBlock?A:this.findBlockInParent(A.parent):null}}r(jr,"lastSelected",null),r(jr,"lastUpdateFrame",[]),r(jr,"needsUpdate",!1);var UQA=Object.defineProperty,NQA=Object.getOwnPropertyDescriptor,Mi=(t,A,e,i)=>{for(var g=i>1?void 0:i?NQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&UQA(A,e,g),g};const FQA=tA("debugorbit"),Gm=tA("freecam"),Mm=tA("debugcamerafit"),Rm=tA("smoothcam"),bQA={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let FK;class Bp extends CustomEvent{constructor(A,e){super("target-reached",{detail:{controls:A,type:e}})}}class Gt extends bA{constructor(){super(...arguments),r(this,"autoTarget",!0),r(this,"autoFit",!1),r(this,"enableRotate",!0),r(this,"autoRotate",!1),r(this,"autoRotateSpeed",1),r(this,"minAzimuthAngle",1/0),r(this,"maxAzimuthAngle",1/0),r(this,"minPolarAngle",0),r(this,"maxPolarAngle",Math.PI),r(this,"enableKeys",!0),r(this,"enableDamping",!0),r(this,"dampingFactor",.1),r(this,"enableZoom",!0),r(this,"minZoom",0),r(this,"maxZoom",1/0),r(this,"enablePan",!0),r(this,"lookAtConstraint",null),r(this,"lookAtConstraint01",1),r(this,"allowInterrupt",!0),r(this,"middleClickToFocus",!0),r(this,"doubleClickToFocus",!0),r(this,"useSlerp",!0),r(this,"debugLog",!1),r(this,"targetLerpDuration",1),r(this,"_controls",null),r(this,"_cameraObject",null),r(this,"_lookTargetLerpActive",!1),r(this,"_lookTargetStartPosition",new f),r(this,"_lookTargetEndPosition",new f),r(this,"_lookTargetLerp01",0),r(this,"_lookTargetLerpDuration",0),r(this,"_cameraLerpActive",!1),r(this,"_cameraStartPosition",new f),r(this,"_cameraEndPosition",new f),r(this,"_cameraLerp01",0),r(this,"_cameraLerpDuration",0),r(this,"_inputs",0),r(this,"_enableTime",0),r(this,"_startedListeningToKeyEvents",!1),r(this,"_eventSystem"),r(this,"_afterHandleInputFn"),r(this,"_camera",null),r(this,"_syncedTransform"),r(this,"_didStart",!1),r(this,"_didSetTarget",!1),r(this,"targetElement",null),r(this,"onControlsChangeStarted",()=>{this._syncedTransform&&this._syncedTransform.requestOwnership()}),r(this,"_shouldDisable",!1),r(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(A){var e;(e=this.controls)==null||e.addEventListener("start",A)}get targetLerpSpeed(){return 5}set targetLerpSpeed(A){this.targetLerpDuration=1/A}awake(){this._didStart=!1,this._didSetTarget=!1,this._startedListeningToKeyEvents=!1}start(){this._didStart=!0,this._eventSystem=ys.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener(NK.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var A,e;(A=this._controls)==null||A.dispose(),(e=this._eventSystem)==null||e.removeEventListener(NK.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._enableTime=this.context.time.time;const A=aA.getComponent(this.gameObject,Lt);this._camera=A;let e=A?.cam;if(!e&&this.gameObject instanceof xe&&(e=this.gameObject),e&&bU(e,this,!0),!this._controls&&e instanceof xe){this._cameraObject=e;const i=this.targetElement??this.context.renderer.domElement,g=e?.quaternion.clone();this._controls=new IQA(e,i),e?.quaternion.copy(g),FK===void 0&&(FK={...this._controls.keys})}this._controls&&(Gm&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,Is()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),e?.type==="PerspectiveCamera"?Gm||(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom):Gm||(this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom),this._startedListeningToKeyEvents||(this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(window.document.body))),this._syncedTransform=aA.getComponent(this.gameObject,Pr)??void 0}onDisable(){var A;(A=this._camera)!=null&&A.cam&&bU(this._camera.cam,this,!1),this._controls&&(this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted))}afterHandleInput(A){A.detail.args.pointerId===0&&(A.detail.args.isDown?this._controls&&this._eventSystem&&(this._shouldDisable=this._eventSystem.hasActiveUI):(!A.detail.args.isPressed||A.detail.args.isUp)&&(this._shouldDisable=!1))}onBeforeRender(){var A,e;if(!this._controls)return;if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}this._controls.enabled=!0,this.__handleSetTargetWhenBecomingActiveTheFirstTime(),(this.context.input.getPointerDown(1)||this.context.input.getPointerDown(2)||this.context.input.mouseWheelChanged||this.context.input.getPointerPressed(0)&&(A=this.context.input.getPointerPositionDelta(0))!=null&&A.length()||0>.1)&&(this._inputs+=1),this._inputs>0&&this.allowInterrupt&&(this.enableRotate&&(this.autoRotate=!1),this._cameraLerpActive=!1,this._lookTargetLerpActive=!1),this._inputs=0;let i=this.middleClickToFocus&&this.context.input.getPointerClicked(1);if(i||(i=this.doubleClickToFocus&&this.context.input.getPointerDoubleClicked(0)&&this.context.time.time-this._enableTime>.3),i&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive){if(this._cameraLerpActive&&this._cameraObject)if(this._cameraLerp01+=this.context.time.deltaTime/this._cameraLerpDuration,this._cameraLerp01>=1)this._cameraObject.position.copy(this._cameraEndPosition),this._cameraLerpActive=!1,this.dispatchEvent(new Bp(this,"camera"));else{const g=ee.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,g)}if(this._lookTargetLerpActive)if(this._lookTargetLerp01+=this.context.time.deltaTime/this._lookTargetLerpDuration,this._lookTargetLerp01>=1)this._controls.target.copy(this._lookTargetEndPosition),this._lookTargetLerpActive=!1,this.dispatchEvent(new Bp(this,"lookat"));else{const g=ee.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,g)}}if(this._controls){if(this.debugLog&&(this._controls.domElement=this.context.renderer.domElement),this._controls.enabled=!this._shouldDisable&&this._camera===this.context.mainCameraComponent&&!this.context.isInXR,this._controls.keys=this.enableKeys?FK:bQA,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.enableDamping=this.enableDamping,this._controls.dampingFactor=this.dampingFactor,this._controls.enablePan=this.enablePan,this._controls.enableRotate=this.enableRotate,this._controls.minAzimuthAngle=this.minAzimuthAngle,this._controls.maxAzimuthAngle=this.maxAzimuthAngle,this._controls.minPolarAngle=this.minPolarAngle,this._controls.maxPolarAngle=this.maxPolarAngle,typeof Rm=="number"||Rm===!0){this._controls.enableDamping=!0;const g=typeof Rm=="number"?Rm:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,g))}this.allowInterrupt||(this._lookTargetLerpActive&&(this._controls.enablePan=!1),this._cameraLerpActive&&(this._controls.enableRotate=!1,this._controls.autoRotate=!1),(this._lookTargetLerpActive||this._cameraLerpActive)&&(this._controls.enableZoom=!1)),this.context.isInXR||(!Gm&&(e=this.lookAtConstraint)!=null&&e.locked&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(),FQA&&Se.DrawWireSphere(this._controls.target,.1,65280))}}__handleSetTargetWhenBecomingActiveTheFirstTime(){if(!this._didSetTarget&&(this._didSetTarget=!0,this.autoTarget)){const A=aA.getComponent(this.gameObject,Lt);if(A&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const e=be(A.cam).length(),i=new f(0,0,-e).applyMatrix4(A.cam.matrixWorld);this.setLookTargetPosition(i,!0)}if(!this.autoFit&&!this.setLookTargetFromConstraint()){const e=new ps;e.screenPoint=new eA(0,0),e.lineThreshold=.1;const i=this.context.physics.raycast(e);i.length>0&&this.setLookTargetPosition(i[0].point,!0),Mm&&console.log("OrbitControls hits",...i)}this.autoFit&&this.fitCamera()}}setCameraAndLookTarget(A){if(!A||!(A instanceof wA))return;const e=be(A),i=_U(A);this.setTargetFromRaycast(new io(e,i)),this.setCameraTargetPosition(e)}setCameraTargetPosition(A,e=!1){var i,g;A&&(A instanceof wA&&(A=be(A)),this._cameraEndPosition||(this._cameraEndPosition=new f),this._cameraEndPosition.copy(A),e===!0?(this._cameraLerpActive=!1,(i=this.controllerObject)==null||i.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((g=this._cameraObject)==null?void 0:g.position),typeof e=="number"?this._cameraLerpDuration=e:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setLookTargetPosition(A=null,e=!1){this._controls&&A&&(A instanceof wA&&(A=be(A)),this._lookTargetEndPosition.copy(A),e===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof e=="number"?this._lookTargetLerpDuration=e:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(A=0,e=1){var i;if(!this._controls)return!1;const g=(i=this.lookAtConstraint)==null?void 0:i.sources;if(g&&g.length>0){const I=g[A];if(I)return I.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,e),!0}return!1}lerpTarget(A,e){return this.lerpLookTarget(A,e)}lerpLookTarget(A,e){this._controls&&(e>=1?this._controls.target.copy(A):this._controls.target.lerp(A,e))}setTargetFromRaycast(A){if(!this.controls)return;const e=A?this.context.physics.raycastFromRay(A):this.context.physics.raycast();for(const i of e)if(i.distance>0&&aA.isActiveInHierarchy(i.object)){const g=UK(i.object);if(g){const I=g.canvas;if(I!=null&&I.screenspace)break}this.setLookTargetPosition(i.point);break}}fitCamera(A,e=void 0,i=!0){if(this.context.isInXR)return;e==null&&(e=1.1);const g=this._cameraObject,I=this._controls;if(A!=null&&A.length||(A=this.context.scene.children),A.length<=0){console.warn("No objects to fit camera to...");return}if(!g||!I){console.warn("No camera or controls found to fit camera to objects...");return}const o=new f,s=new f,C=OU(A);if(g.updateMatrixWorld(),g.updateProjectionMatrix(),C.getCenter(s),C.applyMatrix4(g.matrixWorldInverse),C.getSize(o),C.setFromCenterAndSize(s,o),Number.isNaN(o.x)||Number.isNaN(o.y)||Number.isNaN(o.z)){console.warn("Camera fit size resultet in NaN",g,C,[...A]);return}if(o.length()<=1e-10){Mm&&console.warn("Camera fit size is zero",C,[...A]);return}const a=g.fov,n=2*Math.atan(Math.tan(a*Math.PI/360/2)*g.aspect)/Math.PI*360,B=o.y/(2*Math.atan(Math.PI*a/360)),Q=o.x/(2*Math.atan(Math.PI*n/360)),E=e*Math.max(B,Q)+o.z/2;Mm&&console.log("Fit camera to objects",B,Q,"distance",E),I.maxDistance=E*10,I.minDistance=E*.01;const h=.05,l=s.clone();l.y-=o.y*h,this.setLookTargetPosition(l,i),this.autoTarget=!1,g.near=E/1e3,g.far=E*100,g.updateMatrixWorld(),g.updateProjectionMatrix();const d=be(g),c=s.clone();if(c.sub(d),c.y=0,c.normalize(),c.multiplyScalar(E),c.y+=-h*4*o.y,g.parent){const u=g.parent.worldToLocal(s.clone().sub(c));this.setCameraTargetPosition(u,i)}else console.error(`Can not fit camera ${g.name} because it has no parent`);if(Mm){const u=new vR(C);this.context.scene.add(u),HU(u,Jd(g)),setTimeout(()=>{this.context.scene.remove(u)},1e4),this._haveAttachedKeyboardEvents||(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",p=>{p.code==="KeyF"&&this.fitCamera(A,e,i)}))}I.update()}}Mi([w()],Gt.prototype,"autoTarget",2),Mi([w()],Gt.prototype,"autoFit",2),Mi([w()],Gt.prototype,"enableRotate",2),Mi([w()],Gt.prototype,"autoRotate",2),Mi([w()],Gt.prototype,"autoRotateSpeed",2),Mi([w()],Gt.prototype,"minAzimuthAngle",2),Mi([w()],Gt.prototype,"maxAzimuthAngle",2),Mi([w()],Gt.prototype,"minPolarAngle",2),Mi([w()],Gt.prototype,"maxPolarAngle",2),Mi([w()],Gt.prototype,"enableKeys",2),Mi([w()],Gt.prototype,"enableDamping",2),Mi([w()],Gt.prototype,"dampingFactor",2),Mi([w()],Gt.prototype,"enableZoom",2),Mi([w()],Gt.prototype,"minZoom",2),Mi([w()],Gt.prototype,"maxZoom",2),Mi([w()],Gt.prototype,"enablePan",2),Mi([w(xQ)],Gt.prototype,"lookAtConstraint",2),Mi([w()],Gt.prototype,"lookAtConstraint01",2),Mi([w()],Gt.prototype,"allowInterrupt",2),Mi([w()],Gt.prototype,"middleClickToFocus",2),Mi([w()],Gt.prototype,"doubleClickToFocus",2),Mi([w()],Gt.prototype,"targetLerpDuration",2);var KQA=Object.defineProperty,vQA=Object.getOwnPropertyDescriptor,no=(t,A,e,i)=>{for(var g=i>1?void 0:i?vQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&KQA(A,e,g),g},_Q=(t=>(t[t.Skybox=1]="Skybox",t[t.SolidColor=2]="SolidColor",t[t.Uninitialized=4]="Uninitialized",t))(_Q||{});const rn=tA("debugcam"),Ij=tA("debugscreenpointtoray");var Um;const Qp=(Um=class extends bA{constructor(){super(...arguments),r(this,"_nearClipPlane",.1),r(this,"_farClipPlane",1e3),r(this,"orthographic",!1),r(this,"orthographicSize",5),r(this,"ARBackgroundAlpha",0),r(this,"_cullingMask",4294967295),r(this,"_backgroundBlurriness",0),r(this,"_backgroundIntensity",1),r(this,"_environmentIntensity"),r(this,"_targetTexture",null),r(this,"_backgroundColor"),r(this,"_fov"),r(this,"_cam",null),r(this,"_clearFlags",2),r(this,"_skybox"),r(this,"_frustum"),r(this,"_projScreenMatrix",new NA)}get isCamera(){return!0}get aspect(){return this._cam instanceof xe?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(t){this._cam instanceof xe&&this._cam.aspect!==t&&(this._cam.aspect=t,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof xe?this._cam.fov:this._fov}set fieldOfView(t){const A=this.fieldOfView!=t;if(this._fov=t,A&&this._cam&&this._cam instanceof xe){if(this._fov===void 0){console.warn("Can not set undefined fov on PerspectiveCamera");return}this._cam.fov=this._fov,this._cam.updateProjectionMatrix()}}get nearClipPlane(){return this._nearClipPlane}set nearClipPlane(t){const A=this._nearClipPlane!=t;this._nearClipPlane=t,this._cam&&A&&(this._cam.near=t,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(t){const A=this._farClipPlane!=t;this._farClipPlane=t,this._cam&&A&&(this._cam.far=t,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(t){t!==this._clearFlags&&(this._clearFlags=t,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(t){this._cullingMask=t,this._cam&&(this._cam.layers.mask=t)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(t){this.cullingMask=(1<<t|0)>>>0}set backgroundBlurriness(t){t!==this._backgroundBlurriness&&(t===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(t,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(t){t!==this._backgroundIntensity&&(t===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(t,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set environmentIntensity(t){this._environmentIntensity=t}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(t){if(t){if(this._backgroundColor)this._backgroundColor.copy(t);else{if(!t.clone)return;this._backgroundColor=t.clone()}t.alpha===void 0&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera()}}set targetTexture(t){this._targetTexture=t}get targetTexture(){return this._targetTexture}get cam(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(t,A,e){const i=this.cam,g=Qp._origin;g.set(t,A,-1),this.context.input.convertScreenspaceToRaycastSpace(g),Ij&&console.log("screenPointToRay",t.toFixed(2),A.toFixed(2),"now:",g.x.toFixed(2),g.y.toFixed(2),"isInXR:"+this.context.isInXR),g.z=-1,g.unproject(i);const I=Qp._direction.set(g.x,g.y,g.z),o=be(i);return I.sub(o),I.normalize(),e?(e.set(o,I),e):new io(o.clone(),I.clone())}getFrustum(){return this._frustum||(this._frustum=new JB,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new JB),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(t,A){return A&&this._projScreenMatrix.multiplyMatrices(this.cam.projectionMatrix,this.cam.matrixWorldInverse),t===this._projScreenMatrix?t:t.copy(this._projScreenMatrix)}awake(){Ij&&window.addEventListener("pointerdown",t=>{const A=t.clientX,e=t.clientY;console.log("touch",A.toFixed(2),e.toFixed(2));const i=this.screenPointToRay(A,e),g="#"+Math.floor(Math.random()*16777215).toString(16);Se.DrawRay(i.origin,i.direction,g,10)})}onEnable(){rn&&console.log(`Camera enabled: "${this.name}". ClearFlags=${_Q[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),qQA(this)),this.applyClearFlagsIfIsActiveCamera({applySkybox:!0})}onDisable(){this.context.removeCamera(this)}onBeforeRender(){if(this._cam&&(this._frustum&&this.updateFrustum(),this._clearFlags===2&&this.applyClearFlagsIfIsActiveCamera(),this._targetTexture)){this.context.isManagedExternally&&(this._warnedAboutExternalRenderer||(this._warnedAboutExternalRenderer=!0,console.warn("Rendering with external renderer is not supported yet. This may not work or throw errors. Please remove the the target texture from your camera: "+this.name,this.targetTexture))),this.context.composer;const t=this.context.renderer;if(t){const A=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,t),A?.applyClearFlags()}}}buildCamera(){if(this._cam)return;const t=this.gameObject.isCamera;let A=null;if(t?(A=this.gameObject,A?.layers.enableAll(),A instanceof xe&&(this._fov=A.fov)):A=this.gameObject.children[0],A&&A.isCamera)A instanceof xe&&(this._fov&&(A.fov=this._fov),A.near=this._nearClipPlane,A.far=this._farClipPlane,A.updateProjectionMatrix());else if(!this.orthographic)A=new xe(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(A.fov=this.fieldOfView),this.gameObject.add(A);else{const e=this.orthographicSize*100;A=new Na(window.innerWidth/-e,window.innerWidth/e,window.innerHeight/e,window.innerHeight/-e,this._nearClipPlane,this._farClipPlane),this.gameObject.add(A)}this._cam=A,this._cam.layers.mask=this._cullingMask,this.tag=="MainCamera"&&this.context.setCurrentCamera(this)}applyClearFlagsIfIsActiveCamera(t){this.context.mainCameraComponent===this&&this.applyClearFlags(t)}applyClearFlags(t){if(!this._cam){rn&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,rn){const A=`Camera "${this.name}" clear flags: ${_Q[this._clearFlags]}`;console.debug(A)}switch(this._clearFlags){case 1:if(Qp.backgroundShouldBeTransparent(this.context)&&(!this.ARBackgroundAlpha||this.ARBackgroundAlpha<.001)){this.context.scene.background=null,this.context.renderer.setClearColor(0,0);return}(!this.scene.background||!this._skybox||t?.applySkybox===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:rn&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0?this.context.scene.backgroundIntensity=this._backgroundIntensity:rn&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor){let A=this._backgroundColor.alpha;Qp.backgroundShouldBeTransparent(this.context)&&(A=this.ARBackgroundAlpha??0),this.context.scene.background=null,this.context.renderer.setClearColor(this._backgroundColor,A)}else rn&&console.warn(`Camera "${this.name}" has no background color`,this);break;case 4:this.context.scene.background=null,this.context.renderer.setClearColor(0,0);break}}applySceneSkybox(){this._skybox||(this._skybox=new JQA(this)),this._skybox.apply()}static backgroundShouldBeTransparent(t){var A,e,i,g;const I=(A=t.renderer.xr)==null?void 0:A.getSession();if(!I)return!1;if(typeof I._transparent=="boolean")return I._transparent;const o=I.environmentBlendMode;rn&&ri("Environment blend mode: "+o+" on "+navigator.userAgent);let s=o==="additive"||o==="alpha-blend";return t.isInAR&&o==="opaque"&&((e=navigator.userAgent)!=null&&e.includes("OculusBrowser")||(i=navigator.userAgent)!=null&&i.includes("Mozilla")&&(g=navigator.userAgent)!=null&&g.includes("Mobile WebXRViewer/v2"))&&(s=!0),I._transparent=s,s}},r(Um,"_origin",new f),r(Um,"_direction",new f),Um);let Lt=Qp;no([w()],Lt.prototype,"aspect",1),no([w()],Lt.prototype,"fieldOfView",1),no([w()],Lt.prototype,"nearClipPlane",1),no([w()],Lt.prototype,"farClipPlane",1),no([w()],Lt.prototype,"clearFlags",1),no([w()],Lt.prototype,"orthographic",2),no([w()],Lt.prototype,"orthographicSize",2),no([w()],Lt.prototype,"ARBackgroundAlpha",2),no([w()],Lt.prototype,"cullingMask",1),no([w()],Lt.prototype,"backgroundBlurriness",1),no([w()],Lt.prototype,"backgroundIntensity",1),no([w()],Lt.prototype,"environmentIntensity",1),no([w(kt)],Lt.prototype,"backgroundColor",1),no([w(kc)],Lt.prototype,"targetTexture",1);class JQA{constructor(A){r(this,"_camera"),r(this,"_skybox"),this._camera=A}get context(){var A;return(A=this._camera)==null?void 0:A.context}apply(){this._skybox=this.context.lightmaps.tryGetSkybox(this._camera.sourceId),this._skybox?this.context.scene.background!==this._skybox&&(rn&&console.log(`Camera "${this._camera.name}" set skybox`,this._camera,this._skybox),this._skybox.mapping=As,this.context.scene.background=this._skybox):(this._did_log_failed_to_find_skybox||(this._did_log_failed_to_find_skybox=!0,console.warn(`Camera "${this._camera.name}" failed to load/find skybox texture`,this._camera.sourceId,this.context.lightmaps,"Current background: ",this.context.scene.background)),(rn||Be())&&Bi(`Camera "${this._camera.name}" has no skybox texture`))}}function qQA(t){tA("freecam")&&t.context.mainCameraComponent===t&&aA.getOrAddComponent(t.gameObject,Gt)}class Wr extends bA{constructor(){super(...arguments),r(this,"_listener",null)}get listener(){return this._listener==null&&(this._listener=new aT),this._listener}awake(){Qi.registerWaitForAllowAudio(()=>{if(this.destroyed)return;const A=this.listener;if(A==null||A.parent)return;const e=this.context.mainCameraComponent||aA.getComponentInParent(this.gameObject,Lt);e!=null&&e.cam?e.cam.add(A):this.gameObject.add(A)})}}var xQA=Object.defineProperty,LQA=Object.getOwnPropertyDescriptor,Nm=(t,A,e,i)=>{for(var g=i>1?void 0:i?LQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&xQA(A,e,g),g};const _QA=tA("debugsignals");class Ep{constructor(){r(this,"guid")}}Nm([w()],Ep.prototype,"guid",2);class Uc{constructor(){r(this,"signal"),r(this,"reaction")}}Nm([w(Ep)],Uc.prototype,"signal",2),Nm([w(rg)],Uc.prototype,"reaction",2);var bK;const Bn=(bK=class extends bA{constructor(){super(...arguments),r(this,"events")}static invoke(t){if(Bn.receivers[t]){const A=Bn.receivers[t];if(!A)return;for(const e of A)e.invoke(t)}}awake(){_QA&&console.log("SignalReceiver awake",this)}onEnable(){if(this.events)for(const t of this.events)Bn.receivers[t.signal.guid]||(Bn.receivers[t.signal.guid]=[]),Bn.receivers[t.signal.guid].push(this)}onDisable(){if(this.events){for(const t of this.events)if(Bn.receivers[t.signal.guid]){const A=Bn.receivers[t.signal.guid].indexOf(this);A>=0&&Bn.receivers[t.signal.guid].splice(A,1)}}}invoke(t){if(!this.events||!Array.isArray(this.events))return;const A=typeof t=="object"?t.guid:t;for(const e of this.events)if(e.signal.guid===A)try{if(e.reaction){if(!e.reaction.invoke){console.warn("Missing invoke - possibly a serialization error",e,this);continue}}else{console.warn("Missing reaction for signal",e,this);continue}e.reaction.invoke()}catch(i){console.error(i)}}},r(bK,"receivers",{}),bK);let Nc=Bn;Nm([w(Uc)],Nc.prototype,"events",2);var Ko=(t=>(t.Activation="ActivationTrack",t.Animation="AnimationTrack",t.Audio="AudioTrack",t.Control="ControlTrack",t.Marker="MarkerTrack",t.Signal="SignalTrack",t))(Ko||{}),HC=(t=>(t[t.None=0]="None",t[t.Hold=1]="Hold",t[t.Loop=2]="Loop",t[t.PingPong=3]="PingPong",t[t.Continue=4]="Continue",t))(HC||{}),KK=(t=>(t.Signal="SignalEmitter",t))(KK||{});const OC=tA("debugtimeline");class hp{constructor(){r(this,"director"),r(this,"track")}get muted(){return this.track.muted}set muted(A){var e;A!==this.track.muted&&(this.track.muted=A,(e=this.onMuteChanged)==null||e.call(this))}*forEachClip(A=!1){var e;if((e=this.track)!=null&&e.clips)if(A)for(let i=this.track.clips.length-1;i>=0;i--)yield this.track.clips[i];else for(const i of this.track.clips)yield i}getClipTime(A,e){return e.clipIn+(A-e.start)*e.timeScale}getClipTimeNormalized(A,e){return(A-e.start)/e.duration}evaluateWeight(A,e,i,g=!0){if(e<0||e>=i.length)return 0;const I=i[e];if(g||A>=I.start&&A<=I.end){let o=1;const s=!1;if(I.easeInDuration>0){const C=Math.min((A-I.start)/I.easeInDuration,1);o*=C}if(I.easeOutDuration>0&&!s){const C=Math.min((I.end-A)/I.easeOutDuration,1);o*=C}return o}return 0}}class TQA{constructor(A){r(this,"clip"),r(this,"rootPositionOffset"),r(this,"rootQuaternionOffset"),r(this,"rootStartPosition"),r(this,"rootEndPosition"),r(this,"rootStartQuaternion"),r(this,"rootEndQuaternion");const e=A.getClip();this.clip=e;const i=A.getRoot(),g=i.name+".position",I=i.name+".quaternion";OC&&console.log(e.name,e.tracks,g);for(const o of e.tracks)if(!(o.times.length<=0)){if(o.name.endsWith(g))this.rootStartPosition=new f().fromArray(o.values,0),this.rootEndPosition=new f().fromArray(o.values,o.values.length-3),this.rootPositionOffset=this.rootEndPosition.clone().sub(this.rootStartPosition),OC&&console.log(this.rootPositionOffset);else if(o.name.endsWith(I)&&(this.rootStartQuaternion=new UA().fromArray(o.values,0),this.rootEndQuaternion=new UA().fromArray(o.values,o.values.length-4),this.rootQuaternionOffset=this.rootEndQuaternion.clone().multiply(this.rootStartQuaternion),OC)){const s=new ai().setFromQuaternion(this.rootQuaternionOffset);console.log("ROT",s)}}}get hasOffsets(){return this.rootPositionOffset!==void 0||this.rootQuaternionOffset!==void 0}}class Fm extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"trackOffset"),r(this,"target"),r(this,"mixer"),r(this,"clips",[]),r(this,"actions",[]),r(this,"_actionOffsets",[]),r(this,"_didBind",!1),r(this,"_animator",null),r(this,"_useclipOffsets",!0),r(this,"_totalOffsetPosition",new f),r(this,"_totalOffsetRotation",new UA),r(this,"_totalOffsetPosition2",new f),r(this,"_totalOffsetRotation2",new UA),r(this,"_summedPos",new f),r(this,"_tempPos",new f),r(this,"_summedRot",new UA),r(this,"_tempRot",new UA),r(this,"_clipRotQuat",new UA)}onDisable(){var A;(A=this.mixer)==null||A.stopAllAction()}onStateChanged(){this._animator&&oj(this._animator.gameObject,this,this.director.isPlaying)}createHooks(A,e){var i,g;if(((i=e.tracks)==null?void 0:i.length)<=0){console.warn("No tracks in AnimationClip",e);return}const I=e.tracks[0].name.split("."),o=I[I.length-2],s=o+".position",C=o+".quaternion";let a=!1,n=!1;for(const B of e.tracks)B.name.endsWith(s)?(a=!0,this.createPositionInterpolant(e,A,B)):B.name.endsWith(C)&&(n=!0,this.createRotationInterpolant(e,A,B));if(!a||!n){const B=(g=this.mixer)==null?void 0:g.getRoot(),Q=e.tracks[0],E=Q.name.lastIndexOf("."),h=Q.name.substring(0,E),l=h.substring(h.lastIndexOf(".")+1),d=B.getObjectByName(l);if(d)if(a){if(!n){const c=e.tracks[0].name.substring(0,E)+".quaternion";OC&&console.warn("Create quaternion track",l,d);const u=d.quaternion,p=new fC(c,[0,e.duration],[u.x,u.y,u.z,u.w,u.x,u.y,u.z,u.w]);e.tracks.push(p),this.createRotationInterpolant(e,A,p)}}else{const c=h+".position";OC&&console.warn("Create position track",l,d);const u=d.position,p=new ba(c,[0,e.duration],[u.x,u.y,u.z,u.x,u.y,u.z]);e.tracks.push(p),this.createPositionInterpolant(e,A,p)}}}bind(){if(!this._didBind){this._didBind=!0,OC&&console.log(this.models),this.mixer?this.target=this.mixer.getRoot():console.warn("No mixer was assigned to animation track");for(const A of this.actions){const e=new TQA(A);this._actionOffsets.push(e)}this.target&&(this._animator=aA.getComponent(this.target,Zg)??null,this._animator&&oj(this._animator.gameObject,this,!0));for(const A of this.models){const e=A.asset,i=e.position,g=e.rotation;i&&i.x!==void 0&&(i.isVector3||(e.position=new f(i.x,i.y,i.z)),g.isQuaternion||(e.rotation=new UA(g.x,g.y,g.z,g.w)))}this.ensureTrackOffsets()}}ensureTrackOffsets(){if(this.trackOffset){const A=this.trackOffset.position;A&&(A.isVector3||(this.trackOffset.position=new f(A.x,A.y,A.z)));const e=this.trackOffset.rotation;e&&(e.isQuaternion||(this.trackOffset.rotation=new UA(e.x,e.y,e.z,e.w)))}}evaluate(A){var e,i,g,I,o,s,C;if(this.track.muted||!this.mixer)return;this.bind(),this._totalOffsetPosition.set(0,0,0),this._totalOffsetRotation.set(0,0,0,1),this._totalOffsetPosition2.set(0,0,0),this._totalOffsetRotation2.set(0,0,0,1);let a=0,n=0,B=!1,Q=!1,E=0;for(let h=0;h<this.clips.length;h++){const l=this.models[h],d=this.actions[h],c=l.asset;d.weight=0;const u=A>=l.start&&A<=l.end,p=l.preExtrapolationMode,D=l.postExtrapolationMode,m=h<this.clips.length-1?this.models[h+1]:null;let M=u,k=!1;if(!M&&!B&&l.end<A&&D!==HC.None?(!m||m.start>A)&&(M=!0,B=!0):h==0&&!M&&!Q&&l.start>A&&p!==HC.None&&(!m||m.start<A)&&(M=!0,k=!0,Q=!0),M){let R=1;R*=this.evaluateWeight(A,h,this.models,M),R*=this.director.weight;let F=u;if(k)switch(p){case HC.Hold:break;case HC.Loop:A+=l.start,F=!0;break;default:A+=l.start,F=!0;break}let S=this.getClipTime(A,l),U=0;const T=c.duration;if(k&&p===HC.Hold&&(S=0),F){if(c.loop)for(U+=Math.floor(S/(T+1e-6));S>T;)S-=T}else if(!u&&B)switch(D){case HC.Hold:S=this.getClipTime(l.end,l);break;case HC.Loop:S%=T;break;case HC.PingPong:const K=Math.floor(S/T)%2!==0;S%=T,K&&(S=T-S);break}l.reversed===!0?d.time=d.getClip().duration-S:d.time=S,d.timeScale=0;const Y=Math.max(0,R);if(d.weight=Y,E+=Y,d.clampWhenFinished=!1,d.isRunning()||d.play(),this._useclipOffsets){const K=a==0?this._totalOffsetPosition:this._totalOffsetPosition2,O=a==0?this._totalOffsetRotation:this._totalOffsetRotation2;a<1&&(n=1-R),a+=1;const J=this._summedPos.set(0,0,0),v=this._tempPos.set(0,0,0),_=this._summedRot.identity(),X=this._tempRot.identity(),Z=c.rotation;Z&&(this._clipRotQuat.identity(),this._clipRotQuat.slerp(Z,R));const IA=this._actionOffsets[h];if(IA.hasOffsets)for(let yA=0;yA<U;yA++)IA.rootPositionOffset?v.copy(IA.rootPositionOffset):v.set(0,0,0),v.applyQuaternion(_),this._clipRotQuat&&v.applyQuaternion(this._clipRotQuat),IA.rootQuaternionOffset&&(X.copy(IA.rootQuaternionOffset),_.multiply(X)),J.add(v);this._clipRotQuat&&O.multiply(this._clipRotQuat),O.multiply(_),c.position&&J.add(c.position),K.add(J)}}}if(this._useclipOffsets&&(this._totalOffsetPosition.lerp(this._totalOffsetPosition2,n),this._totalOffsetRotation.slerp(this._totalOffsetRotation2,n)),this.__mixerError===void 0&&(OC||Be())&&(i=(e=this._animator)==null?void 0:e.runtimeAnimatorController)!=null&&i.mixer&&this.mixer!==((I=(g=this._animator)==null?void 0:g.runtimeAnimatorController)==null?void 0:I.mixer)&&(this.__mixerError=!0,console.error("AnimationTrack mixer is not shared with the animator controller - this might result in the timeline to not animate properly. Please report a bug to the Needle Engine team!",this)),(o=this._animator)!=null&&o.runtimeAnimatorController){const h=Math.max(0,1-E);(C=(s=this._animator)==null?void 0:s.runtimeAnimatorController)==null||C.update(h)}else this.mixer.update(A)}createRotationInterpolant(A,e,i){var g;const I=i.createInterpolant.bind(i),o=new UA;this.ensureTrackOffsets();const s=(g=this.trackOffset)==null?void 0:g.rotation;i.createInterpolant=()=>{const C=I(),a=C.evaluate.bind(C);return C.evaluate=n=>{var B;const Q=a(n);if(o.set(Q[0],Q[1],Q[2],Q[3]),o.premultiply(this._totalOffsetRotation),s&&o.premultiply(s),this.director.animationCallbackReceivers)for(const E of this.director.animationCallbackReceivers)(B=E?.onTimelineRotation)==null||B.call(E,this.director,this.target,n,o);return Q[0]=o.x,Q[1]=o.y,Q[2]=o.z,Q[3]=o.w,Q},C}}createPositionInterpolant(A,e,i){var g,I;const o=i.createInterpolant.bind(i),s=new f;this.ensureTrackOffsets();const C=(g=this.trackOffset)==null?void 0:g.rotation,a=(I=this.trackOffset)==null?void 0:I.position;let n;i.createInterpolant=()=>{const B=o(),Q=B.evaluate.bind(B);return B.evaluate=E=>{var h,l,d;const c=Q(E);if(s.set(c[0],c[1],c[2]),e.removeStartOffset&&(n===void 0?(n=null,n=(l=(h=this._actionOffsets.find(u=>u.clip===A))==null?void 0:h.rootStartPosition)==null?void 0:l.clone()):n!=null&&n.isVector3&&s.sub(n)),s.applyQuaternion(this._totalOffsetRotation),s.add(this._totalOffsetPosition),C&&s.applyQuaternion(C),a&&(s.x-=a.x,s.y+=a.y,s.z+=a.z),this.director.animationCallbackReceivers)for(const u of this.director.animationCallbackReceivers)(d=u?.onTimelinePosition)==null||d.call(u,this.director,this.target,E,s);return c[0]=s.x,c[1]=s.y,c[2]=s.z,c},B}}}const YQA=tA("mutetimeline"),cp=class extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"listener"),r(this,"audio",[]),r(this,"audioContextTimeOffset",[]),r(this,"lastTime",0),r(this,"audioSource"),r(this,"_audioLoader",null),r(this,"_playableDirectorResumed",!1)}getAudioFilePath(t){const A=this.director.sourceId;return Cr(A,t)}onAllowAudioChanged(t){for(let A=0;A<this.models.length;A++){const e=this.models[A];this.audio[A].setVolume(t?e.asset.volume:0)}}addModel(t){const A=new GR(this.listener);this.audio.push(A);const e=t;e._didTriggerPlay=!1,this.models.push(e)}onDisable(){for(const t of this.audio)t.isPlaying&&t.stop();for(const t of this.models)t._didTriggerPlay=!1}onDestroy(){for(const t of this.audio)t.source&&t?.disconnect();this.audio.length=0}onMuteChanged(){if(this.muted)for(let t=0;t<this.audio.length;t++){const A=this.audio[t];A!=null&&A.isPlaying&&A.stop()}}stop(){for(let t=0;t<this.audio.length;t++){const A=this.audio[t];A!=null&&A.isPlaying&&A.stop()}for(const t of this.models)t._didTriggerPlay=!1}onPauseChanged(){for(let t=0;t<this.audio.length;t++){const A=this.audio[t];A!=null&&A.isPlaying&&A.stop()}this._playableDirectorResumed=this.director.isPlaying}evaluate(t){if(YQA||this.track.muted||this.director.speed<0)return;const A=this.director.context.application.muted,e=this._playableDirectorResumed;this._playableDirectorResumed=!1;const i=A?.1:0;for(let g=0;g<this.models.length;g++){const I=this.models[g],o=this.audio[g],s=I.asset;if((!o||!o.buffer)&&this.isInTimeRange(I,t-1,t+1)&&this.handleAudioLoading(I,o),Qi.userInteractionRegistered!==!1&&!(o===null||!o.buffer))if(o.playbackRate=this.director.context.time.timeScale*this.director.speed,o.loop=s.loop,t>=I.start&&t<=I.end&&t<this.director.duration){if(!o.isPlaying||!this.director.isPlaying)(e||!I._didTriggerPlay&&this.lastTime<t)&&(I.duration*I.timeScale>.3?o.offset=I.clipIn+(t-I.start)*I.timeScale:o.offset=0,OC&&console.log("Timeline Audio ("+this.track.name+") play with offset "+o.offset+" - "+I.asset.clip),o.play(i),I._didTriggerPlay=!0);else{const a=I.clipIn+(t-I.start)*I.timeScale,n=o.context.currentTime-o._startedAt+o.offset;Math.abs(a-n)>.3&&(o.offset=a,o.stop(),o.play(i))}let C=s.volume;if(this.track.volume!==void 0&&(C*=this.track.volume),A&&(C=0),I.easeInDuration>0){const a=Math.min((t-I.start)/I.easeInDuration,1);C*=a}if(I.easeOutDuration>0){const a=Math.min((I.end-t)/I.easeOutDuration,1);C*=a}o.setVolume(C*this.director.weight)}else I._didTriggerPlay=!1,this.director.isPlaying&&o.isPlaying&&o.stop()}this.lastTime=t}loadAudio(t,A=0,e=0){let i=null;const g=t-e,I=t+A;for(const o of this.models)if(this.isInTimeRange(o,g,I)){const s=this.audio[this.models.indexOf(o)],C=this.handleAudioLoading(o,s);C!==null&&(i===null&&(i=[]),i.push(C))}return i!==null?Promise.all(i):null}isInTimeRange(t,A,e){return A<=t.start&&e>=t.end||A>=t.start&&A<=t.end||e>=t.start&&e<=t.end}static dispose(){cp._audioBuffers.clear()}handleAudioLoading(t,A){this._audioLoader||(this._audioLoader=new _y);const e=this.getAudioFilePath(t.asset.clip);if(cp._audioBuffers.get(e)){const g=cp._audioBuffers.get(e);return g.then(I=>{I&&A.setBuffer(I)}),g}OC&&console.warn("LOAD audio track",e,this.director.sourceId);const i=new Promise((g,I)=>{this._audioLoader.load(e,o=>{A.setBuffer(o),g(o)},void 0,o=>{console.error("Error loading audio",o),g(null)})});return cp._audioBuffers.set(e,i),i}};let lp=cp;r(lp,"_audioBuffers",new Map);class dp extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"didTrigger",[]),r(this,"receivers",[])}evaluate(A){var e;if(this.track.muted)return;const i=this.director.context.time.deltaTime*1.5;for(let g=0;g<this.models.length;g++){const I=this.models[g],o=this.didTrigger[g],s=I.time-A;let C=!1;if(I.retroActive)C=s<=1e-6;else{const a=Math.abs(s);(a===0||a>=1e-5&&a<i)&&(C=!0)}if(C){if(!o)if(OC&&console.log("Trigger signal",A,I.time,I),this.didTrigger[g]=!0,((e=this.receivers)==null?void 0:e.length)<=0)Nc.invoke(I.asset);else for(const a of this.receivers)a&&a.invoke(I.asset)}else I.emitOnce||(this.didTrigger[g]=!1)}}}class bm extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"timelines",[]),r(this,"_previousActiveModel",null)}resolveSourceObjects(A){for(let e=this.models.length-1;e>=0;e--){const i=this.models[e].asset;if(!i.sourceObject||typeof i.sourceObject!="object"){console.log("no source object, removing model",e,i),this.models.splice(e,1);continue}else{const g=aA.getComponent(i.sourceObject,TQ);this.timelines.push(g),g&&i.updateDirector&&(g.playOnAwake=!1)}}}evaluate(A){var e;this._previousActiveModel=null;for(let i=0;i<this.models.length;i++){const g=this.models[i],I=g.asset;if(A>=g.start&&A<=g.end){this._previousActiveModel=g;const o=this.getClipTime(A,g);if(I.controlActivation){const s=I.sourceObject;s.visible=!0}if(I.updateDirector){const s=this.timelines[i];s&&(s.isPlaying&&s.pause(),s.time=o,s.evaluate())}}else{const o=(e=this._previousActiveModel)==null?void 0:e.asset;if(I.controlActivation){const s=I.sourceObject;o?.sourceObject!==s&&(s.visible=!1)}}}}}const Fc=tA("debugtimeline"),vK=class extends bA{constructor(){super(...arguments),r(this,"playableAsset"),r(this,"playOnAwake"),r(this,"extrapolationMode",1),r(this,"waitForAudio",!0),r(this,"_visibilityChangeEvt"),r(this,"_clonedPlayableAsset",!1),r(this,"_speed",1),r(this,"_guidsMap"),r(this,"_isPlaying",!1),r(this,"_internalUpdateRoutine"),r(this,"_isPaused",!1),r(this,"_isStopping",!1),r(this,"_time",0),r(this,"_duration",0),r(this,"_weight",1),r(this,"_animationTracks",[]),r(this,"_audioTracks",[]),r(this,"_signalTracks",[]),r(this,"_controlTracks",[]),r(this,"_customTracks",[]),r(this,"_allTracks",[this._animationTracks,this._audioTracks,this._signalTracks,this._controlTracks,this._customTracks]),r(this,"animationCallbackReceivers",[])}static registerCreateTrack(t,A){this.createTrackFunctions[t]=A}get isPlaying(){return this._isPlaying}get isPaused(){return this._isPaused}get time(){return this._time}set time(t){typeof t=="number"&&!Number.isNaN(t)?this._time=t:(Fc||ho())&&console.error("INVALID TIMELINE.TIME VALUE",t,this.name)}get duration(){return this._duration}set duration(t){this._duration=t}get weight(){return this._weight}set weight(t){this._weight=t}get speed(){return this._speed}set speed(t){this._speed=t}awake(){var t,A,e;Fc&&console.log(this,(t=this.playableAsset)==null?void 0:t.tracks),this.rebuildGraph(),this.isValid()||console.warn("PlayableDirector is not valid",this.playableAsset,(A=this.playableAsset)==null?void 0:A.tracks,Array.isArray((e=this.playableAsset)==null?void 0:e.tracks),this)}onEnable(){var t,A,e;for(const i of this._audioTracks)(t=i.onEnable)==null||t.call(i);for(const i of this._customTracks)(A=i.onEnable)==null||A.call(i);for(const i of this._animationTracks)(e=i.onEnable)==null||e.call(i);this.playOnAwake&&this.play(),this._visibilityChangeEvt||(this._visibilityChangeEvt=()=>{switch(document.visibilityState){case"hidden":this.setAudioTracksAllowPlaying(!1);break;case"visible":this.setAudioTracksAllowPlaying(!0);break}}),window.addEventListener("visibilitychange",this._visibilityChangeEvt)}onDisable(){var t,A,e;this.stop();for(const i of this._audioTracks)(t=i.onDisable)==null||t.call(i);for(const i of this._customTracks)(A=i.onDisable)==null||A.call(i);for(const i of this._animationTracks)(e=i.onDisable)==null||e.call(i);this._visibilityChangeEvt&&window.removeEventListener("visibilitychange",this._visibilityChangeEvt)}onDestroy(){var t;for(const A of this._allTracks)for(const e of A)(t=e.onDestroy)==null||t.call(e)}rebuildGraph(){this.isValid()&&(this.resolveBindings(),this.updateTimelineDuration(),this.setupAndCreateTrackHandlers())}async play(){if(!this.isValid())return;const t=this._isPaused==!0;if(this._isPaused=!1,!this._isPlaying){if(this._isPlaying=!0,t&&this.invokePauseChangedMethodsOnTracks(),this.waitForAudio){const A=[];for(const e of this._audioTracks){const i=e.loadAudio(this._time,1,0);i&&A.push(i)}if(A.length>0&&(await Promise.all(A),!this._isPlaying))return;for(;this._audioTracks.length>0&&this._isPlaying&&!Qi.userInteractionRegistered&&this.waitForAudio;)await GC(200)}this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine=this.startCoroutine(this.internalUpdate(),Zt.LateUpdate)}}pause(){this.isValid()&&(this._isPlaying=!1,!this._isPaused&&(this._isPaused=!0,this.internalEvaluate(),this.invokePauseChangedMethodsOnTracks(),this.invokeStateChangedMethodsOnTracks()))}stop(){this._isStopping=!0;for(const e of this._audioTracks)e.stop();const t=this._isPaused==!0,A=this._isPlaying;this._isPlaying&&(this._time=0,this._isPlaying=!1,this._isPaused=!1,this.internalEvaluate(),t&&this.invokePauseChangedMethodsOnTracks()),this._isPlaying=!1,this._isPaused=!1,t&&!A&&this.invokePauseChangedMethodsOnTracks(),A&&this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine&&this.stopCoroutine(this._internalUpdateRoutine),this._internalUpdateRoutine=null,this._isStopping=!1}evaluate(){this.internalEvaluate(!0)}isValid(){return this.playableAsset&&this.playableAsset.tracks&&Array.isArray(this.playableAsset.tracks)}*forEachTrack(){for(const t of this._allTracks)for(const A of t)yield A}get audioTracks(){return this._audioTracks}resolveGuids(t){this._guidsMap=t}invokePauseChangedMethodsOnTracks(){var t;for(const A of this.forEachTrack())(t=A.onPauseChanged)==null||t.call(A)}invokeStateChangedMethodsOnTracks(){var t;for(const A of this.forEachTrack())(t=A.onStateChanged)==null||t.call(A,this._isPlaying)}*internalUpdate(){for(;this._isPlaying&&this.activeAndEnabled;)!this._isPaused&&this._isPlaying&&(this._time+=this.context.time.deltaTime*this.speed,this.internalEvaluate()),yield}internalEvaluate(t=!1){if(!this.isValid())return;let A=this._time;switch(this.extrapolationMode){case 0:this._speed>0?A=Math.min(A,this._duration):this._speed<0&&(A=Math.max(A,0)),this._time=A;break;case 1:A%=this._duration,this._time=A;break;case 2:if(A>this._duration){this.stop();return}break}const e=this._time;for(const i of this.playableAsset.tracks)if(!i.muted)switch(i.type){case Ko.Activation:if(!t&&!this._isPlaying)continue;for(let g=0;g<i.outputs.length;g++){const I=i.outputs[g];if(typeof I=="object"){let o=!1;if(i.clips)for(const C of i.clips)C.start<=e&&e<=C.end&&(o=!0);const s=I;s.visible!==void 0&&s.visible!==o&&(s.visible=o,Fc&&console.warn(this.name,"set ActivationTrack-"+g,s.name,o,e))}}break}if(!this._isStopping)for(const i of this._animationTracks)i.evaluate(e);for(const i of this._audioTracks)i.evaluate(e);for(const i of this._signalTracks)i.evaluate(e);for(const i of this._controlTracks)i.evaluate(e);for(const i of this._customTracks)i.evaluate(e)}resolveBindings(){if(this._clonedPlayableAsset||(this._clonedPlayableAsset=!0,this.playableAsset=Gd(this.playableAsset)),!this.playableAsset||!this.playableAsset.tracks)return;const t=this.findRoot(this.gameObject);for(const A of this.playableAsset.tracks){for(let e=A.outputs.length-1;e>=0;e--){let i=A.outputs[e];if(typeof i=="string"){this._guidsMap&&this._guidsMap[i]&&(i=this._guidsMap[i]);const g=aA.findByGuid(i,t);g===null||typeof g!="object"?(A.outputs.splice(e,1),console.warn("Failed to resolve binding",i,A.name,A.type)):(Fc&&console.log("Resolved binding",i,"to",g),A.outputs[e]=g)}else if(i===null){if(A.outputs.splice(e,1),vK.createTrackFunctions[A.type])continue;A.type!==Ko.Audio&&A.type!==Ko.Control&&A.type!==Ko.Marker&&A.type!==Ko.Signal&&console.warn("Missing binding",i,A.name,A.type,this.name,this.playableAsset.name)}}if(A.type===Ko.Control&&A.clips)for(let e=0;e<A.clips.length;e++){const i=A.clips[e];let g=i.asset.sourceObject;if(typeof g=="string"){this._guidsMap&&this._guidsMap[g]&&(g=this._guidsMap[g]);const I=aA.findByGuid(g,t);I===null||typeof I!="object"?console.warn("Failed to resolve sourceObject binding",g,A.name,i):(Fc&&console.log("Resolved binding",g,"to",I),i.asset.sourceObject=I)}}}}findRoot(t){return t.parent?this.findRoot(t.parent):t}updateTimelineDuration(){if(this._duration=0,!(!this.playableAsset||!this.playableAsset.tracks)){for(const t of this.playableAsset.tracks)if(t.muted!==!0){if(t.clips)for(const A of t.clips)A.end>this._duration&&(this._duration=A.end);if(t.markers)for(const A of t.markers)A.time>this._duration&&(this._duration=A.time+.001)}}}setupAndCreateTrackHandlers(){var t,A,e;if(this._animationTracks.length=0,this._audioTracks.length=0,this._signalTracks.length=0,!this.playableAsset)return;let i=aA.findObjectOfType(Wr,this.context);for(const g of this.playableAsset.tracks){const I=g.type,o=vK.createTrackFunctions[I];if(o!=null){const s=o(this,g);if(typeof s.evaluate=="function"){s.director=this,s.track=g,this._customTracks.push(s);continue}}if(g.type===Ko.Animation){if(!g.clips||g.clips.length<=0){Fc&&console.warn("Animation track has no clips",g);continue}for(let s=g.outputs.length-1;s>=0;s--){let C=g.outputs[s];if(C instanceof wA){const n=aA.getOrAddComponent(C,Zg);n&&(C=n)}const a=(t=C?.gameObject)==null?void 0:t.animations;if(a){const n=new Fm;n.trackOffset=g.trackOffset,n.director=this,n.track=g;for(let B=0;B<g.clips.length;B++){const Q=g.clips[B],E=Q.asset;if(!E){console.error(`Timeline ${this.name}: clip #${B} on track "${g.name}" has no animation data`);continue}const h=E.clip;let l=h;if((typeof l=="string"||typeof l=="number")&&(l=a.find(c=>c.name===h)),!l){console.warn("Could not find animationClip for model",Q,g.name,this.name,(A=this.playableAsset)==null?void 0:A.name);continue}C instanceof Zg&&C.runtimeAnimatorController&&(C.__internalDidAwakeAndStart||C.initializeRuntimeAnimatorController(),C.runtimeAnimatorController.mixer||C.runtimeAnimatorController.bind(C),n.mixer=C.runtimeAnimatorController.mixer),n.mixer||(n.mixer=new Ty(C.gameObject)),n.clips.push(l),n.mixer.uncacheAction(l),n.createHooks(Q.asset,l);const d=n.mixer.clipAction(l);n.actions.push(d),n.models.push(Q)}this._animationTracks.push(n)}}}else if(g.type===Ko.Audio){if(!g.clips||g.clips.length<=0)continue;const s=new lp;s.director=this,s.track=g,s.audioSource=g.outputs.find(C=>C instanceof Qi),this._audioTracks.push(s),i||(i=(e=this.context.mainCameraComponent)==null?void 0:e.gameObject.addNewComponent(Wr)),s.listener=i.listener;for(let C=0;C<g.clips.length;C++){const a=g.clips[C];s.addModel(a)}}else if(g.type===Ko.Marker){const s=new dp;if(s.director=this,s.track=g,g.markers)for(const C of g.markers)switch(C.type){case KK.Signal:s.models.push(C),s.didTrigger.push(!1);break}if(s!==null&&s.models.length>0){const C=aA.getComponent(this.gameObject,Nc);C&&(s.receivers.push(C),this._signalTracks.push(s))}}else if(g.type===Ko.Signal){const s=new dp;if(s.director=this,s.track=g,g.markers)for(const C of g.markers)s.models.push(C),s.didTrigger.push(!1);for(const C of g.outputs)s.receivers.push(C);this._signalTracks.push(s)}else if(g.type===Ko.Control){const s=new bm;if(s.director=this,s.track=g,g.clips)for(const C of g.clips)s.models.push(C);s.resolveSourceObjects(this.context),this._controlTracks.push(s)}}}setAudioTracksAllowPlaying(t){for(const A of this._audioTracks)A.onAllowAudioChanged(t)}registerAnimationCallback(t){this.animationCallbackReceivers.push(t)}unregisterAnimationCallback(t){const A=this.animationCallbackReceivers.indexOf(t);A!==-1&&this.animationCallbackReceivers.splice(A,1)}};let TQ=vK;r(TQ,"createTrackFunctions",{});const Km=Symbol("objectIsAnimatedData");function oj(t,A,e){if(!t)return;if(t[Km]===void 0){if(!e)return;t[Km]=new Set}const i=t[Km];e?i.add(A):i.has(A)&&i.delete(A)}function HQA(t){if(!t)return!1;const A=t[Km];return A!==void 0&&A.size>0}Bt.registerCallback(ki.ContextCreated,t=>{const A=t.context.domElement.getAttribute("autoplay");if(A!==void 0&&(A===""||A==="true")&&t.files)for(const e of t.files)aA.foreachComponent(e.file.scene,i=>{if(i.enabled!==!1){if(i instanceof jI&&i.playAutomatically||i instanceof Zg||i instanceof TQ&&i.playOnAwake===!0)return!0;if(i instanceof jI)return i.playAutomatically=!0,!0;if(i instanceof TQ)return i.playOnAwake=!0,!0}},!0)!==!0&&OQA(e.file)});function OQA(t){if(!t||!t.animations)return;for(let e=0;e<t.animations.length;e++){const i=t.animations[e];if(!(!i.tracks||i.tracks.length<=0))for(const g in i.tracks){const I=i.tracks[g],o=I.__objectName??I.name.substring(0,I.name.indexOf("."));let s=t.scene.getObjectByName(o);if(!s&&(s=t.scene.getObjectByProperty("uuid",o),!s))continue;let C=A(s);C||(C=Lr(t.scene,new jI));const a=C.animations=C.animations||[];i.name_animator=C.name,a.indexOf(i)<0&&a.push(i)}}function A(e){var i;if(!e)return;const g=(i=e.userData)==null?void 0:i.components;if(g&&g.length>0)for(let I=0;I<g.length;I++){const o=g[I];if(o instanceof Zg||o instanceof jI)return e}return A(e.parent)}}class PQA{constructor(){r(this,"_context")}get context(){return this._context??Ke.Current}get isStateMachineBehaviour(){return!0}}class up{constructor(A,e,i,g){r(this,"name"),r(this,"nameHash"),r(this,"normalizedTime"),r(this,"length"),r(this,"speed"),r(this,"action"),r(this,"hasTransitions");var I;this.name=A.name,this.nameHash=A.hash,this.normalizedTime=e,this.length=i,this.speed=g,this.action=A.motion.action||null,this.hasTransitions=((I=A.transitions)==null?void 0:I.length)>0||!1}}function sj(t,A){return{name:"Empty",isLooping:!1,guid:A?.generateUUID()??og.generateUUID(),index:-1,clip:new JI(t,0,[])}}var Zr=(t=>(t[t.If=1]="If",t[t.IfNot=2]="IfNot",t[t.Greater=3]="Greater",t[t.Less=4]="Less",t[t.Equals=6]="Equals",t[t.NotEqual=7]="NotEqual",t))(Zr||{}),JK=(t=>(t[t.Float=1]="Float",t[t.Int=3]="Int",t[t.Bool=4]="Bool",t[t.Trigger=9]="Trigger",t))(JK||{});const kg=tA("debuganimatorcontroller"),vm=tA("debugrootmotion");class zo{constructor(A){r(this,"_speed",1),r(this,"normalizedStartOffset",0),r(this,"animator"),r(this,"model"),r(this,"_mixer"),r(this,"_activeState"),r(this,"_activeStates",[]),r(this,"_heldActions",[]),r(this,"rootMotionHandler"),this.model=A,kg&&console.log(this)}static createFromClips(A,e={looping:!1,autoTransition:!0,transitionDuration:0}){const i=[];for(let I=0;I<A.length;I++){const o=A[I],s=[];if(e.autoTransition!==!1){const a=e.transitionDuration??0,n=a/o.duration;let B=I;(e.autoTransition===void 0||e.autoTransition===!0)&&(B=(I+1)%A.length),s.push({exitTime:1-n,offset:0,duration:a,hasExitTime:!0,destinationState:B,conditions:[]})}const C={name:o.name,hash:I,motion:{name:o.name,clip:o,isLooping:e?.looping??!1},transitions:s,behaviours:[]};i.push(C)}const g={name:"AnimatorController",guid:new Fg(Date.now()).generateUUID(),parameters:[],layers:[{name:"Base Layer",stateMachine:{defaultState:0,states:i}}]};return new zo(g)}play(A,e=-1,i=Number.NEGATIVE_INFINITY,g=0){if(e<0)e=0;else if(e>=this.model.layers.length){console.warn("invalid layer");return}const I=this.model.layers[e].stateMachine;for(const o of I.states)if(o.name===A||o.hash===A){kg&&console.log("transition to ",o),this.transitionTo(o,g,i);return}console.warn("Could not find "+A+" to play")}reset(){this.setStartTransition()}setBool(A,e){var i,g;const I=typeof A=="string"?"name":"hash";return(g=(i=this.model)==null?void 0:i.parameters)==null?void 0:g.filter(o=>o[I]===A).forEach(o=>o.value=e)}getBool(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??!1}setFloat(A,e){var i,g;const I=typeof A=="string"?"name":"hash",o=(g=(i=this.model)==null?void 0:i.parameters)==null?void 0:g.filter(s=>s[I]===A);return o.forEach(s=>s.value=e),o?.length>0}getFloat(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??0}setInteger(A,e){var i,g;const I=typeof A=="string"?"name":"hash";return(g=(i=this.model)==null?void 0:i.parameters)==null?void 0:g.filter(o=>o[I]===A).forEach(o=>o.value=e)}getInteger(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??0}setTrigger(A){var e,i;kg&&console.log("SET TRIGGER",A);const g=typeof A=="string"?"name":"hash";return(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.filter(I=>I[g]===A).forEach(I=>I.value=!0)}resetTrigger(A){var e,i;const g=typeof A=="string"?"name":"hash";return(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.filter(I=>I[g]===A).forEach(I=>I.value=!1)}getTrigger(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??!1}isInTransition(){return this._activeStates.length>1}setSpeed(A){this._speed=A}FindState(A){return this.findState(A)}findState(A){if(!A)return null;if(Array.isArray(this.model.layers)){for(const e of this.model.layers)for(const i of e.stateMachine.states)if(i.name===A||i.hash==A)return i}return null}getCurrentStateInfo(){if(!this._activeState)return null;const A=this._activeState.motion.action;if(!A)return null;const e=this._activeState.motion.clip.duration,i=e<=0?0:Math.abs(A.time/e);return new up(this._activeState,i,e,this._speed)}get currentAction(){return this._activeState&&this._activeState.motion.action||null}get context(){var A;return(A=this.animator)==null?void 0:A.context}get mixer(){return this._mixer}bind(A){A?this.animator!==A&&(this.animator=A,this._mixer=new Ty(this.animator.gameObject),this.createActions(this.animator)):console.error("AnimatorController.bind: animator is null")}clone(){if(typeof this.model=="string")return console.warn("AnimatorController has not been resolved, can not create model from string",this.model),null;kg&&console.warn("AnimatorController clone()",this.model);const A=Gd(this.model,(e,i,g)=>g==null?!0:!(g.type==="Object3D"||g.isObject3D===!0||eH(g)||g.tracks!==void 0||g instanceof zo));return console.assert(A!==this.model),new zo(A)}update(A){var e,i;if(!this.animator)return;this.evaluateTransitions(),this.updateActiveStates(A);const g=this.animator.context.time.deltaTime;this.animator.applyRootMotion&&((e=this.rootMotionHandler)==null||e.onBeforeUpdate(A)),this._mixer.update(g),this.animator.applyRootMotion&&((i=this.rootMotionHandler)==null||i.onAfterUpdate(A))}get activeState(){return this._activeState}updateActiveStates(A){for(let e=0;e<this._activeStates.length;e++){const i=this._activeStates[e],g=i.motion;if(!g.action)this._activeStates.splice(e,1),e--;else{const I=g.action;I.weight=A,I.getEffectiveWeight()<=0&&!I.isRunning()&&(kg&&console.debug("REMOVE",i.name,I.getEffectiveWeight(),I.isRunning(),I.isScheduled()),this._activeStates.splice(e,1),e--)}}}setStartTransition(){var A;this.model.layers.length>1&&(kg||Be())&&console.warn("Multiple layers are not supported yet "+((A=this.animator)==null?void 0:A.name));for(const e of this.model.layers){const i=e.stateMachine;i.defaultState===void 0&&(kg&&console.warn("AnimatorController default state is undefined, will assign state 0 as default",e),i.defaultState=0);const g=i.states[i.defaultState];this.transitionTo(g,0,this.normalizedStartOffset);break}}evaluateTransitions(){var A;let e=!1;if(!this._activeState){if(this.setStartTransition(),!this._activeState)return;e=!0}const i=this._activeState,g=i.motion.action;for(const o of i.transitions){if(!o.hasExitTime&&o.conditions.length<=0)continue;let s=!0;for(const C of o.conditions)if(!this.evaluateCondition(C)){s=!1;break}if(s)if(g){const C=i.motion.clip.duration,a=C<=0?1:Math.abs(g.time/C);let n=o.exitTime;g.timeScale<0&&(n=1-n);let B=!1;if(o.hasExitTime?B=a>=n:B=!0,B){for(const Q of o.conditions){const E=this.model.parameters.find(h=>h.name===Q.parameter);E?.type===JK.Trigger&&E.value&&(E.value=!1)}if(g.clampWhenFinished=!0,kg){const Q=this.getState(o.destinationState,0);console.log(`Transition to ${o.destinationState} / ${Q?.name}`,o,`
|
|
5519
|
+
Could not find method ${n.method} on object ${Q.name}`,Q,typeof Q[n.method])};if(typeof Q[n.method]!="function"){let u=!1,p=Q;for(;p;){const D=Object.getOwnPropertyDescriptor(p,n.method);if(D&&(D.writable===!0||D.set)){u=!0;break}p=Object.getPrototypeOf(p)}!u&&(Be()||Hg)&&c()}}let h=n.argument;h!==void 0?h=B(h):n.arguments!==void 0&&(h=n.arguments.map(B));const l=E?this.createEventMethod(Q,n.method,h):void 0,d=new Mc(l,n.enabled);if(d.method||(d[yQA]=(o=e.object)==null?void 0:o.name),!Q||!d.method){const c=e.object?"Current object: "+e.object.name+", "+e.object.guid:null;Q?console.warn('EventList method not found: "'+n.method+'" on',Q):console.warn("EventList is missing target - will be ignored",n.target,c,A)}else s.push(d)}const C=new rg(s);Hg&&console.log(C);const a=e.target;return a!==void 0&&e.path!==void 0&&C.setEventTarget(e.path,a),C}}createEventMethod(A,e,i){return(...g)=>{const I=A[e];typeof I=="function"?i!==void 0?Array.isArray(i)?I?.call(A,...i):I?.call(A,i):I?.call(A,...g):A[e]=i}}}const mQA=new SQA;class tj extends bC{constructor(){super([kc,Pe])}onSerialize(A,e){}onDeserialize(A,e){if(A instanceof He&&e.type===kc){const i=A,g=new kc(i.image.width,i.image.height,{colorSpace:Dt});return g.texture=i,i.isRenderTargetTexture=!0,i.flipY=!0,i.offset.y=1,i.repeat.y=-1,i.needsUpdate=!0,i.mipmaps=[],i instanceof mC&&(i.isCompressedTexture=!1,i.format=RGBAFormat),g}}}new tj;class ij extends bC{constructor(){super([URL])}onSerialize(A,e){return null}onDeserialize(A,e){if(typeof A=="string"&&A.length>0)return Cr(e.gltfId,A)}}new ij;var fQA=Object.defineProperty,kQA=Object.getOwnPropertyDescriptor,GQA=(t,A,e,i)=>{for(var g=i>1?void 0:i?kQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&fQA(A,e,g),g};class np extends bA{awake(){ys.createIfNoneExists(this.context)}onEnable(){var A;(A=ys.get(this.context))==null||A.register(this)}onDisable(){var A;(A=ys.get(this.context))==null||A.unregister(this)}}class bo extends np{constructor(){super(...arguments),r(this,"targets",null),r(this,"raycastHits",[]),r(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(A=null){if(!this.targets)return null;A??(A=new ps),A.targets=this.targets,A.results=this.raycastHits;const e=A.testObject;this.ignoreSkinnedMeshes&&(A.testObject=g=>g instanceof Do?"continue in children":e?e(g):!0);const i=this.context.physics.raycast(A);return A.testObject=e,i}}GQA([w()],bo.prototype,"ignoreSkinnedMeshes",2);class mm extends bo{constructor(){super(),this.ignoreSkinnedMeshes=!0}}class rp extends np{performRaycast(A){if(!pe.active||!(A!=null&&A.ray))return null;const e=A.ray.origin,i=.01;return this.context.physics.sphereOverlap(e,i)}}class fm{static getObject(A){const e=A[ws];return e&&(e.isComponent===!0?A=e.gameObject:A=e),A}static isInteractable(A,e){if(e&&(e.canvasGroup=void 0,e.graphic=void 0),A==null||!A.visible||(A=this.getObject(A),!A.visible))return!1;const i=this.tryFindCanvasGroup(A);if(i?.isCanvasGroup===!0&&(e&&(e.canvasGroup=i),i.blocksRaycasts===!1||i.interactable===!1))return!1;const g=KQ(A,I=>{if(I.isGraphic===!0)return I},!1);return e&&g?.isGraphic===!0&&(e.graphic=g),!(g?.raycastTarget===!1||g?.layer===2)}static tryFindCanvasGroup(A){if(!A)return null;const e=KQ(A,i=>{const g=i;if(g.blocksRaycasts!==void 0&&g.interactable!==void 0)return g},!1);return e!==void 0?e:this.tryFindCanvasGroup(A.parent)}}function UK(t){return t[ws]||(t.parent?UK(t.parent):null)}function MQA(t){return t.isUI===!0||typeof t[ws]=="object"}function km(t,A){if(!t)return;const e=t.material;if(e?.isMaterial===!0){const i=t.parent;i&&i.isText,e.side=A.doubleSided??!0?ht:lg,e.shadowSide=A.doubleSided?ht:lg,t.castShadow=A.castShadows?A.castShadows:!1,t.receiveShadow=A.receiveShadows?A.receiveShadows:!1}for(const i of t.children)km(i,A)}function Rc(t,A,e){t[A]===void 0&&console.warn("Field",A,"is undefined on",t);const i=Proxy.revocable(t[A],{set(o,s,C,a){const n=o[s],B=Reflect.set(o,s,C,a);return e(C,n),B}}),g=i.revoke,I=t[A];return i.revoke=()=>{t[A]=I,g()},t[A]=i.proxy,i}const gj=Symbol("Scheduled action");function RQA(t,A,e=Zt.OnBeforeRender){let i=t[gj];i||(i=t[gj]={});const g=A.name;i[e]||(i[e]={});const I=i[e];if(I[g])return;function*o(){A?.call(t),I[g]=null}const s=t.startCoroutine(o(),e);I[g]=s}const an=tA("debugeventsystem");var NK=(t=>(t.BeforeHandleInput="BeforeHandleInput",t.AfterHandleInput="AfterHandleInput",t))(NK||{});const nn=class extends bA{constructor(){super(),r(this,"raycaster",[]),r(this,"_handleInputFn"),r(this,"pressedByID",new Map),r(this,"hoveredByID",new Map),r(this,"_sortedHits",[]),r(this,"_testObjectsCache",new Map),r(this,"_currentlyActiveRaycaster",null),r(this,"_currentPointerEventName",null),r(this,"shouldRaycastObject",t=>{var A;let e=null;if(MQA(t)&&(e=(A=t[ws])==null?void 0:A.gameObject),this._testObjectsCache.has(t)||e&&this._testObjectsCache.has(e))return this._testObjectsCache.get(t)===!1?"continue in children":!0;{let i=RK(t,this._currentPointerEventName);if(!i&&e&&(i=RK(e,this._currentPointerEventName)),i){this._testObjectsCache.set(t,!0);for(const g of t.children)this.shouldRaycastObject_AddToYesCache(g);return!0}return this._testObjectsCache.set(t,!1),"continue in children"}}),r(this,"_sortingBuffer",[]),r(this,"_noDepthTestingResults",[]),r(this,"out",{}),r(this,"_capturedPointer",{}),r(this,"pointerEnterSymbol",Symbol("pointerEnter")),r(this,"pointerExitSymbol",Symbol("pointerExit")),r(this,"currentActiveMeshUIComponents",[]),nn.systems.push(this)}static createIfNoneExists(t){this.didSearchEventSystem||(this.didSearchEventSystem=!0,nn.systems.length<=0&&nn.systems.push(...aA.findObjectsOfType(nn,t)));for(const e of nn.systems)if(e.context===t)return;const A=new wA;aA.addNewComponent(A,nn),t.scene.add(A)}static get systems(){const t=Ke.Current;return this._eventSystemMap.has(t)||this._eventSystemMap.set(t,[]),this._eventSystemMap.get(t)}static get(t){const A=this._eventSystemMap.get(t);return A&&A.length>0?A[0]:null}static get instance(){return this.systems[0]}static ensureUpdateMeshUI(t,A,e=!1){jr.update(t,A,e)}static markUIDirty(t){jr.markDirty()}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}onDestroy(){nn.systems.splice(nn.systems.indexOf(this),1)}start(){if(this.raycaster.length<=0&&!aA.findObjectOfType(np,this.context)){const t=aA.addNewComponent(this.context.scene,bo);this.raycaster.push(t),(Be()||an)&&console.warn("Added an ObjectRaycaster to the scene because no raycaster was found.")}}register(t){var A;t&&this.raycaster&&!this.raycaster.includes(t)&&((A=this.raycaster)==null||A.push(t))}unregister(t){var A,e;const i=(A=this.raycaster)==null?void 0:A.indexOf(t);i!==void 0&&i!==-1&&((e=this.raycaster)==null||e.splice(i,1))}onEnable(){this._handleInputFn??(this._handleInputFn=this.onPointerEvent.bind(this)),this.context.input.addEventListener(ii.PointerDown,this._handleInputFn),this.context.input.addEventListener(ii.PointerUp,this._handleInputFn),this.context.input.addEventListener(ii.PointerMove,this._handleInputFn)}onDisable(){this.context.input.removeEventListener(ii.PointerDown,this._handleInputFn),this.context.input.removeEventListener(ii.PointerUp,this._handleInputFn),this.context.input.removeEventListener(ii.PointerMove,this._handleInputFn)}onBeforeRender(){this.resetMeshUIStates()}onPointerEvent(t){if(t===void 0||t.propagationStopped)return;const A=new Ml(this.context.input,t);this._currentPointerEventName=t.type,A.inputSource=this.context.input,A.isClick=t.isClick,A.isDoubleClick=t.isDoubleClick,A.isDown=t.type==ii.PointerDown,A.isUp=t.type==ii.PointerUp,A.isPressed=this.context.input.getPointerPressed(t.pointerId),an&&(A.isDown?console.log("DOWN",A.pointerId):A.isUp&&console.log("UP",A.pointerId),A.isClick&&console.log("CLICK",A.pointerId));const e=new ps;t.hasRay?e.ray=t.ray:e.screenPoint=this.context.input.getPointerPositionRC(t.pointerId);const i=this.performRaycast(e);if(i)for(const I of i)I.event=t,t.intersections.push(I);an&&A.isClick&&ri("EventSystem: "+A.pointerId+" - "+this.context.time.frame+" - Up:"+A.isUp+", Down:"+A.isDown);const g={sender:this,args:A,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:g})),this.handleIntersections(i,A),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:g}))}shouldRaycastObject_AddToYesCache(t){this._testObjectsCache.set(t,!0);for(const A of t.children)this.shouldRaycastObject_AddToYesCache(A)}performRaycast(t){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,t||(t=new ps),t.testObject=this.shouldRaycastObject;for(const A of this.raycaster){if(!A.activeAndEnabled)continue;this._currentlyActiveRaycaster=A;const e=A.performRaycast(t);this._currentlyActiveRaycaster=null,e&&e.length>0&&this._sortedHits.push(...e)}return this._sortedHits.sort((A,e)=>A.distance-e.distance),this._sortedHits}assignHitInformation(t,A){A?(t.intersection=A,t.point=A.point,t.normal=A.normal,t.face=A.face,t.distance=A.distance,t.instanceId=A.instanceId):(t.intersection=void 0,t.point=void 0,t.normal=void 0,t.face=void 0,t.distance=void 0,t.instanceId=void 0)}handleIntersections(t,A){var e;if(t!=null&&t.length){t=this.sortCandidates(t);for(const g of t){if(A.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(A,g),this.handleEventOnObject(g.object,A))return!0}}this.assignHitInformation(A,t?.[0]),this.invokePointerCapture(A);const i=this.hoveredByID.get(A.pointerId);return i&&this.propagatePointerExit(i.obj,i.data,null),this.hoveredByID.delete(A.pointerId),A.isUp&&((e=this.pressedByID.get(A.pointerId))==null||e.handlers.forEach(g=>this.invokeOnPointerUp(A,g)),this.pressedByID.delete(A.pointerId)),!1}sortCandidates(t){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let A=0;A<t.length;A++){const e=t[A],i=e.object;if(i.material&&i.material.depthTest===!1){this._noDepthTestingResults.push(e);continue}this._sortingBuffer.push(e)}for(const A of this._sortingBuffer)this._noDepthTestingResults.push(A);return this._noDepthTestingResults}handleEventOnObject(t,A){if(!this.testIsVisible(t))return A.isClick&&an&&console.log("not allowed",t),!1;if(A.pointerId===void 0)return an&&console.error("Event without pointer can't be handled",A),!1;A.object=t;const e=t.parent,i=A.isClick??!1;let g=null;if(e&&e.isUI){const C=(A.isPressed||A.isClick)??!1;if(e[ws]){const a=e[ws].gameObject;if(a){if(!fm.isInteractable(a,this.out))return!1;g=this.out.canvasGroup??null,this.handleMeshUIIntersection(t,C),t=a}}}i&&an&&console.log(this.context.time.frame,t);const I=this.hoveredByID.get(A.pointerId),o=I?.obj;o!==t&&o&&this.propagatePointerExit(o,I.data,t);const s=this.hoveredByID.get(A.pointerId);if(s?(s.obj=t,s.data=A):this.hoveredByID.set(A.pointerId,{obj:t,data:A}),A.isDown){const C=this.pressedByID.get(A.pointerId);C?(C.obj=t,C.data=A):this.pressedByID.set(A.pointerId,{obj:t,data:A,handlers:new Set})}return(g===null||g.interactable)&&this.handleMainInteraction(t,A,o??null),!0}propagate(t,A){for(;t;)aA.foreachComponent(t,e=>{A(e)},!1),t=t.parent}handleMainInteraction(t,A,e){const i=this.pressedByID.get(A.pointerId),g=e!==t;let I=!0;switch(A.event.pointerType){case"mouse":case"touch":const o=this.context.input.getPointerPositionLastFrame(A.pointerId),s=this.context.input.getPointerPosition(A.pointerId);I=o&&!ee.approximately(o,s);break}this.propagate(t,o=>{var s;const C=o;C.interactable!==!1&&(!C.activeAndEnabled||!C.enabled||(C.onPointerEnter&&g&&this.handlePointerEnter(C,A),A.isDown&&C.onPointerDown&&(C.onPointerDown(A),i?.handlers.add(C),this.handlePointerCapture(A,C)),C.onPointerMove&&(I&&C.onPointerMove(A),this.handlePointerCapture(A,C)),A.isUp&&(C.onPointerUp&&(this.invokeOnPointerUp(A,C),i?.handlers.delete(C)),C.onPointerExit&&((s=A.event)==null?void 0:s.pointerType)===gS.Touch&&(this.handlePointerExit(C,A),this.hoveredByID.delete(A.pointerId))),A.isClick&&C.onPointerClick&&C.onPointerClick(A)))}),A.isUp&&(i?.handlers.forEach(o=>{this.invokeOnPointerUp(A,o)}),this.pressedByID.delete(A.pointerId))}propagatePointerExit(t,A,e){this.propagate(t,i=>{if(!i.gameObject||i.destroyed)return;const g=i;if(g.onPointerExit){if(e&&this.isChild(e,i.gameObject))return;this.handlePointerExit(g,A)}})}invokeOnPointerUp(t,A){var e;(e=A.onPointerUp)==null||e.call(A,t),this.releasePointerCapture(t,A)}handlePointerEnter(t,A){t.onPointerEnter&&this.updatePointerState(t,A.pointerId,this.pointerEnterSymbol,!0)&&t.onPointerEnter(A),this.updatePointerState(t,A.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(t,A){t.onPointerExit&&this.updatePointerState(t,A.pointerId,this.pointerExitSymbol,!0)&&t.onPointerExit(A),this.updatePointerState(t,A.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(t,A,e,i){let g=t[e];if(i)return g&&g.includes(A)?!1:(g=g||[],g.push(A),t[e]=g,!0);{if(!g||!g.includes(A))return!1;const I=g.indexOf(A);return I!==-1&&g.splice(I,1),!0}}handlePointerCapture(t,A){if(t.z__pointer_ctured){t.z__pointer_ctured=!1;const e=t.pointerId;if(A.onPointerMove){const i=this._capturedPointer[e]||[];i.push(A),this._capturedPointer[e]=i}else Be()&&!A.z__warned_no_pointermove&&(A.z__warned_no_pointermove=!0,console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"))}else t.z__pointer_cture_rleased&&(t.z__pointer_cture_rleased=!1,this.releasePointerCapture(t,A))}releasePointerCapture(t,A){const e=t.pointerId;if(this._capturedPointer[e]){const i=this._capturedPointer[e].indexOf(A);i!==-1&&(this._capturedPointer[e].splice(i,1),an&&console.log("released pointer capture",e,A,this._capturedPointer))}}invokePointerCapture(t){var A;if(t.event.type===ii.PointerMove){const e=t.pointerId,i=this._capturedPointer[e];if(i){an&&console.log("Captured",e,i);for(let g=0;g<i.length;g++){const I=i[g];if(I.destroyed){i.splice(g,1),g--;continue}(A=I.onPointerMove)==null||A.call(I,t)}}}}isChild(t,A){return!t||!A?!1:t===A?!0:t.parent?this.isChild(t.parent,A):!1}handleMeshUiObjectWithoutShadowDom(t,A){return!t||!t.isUI?!0:this.handleMeshUIIntersection(t,A)}handleMeshUIIntersection(t,A){const e=jr.updateState(t,A);return e&&this.currentActiveMeshUIComponents.push(e),e!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&jr.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let t=0;t<this.currentActiveMeshUIComponents.length;t++){const A=this.currentActiveMeshUIComponents[t];jr.resetState(A)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(t){return t?aA.isActiveSelf(t)?this.testIsVisible(t.parent):!1:!0}};let ys=nn;r(ys,"_eventSystemMap",new Map),r(ys,"didSearchEventSystem",!1);class jr{static markDirty(){this.needsUpdate=!0}static update(A,e,i=!1){if(i){A.update();return}const g=e.time.frameCount;for(const I of this.lastUpdateFrame)if(I.context===e){if(g===I.frame)return;I.frame=g;let o=this.needsUpdate||g<1;I.nextUpdate===e.time.frameCount&&(o=!0),o&&(an&&console.log("Update threemeshui"),this.needsUpdate=!1,A.update());return}this.lastUpdateFrame=[{context:e,frame:g,nextUpdate:g}],A.update()}static updateState(A,e){let i=null;if(A&&(i=this.findBlockInParent(A),i&&i!==this.lastSelected)){if(i.interactable===!1)return null;this.needsUpdate=!0}return i}static resetLastSelected(){const A=this.lastSelected;A&&(this.lastSelected=null,this.resetState(A))}static resetState(A){A&&(this.needsUpdate=!0)}static findBlockInParent(A){return A?A.isBlock?A:this.findBlockInParent(A.parent):null}}r(jr,"lastSelected",null),r(jr,"lastUpdateFrame",[]),r(jr,"needsUpdate",!1);var UQA=Object.defineProperty,NQA=Object.getOwnPropertyDescriptor,Mi=(t,A,e,i)=>{for(var g=i>1?void 0:i?NQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&UQA(A,e,g),g};const FQA=tA("debugorbit"),Gm=tA("freecam"),Mm=tA("debugcamerafit"),Rm=tA("smoothcam"),bQA={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let FK;class Bp extends CustomEvent{constructor(A,e){super("target-reached",{detail:{controls:A,type:e}})}}class Gt extends bA{constructor(){super(...arguments),r(this,"autoTarget",!0),r(this,"autoFit",!1),r(this,"enableRotate",!0),r(this,"autoRotate",!1),r(this,"autoRotateSpeed",1),r(this,"minAzimuthAngle",1/0),r(this,"maxAzimuthAngle",1/0),r(this,"minPolarAngle",0),r(this,"maxPolarAngle",Math.PI),r(this,"enableKeys",!0),r(this,"enableDamping",!0),r(this,"dampingFactor",.1),r(this,"enableZoom",!0),r(this,"minZoom",0),r(this,"maxZoom",1/0),r(this,"enablePan",!0),r(this,"lookAtConstraint",null),r(this,"lookAtConstraint01",1),r(this,"allowInterrupt",!0),r(this,"middleClickToFocus",!0),r(this,"doubleClickToFocus",!0),r(this,"useSlerp",!0),r(this,"debugLog",!1),r(this,"targetLerpDuration",1),r(this,"_controls",null),r(this,"_cameraObject",null),r(this,"_lookTargetLerpActive",!1),r(this,"_lookTargetStartPosition",new f),r(this,"_lookTargetEndPosition",new f),r(this,"_lookTargetLerp01",0),r(this,"_lookTargetLerpDuration",0),r(this,"_cameraLerpActive",!1),r(this,"_cameraStartPosition",new f),r(this,"_cameraEndPosition",new f),r(this,"_cameraLerp01",0),r(this,"_cameraLerpDuration",0),r(this,"_inputs",0),r(this,"_enableTime",0),r(this,"_startedListeningToKeyEvents",!1),r(this,"_eventSystem"),r(this,"_afterHandleInputFn"),r(this,"_camera",null),r(this,"_syncedTransform"),r(this,"_didStart",!1),r(this,"_didSetTarget",!1),r(this,"targetElement",null),r(this,"onControlsChangeStarted",()=>{this._syncedTransform&&this._syncedTransform.requestOwnership()}),r(this,"_shouldDisable",!1),r(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(A){var e;(e=this.controls)==null||e.addEventListener("start",A)}set zoomSpeed(A){this._controls&&(this._controls.zoomSpeed=A)}get zoomSpeed(){var A;return((A=this._controls)==null?void 0:A.zoomSpeed)??0}set zoomToCursor(A){this._controls&&(this._controls.zoomToCursor=A)}get zoomToCursor(){var A;return((A=this._controls)==null?void 0:A.zoomToCursor)??!1}get targetLerpSpeed(){return 5}set targetLerpSpeed(A){this.targetLerpDuration=1/A}awake(){this._didStart=!1,this._didSetTarget=!1,this._startedListeningToKeyEvents=!1}start(){this._didStart=!0,this._eventSystem=ys.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener(NK.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var A,e;(A=this._controls)==null||A.dispose(),(e=this._eventSystem)==null||e.removeEventListener(NK.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._enableTime=this.context.time.time;const A=aA.getComponent(this.gameObject,Lt);this._camera=A;let e=A?.cam;if(!e&&this.gameObject instanceof xe&&(e=this.gameObject),e&&bU(e,this,!0),!this._controls&&e instanceof xe){this._cameraObject=e;const i=this.targetElement??this.context.renderer.domElement,g=e?.quaternion.clone();this._controls=new IQA(e,i),e?.quaternion.copy(g),FK===void 0&&(FK={...this._controls.keys})}this._controls&&(Gm&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,Is()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),e?.type==="PerspectiveCamera"?Gm||(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom):Gm||(this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom),this._startedListeningToKeyEvents||(this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(window.document.body))),this._syncedTransform=aA.getComponent(this.gameObject,Pr)??void 0}onDisable(){var A;(A=this._camera)!=null&&A.cam&&bU(this._camera.cam,this,!1),this._controls&&(this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted))}afterHandleInput(A){A.detail.args.pointerId===0&&(A.detail.args.isDown?this._controls&&this._eventSystem&&(this._shouldDisable=this._eventSystem.hasActiveUI):(!A.detail.args.isPressed||A.detail.args.isUp)&&(this._shouldDisable=!1))}onBeforeRender(){var A,e;if(!this._controls)return;if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}this._controls.enabled=!0,this.__handleSetTargetWhenBecomingActiveTheFirstTime(),(this.context.input.getPointerDown(1)||this.context.input.getPointerDown(2)||this.context.input.mouseWheelChanged||this.context.input.getPointerPressed(0)&&(A=this.context.input.getPointerPositionDelta(0))!=null&&A.length()||0>.1)&&(this._inputs+=1),this._inputs>0&&this.allowInterrupt&&(this.enableRotate&&(this.autoRotate=!1),this._cameraLerpActive=!1,this._lookTargetLerpActive=!1),this._inputs=0;let i=this.middleClickToFocus&&this.context.input.getPointerClicked(1);if(i||(i=this.doubleClickToFocus&&this.context.input.getPointerDoubleClicked(0)&&this.context.time.time-this._enableTime>.3),i&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive){if(this._cameraLerpActive&&this._cameraObject)if(this._cameraLerp01+=this.context.time.deltaTime/this._cameraLerpDuration,this._cameraLerp01>=1)this._cameraObject.position.copy(this._cameraEndPosition),this._cameraLerpActive=!1,this.dispatchEvent(new Bp(this,"camera"));else{const g=ee.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,g)}if(this._lookTargetLerpActive)if(this._lookTargetLerp01+=this.context.time.deltaTime/this._lookTargetLerpDuration,this._lookTargetLerp01>=1)this._controls.target.copy(this._lookTargetEndPosition),this._lookTargetLerpActive=!1,this.dispatchEvent(new Bp(this,"lookat"));else{const g=ee.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,g)}}if(this._controls){if(this.debugLog&&(this._controls.domElement=this.context.renderer.domElement),this._controls.enabled=!this._shouldDisable&&this._camera===this.context.mainCameraComponent&&!this.context.isInXR,this._controls.keys=this.enableKeys?FK:bQA,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.enableDamping=this.enableDamping,this._controls.dampingFactor=this.dampingFactor,this._controls.enablePan=this.enablePan,this._controls.enableRotate=this.enableRotate,this._controls.minAzimuthAngle=this.minAzimuthAngle,this._controls.maxAzimuthAngle=this.maxAzimuthAngle,this._controls.minPolarAngle=this.minPolarAngle,this._controls.maxPolarAngle=this.maxPolarAngle,typeof Rm=="number"||Rm===!0){this._controls.enableDamping=!0;const g=typeof Rm=="number"?Rm:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,g))}this.allowInterrupt||(this._lookTargetLerpActive&&(this._controls.enablePan=!1),this._cameraLerpActive&&(this._controls.enableRotate=!1,this._controls.autoRotate=!1),(this._lookTargetLerpActive||this._cameraLerpActive)&&(this._controls.enableZoom=!1)),this.context.isInXR||(!Gm&&(e=this.lookAtConstraint)!=null&&e.locked&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(),FQA&&Se.DrawWireSphere(this._controls.target,.1,65280))}}__handleSetTargetWhenBecomingActiveTheFirstTime(){if(!this._didSetTarget&&(this._didSetTarget=!0,this.autoTarget)){const A=aA.getComponent(this.gameObject,Lt);if(A&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const e=be(A.cam).length(),i=new f(0,0,-e).applyMatrix4(A.cam.matrixWorld);this.setLookTargetPosition(i,!0)}if(!this.autoFit&&!this.setLookTargetFromConstraint()){const e=new ps;e.screenPoint=new eA(0,0),e.lineThreshold=.1;const i=this.context.physics.raycast(e);i.length>0&&this.setLookTargetPosition(i[0].point,!0),Mm&&console.log("OrbitControls hits",...i)}this.autoFit&&this.fitCamera()}}setCameraAndLookTarget(A){if(!A||!(A instanceof wA))return;const e=be(A),i=_U(A);this.setTargetFromRaycast(new io(e,i)),this.setCameraTargetPosition(e)}setCameraTargetPosition(A,e=!1){var i,g;A&&(A instanceof wA&&(A=be(A)),this._cameraEndPosition||(this._cameraEndPosition=new f),this._cameraEndPosition.copy(A),e===!0?(this._cameraLerpActive=!1,(i=this.controllerObject)==null||i.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((g=this._cameraObject)==null?void 0:g.position),typeof e=="number"?this._cameraLerpDuration=e:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setLookTargetPosition(A=null,e=!1){this._controls&&A&&(A instanceof wA&&(A=be(A)),this._lookTargetEndPosition.copy(A),e===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof e=="number"?this._lookTargetLerpDuration=e:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(A=0,e=1){var i;if(!this._controls)return!1;const g=(i=this.lookAtConstraint)==null?void 0:i.sources;if(g&&g.length>0){const I=g[A];if(I)return I.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,e),!0}return!1}lerpTarget(A,e){return this.lerpLookTarget(A,e)}lerpLookTarget(A,e){this._controls&&(e>=1?this._controls.target.copy(A):this._controls.target.lerp(A,e))}setTargetFromRaycast(A){if(!this.controls)return;const e=A?this.context.physics.raycastFromRay(A):this.context.physics.raycast();for(const i of e)if(i.distance>0&&aA.isActiveInHierarchy(i.object)){const g=UK(i.object);if(g){const I=g.canvas;if(I!=null&&I.screenspace)break}this.setLookTargetPosition(i.point);break}}fitCamera(A,e=void 0,i=!0){if(this.context.isInXR)return;e==null&&(e=1.1);const g=this._cameraObject,I=this._controls;if(A!=null&&A.length||(A=this.context.scene.children),A.length<=0){console.warn("No objects to fit camera to...");return}if(!g||!I){console.warn("No camera or controls found to fit camera to objects...");return}const o=new f,s=new f,C=OU(A);if(g.updateMatrixWorld(),g.updateProjectionMatrix(),C.getCenter(s),C.applyMatrix4(g.matrixWorldInverse),C.getSize(o),C.setFromCenterAndSize(s,o),Number.isNaN(o.x)||Number.isNaN(o.y)||Number.isNaN(o.z)){console.warn("Camera fit size resultet in NaN",g,C,[...A]);return}if(o.length()<=1e-10){Mm&&console.warn("Camera fit size is zero",C,[...A]);return}const a=g.fov,n=2*Math.atan(Math.tan(a*Math.PI/360/2)*g.aspect)/Math.PI*360,B=o.y/(2*Math.atan(Math.PI*a/360)),Q=o.x/(2*Math.atan(Math.PI*n/360)),E=e*Math.max(B,Q)+o.z/2;Mm&&console.log("Fit camera to objects",B,Q,"distance",E),I.maxDistance=E*10,I.minDistance=E*.01;const h=.05,l=s.clone();l.y-=o.y*h,this.setLookTargetPosition(l,i),this.autoTarget=!1,g.near=E/1e3,g.far=E*100,g.updateMatrixWorld(),g.updateProjectionMatrix();const d=be(g),c=s.clone();if(c.sub(d),c.y=0,c.normalize(),c.multiplyScalar(E),c.y+=-h*4*o.y,g.parent){const u=g.parent.worldToLocal(s.clone().sub(c));this.setCameraTargetPosition(u,i)}else console.error(`Can not fit camera ${g.name} because it has no parent`);if(Mm){const u=new vR(C);this.context.scene.add(u),HU(u,Jd(g)),setTimeout(()=>{this.context.scene.remove(u)},1e4),this._haveAttachedKeyboardEvents||(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",p=>{p.code==="KeyF"&&this.fitCamera(A,e,i)}))}I.update()}}Mi([w()],Gt.prototype,"autoTarget",2),Mi([w()],Gt.prototype,"autoFit",2),Mi([w()],Gt.prototype,"enableRotate",2),Mi([w()],Gt.prototype,"autoRotate",2),Mi([w()],Gt.prototype,"autoRotateSpeed",2),Mi([w()],Gt.prototype,"minAzimuthAngle",2),Mi([w()],Gt.prototype,"maxAzimuthAngle",2),Mi([w()],Gt.prototype,"minPolarAngle",2),Mi([w()],Gt.prototype,"maxPolarAngle",2),Mi([w()],Gt.prototype,"enableKeys",2),Mi([w()],Gt.prototype,"enableDamping",2),Mi([w()],Gt.prototype,"dampingFactor",2),Mi([w()],Gt.prototype,"enableZoom",2),Mi([w()],Gt.prototype,"minZoom",2),Mi([w()],Gt.prototype,"maxZoom",2),Mi([w()],Gt.prototype,"enablePan",2),Mi([w(xQ)],Gt.prototype,"lookAtConstraint",2),Mi([w()],Gt.prototype,"lookAtConstraint01",2),Mi([w()],Gt.prototype,"allowInterrupt",2),Mi([w()],Gt.prototype,"middleClickToFocus",2),Mi([w()],Gt.prototype,"doubleClickToFocus",2),Mi([w()],Gt.prototype,"targetLerpDuration",2);var KQA=Object.defineProperty,vQA=Object.getOwnPropertyDescriptor,no=(t,A,e,i)=>{for(var g=i>1?void 0:i?vQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&KQA(A,e,g),g},_Q=(t=>(t[t.Skybox=1]="Skybox",t[t.SolidColor=2]="SolidColor",t[t.Uninitialized=4]="Uninitialized",t))(_Q||{});const rn=tA("debugcam"),Ij=tA("debugscreenpointtoray");var Um;const Qp=(Um=class extends bA{constructor(){super(...arguments),r(this,"_nearClipPlane",.1),r(this,"_farClipPlane",1e3),r(this,"orthographic",!1),r(this,"orthographicSize",5),r(this,"ARBackgroundAlpha",0),r(this,"_cullingMask",4294967295),r(this,"_backgroundBlurriness",0),r(this,"_backgroundIntensity",1),r(this,"_environmentIntensity"),r(this,"_targetTexture",null),r(this,"_backgroundColor"),r(this,"_fov"),r(this,"_cam",null),r(this,"_clearFlags",2),r(this,"_skybox"),r(this,"_frustum"),r(this,"_projScreenMatrix",new NA)}get isCamera(){return!0}get aspect(){return this._cam instanceof xe?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(t){this._cam instanceof xe&&this._cam.aspect!==t&&(this._cam.aspect=t,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof xe?this._cam.fov:this._fov}set fieldOfView(t){const A=this.fieldOfView!=t;if(this._fov=t,A&&this._cam&&this._cam instanceof xe){if(this._fov===void 0){console.warn("Can not set undefined fov on PerspectiveCamera");return}this._cam.fov=this._fov,this._cam.updateProjectionMatrix()}}get nearClipPlane(){return this._nearClipPlane}set nearClipPlane(t){const A=this._nearClipPlane!=t;this._nearClipPlane=t,this._cam&&A&&(this._cam.near=t,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(t){const A=this._farClipPlane!=t;this._farClipPlane=t,this._cam&&A&&(this._cam.far=t,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(t){t!==this._clearFlags&&(this._clearFlags=t,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(t){this._cullingMask=t,this._cam&&(this._cam.layers.mask=t)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(t){this.cullingMask=(1<<t|0)>>>0}set backgroundBlurriness(t){t!==this._backgroundBlurriness&&(t===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(t,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(t){t!==this._backgroundIntensity&&(t===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(t,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set environmentIntensity(t){this._environmentIntensity=t}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(t){if(t){if(this._backgroundColor)this._backgroundColor.copy(t);else{if(!t.clone)return;this._backgroundColor=t.clone()}t.alpha===void 0&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera()}}set targetTexture(t){this._targetTexture=t}get targetTexture(){return this._targetTexture}get cam(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(t,A,e){const i=this.cam,g=Qp._origin;g.set(t,A,-1),this.context.input.convertScreenspaceToRaycastSpace(g),Ij&&console.log("screenPointToRay",t.toFixed(2),A.toFixed(2),"now:",g.x.toFixed(2),g.y.toFixed(2),"isInXR:"+this.context.isInXR),g.z=-1,g.unproject(i);const I=Qp._direction.set(g.x,g.y,g.z),o=be(i);return I.sub(o),I.normalize(),e?(e.set(o,I),e):new io(o.clone(),I.clone())}getFrustum(){return this._frustum||(this._frustum=new JB,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new JB),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(t,A){return A&&this._projScreenMatrix.multiplyMatrices(this.cam.projectionMatrix,this.cam.matrixWorldInverse),t===this._projScreenMatrix?t:t.copy(this._projScreenMatrix)}awake(){Ij&&window.addEventListener("pointerdown",t=>{const A=t.clientX,e=t.clientY;console.log("touch",A.toFixed(2),e.toFixed(2));const i=this.screenPointToRay(A,e),g="#"+Math.floor(Math.random()*16777215).toString(16);Se.DrawRay(i.origin,i.direction,g,10)})}onEnable(){rn&&console.log(`Camera enabled: "${this.name}". ClearFlags=${_Q[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),qQA(this)),this.applyClearFlagsIfIsActiveCamera({applySkybox:!0})}onDisable(){this.context.removeCamera(this)}onBeforeRender(){if(this._cam&&(this._frustum&&this.updateFrustum(),this._clearFlags===2&&this.applyClearFlagsIfIsActiveCamera(),this._targetTexture)){this.context.isManagedExternally&&(this._warnedAboutExternalRenderer||(this._warnedAboutExternalRenderer=!0,console.warn("Rendering with external renderer is not supported yet. This may not work or throw errors. Please remove the the target texture from your camera: "+this.name,this.targetTexture))),this.context.composer;const t=this.context.renderer;if(t){const A=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,t),A?.applyClearFlags()}}}buildCamera(){if(this._cam)return;const t=this.gameObject.isCamera;let A=null;if(t?(A=this.gameObject,A?.layers.enableAll(),A instanceof xe&&(this._fov=A.fov)):A=this.gameObject.children[0],A&&A.isCamera)A instanceof xe&&(this._fov&&(A.fov=this._fov),A.near=this._nearClipPlane,A.far=this._farClipPlane,A.updateProjectionMatrix());else if(!this.orthographic)A=new xe(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(A.fov=this.fieldOfView),this.gameObject.add(A);else{const e=this.orthographicSize*100;A=new Na(window.innerWidth/-e,window.innerWidth/e,window.innerHeight/e,window.innerHeight/-e,this._nearClipPlane,this._farClipPlane),this.gameObject.add(A)}this._cam=A,this._cam.layers.mask=this._cullingMask,this.tag=="MainCamera"&&this.context.setCurrentCamera(this)}applyClearFlagsIfIsActiveCamera(t){this.context.mainCameraComponent===this&&this.applyClearFlags(t)}applyClearFlags(t){if(!this._cam){rn&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,rn){const A=`Camera "${this.name}" clear flags: ${_Q[this._clearFlags]}`;console.debug(A)}switch(this._clearFlags){case 1:if(Qp.backgroundShouldBeTransparent(this.context)&&(!this.ARBackgroundAlpha||this.ARBackgroundAlpha<.001)){this.context.scene.background=null,this.context.renderer.setClearColor(0,0);return}(!this.scene.background||!this._skybox||t?.applySkybox===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:rn&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0?this.context.scene.backgroundIntensity=this._backgroundIntensity:rn&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor){let A=this._backgroundColor.alpha;Qp.backgroundShouldBeTransparent(this.context)&&(A=this.ARBackgroundAlpha??0),this.context.scene.background=null,this.context.renderer.setClearColor(this._backgroundColor,A)}else rn&&console.warn(`Camera "${this.name}" has no background color`,this);break;case 4:this.context.scene.background=null,this.context.renderer.setClearColor(0,0);break}}applySceneSkybox(){this._skybox||(this._skybox=new JQA(this)),this._skybox.apply()}static backgroundShouldBeTransparent(t){var A,e,i,g;const I=(A=t.renderer.xr)==null?void 0:A.getSession();if(!I)return!1;if(typeof I._transparent=="boolean")return I._transparent;const o=I.environmentBlendMode;rn&&ri("Environment blend mode: "+o+" on "+navigator.userAgent);let s=o==="additive"||o==="alpha-blend";return t.isInAR&&o==="opaque"&&((e=navigator.userAgent)!=null&&e.includes("OculusBrowser")||(i=navigator.userAgent)!=null&&i.includes("Mozilla")&&(g=navigator.userAgent)!=null&&g.includes("Mobile WebXRViewer/v2"))&&(s=!0),I._transparent=s,s}},r(Um,"_origin",new f),r(Um,"_direction",new f),Um);let Lt=Qp;no([w()],Lt.prototype,"aspect",1),no([w()],Lt.prototype,"fieldOfView",1),no([w()],Lt.prototype,"nearClipPlane",1),no([w()],Lt.prototype,"farClipPlane",1),no([w()],Lt.prototype,"clearFlags",1),no([w()],Lt.prototype,"orthographic",2),no([w()],Lt.prototype,"orthographicSize",2),no([w()],Lt.prototype,"ARBackgroundAlpha",2),no([w()],Lt.prototype,"cullingMask",1),no([w()],Lt.prototype,"backgroundBlurriness",1),no([w()],Lt.prototype,"backgroundIntensity",1),no([w()],Lt.prototype,"environmentIntensity",1),no([w(kt)],Lt.prototype,"backgroundColor",1),no([w(kc)],Lt.prototype,"targetTexture",1);class JQA{constructor(A){r(this,"_camera"),r(this,"_skybox"),this._camera=A}get context(){var A;return(A=this._camera)==null?void 0:A.context}apply(){this._skybox=this.context.lightmaps.tryGetSkybox(this._camera.sourceId),this._skybox?this.context.scene.background!==this._skybox&&(rn&&console.log(`Camera "${this._camera.name}" set skybox`,this._camera,this._skybox),this._skybox.mapping=As,this.context.scene.background=this._skybox):(this._did_log_failed_to_find_skybox||(this._did_log_failed_to_find_skybox=!0,console.warn(`Camera "${this._camera.name}" failed to load/find skybox texture`,this._camera.sourceId,this.context.lightmaps,"Current background: ",this.context.scene.background)),(rn||Be())&&Bi(`Camera "${this._camera.name}" has no skybox texture`))}}function qQA(t){tA("freecam")&&t.context.mainCameraComponent===t&&aA.getOrAddComponent(t.gameObject,Gt)}class Wr extends bA{constructor(){super(...arguments),r(this,"_listener",null)}get listener(){return this._listener==null&&(this._listener=new aT),this._listener}awake(){Qi.registerWaitForAllowAudio(()=>{if(this.destroyed)return;const A=this.listener;if(A==null||A.parent)return;const e=this.context.mainCameraComponent||aA.getComponentInParent(this.gameObject,Lt);e!=null&&e.cam?e.cam.add(A):this.gameObject.add(A)})}}var xQA=Object.defineProperty,LQA=Object.getOwnPropertyDescriptor,Nm=(t,A,e,i)=>{for(var g=i>1?void 0:i?LQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&xQA(A,e,g),g};const _QA=tA("debugsignals");class Ep{constructor(){r(this,"guid")}}Nm([w()],Ep.prototype,"guid",2);class Uc{constructor(){r(this,"signal"),r(this,"reaction")}}Nm([w(Ep)],Uc.prototype,"signal",2),Nm([w(rg)],Uc.prototype,"reaction",2);var bK;const Bn=(bK=class extends bA{constructor(){super(...arguments),r(this,"events")}static invoke(t){if(Bn.receivers[t]){const A=Bn.receivers[t];if(!A)return;for(const e of A)e.invoke(t)}}awake(){_QA&&console.log("SignalReceiver awake",this)}onEnable(){if(this.events)for(const t of this.events)Bn.receivers[t.signal.guid]||(Bn.receivers[t.signal.guid]=[]),Bn.receivers[t.signal.guid].push(this)}onDisable(){if(this.events){for(const t of this.events)if(Bn.receivers[t.signal.guid]){const A=Bn.receivers[t.signal.guid].indexOf(this);A>=0&&Bn.receivers[t.signal.guid].splice(A,1)}}}invoke(t){if(!this.events||!Array.isArray(this.events))return;const A=typeof t=="object"?t.guid:t;for(const e of this.events)if(e.signal.guid===A)try{if(e.reaction){if(!e.reaction.invoke){console.warn("Missing invoke - possibly a serialization error",e,this);continue}}else{console.warn("Missing reaction for signal",e,this);continue}e.reaction.invoke()}catch(i){console.error(i)}}},r(bK,"receivers",{}),bK);let Nc=Bn;Nm([w(Uc)],Nc.prototype,"events",2);var Ko=(t=>(t.Activation="ActivationTrack",t.Animation="AnimationTrack",t.Audio="AudioTrack",t.Control="ControlTrack",t.Marker="MarkerTrack",t.Signal="SignalTrack",t))(Ko||{}),HC=(t=>(t[t.None=0]="None",t[t.Hold=1]="Hold",t[t.Loop=2]="Loop",t[t.PingPong=3]="PingPong",t[t.Continue=4]="Continue",t))(HC||{}),KK=(t=>(t.Signal="SignalEmitter",t))(KK||{});const OC=tA("debugtimeline");class hp{constructor(){r(this,"director"),r(this,"track")}get muted(){return this.track.muted}set muted(A){var e;A!==this.track.muted&&(this.track.muted=A,(e=this.onMuteChanged)==null||e.call(this))}*forEachClip(A=!1){var e;if((e=this.track)!=null&&e.clips)if(A)for(let i=this.track.clips.length-1;i>=0;i--)yield this.track.clips[i];else for(const i of this.track.clips)yield i}getClipTime(A,e){return e.clipIn+(A-e.start)*e.timeScale}getClipTimeNormalized(A,e){return(A-e.start)/e.duration}evaluateWeight(A,e,i,g=!0){if(e<0||e>=i.length)return 0;const I=i[e];if(g||A>=I.start&&A<=I.end){let o=1;const s=!1;if(I.easeInDuration>0){const C=Math.min((A-I.start)/I.easeInDuration,1);o*=C}if(I.easeOutDuration>0&&!s){const C=Math.min((I.end-A)/I.easeOutDuration,1);o*=C}return o}return 0}}class TQA{constructor(A){r(this,"clip"),r(this,"rootPositionOffset"),r(this,"rootQuaternionOffset"),r(this,"rootStartPosition"),r(this,"rootEndPosition"),r(this,"rootStartQuaternion"),r(this,"rootEndQuaternion");const e=A.getClip();this.clip=e;const i=A.getRoot(),g=i.name+".position",I=i.name+".quaternion";OC&&console.log(e.name,e.tracks,g);for(const o of e.tracks)if(!(o.times.length<=0)){if(o.name.endsWith(g))this.rootStartPosition=new f().fromArray(o.values,0),this.rootEndPosition=new f().fromArray(o.values,o.values.length-3),this.rootPositionOffset=this.rootEndPosition.clone().sub(this.rootStartPosition),OC&&console.log(this.rootPositionOffset);else if(o.name.endsWith(I)&&(this.rootStartQuaternion=new UA().fromArray(o.values,0),this.rootEndQuaternion=new UA().fromArray(o.values,o.values.length-4),this.rootQuaternionOffset=this.rootEndQuaternion.clone().multiply(this.rootStartQuaternion),OC)){const s=new ai().setFromQuaternion(this.rootQuaternionOffset);console.log("ROT",s)}}}get hasOffsets(){return this.rootPositionOffset!==void 0||this.rootQuaternionOffset!==void 0}}class Fm extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"trackOffset"),r(this,"target"),r(this,"mixer"),r(this,"clips",[]),r(this,"actions",[]),r(this,"_actionOffsets",[]),r(this,"_didBind",!1),r(this,"_animator",null),r(this,"_useclipOffsets",!0),r(this,"_totalOffsetPosition",new f),r(this,"_totalOffsetRotation",new UA),r(this,"_totalOffsetPosition2",new f),r(this,"_totalOffsetRotation2",new UA),r(this,"_summedPos",new f),r(this,"_tempPos",new f),r(this,"_summedRot",new UA),r(this,"_tempRot",new UA),r(this,"_clipRotQuat",new UA)}onDisable(){var A;(A=this.mixer)==null||A.stopAllAction()}onStateChanged(){this._animator&&oj(this._animator.gameObject,this,this.director.isPlaying)}createHooks(A,e){var i,g;if(((i=e.tracks)==null?void 0:i.length)<=0){console.warn("No tracks in AnimationClip",e);return}const I=e.tracks[0].name.split("."),o=I[I.length-2],s=o+".position",C=o+".quaternion";let a=!1,n=!1;for(const B of e.tracks)B.name.endsWith(s)?(a=!0,this.createPositionInterpolant(e,A,B)):B.name.endsWith(C)&&(n=!0,this.createRotationInterpolant(e,A,B));if(!a||!n){const B=(g=this.mixer)==null?void 0:g.getRoot(),Q=e.tracks[0],E=Q.name.lastIndexOf("."),h=Q.name.substring(0,E),l=h.substring(h.lastIndexOf(".")+1),d=B.getObjectByName(l);if(d)if(a){if(!n){const c=e.tracks[0].name.substring(0,E)+".quaternion";OC&&console.warn("Create quaternion track",l,d);const u=d.quaternion,p=new fC(c,[0,e.duration],[u.x,u.y,u.z,u.w,u.x,u.y,u.z,u.w]);e.tracks.push(p),this.createRotationInterpolant(e,A,p)}}else{const c=h+".position";OC&&console.warn("Create position track",l,d);const u=d.position,p=new ba(c,[0,e.duration],[u.x,u.y,u.z,u.x,u.y,u.z]);e.tracks.push(p),this.createPositionInterpolant(e,A,p)}}}bind(){if(!this._didBind){this._didBind=!0,OC&&console.log(this.models),this.mixer?this.target=this.mixer.getRoot():console.warn("No mixer was assigned to animation track");for(const A of this.actions){const e=new TQA(A);this._actionOffsets.push(e)}this.target&&(this._animator=aA.getComponent(this.target,Zg)??null,this._animator&&oj(this._animator.gameObject,this,!0));for(const A of this.models){const e=A.asset,i=e.position,g=e.rotation;i&&i.x!==void 0&&(i.isVector3||(e.position=new f(i.x,i.y,i.z)),g.isQuaternion||(e.rotation=new UA(g.x,g.y,g.z,g.w)))}this.ensureTrackOffsets()}}ensureTrackOffsets(){if(this.trackOffset){const A=this.trackOffset.position;A&&(A.isVector3||(this.trackOffset.position=new f(A.x,A.y,A.z)));const e=this.trackOffset.rotation;e&&(e.isQuaternion||(this.trackOffset.rotation=new UA(e.x,e.y,e.z,e.w)))}}evaluate(A){var e,i,g,I,o,s,C;if(this.track.muted||!this.mixer)return;this.bind(),this._totalOffsetPosition.set(0,0,0),this._totalOffsetRotation.set(0,0,0,1),this._totalOffsetPosition2.set(0,0,0),this._totalOffsetRotation2.set(0,0,0,1);let a=0,n=0,B=!1,Q=!1,E=0;for(let h=0;h<this.clips.length;h++){const l=this.models[h],d=this.actions[h],c=l.asset;d.weight=0;const u=A>=l.start&&A<=l.end,p=l.preExtrapolationMode,D=l.postExtrapolationMode,m=h<this.clips.length-1?this.models[h+1]:null;let M=u,k=!1;if(!M&&!B&&l.end<A&&D!==HC.None?(!m||m.start>A)&&(M=!0,B=!0):h==0&&!M&&!Q&&l.start>A&&p!==HC.None&&(!m||m.start<A)&&(M=!0,k=!0,Q=!0),M){let R=1;R*=this.evaluateWeight(A,h,this.models,M),R*=this.director.weight;let F=u;if(k)switch(p){case HC.Hold:break;case HC.Loop:A+=l.start,F=!0;break;default:A+=l.start,F=!0;break}let S=this.getClipTime(A,l),U=0;const T=c.duration;if(k&&p===HC.Hold&&(S=0),F){if(c.loop)for(U+=Math.floor(S/(T+1e-6));S>T;)S-=T}else if(!u&&B)switch(D){case HC.Hold:S=this.getClipTime(l.end,l);break;case HC.Loop:S%=T;break;case HC.PingPong:const K=Math.floor(S/T)%2!==0;S%=T,K&&(S=T-S);break}l.reversed===!0?d.time=d.getClip().duration-S:d.time=S,d.timeScale=0;const Y=Math.max(0,R);if(d.weight=Y,E+=Y,d.clampWhenFinished=!1,d.isRunning()||d.play(),this._useclipOffsets){const K=a==0?this._totalOffsetPosition:this._totalOffsetPosition2,O=a==0?this._totalOffsetRotation:this._totalOffsetRotation2;a<1&&(n=1-R),a+=1;const J=this._summedPos.set(0,0,0),v=this._tempPos.set(0,0,0),_=this._summedRot.identity(),X=this._tempRot.identity(),Z=c.rotation;Z&&(this._clipRotQuat.identity(),this._clipRotQuat.slerp(Z,R));const IA=this._actionOffsets[h];if(IA.hasOffsets)for(let yA=0;yA<U;yA++)IA.rootPositionOffset?v.copy(IA.rootPositionOffset):v.set(0,0,0),v.applyQuaternion(_),this._clipRotQuat&&v.applyQuaternion(this._clipRotQuat),IA.rootQuaternionOffset&&(X.copy(IA.rootQuaternionOffset),_.multiply(X)),J.add(v);this._clipRotQuat&&O.multiply(this._clipRotQuat),O.multiply(_),c.position&&J.add(c.position),K.add(J)}}}if(this._useclipOffsets&&(this._totalOffsetPosition.lerp(this._totalOffsetPosition2,n),this._totalOffsetRotation.slerp(this._totalOffsetRotation2,n)),this.__mixerError===void 0&&(OC||Be())&&(i=(e=this._animator)==null?void 0:e.runtimeAnimatorController)!=null&&i.mixer&&this.mixer!==((I=(g=this._animator)==null?void 0:g.runtimeAnimatorController)==null?void 0:I.mixer)&&(this.__mixerError=!0,console.error("AnimationTrack mixer is not shared with the animator controller - this might result in the timeline to not animate properly. Please report a bug to the Needle Engine team!",this)),(o=this._animator)!=null&&o.runtimeAnimatorController){const h=Math.max(0,1-E);(C=(s=this._animator)==null?void 0:s.runtimeAnimatorController)==null||C.update(h)}else this.mixer.update(A)}createRotationInterpolant(A,e,i){var g;const I=i.createInterpolant.bind(i),o=new UA;this.ensureTrackOffsets();const s=(g=this.trackOffset)==null?void 0:g.rotation;i.createInterpolant=()=>{const C=I(),a=C.evaluate.bind(C);return C.evaluate=n=>{var B;const Q=a(n);if(o.set(Q[0],Q[1],Q[2],Q[3]),o.premultiply(this._totalOffsetRotation),s&&o.premultiply(s),this.director.animationCallbackReceivers)for(const E of this.director.animationCallbackReceivers)(B=E?.onTimelineRotation)==null||B.call(E,this.director,this.target,n,o);return Q[0]=o.x,Q[1]=o.y,Q[2]=o.z,Q[3]=o.w,Q},C}}createPositionInterpolant(A,e,i){var g,I;const o=i.createInterpolant.bind(i),s=new f;this.ensureTrackOffsets();const C=(g=this.trackOffset)==null?void 0:g.rotation,a=(I=this.trackOffset)==null?void 0:I.position;let n;i.createInterpolant=()=>{const B=o(),Q=B.evaluate.bind(B);return B.evaluate=E=>{var h,l,d;const c=Q(E);if(s.set(c[0],c[1],c[2]),e.removeStartOffset&&(n===void 0?(n=null,n=(l=(h=this._actionOffsets.find(u=>u.clip===A))==null?void 0:h.rootStartPosition)==null?void 0:l.clone()):n!=null&&n.isVector3&&s.sub(n)),s.applyQuaternion(this._totalOffsetRotation),s.add(this._totalOffsetPosition),C&&s.applyQuaternion(C),a&&(s.x-=a.x,s.y+=a.y,s.z+=a.z),this.director.animationCallbackReceivers)for(const u of this.director.animationCallbackReceivers)(d=u?.onTimelinePosition)==null||d.call(u,this.director,this.target,E,s);return c[0]=s.x,c[1]=s.y,c[2]=s.z,c},B}}}const YQA=tA("mutetimeline"),cp=class extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"listener"),r(this,"audio",[]),r(this,"audioContextTimeOffset",[]),r(this,"lastTime",0),r(this,"audioSource"),r(this,"_audioLoader",null),r(this,"_playableDirectorResumed",!1)}getAudioFilePath(t){const A=this.director.sourceId;return Cr(A,t)}onAllowAudioChanged(t){for(let A=0;A<this.models.length;A++){const e=this.models[A];this.audio[A].setVolume(t?e.asset.volume:0)}}addModel(t){const A=new GR(this.listener);this.audio.push(A);const e=t;e._didTriggerPlay=!1,this.models.push(e)}onDisable(){for(const t of this.audio)t.isPlaying&&t.stop();for(const t of this.models)t._didTriggerPlay=!1}onDestroy(){for(const t of this.audio)t.source&&t?.disconnect();this.audio.length=0}onMuteChanged(){if(this.muted)for(let t=0;t<this.audio.length;t++){const A=this.audio[t];A!=null&&A.isPlaying&&A.stop()}}stop(){for(let t=0;t<this.audio.length;t++){const A=this.audio[t];A!=null&&A.isPlaying&&A.stop()}for(const t of this.models)t._didTriggerPlay=!1}onPauseChanged(){for(let t=0;t<this.audio.length;t++){const A=this.audio[t];A!=null&&A.isPlaying&&A.stop()}this._playableDirectorResumed=this.director.isPlaying}evaluate(t){if(YQA||this.track.muted||this.director.speed<0)return;const A=this.director.context.application.muted,e=this._playableDirectorResumed;this._playableDirectorResumed=!1;const i=A?.1:0;for(let g=0;g<this.models.length;g++){const I=this.models[g],o=this.audio[g],s=I.asset;if((!o||!o.buffer)&&this.isInTimeRange(I,t-1,t+1)&&this.handleAudioLoading(I,o),Qi.userInteractionRegistered!==!1&&!(o===null||!o.buffer))if(o.playbackRate=this.director.context.time.timeScale*this.director.speed,o.loop=s.loop,t>=I.start&&t<=I.end&&t<this.director.duration){if(!o.isPlaying||!this.director.isPlaying)(e||!I._didTriggerPlay&&this.lastTime<t)&&(I.duration*I.timeScale>.3?o.offset=I.clipIn+(t-I.start)*I.timeScale:o.offset=0,OC&&console.log("Timeline Audio ("+this.track.name+") play with offset "+o.offset+" - "+I.asset.clip),o.play(i),I._didTriggerPlay=!0);else{const a=I.clipIn+(t-I.start)*I.timeScale,n=o.context.currentTime-o._startedAt+o.offset;Math.abs(a-n)>.3&&(o.offset=a,o.stop(),o.play(i))}let C=s.volume;if(this.track.volume!==void 0&&(C*=this.track.volume),A&&(C=0),I.easeInDuration>0){const a=Math.min((t-I.start)/I.easeInDuration,1);C*=a}if(I.easeOutDuration>0){const a=Math.min((I.end-t)/I.easeOutDuration,1);C*=a}o.setVolume(C*this.director.weight)}else I._didTriggerPlay=!1,this.director.isPlaying&&o.isPlaying&&o.stop()}this.lastTime=t}loadAudio(t,A=0,e=0){let i=null;const g=t-e,I=t+A;for(const o of this.models)if(this.isInTimeRange(o,g,I)){const s=this.audio[this.models.indexOf(o)],C=this.handleAudioLoading(o,s);C!==null&&(i===null&&(i=[]),i.push(C))}return i!==null?Promise.all(i):null}isInTimeRange(t,A,e){return A<=t.start&&e>=t.end||A>=t.start&&A<=t.end||e>=t.start&&e<=t.end}static dispose(){cp._audioBuffers.clear()}handleAudioLoading(t,A){this._audioLoader||(this._audioLoader=new _y);const e=this.getAudioFilePath(t.asset.clip);if(cp._audioBuffers.get(e)){const g=cp._audioBuffers.get(e);return g.then(I=>{I&&A.setBuffer(I)}),g}OC&&console.warn("LOAD audio track",e,this.director.sourceId);const i=new Promise((g,I)=>{this._audioLoader.load(e,o=>{A.setBuffer(o),g(o)},void 0,o=>{console.error("Error loading audio",o),g(null)})});return cp._audioBuffers.set(e,i),i}};let lp=cp;r(lp,"_audioBuffers",new Map);class dp extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"didTrigger",[]),r(this,"receivers",[])}evaluate(A){var e;if(this.track.muted)return;const i=this.director.context.time.deltaTime*1.5;for(let g=0;g<this.models.length;g++){const I=this.models[g],o=this.didTrigger[g],s=I.time-A;let C=!1;if(I.retroActive)C=s<=1e-6;else{const a=Math.abs(s);(a===0||a>=1e-5&&a<i)&&(C=!0)}if(C){if(!o)if(OC&&console.log("Trigger signal",A,I.time,I),this.didTrigger[g]=!0,((e=this.receivers)==null?void 0:e.length)<=0)Nc.invoke(I.asset);else for(const a of this.receivers)a&&a.invoke(I.asset)}else I.emitOnce||(this.didTrigger[g]=!1)}}}class bm extends hp{constructor(){super(...arguments),r(this,"models",[]),r(this,"timelines",[]),r(this,"_previousActiveModel",null)}resolveSourceObjects(A){for(let e=this.models.length-1;e>=0;e--){const i=this.models[e].asset;if(!i.sourceObject||typeof i.sourceObject!="object"){console.log("no source object, removing model",e,i),this.models.splice(e,1);continue}else{const g=aA.getComponent(i.sourceObject,TQ);this.timelines.push(g),g&&i.updateDirector&&(g.playOnAwake=!1)}}}evaluate(A){var e;this._previousActiveModel=null;for(let i=0;i<this.models.length;i++){const g=this.models[i],I=g.asset;if(A>=g.start&&A<=g.end){this._previousActiveModel=g;const o=this.getClipTime(A,g);if(I.controlActivation){const s=I.sourceObject;s.visible=!0}if(I.updateDirector){const s=this.timelines[i];s&&(s.isPlaying&&s.pause(),s.time=o,s.evaluate())}}else{const o=(e=this._previousActiveModel)==null?void 0:e.asset;if(I.controlActivation){const s=I.sourceObject;o?.sourceObject!==s&&(s.visible=!1)}}}}}const Fc=tA("debugtimeline"),vK=class extends bA{constructor(){super(...arguments),r(this,"playableAsset"),r(this,"playOnAwake"),r(this,"extrapolationMode",1),r(this,"waitForAudio",!0),r(this,"_visibilityChangeEvt"),r(this,"_clonedPlayableAsset",!1),r(this,"_speed",1),r(this,"_guidsMap"),r(this,"_isPlaying",!1),r(this,"_internalUpdateRoutine"),r(this,"_isPaused",!1),r(this,"_isStopping",!1),r(this,"_time",0),r(this,"_duration",0),r(this,"_weight",1),r(this,"_animationTracks",[]),r(this,"_audioTracks",[]),r(this,"_signalTracks",[]),r(this,"_controlTracks",[]),r(this,"_customTracks",[]),r(this,"_allTracks",[this._animationTracks,this._audioTracks,this._signalTracks,this._controlTracks,this._customTracks]),r(this,"animationCallbackReceivers",[])}static registerCreateTrack(t,A){this.createTrackFunctions[t]=A}get isPlaying(){return this._isPlaying}get isPaused(){return this._isPaused}get time(){return this._time}set time(t){typeof t=="number"&&!Number.isNaN(t)?this._time=t:(Fc||ho())&&console.error("INVALID TIMELINE.TIME VALUE",t,this.name)}get duration(){return this._duration}set duration(t){this._duration=t}get weight(){return this._weight}set weight(t){this._weight=t}get speed(){return this._speed}set speed(t){this._speed=t}awake(){var t,A,e;Fc&&console.log(this,(t=this.playableAsset)==null?void 0:t.tracks),this.rebuildGraph(),this.isValid()||console.warn("PlayableDirector is not valid",this.playableAsset,(A=this.playableAsset)==null?void 0:A.tracks,Array.isArray((e=this.playableAsset)==null?void 0:e.tracks),this)}onEnable(){var t,A,e;for(const i of this._audioTracks)(t=i.onEnable)==null||t.call(i);for(const i of this._customTracks)(A=i.onEnable)==null||A.call(i);for(const i of this._animationTracks)(e=i.onEnable)==null||e.call(i);this.playOnAwake&&this.play(),this._visibilityChangeEvt||(this._visibilityChangeEvt=()=>{switch(document.visibilityState){case"hidden":this.setAudioTracksAllowPlaying(!1);break;case"visible":this.setAudioTracksAllowPlaying(!0);break}}),window.addEventListener("visibilitychange",this._visibilityChangeEvt)}onDisable(){var t,A,e;this.stop();for(const i of this._audioTracks)(t=i.onDisable)==null||t.call(i);for(const i of this._customTracks)(A=i.onDisable)==null||A.call(i);for(const i of this._animationTracks)(e=i.onDisable)==null||e.call(i);this._visibilityChangeEvt&&window.removeEventListener("visibilitychange",this._visibilityChangeEvt)}onDestroy(){var t;for(const A of this._allTracks)for(const e of A)(t=e.onDestroy)==null||t.call(e)}rebuildGraph(){this.isValid()&&(this.resolveBindings(),this.updateTimelineDuration(),this.setupAndCreateTrackHandlers())}async play(){if(!this.isValid())return;const t=this._isPaused==!0;if(this._isPaused=!1,!this._isPlaying){if(this._isPlaying=!0,t&&this.invokePauseChangedMethodsOnTracks(),this.waitForAudio){const A=[];for(const e of this._audioTracks){const i=e.loadAudio(this._time,1,0);i&&A.push(i)}if(A.length>0&&(await Promise.all(A),!this._isPlaying))return;for(;this._audioTracks.length>0&&this._isPlaying&&!Qi.userInteractionRegistered&&this.waitForAudio;)await GC(200)}this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine=this.startCoroutine(this.internalUpdate(),Zt.LateUpdate)}}pause(){this.isValid()&&(this._isPlaying=!1,!this._isPaused&&(this._isPaused=!0,this.internalEvaluate(),this.invokePauseChangedMethodsOnTracks(),this.invokeStateChangedMethodsOnTracks()))}stop(){this._isStopping=!0;for(const e of this._audioTracks)e.stop();const t=this._isPaused==!0,A=this._isPlaying;this._isPlaying&&(this._time=0,this._isPlaying=!1,this._isPaused=!1,this.internalEvaluate(),t&&this.invokePauseChangedMethodsOnTracks()),this._isPlaying=!1,this._isPaused=!1,t&&!A&&this.invokePauseChangedMethodsOnTracks(),A&&this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine&&this.stopCoroutine(this._internalUpdateRoutine),this._internalUpdateRoutine=null,this._isStopping=!1}evaluate(){this.internalEvaluate(!0)}isValid(){return this.playableAsset&&this.playableAsset.tracks&&Array.isArray(this.playableAsset.tracks)}*forEachTrack(){for(const t of this._allTracks)for(const A of t)yield A}get audioTracks(){return this._audioTracks}resolveGuids(t){this._guidsMap=t}invokePauseChangedMethodsOnTracks(){var t;for(const A of this.forEachTrack())(t=A.onPauseChanged)==null||t.call(A)}invokeStateChangedMethodsOnTracks(){var t;for(const A of this.forEachTrack())(t=A.onStateChanged)==null||t.call(A,this._isPlaying)}*internalUpdate(){for(;this._isPlaying&&this.activeAndEnabled;)!this._isPaused&&this._isPlaying&&(this._time+=this.context.time.deltaTime*this.speed,this.internalEvaluate()),yield}internalEvaluate(t=!1){if(!this.isValid())return;let A=this._time;switch(this.extrapolationMode){case 0:this._speed>0?A=Math.min(A,this._duration):this._speed<0&&(A=Math.max(A,0)),this._time=A;break;case 1:A%=this._duration,this._time=A;break;case 2:if(A>this._duration){this.stop();return}break}const e=this._time;for(const i of this.playableAsset.tracks)if(!i.muted)switch(i.type){case Ko.Activation:if(!t&&!this._isPlaying)continue;for(let g=0;g<i.outputs.length;g++){const I=i.outputs[g];if(typeof I=="object"){let o=!1;if(i.clips)for(const C of i.clips)C.start<=e&&e<=C.end&&(o=!0);const s=I;s.visible!==void 0&&s.visible!==o&&(s.visible=o,Fc&&console.warn(this.name,"set ActivationTrack-"+g,s.name,o,e))}}break}if(!this._isStopping)for(const i of this._animationTracks)i.evaluate(e);for(const i of this._audioTracks)i.evaluate(e);for(const i of this._signalTracks)i.evaluate(e);for(const i of this._controlTracks)i.evaluate(e);for(const i of this._customTracks)i.evaluate(e)}resolveBindings(){if(this._clonedPlayableAsset||(this._clonedPlayableAsset=!0,this.playableAsset=Gd(this.playableAsset)),!this.playableAsset||!this.playableAsset.tracks)return;const t=this.findRoot(this.gameObject);for(const A of this.playableAsset.tracks){for(let e=A.outputs.length-1;e>=0;e--){let i=A.outputs[e];if(typeof i=="string"){this._guidsMap&&this._guidsMap[i]&&(i=this._guidsMap[i]);const g=aA.findByGuid(i,t);g===null||typeof g!="object"?(A.outputs.splice(e,1),console.warn("Failed to resolve binding",i,A.name,A.type)):(Fc&&console.log("Resolved binding",i,"to",g),A.outputs[e]=g)}else if(i===null){if(A.outputs.splice(e,1),vK.createTrackFunctions[A.type])continue;A.type!==Ko.Audio&&A.type!==Ko.Control&&A.type!==Ko.Marker&&A.type!==Ko.Signal&&console.warn("Missing binding",i,A.name,A.type,this.name,this.playableAsset.name)}}if(A.type===Ko.Control&&A.clips)for(let e=0;e<A.clips.length;e++){const i=A.clips[e];let g=i.asset.sourceObject;if(typeof g=="string"){this._guidsMap&&this._guidsMap[g]&&(g=this._guidsMap[g]);const I=aA.findByGuid(g,t);I===null||typeof I!="object"?console.warn("Failed to resolve sourceObject binding",g,A.name,i):(Fc&&console.log("Resolved binding",g,"to",I),i.asset.sourceObject=I)}}}}findRoot(t){return t.parent?this.findRoot(t.parent):t}updateTimelineDuration(){if(this._duration=0,!(!this.playableAsset||!this.playableAsset.tracks)){for(const t of this.playableAsset.tracks)if(t.muted!==!0){if(t.clips)for(const A of t.clips)A.end>this._duration&&(this._duration=A.end);if(t.markers)for(const A of t.markers)A.time>this._duration&&(this._duration=A.time+.001)}}}setupAndCreateTrackHandlers(){var t,A,e;if(this._animationTracks.length=0,this._audioTracks.length=0,this._signalTracks.length=0,!this.playableAsset)return;let i=aA.findObjectOfType(Wr,this.context);for(const g of this.playableAsset.tracks){const I=g.type,o=vK.createTrackFunctions[I];if(o!=null){const s=o(this,g);if(typeof s.evaluate=="function"){s.director=this,s.track=g,this._customTracks.push(s);continue}}if(g.type===Ko.Animation){if(!g.clips||g.clips.length<=0){Fc&&console.warn("Animation track has no clips",g);continue}for(let s=g.outputs.length-1;s>=0;s--){let C=g.outputs[s];if(C instanceof wA){const n=aA.getOrAddComponent(C,Zg);n&&(C=n)}const a=(t=C?.gameObject)==null?void 0:t.animations;if(a){const n=new Fm;n.trackOffset=g.trackOffset,n.director=this,n.track=g;for(let B=0;B<g.clips.length;B++){const Q=g.clips[B],E=Q.asset;if(!E){console.error(`Timeline ${this.name}: clip #${B} on track "${g.name}" has no animation data`);continue}const h=E.clip;let l=h;if((typeof l=="string"||typeof l=="number")&&(l=a.find(c=>c.name===h)),!l){console.warn("Could not find animationClip for model",Q,g.name,this.name,(A=this.playableAsset)==null?void 0:A.name);continue}C instanceof Zg&&C.runtimeAnimatorController&&(C.__internalDidAwakeAndStart||C.initializeRuntimeAnimatorController(),C.runtimeAnimatorController.mixer||C.runtimeAnimatorController.bind(C),n.mixer=C.runtimeAnimatorController.mixer),n.mixer||(n.mixer=new Ty(C.gameObject)),n.clips.push(l),n.mixer.uncacheAction(l),n.createHooks(Q.asset,l);const d=n.mixer.clipAction(l);n.actions.push(d),n.models.push(Q)}this._animationTracks.push(n)}}}else if(g.type===Ko.Audio){if(!g.clips||g.clips.length<=0)continue;const s=new lp;s.director=this,s.track=g,s.audioSource=g.outputs.find(C=>C instanceof Qi),this._audioTracks.push(s),i||(i=(e=this.context.mainCameraComponent)==null?void 0:e.gameObject.addNewComponent(Wr)),s.listener=i.listener;for(let C=0;C<g.clips.length;C++){const a=g.clips[C];s.addModel(a)}}else if(g.type===Ko.Marker){const s=new dp;if(s.director=this,s.track=g,g.markers)for(const C of g.markers)switch(C.type){case KK.Signal:s.models.push(C),s.didTrigger.push(!1);break}if(s!==null&&s.models.length>0){const C=aA.getComponent(this.gameObject,Nc);C&&(s.receivers.push(C),this._signalTracks.push(s))}}else if(g.type===Ko.Signal){const s=new dp;if(s.director=this,s.track=g,g.markers)for(const C of g.markers)s.models.push(C),s.didTrigger.push(!1);for(const C of g.outputs)s.receivers.push(C);this._signalTracks.push(s)}else if(g.type===Ko.Control){const s=new bm;if(s.director=this,s.track=g,g.clips)for(const C of g.clips)s.models.push(C);s.resolveSourceObjects(this.context),this._controlTracks.push(s)}}}setAudioTracksAllowPlaying(t){for(const A of this._audioTracks)A.onAllowAudioChanged(t)}registerAnimationCallback(t){this.animationCallbackReceivers.push(t)}unregisterAnimationCallback(t){const A=this.animationCallbackReceivers.indexOf(t);A!==-1&&this.animationCallbackReceivers.splice(A,1)}};let TQ=vK;r(TQ,"createTrackFunctions",{});const Km=Symbol("objectIsAnimatedData");function oj(t,A,e){if(!t)return;if(t[Km]===void 0){if(!e)return;t[Km]=new Set}const i=t[Km];e?i.add(A):i.has(A)&&i.delete(A)}function HQA(t){if(!t)return!1;const A=t[Km];return A!==void 0&&A.size>0}Bt.registerCallback(ki.ContextCreated,t=>{const A=t.context.domElement.getAttribute("autoplay");if(A!==void 0&&(A===""||A==="true")&&t.files)for(const e of t.files)aA.foreachComponent(e.file.scene,i=>{if(i.enabled!==!1){if(i instanceof jI&&i.playAutomatically||i instanceof Zg||i instanceof TQ&&i.playOnAwake===!0)return!0;if(i instanceof jI)return i.playAutomatically=!0,!0;if(i instanceof TQ)return i.playOnAwake=!0,!0}},!0)!==!0&&OQA(e.file)});function OQA(t){if(!t||!t.animations)return;for(let e=0;e<t.animations.length;e++){const i=t.animations[e];if(!(!i.tracks||i.tracks.length<=0))for(const g in i.tracks){const I=i.tracks[g],o=I.__objectName??I.name.substring(0,I.name.indexOf("."));let s=t.scene.getObjectByName(o);if(!s&&(s=t.scene.getObjectByProperty("uuid",o),!s))continue;let C=A(s);C||(C=Lr(t.scene,new jI));const a=C.animations=C.animations||[];i.name_animator=C.name,a.indexOf(i)<0&&a.push(i)}}function A(e){var i;if(!e)return;const g=(i=e.userData)==null?void 0:i.components;if(g&&g.length>0)for(let I=0;I<g.length;I++){const o=g[I];if(o instanceof Zg||o instanceof jI)return e}return A(e.parent)}}class PQA{constructor(){r(this,"_context")}get context(){return this._context??Ke.Current}get isStateMachineBehaviour(){return!0}}class up{constructor(A,e,i,g){r(this,"name"),r(this,"nameHash"),r(this,"normalizedTime"),r(this,"length"),r(this,"speed"),r(this,"action"),r(this,"hasTransitions");var I;this.name=A.name,this.nameHash=A.hash,this.normalizedTime=e,this.length=i,this.speed=g,this.action=A.motion.action||null,this.hasTransitions=((I=A.transitions)==null?void 0:I.length)>0||!1}}function sj(t,A){return{name:"Empty",isLooping:!1,guid:A?.generateUUID()??og.generateUUID(),index:-1,clip:new JI(t,0,[])}}var Zr=(t=>(t[t.If=1]="If",t[t.IfNot=2]="IfNot",t[t.Greater=3]="Greater",t[t.Less=4]="Less",t[t.Equals=6]="Equals",t[t.NotEqual=7]="NotEqual",t))(Zr||{}),JK=(t=>(t[t.Float=1]="Float",t[t.Int=3]="Int",t[t.Bool=4]="Bool",t[t.Trigger=9]="Trigger",t))(JK||{});const kg=tA("debuganimatorcontroller"),vm=tA("debugrootmotion");class zo{constructor(A){r(this,"_speed",1),r(this,"normalizedStartOffset",0),r(this,"animator"),r(this,"model"),r(this,"_mixer"),r(this,"_activeState"),r(this,"_activeStates",[]),r(this,"_heldActions",[]),r(this,"rootMotionHandler"),this.model=A,kg&&console.log(this)}static createFromClips(A,e={looping:!1,autoTransition:!0,transitionDuration:0}){const i=[];for(let I=0;I<A.length;I++){const o=A[I],s=[];if(e.autoTransition!==!1){const a=e.transitionDuration??0,n=a/o.duration;let B=I;(e.autoTransition===void 0||e.autoTransition===!0)&&(B=(I+1)%A.length),s.push({exitTime:1-n,offset:0,duration:a,hasExitTime:!0,destinationState:B,conditions:[]})}const C={name:o.name,hash:I,motion:{name:o.name,clip:o,isLooping:e?.looping??!1},transitions:s,behaviours:[]};i.push(C)}const g={name:"AnimatorController",guid:new Fg(Date.now()).generateUUID(),parameters:[],layers:[{name:"Base Layer",stateMachine:{defaultState:0,states:i}}]};return new zo(g)}play(A,e=-1,i=Number.NEGATIVE_INFINITY,g=0){if(e<0)e=0;else if(e>=this.model.layers.length){console.warn("invalid layer");return}const I=this.model.layers[e].stateMachine;for(const o of I.states)if(o.name===A||o.hash===A){kg&&console.log("transition to ",o),this.transitionTo(o,g,i);return}console.warn("Could not find "+A+" to play")}reset(){this.setStartTransition()}setBool(A,e){var i,g;const I=typeof A=="string"?"name":"hash";return(g=(i=this.model)==null?void 0:i.parameters)==null?void 0:g.filter(o=>o[I]===A).forEach(o=>o.value=e)}getBool(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??!1}setFloat(A,e){var i,g;const I=typeof A=="string"?"name":"hash",o=(g=(i=this.model)==null?void 0:i.parameters)==null?void 0:g.filter(s=>s[I]===A);return o.forEach(s=>s.value=e),o?.length>0}getFloat(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??0}setInteger(A,e){var i,g;const I=typeof A=="string"?"name":"hash";return(g=(i=this.model)==null?void 0:i.parameters)==null?void 0:g.filter(o=>o[I]===A).forEach(o=>o.value=e)}getInteger(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??0}setTrigger(A){var e,i;kg&&console.log("SET TRIGGER",A);const g=typeof A=="string"?"name":"hash";return(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.filter(I=>I[g]===A).forEach(I=>I.value=!0)}resetTrigger(A){var e,i;const g=typeof A=="string"?"name":"hash";return(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.filter(I=>I[g]===A).forEach(I=>I.value=!1)}getTrigger(A){var e,i,g;const I=typeof A=="string"?"name":"hash";return((g=(i=(e=this.model)==null?void 0:e.parameters)==null?void 0:i.find(o=>o[I]===A))==null?void 0:g.value)??!1}isInTransition(){return this._activeStates.length>1}setSpeed(A){this._speed=A}FindState(A){return this.findState(A)}findState(A){if(!A)return null;if(Array.isArray(this.model.layers)){for(const e of this.model.layers)for(const i of e.stateMachine.states)if(i.name===A||i.hash==A)return i}return null}getCurrentStateInfo(){if(!this._activeState)return null;const A=this._activeState.motion.action;if(!A)return null;const e=this._activeState.motion.clip.duration,i=e<=0?0:Math.abs(A.time/e);return new up(this._activeState,i,e,this._speed)}get currentAction(){return this._activeState&&this._activeState.motion.action||null}get context(){var A;return(A=this.animator)==null?void 0:A.context}get mixer(){return this._mixer}bind(A){A?this.animator!==A&&(this.animator=A,this._mixer=new Ty(this.animator.gameObject),this.createActions(this.animator)):console.error("AnimatorController.bind: animator is null")}clone(){if(typeof this.model=="string")return console.warn("AnimatorController has not been resolved, can not create model from string",this.model),null;kg&&console.warn("AnimatorController clone()",this.model);const A=Gd(this.model,(e,i,g)=>g==null?!0:!(g.type==="Object3D"||g.isObject3D===!0||eH(g)||g.tracks!==void 0||g instanceof zo));return console.assert(A!==this.model),new zo(A)}update(A){var e,i;if(!this.animator)return;this.evaluateTransitions(),this.updateActiveStates(A);const g=this.animator.context.time.deltaTime;this.animator.applyRootMotion&&((e=this.rootMotionHandler)==null||e.onBeforeUpdate(A)),this._mixer.update(g),this.animator.applyRootMotion&&((i=this.rootMotionHandler)==null||i.onAfterUpdate(A))}get activeState(){return this._activeState}updateActiveStates(A){for(let e=0;e<this._activeStates.length;e++){const i=this._activeStates[e],g=i.motion;if(!g.action)this._activeStates.splice(e,1),e--;else{const I=g.action;I.weight=A,I.getEffectiveWeight()<=0&&!I.isRunning()&&(kg&&console.debug("REMOVE",i.name,I.getEffectiveWeight(),I.isRunning(),I.isScheduled()),this._activeStates.splice(e,1),e--)}}}setStartTransition(){var A;this.model.layers.length>1&&(kg||Be())&&console.warn("Multiple layers are not supported yet "+((A=this.animator)==null?void 0:A.name));for(const e of this.model.layers){const i=e.stateMachine;i.defaultState===void 0&&(kg&&console.warn("AnimatorController default state is undefined, will assign state 0 as default",e),i.defaultState=0);const g=i.states[i.defaultState];this.transitionTo(g,0,this.normalizedStartOffset);break}}evaluateTransitions(){var A;let e=!1;if(!this._activeState){if(this.setStartTransition(),!this._activeState)return;e=!0}const i=this._activeState,g=i.motion.action;for(const o of i.transitions){if(!o.hasExitTime&&o.conditions.length<=0)continue;let s=!0;for(const C of o.conditions)if(!this.evaluateCondition(C)){s=!1;break}if(s)if(g){const C=i.motion.clip.duration,a=C<=0?1:Math.abs(g.time/C);let n=o.exitTime;g.timeScale<0&&(n=1-n);let B=!1;if(o.hasExitTime?B=a>=n:B=!0,B){for(const Q of o.conditions){const E=this.model.parameters.find(h=>h.name===Q.parameter);E?.type===JK.Trigger&&E.value&&(E.value=!1)}if(g.clampWhenFinished=!0,kg){const Q=this.getState(o.destinationState,0);console.log(`Transition to ${o.destinationState} / ${Q?.name}`,o,`
|
|
5520
5520
|
Timescale: `+g.timeScale,`
|
|
5521
5521
|
Normalized time: `+a.toFixed(3),`
|
|
5522
5522
|
Exit Time: `+n,o.hasExitTime)}this.transitionTo(o.destinationState,o.duration,o.offset);return}}else{this.transitionTo(o.destinationState,o.duration,o.offset);return}}g&&this.setTimescale(g,i);let I=!1;if(i.motion.isLooping&&g&&(g.time>=g.getClip().duration?(I=!0,g.reset(),g.time=0,g.play()):g.time<=0&&g.timeScale<0&&(I=!0,g.reset(),g.time=g.getClip().duration,g.play())),!I&&i&&!e&&g&&this.animator&&i.behaviours){const o=g?.getClip().duration,s=g.time/o,C=new up(this._activeState,s,o,this._speed);for(const a of i.behaviours)a.instance&&((A=a.instance.onStateUpdate)==null||A.call(a.instance,this.animator,C,0))}}setTimescale(A,e){let i=e.speed??1;e.speedParameter&&(i*=this.getFloat(e.speedParameter)),i!==void 0&&(A.timeScale=i*this._speed)}getState(A,e){return typeof A=="number"&&(A==-1&&(A=this.model.layers[e].stateMachine.defaultState,A===void 0&&(kg&&console.warn("AnimatorController default state is undefined: ",this.model,"Layer: "+e),A=0)),A=this.model.layers[e].stateMachine.states[A]),A}releaseHeldActions(A){for(const e of this._heldActions)e.fadeOut(A);this._heldActions.length=0}transitionTo(A,e,i){var g,I,o,s,C,a,n,B;if(!this.animator)return;const Q=0;if(A=this.getState(A,Q),!(A!=null&&A.motion)||!A.motion.clip||!(A.motion.clip instanceof JI))return;const E=this._activeState===A;if(E){const u=A.motion;if(!u.action_loopback&&u.clip){const p=this.rootMotionHandler?this.animator.gameObject.matrix.clone():null;this._mixer.uncacheAction(u.clip,this.animator.gameObject),p&&p.decompose(this.animator.gameObject.position,this.animator.gameObject.quaternion,this.animator.gameObject.scale),u.action_loopback=this.createAction(u.clip)}}if((g=this._activeState)!=null&&g.behaviours&&this._activeState.motion.action){const u=(I=this._activeState)==null?void 0:I.motion.clip.duration,p=this._activeState.motion.action.time/u,D=new up(this._activeState,p,u,this._speed);for(const m of this._activeState.behaviours)(s=(o=m.instance)==null?void 0:o.onStateExit)==null||s.call(m.instance,this.animator,D,Q)}const h=(C=this._activeState)==null?void 0:C.motion.action;E&&(A.motion.action=A.motion.action_loopback,A.motion.action_loopback=h);const l=this._activeState;this._activeState=A;const d=(a=A.motion)==null?void 0:a.action,c=A.motion.clip;if(c?.duration<=0&&c.tracks.length<=0?h&&this._heldActions.push(h):h&&(h.fadeOut(e),this.releaseHeldActions(e)),d){if(i=Math.max(0,Math.min(1,i)),A.cycleOffsetParameter){let p=this.getFloat(A.cycleOffsetParameter);typeof p=="number"?(p<0&&(p+=1),i+=p,i%=1):kg&&console.warn("AnimatorController cycle offset parameter is not a number",A.cycleOffsetParameter)}else typeof A.cycleOffset=="number"&&(i+=A.cycleOffset,i%=1);d.isRunning()&&d.stop(),d.reset(),d.enabled=!0,this.setTimescale(d,A);const u=A.motion.clip.duration;if(d.time=E?0:i*u,d.timeScale<0&&(d.time=u-d.time),d.clampWhenFinished=!0,d.setLoop(Pl,0),e>0?d.fadeIn(e):d.weight=1,d.play(),this.rootMotionHandler&&this.rootMotionHandler.onStart(d),this._activeStates.includes(A)||this._activeStates.push(A),this._activeState.behaviours){const p=new up(A,i,u,this._speed);for(const D of this._activeState.behaviours)(B=(n=D.instance)==null?void 0:n.onStateEnter)==null||B.call(D.instance,this.animator,p,Q)}}else kg&&(A.__warned_no_motion||(A.__warned_no_motion=!0,console.warn("No action",A.motion,this)));kg&&console.log("TRANSITION FROM "+l?.name+" TO "+A.name,e,h,d,d?.getEffectiveTimeScale(),d?.getEffectiveWeight(),d?.isRunning(),d?.isScheduled(),d?.paused)}createAction(A){var e,i;if(this._mixer.existingAction(A)&&this._mixer.uncacheAction(A,(e=this.animator)==null?void 0:e.gameObject),(i=this.animator)!=null&&i.applyRootMotion){this.rootMotionHandler||(this.rootMotionHandler=new jQA(this));const g=this.animator.gameObject;return this.rootMotionHandler.createClip(this._mixer,g,A)}else return this._mixer.clipAction(A)}evaluateCondition(A){const e=this.model.parameters.find(i=>i.name===A.parameter);if(!e)return!1;switch(A.mode){case Zr.If:return e.value===!0;case Zr.IfNot:return e.value===!1;case Zr.Greater:return e.value>A.threshold;case Zr.Less:return e.value<A.threshold;case Zr.Equals:return e.value===A.threshold;case Zr.NotEqual:return e.value!==A.threshold}return!1}createActions(A){var e,i,g,I;kg&&console.log("AnimatorController createActions",this.model);for(const o of this.model.layers){const s=o.stateMachine;for(let C=0;C<s.states.length;C++){const a=s.states[C];a.transitions||(a.transitions=[]);for(const n of a.transitions)n.conditions||(n.conditions=[]);if(a.motion||(kg&&console.warn("No motion",a),a.motion=sj(a.name)),this.animator&&a.motion.clips){const n=(e=a.motion.clips)==null?void 0:e.find(B=>{var Q,E;return B.node.name===((E=(Q=this.animator)==null?void 0:Q.gameObject)==null?void 0:E.name)});n?a.motion.clip=n.clip:(kg||Be())&&console.warn('Could not find clip for animator "'+((g=(i=this.animator)==null?void 0:i.gameObject)==null?void 0:g.name)+'"',a.motion.clips.map(B=>B.node.name))}if(!a.motion.clip){kg&&console.warn("No clip assigned to state",a);const n=new JI(void 0,void 0,[]);a.motion.clip=n}if((I=a.motion)!=null&&I.clip){const n=a.motion.clip;if(n instanceof JI){const B=this.createAction(n);a.motion.action=B}else(kg||Be())&&console.warn("No valid animationclip assigned",a)}if(a.behaviours&&Array.isArray(a.behaviours))for(const n of a.behaviours){if(!(n!=null&&n.typeName))continue;const B=W.get(n.typeName),Q=new B;Q.isStateMachineBehaviour&&(Q._context=this.context??void 0,Th(Q,n.properties),n.instance=Q),kg&&console.log("Created animator controller behaviour",a.name,n.typeName,n.properties,Q)}}}}*enumerateActions(){if(this.model.layers)for(const A of this.model.layers){const e=A.stateMachine;for(let i=0;i<e.states.length;i++){const g=e.states[i];g!=null&&g.motion&&(g.motion.action&&(yield g.motion.action),g.motion.action_loopback&&(yield g.motion.action_loopback))}}}}class Cj{constructor(A,e){r(this,"track"),r(this,"createdInterpolant"),r(this,"originalEvaluate"),r(this,"customEvaluate"),this.track=A;const i=A,g=i.createInterpolant.bind(A);i.createInterpolant=()=>(i.createInterpolant=g,this.createdInterpolant=g(),this.originalEvaluate=this.createdInterpolant.evaluate.bind(this.createdInterpolant),this.customEvaluate=I=>{if(!this.originalEvaluate)return;const o=this.originalEvaluate(I);return e(I,o)},this.createdInterpolant.evaluate=this.customEvaluate,this.createdInterpolant)}dispose(){this.createdInterpolant&&this.originalEvaluate&&(this.createdInterpolant.evaluate=this.originalEvaluate),this.track=void 0,this.createdInterpolant=null,this.originalEvaluate=void 0,this.customEvaluate=void 0}}const Gg=class{constructor(t,A,e,i,g){if(r(this,"_action"),r(this,"root"),r(this,"clip"),r(this,"positionWrapper",null),r(this,"rotationWrapper",null),r(this,"context"),r(this,"positionChange",new f),r(this,"rotationChange",new UA),r(this,"_prevTime",0),this.context=t,this.root=A,this.clip=e,Gg.firstKeyframeRotation[this.cacheId]||(Gg.firstKeyframeRotation[this.cacheId]=new UA),g){const I=g.values;Gg.firstKeyframeRotation[this.cacheId].set(I[0],I[1],I[2],I[3])}Gg.spaceRotation[this.cacheId]||(Gg.spaceRotation[this.cacheId]=new UA),Gg.effectiveSpaceRotation[this.cacheId]||(Gg.effectiveSpaceRotation[this.cacheId]=new UA),Gg.clipOffsetRotation[this.cacheId]=new UA,g&&Gg.clipOffsetRotation[this.cacheId].set(g.values[0],g.values[1],g.values[2],g.values[3]).invert(),this.handlePosition(e,i),this.handleRotation(e,g)}set action(t){this._action=t}get action(){return this._action}get cacheId(){return this.root.uuid}onStart(t){if(t.getClip()!==this.clip)return;Gg.lastObjRotation[this.cacheId]||(Gg.lastObjRotation[this.cacheId]=this.root.quaternion.clone());const A=Gg.lastObjRotation[this.cacheId];if(Gg.spaceRotation[this.cacheId].copy(A),vm){const e=new ai().setFromQuaternion(A);console.log("START",this.clip.name,ee.toDegrees(e.y),this.root.position.z)}}getClipRotationOffset(){return Gg.clipOffsetRotation[this.cacheId]}handlePosition(t,A){if(A){const e=this.root;vm&&e.add(new is),Gg.lastObjPosition[this.cacheId]||(Gg.lastObjPosition[this.cacheId]=this.root.position.clone());const i=new f,g=new f;this.positionWrapper=new Cj(A,(I,o)=>{const s=this.action.getEffectiveWeight();return vm&&e.position.length()>8&&e.position.set(0,e.position.y,0),I>this._prevTime&&(i.set(o[0],o[1],o[2]),i.sub(g),i.multiplyScalar(s),i.applyQuaternion(this.getClipRotationOffset()),i.applyQuaternion(e.quaternion),this.positionChange.copy(i)),g.fromArray(o),this._prevTime=I,o[0]=0,o[1]=0,o[2]=0,o})}}handleRotation(t,A){if(A){if(vm){const I=A.values,o=new ai().setFromQuaternion(new UA(I[0],I[1],I[2],I[3]));console.log(t.name,A.name,"FIRST ROTATION IN TRACK",ee.toDegrees(o.y));const s=A.values.length-4,C=new UA().set(I[s],I[s+1],I[s+2],I[s+3]),a=new ai().setFromQuaternion(C);console.log(t.name,A.name,"LAST ROTATION IN TRACK",ee.toDegrees(a.y))}let e=0;const i=new UA,g=new UA;this.rotationWrapper=new Cj(A,(I,o)=>(I>e&&(g.set(o[0],o[1],o[2],o[3]),i.invert(),g.multiply(i),this.rotationChange.copy(g)),i.fromArray(o),e=I,o[0]=0,o[1]=0,o[2]=0,o[3]=1,o))}}onBeforeUpdate(t){this.positionChange.set(0,0,0),this.rotationChange.set(0,0,0,1)}onAfterUpdate(t){return!this.action||(t*=this.action.getEffectiveWeight(),t<=0)?!1:(this.positionChange.multiplyScalar(t),this.rotationChange.slerp(Gg.identityQuaternion,1-t),!0)}};let Vr=Gg;r(Vr,"lastObjPosition",{}),r(Vr,"lastObjRotation",{}),r(Vr,"firstKeyframeRotation",{}),r(Vr,"spaceRotation",{}),r(Vr,"effectiveSpaceRotation",{}),r(Vr,"clipOffsetRotation",{}),r(Vr,"identityQuaternion",new UA);class jQA{constructor(A){r(this,"controller"),r(this,"handler",[]),r(this,"root"),r(this,"basePosition",new f),r(this,"baseQuaternion",new UA),r(this,"baseRotation",new ai),r(this,"summedPosition",new f),r(this,"summedRotation",new UA),this.controller=A}createClip(A,e,i){this.root=e,e&&"name"in e&&e.name;const g=this.findRootTrack(i,".position"),I=this.findRootTrack(i,".quaternion"),o=new Vr(this.controller.context,e,i,g,I);this.handler.push(o);const s=A.clipAction(i);return o.action=s,s}onStart(A){for(const e of this.handler)e.onStart(A)}onBeforeUpdate(A){this.basePosition.copy(this.root.position),this.baseQuaternion.copy(this.root.quaternion);for(const e of this.handler)e.onBeforeUpdate(A)}onAfterUpdate(A){if(!(A<=0)){this.root.position.copy(this.basePosition),this.root.quaternion.copy(this.baseQuaternion),this.summedPosition.set(0,0,0),this.summedRotation.set(0,0,0,1);for(const e of this.handler)e.onAfterUpdate(A)&&(this.summedPosition.add(e.positionChange),this.summedRotation.multiply(e.rotationChange));this.root.position.add(this.summedPosition),this.root.quaternion.multiply(this.summedRotation)}}findRootTrack(A,e){const i=A.tracks;if(!i)return null;for(const g of i)if(g.name.endsWith(e))return g;return null}}class WQA extends bC{onSerialize(A,e){}onDeserialize(A,e){if(e.type===zo&&A?.__type==="AnimatorController")return new zo(A)}}new WQA(zo);var ZQA=Object.defineProperty,VQA=Object.getOwnPropertyDescriptor,Jm=(t,A,e,i)=>{for(var g=i>1?void 0:i?VQA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&ZQA(A,e,g),g};const Ss=tA("debuganimator");class Zg extends bA{constructor(){super(...arguments),r(this,"applyRootMotion",!1),r(this,"hasRootMotion",!1),r(this,"keepAnimatorControllerStateOnDisable",!1),r(this,"_parametersAreDirty",!1),r(this,"_isDirty",!1),r(this,"_speed",1),r(this,"_normalizedStartOffset",0),r(this,"_animatorController",null),r(this,"_initializeWithRuntimeAnimatorController")}set runtimeAnimatorController(A){var e;this._animatorController&&this._animatorController.model===A||(A?A instanceof zo?(A.animator&&A.animator!==this&&(console.warn("AnimatorController can not be bound to multiple animators",(e=A.model)==null?void 0:e.name),A.model||console.error("AnimatorController has no model"),A=new zo(A.model)),this._animatorController=A,this._animatorController.bind(this)):(Ss&&console.log("Assign animator controller",A,this),this._animatorController=new zo(A),this.__didAwake&&this._animatorController.bind(this)):this._animatorController=null)}get runtimeAnimatorController(){return this._animatorController}getCurrentStateInfo(){var A;return(A=this.runtimeAnimatorController)==null?void 0:A.getCurrentStateInfo()}get currentAction(){var A;return((A=this.runtimeAnimatorController)==null?void 0:A.currentAction)||null}get parametersAreDirty(){return this._parametersAreDirty}get isDirty(){return this._isDirty}Play(A,e=-1,i=Number.NEGATIVE_INFINITY,g=0){this.play(A,e,i,g)}play(A,e=-1,i=Number.NEGATIVE_INFINITY,g=0){var I;(I=this.runtimeAnimatorController)==null||I.play(A,e,i,g),this._isDirty=!0}Reset(){this.reset()}reset(){var A;(A=this._animatorController)==null||A.reset(),this._isDirty=!0}SetBool(A,e){this.setBool(A,e)}setBool(A,e){var i,g;Ss&&console.log("setBool",A,e),((i=this.runtimeAnimatorController)==null?void 0:i.getBool(A))!==e&&(this._parametersAreDirty=!0),(g=this.runtimeAnimatorController)==null||g.setBool(A,e)}GetBool(A){return this.getBool(A)}getBool(A){var e;const i=((e=this.runtimeAnimatorController)==null?void 0:e.getBool(A))??!1;return Ss&&console.log("getBool",A,i),i}toggleBool(A){this.setBool(A,!this.getBool(A))}SetFloat(A,e){this.setFloat(A,e)}setFloat(A,e){var i,g;((i=this.runtimeAnimatorController)==null?void 0:i.getFloat(A))!==e&&(this._parametersAreDirty=!0),Ss&&console.log("setFloat",A,e),(g=this.runtimeAnimatorController)==null||g.setFloat(A,e)}GetFloat(A){return this.getFloat(A)}getFloat(A){var e;const i=((e=this.runtimeAnimatorController)==null?void 0:e.getFloat(A))??-1;return Ss&&console.log("getFloat",A,i),i}SetInteger(A,e){this.setInteger(A,e)}setInteger(A,e){var i,g;((i=this.runtimeAnimatorController)==null?void 0:i.getInteger(A))!==e&&(this._parametersAreDirty=!0),Ss&&console.log("setInteger",A,e),(g=this.runtimeAnimatorController)==null||g.setInteger(A,e)}GetInteger(A){return this.getInteger(A)}getInteger(A){var e;const i=((e=this.runtimeAnimatorController)==null?void 0:e.getInteger(A))??-1;return Ss&&console.log("getInteger",A,i),i}SetTrigger(A){this.setTrigger(A)}setTrigger(A){var e;this._parametersAreDirty=!0,Ss&&console.log("setTrigger",A),(e=this.runtimeAnimatorController)==null||e.setTrigger(A)}ResetTrigger(A){this.resetTrigger(A)}resetTrigger(A){var e;this._parametersAreDirty=!0,Ss&&console.log("resetTrigger",A),(e=this.runtimeAnimatorController)==null||e.resetTrigger(A)}GetTrigger(A){this.getTrigger(A)}getTrigger(A){var e;const i=(e=this.runtimeAnimatorController)==null?void 0:e.getTrigger(A);return Ss&&console.log("getTrigger",A,i),i}IsInTransition(){return this.isInTransition()}isInTransition(){var A;return((A=this.runtimeAnimatorController)==null?void 0:A.isInTransition())??!1}SetSpeed(A){return this.setSpeed(A)}setSpeed(A){var e;A!==this._speed&&(Ss&&console.log("setSpeed",A),this._speed=A,((e=this._animatorController)==null?void 0:e.animator)==this&&this._animatorController.setSpeed(A))}set minMaxSpeed(A){var e;this._speed=ee.lerp(A.x,A.y,Math.random()),((e=this._animatorController)==null?void 0:e.animator)==this&&this._animatorController.setSpeed(this._speed)}set minMaxOffsetNormalized(A){var e;this._normalizedStartOffset=ee.lerp(A.x,A.y,Math.random()),((e=this.runtimeAnimatorController)==null?void 0:e.animator)==this&&(this.runtimeAnimatorController.normalizedStartOffset=this._normalizedStartOffset)}awake(){Ss&&console.log("ANIMATOR",this.name,this),this.gameObject&&this.initializeRuntimeAnimatorController()}initializeRuntimeAnimatorController(A=!1){const e=A||this.runtimeAnimatorController!==this._initializeWithRuntimeAnimatorController;if(this.runtimeAnimatorController&&e){const i=this.runtimeAnimatorController.clone();this._initializeWithRuntimeAnimatorController=i,i?(console.assert(this.runtimeAnimatorController!==i),this.runtimeAnimatorController=i,console.assert(this.runtimeAnimatorController===i),this.runtimeAnimatorController.bind(this),this.runtimeAnimatorController.setSpeed(this._speed),this.runtimeAnimatorController.normalizedStartOffset=this._normalizedStartOffset):console.warn("Could not clone animator controller",this.runtimeAnimatorController)}}onDisable(){var A;this.keepAnimatorControllerStateOnDisable||(A=this._animatorController)==null||A.reset()}onBeforeRender(){this._isDirty=!1,this._parametersAreDirty=!1,!HQA(this.gameObject)&&this._animatorController&&this._animatorController.update(1)}}Jm([w()],Zg.prototype,"applyRootMotion",2),Jm([w()],Zg.prototype,"hasRootMotion",2),Jm([w()],Zg.prototype,"keepAnimatorControllerStateOnDisable",2),Jm([w()],Zg.prototype,"runtimeAnimatorController",1);const PC=tA("debugusdzanimation"),qK=tA("debugusdzanimationserialization");class qm{constructor(A,e,i){r(this,"_start"),r(this,"ext"),r(this,"root"),r(this,"clip"),this.ext=A,this.root=e,this.clip=i}get start(){return this._start===void 0&&(this._start=this.ext.getStartTime01(this.root,this.clip)),this._start}get duration(){var A;return((A=this.clip)==null?void 0:A.duration)??Mg.restPoseClipDuration}}const aj=class{constructor(t,A,e){r(this,"clip"),r(this,"pos"),r(this,"rot"),r(this,"scale"),r(this,"root"),r(this,"target"),r(this,"duration",0),r(this,"useRootMotion",!1),this.root=t,this.target=A,this.clip=e,e?this.duration=e.duration:this.duration=aj.restPoseClipDuration;const i=aA.getComponent(t,Zg);i&&(this.useRootMotion=i.applyRootMotion)}get frameRate(){return 60}addTrack(t){if(!this.clip){console.error("This is a rest clip but you're trying to add tracks to it \u2013 this is likely a bug");return}t.name.endsWith("position")&&(this.pos=t),t.name.endsWith("quaternion")&&(this.rot=t),t.name.endsWith("scale")&&(this.scale=t)}getFrames(){var t,A,e,i,g,I;return this.clip?Math.max(((A=(t=this.pos)==null?void 0:t.times)==null?void 0:A.length)??0,((i=(e=this.rot)==null?void 0:e.times)==null?void 0:i.length)??0,((I=(g=this.scale)==null?void 0:g.times)==null?void 0:I.length)??0):2}getDuration(){return this.duration}getSortedTimesArray(t=!0,A=!0,e=!0){var i,g,I;if(!this.clip)return[0,this.duration];const o=(i=this.pos)==null?void 0:i.times,s=(g=this.rot)==null?void 0:g.times,C=(I=this.scale)==null?void 0:I.times,a=[];if(t&&o)for(const n of o)a.push(n);if(A&&s)for(const n of s)a.push(n);if(e&&C)for(const n of C)a.push(n);return a.includes(0)||a.push(0),a.sort((n,B)=>n-B),[...new Set(a)]}*getValues(t,A=!0,e=!0,i=!0){var g,I,o;const s=new f,C=new UA,a=new f(1,1,1),n=this.target,B=A?(g=this.pos)==null?void 0:g.createInterpolant():void 0,Q=e?(I=this.rot)==null?void 0:I.createInterpolant():void 0,E=i?(o=this.scale)==null?void 0:o.createInterpolant():void 0;B||s.set(n.position.x,n.position.y,n.position.z),Q||C.set(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w),E||a.set(n.scale.x,n.scale.y,n.scale.z);for(let h=0;h<t.length;h++){const l=t[h];if(B){const d=B.evaluate(l);s.set(d[0],d[1],d[2])}if(Q){const d=Q.evaluate(l);C.set(d[0],d[1],d[2],d[3])}if(E){const d=E.evaluate(l);a.set(d[0],d[1],d[2])}if(this.useRootMotion&&n===this.root){const d=new NA;d.compose(s,C,a),d.multiply(n.matrix),d.decompose(s,C,a)}yield{time:l,translation:s,rotation:C,scale:a,index:h}}}};let Mg=aj;r(Mg,"animationDurationPadding",1/60),r(Mg,"restPoseClipDuration",1/60);class pp{constructor(A){r(this,"dict",new Map),r(this,"rootTargetMap",new Map),r(this,"rootAndClipToRegisteredAnimationMap",new Map),r(this,"rootToRegisteredClip",new Map),r(this,"serializers",[]),r(this,"injectRestPoses",!1),r(this,"injectImplicitBehaviours",!1),this.injectRestPoses=A,this.injectImplicitBehaviours=A}get extensionName(){return"animation"}getStartTimeCode(){return!this.injectRestPoses||this.rootAndClipToRegisteredAnimationMap.size===0?0:(Mg.restPoseClipDuration+Mg.animationDurationPadding)*60}getEndTimeCode(){let A=0;for(const[e,i]of this.rootAndClipToRegisteredAnimationMap){const g=i.start+i.duration;g>A&&(A=g)}return A*60}getClipCount(A){var e;return((e=this.rootToRegisteredClip.get(A))==null?void 0:e.length)??0??0}getStartTime01(A,e){if(!e)return 0;const i=this.rootTargetMap.get(A);if(!i)return 0;const g=this.dict.get(i[0]);if(!g)return console.error("Trying to get start time for root that has no animation data",A,e,...this.dict),0;let I=0;for(let o=0;o<g.length&&g[o].clip!==e;o++)I+=g[o].getDuration()+Mg.animationDurationPadding;return I}registerAnimation(A,e){var i;if(!A)return null;this.rootTargetMap.has(A)||this.rootTargetMap.set(A,[]);const g=A.uuid+(e?.uuid??"-rest");if(this.rootAndClipToRegisteredAnimationMap.has(g))return this.rootAndClipToRegisteredAnimationMap.get(g);PC&&console.log("registerAnimation",A,e);const I=this.injectRestPoses?1:0,o=(((i=this.rootToRegisteredClip.get(A))==null?void 0:i.length)??0)+I,s=this.rootTargetMap.get(A),C=new Set(s);if(e&&e.tracks)for(const n of e.tracks){const B=Ct.parseTrackName(n.name),Q=Ct.findNode(A,B.nodeName);if(!Q){console.warn("no object found for track",n.name,"using "+A.name+" instead");continue}this.dict.has(Q)||this.dict.set(Q,[]);const E=this.dict.get(Q);if(!E){console.warn("no transform data found for target ",Q,"at slot "+o+", this is likely a bug");continue}C.delete(Q),this.injectRestPoses&&!E[0]&&(E[0]=new Mg(null,Q,null));let h=E[o];h||(h=new Mg(A,Q,e),E[o]=h),h.addTrack(n),s!=null&&s.includes(Q)||s==null||s.push(Q)}PC&&console.log("Unregistered nodes for this clip",C,"clip",e,"at slot",o,"for root",A,"targets",s);for(const n of C){const B=this.dict.get(n);if(!B)continue;if(this.injectRestPoses&&!B[0]){console.warn("Adding rest pose for ",n,e,"at slot",o,"This is likely a bug, should have been added earlier.");const E=new Mg(null,n,null);B[0]=E}let Q=B[o];Q||(PC&&console.log("Adding padding clip for ",n,e,"at slot",o),Q=new Mg(A,n,e),B[o]=Q)}const a=new qm(this,A,e);if(this.rootAndClipToRegisteredAnimationMap.set(g,a),PC&&console.log({root:A,clip:e,info:a}),e){const n=this.rootToRegisteredClip.get(A);n?n.push(e):this.rootToRegisteredClip.set(A,[e])}return a}onAfterHierarchy(A){PC&&console.log("Animation clips per animation target node",this.dict)}onAfterBuildDocument(A){var e,i;PC&&console.log("Animation data",{dict:this.dict,rootTargetMap:this.rootTargetMap,rootToRegisteredClip:this.rootToRegisteredClip});for(const g of this.rootTargetMap.keys()){const I=this.rootTargetMap.get(g);if(!I)continue;let o;const s=[];for(const C of I){const a=this.dict.get(C);if(!a){console.error("No data found for target on USDZ export \u2013 please report a bug!",C);continue}o===void 0&&(o=a?.length),o!==a?.length&&console.error("Different array lengths for targets \u2013 please report a bug!",a);for(let n=0;n<a.length;n++){let B=a[n];if(!B){const Q=n-(this.injectRestPoses?1:0);a[n]=new Mg(null,C,this.rootToRegisteredClip.get(g)[Q]),B=a[n]}if(!s[n])s[n]=B.getDuration();else if(s[n]!==B.getDuration()){console.error("Different durations for targets \u2013 please report a bug!",a);continue}}}}for(const g of this.serializers){const I=(e=g.model)==null?void 0:e.parent,o=I?.isDynamic===!0;qK&&console.log(o,(i=g.model)==null?void 0:i.parent),o&&g.registerCallback(I)}}onExportObject(A,e,i){aA.foreachComponent(A,I=>{const o=I;typeof o.createAnimation=="function"&&o.createAnimation(this,e,i)},!1);const g=new zQA(A,this.dict);this.serializers.push(g),g.registerCallback(e)}}class zQA{constructor(A,e){r(this,"object"),r(this,"dict"),r(this,"model"),r(this,"callback"),this.object=A,this.dict=e}registerCallback(A){this.model&&this.callback&&this.model.removeEventListener("serialize",this.callback),this.callback||(this.callback=this.onSerialize.bind(this)),qK&&console.log("REPARENT",A),this.model=A,this.model.addEventListener("serialize",this.callback)}skinnedMeshExport(A,e){var i;const g=this.model,I=this.dict;if(g&&g.skinnedMesh){let o=function(R){const F=[];for(const[S,U]of R){let T=`${S} : [`;const Y=[];for(const K of U)Y.push(`(${Dg(K.x)}, ${Dg(K.y)}, ${Dg(K.z)})`);T=T.concat(Y.join(", ")),T=T.concat("],"),F.push(T)}return F},s=function(R){const F=[];for(const[S,U]of R){let T=`${S} : [`;const Y=[];for(const K of U)Y.push(`(${Dg(K.w)}, ${Dg(K.x)}, ${Dg(K.y)}, ${Dg(K.z)})`);T=T.concat(Y.join(", ")),T=T.concat("],"),F.push(T)}return F},C=function(R){let F,S=!0;const U=new Map;for(const[Y,K]of R){F===void 0&&(F=K.length),F!==K.length&&(S=!1);let O=0;for(const J of K)O++,J||(U.has(Y)||U.set(Y,[]),U.get(Y).push(O))}PC&&console.log("Bone count: ",R.size,"TransformData entries per bone: ",F,"Undefined bone entries: ",U),console.assert(S,"All bones should have the same number of TransformData entries",R),console.assert(U.size===0,"All TransformData entries should be set",U);const T=[];for(const[Y,K]of R){const O=new Array;let J=0;for(let v=0;v<K.length;v++)O.push(J),J+=K[v].getDuration()+Mg.animationDurationPadding;for(let v=0;v<K.length;v++){const _=K[v],X=O[v];T.length<=v&&T.push({pos:[],rot:[],scale:[],timeOffset:X});const Z=T[v];Z.pos.push(..._.getSortedTimesArray(!0,!1,!1)),Z.rot.push(..._.getSortedTimesArray(!1,!0,!1)),Z.scale.push(..._.getSortedTimesArray(!1,!1,!0))}}for(const Y of T)Y.pos.sort((K,O)=>K-O),Y.rot.sort((K,O)=>K-O),Y.scale.sort((K,O)=>K-O),Y.pos=[...new Set(Y.pos)],Y.rot=[...new Set(Y.rot)],Y.scale=[...new Set(Y.scale)];return T},a=function(R,F,S){const U=new Map,T=new Map,Y=new Map,K=F.length;for(const O of S){const J=R.get(O);let v;J?console.assert(J.length===K,"We should have the same number of TransformData entries for each bone",J,F):v=new Mg(null,O,null);for(let _=0;_<K;_++){const X=J?J[_]:v,Z=F[_];for(const{time:IA,translation:yA}of X.getValues(Z.pos,!0,!1,!1)){const KA=(IA+Z.timeOffset)*60;U.has(KA)||U.set(KA,new Array),U.get(KA).push(yA.clone())}for(const{time:IA,rotation:yA}of X.getValues(Z.rot,!1,!0,!1)){const KA=(IA+Z.timeOffset)*60;T.has(KA)||T.set(KA,new Array),T.get(KA).push(yA.clone())}for(const{time:IA,scale:yA}of X.getValues(Z.scale,!1,!1,!0)){const KA=(IA+Z.timeOffset)*60;Y.has(KA)||Y.set(KA,new Array),Y.get(KA).push(yA.clone())}}}return{position:U.size==0?void 0:U,quaternion:T.size==0?void 0:T,scale:Y.size==0?void 0:Y}},n=function(R){const F=[];for(const S of R)F.push(`(${Dg(S.x)}, ${Dg(S.y)}, ${Dg(S.z)})`);return F.join(", ")},B=function(R){const F=[];for(const S of R)F.push(`(${Dg(S.w)}, ${Dg(S.x)}, ${Dg(S.y)}, ${Dg(S.z)})`);return F.join(", ")},Q=function(R){const F=new Map;if(PC){const S=new Array;for(const[U,T]of I)S.push(U.uuid+": "+T.length+" "+T.map(Y=>{var K;return(K=Y.clip)==null?void 0:K.uuid.substring(0,6)}).join(" "));console.log(`getPerBoneTransformData
|
|
@@ -6217,7 +6217,7 @@ void main() {
|
|
|
6217
6217
|
`+e.fragmentShader),this.effectCompositerQuad?(this.effectCompositerQuad.material.dispose(),this.effectCompositerQuad.material=new Me(e)):this.effectCompositerQuad=new tE(new Me(e))}generateHemisphereSamples(A){const e=[];for(let i=0;i<A;i++){const g=2.399963*i,I=Math.sqrt(i+.5)/Math.sqrt(A),o=I*Math.cos(g),s=I*Math.sin(g),C=Math.sqrt(1-(o*o+s*s));e.push(new f(o,s,C))}return e}generateDenoiseSamples(A,e){const i=2*Math.PI*e/A,g=1/A,I=g,o=[];let s=g,C=0;for(let a=0;a<A;a++)o.push(new eA(Math.cos(C),Math.sin(C)).multiplyScalar(Math.pow(s,.75))),s+=I,C+=i;return o}setSize(A,e){this.firstFrame(),this.width=A,this.height=e;const i=this.configuration.halfRes?.5:1;this.writeTargetInternal.setSize(A*i,e*i),this.readTargetInternal.setSize(A*i,e*i),this.accumulationRenderTarget.setSize(A*i,e*i),this.configuration.halfRes&&this.depthDownsampleTarget.setSize(A*i,e*i),this.configuration.transparencyAware&&(this.transparencyRenderTargetDWFalse.setSize(A,e),this.transparencyRenderTargetDWTrue.setSize(A,e)),this.outputTargetInternal.setSize(A,e)}setDepthTexture(A){this.depthTexture=A}firstFrame(){this.needsFrame=!0}render(A,e,i){const g=A.xr.enabled;A.xr.enabled=!1,A.capabilities.logarithmicDepthBuffer!==this.configuration.logarithmicDepthBuffer&&(this.configuration.logarithmicDepthBuffer=A.capabilities.logarithmicDepthBuffer,this.configureAOPass(this.configuration.logarithmicDepthBuffer),this.configureDenoisePass(this.configuration.logarithmicDepthBuffer),this.configureEffectCompositer(this.configuration.logarithmicDepthBuffer)),this.detectTransparency(),(e.texture.type!==this.outputTargetInternal.texture.type||e.texture.format!==this.outputTargetInternal.texture.format)&&(this.outputTargetInternal.texture.type=e.texture.type,this.outputTargetInternal.texture.format=e.texture.format,this.outputTargetInternal.texture.needsUpdate=!0),this.camera.updateMatrixWorld(),this.lastViewMatrix.equals(this.camera.matrixWorldInverse)&&this.lastProjectionMatrix.equals(this.camera.projectionMatrix)&&this.configuration.accumulate&&!this.needsFrame?this.frame++:(A.setRenderTarget(this.accumulationRenderTarget),A.clear(!0,!0,!0),this.frame=0,this.needsFrame=!1),this.lastViewMatrix.copy(this.camera.matrixWorldInverse),this.lastProjectionMatrix.copy(this.camera.projectionMatrix);let I,o,s;this.debugMode&&(I=A.getContext(),o=I.getExtension("EXT_disjoint_timer_query_webgl2"),o===null&&(console.error("EXT_disjoint_timer_query_webgl2 not available, disabling debug mode."),this.debugMode=!1)),this.debugMode&&(s=I.createQuery(),I.beginQuery(o.TIME_ELAPSED_EXT,s)),this.configuration.transparencyAware&&this.renderTransparency(A),this._r.set(this.width,this.height);let C=this.configuration.aoRadius;if(this.configuration.halfRes&&this.configuration.screenSpaceRadius&&(C*=.5),this.frame<1024/this.configuration.aoSamples){this.configuration.halfRes&&(A.setRenderTarget(this.depthDownsampleTarget),this.depthDownsampleQuad.material.uniforms.sceneDepth.value=this.depthTexture,this.depthDownsampleQuad.material.uniforms.resolution.value=this._r,this.depthDownsampleQuad.material.uniforms.near.value=this.camera.near,this.depthDownsampleQuad.material.uniforms.far.value=this.camera.far,this.depthDownsampleQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.depthDownsampleQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.depthDownsampleQuad.material.uniforms.logDepth.value=this.configuration.logarithmicDepthBuffer,this.depthDownsampleQuad.render(A)),this.effectShaderQuad.material.uniforms.sceneDiffuse.value=e.texture,this.effectShaderQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.texture[0]:this.depthTexture,this.effectShaderQuad.material.uniforms.sceneNormal.value=this.configuration.halfRes?this.depthDownsampleTarget.texture[1]:null,this.effectShaderQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.effectShaderQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.effectShaderQuad.material.uniforms.projViewMat.value=this.camera.projectionMatrix.clone().multiply(this.camera.matrixWorldInverse.clone()),this.effectShaderQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectShaderQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectShaderQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new f),this.effectShaderQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.effectShaderQuad.material.uniforms.time.value=performance.now()/1e3,this.effectShaderQuad.material.uniforms.samples.value=this.samples,this.effectShaderQuad.material.uniforms.bluenoise.value=this.bluenoise,this.effectShaderQuad.material.uniforms.radius.value=C,this.effectShaderQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectShaderQuad.material.uniforms.near.value=this.camera.near,this.effectShaderQuad.material.uniforms.far.value=this.camera.far,this.effectShaderQuad.material.uniforms.logDepth.value=A.capabilities.logarithmicDepthBuffer,this.effectShaderQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectShaderQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectShaderQuad.material.uniforms.frame.value=this.frame,A.setRenderTarget(this.writeTargetInternal),this.effectShaderQuad.render(A);for(let n=0;n<this.configuration.denoiseIterations;n++)[this.writeTargetInternal,this.readTargetInternal]=[this.readTargetInternal,this.writeTargetInternal],this.poissonBlurQuad.material.uniforms.tDiffuse.value=this.readTargetInternal.texture,this.poissonBlurQuad.material.uniforms.sceneDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.texture[0]:this.depthTexture,this.poissonBlurQuad.material.uniforms.projMat.value=this.camera.projectionMatrix,this.poissonBlurQuad.material.uniforms.viewMat.value=this.camera.matrixWorldInverse,this.poissonBlurQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.poissonBlurQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.poissonBlurQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new f),this.poissonBlurQuad.material.uniforms.resolution.value=this.configuration.halfRes?this._r.clone().multiplyScalar(.5).floor():this._r,this.poissonBlurQuad.material.uniforms.time.value=performance.now()/1e3,this.poissonBlurQuad.material.uniforms.blueNoise.value=this.bluenoise,this.poissonBlurQuad.material.uniforms.radius.value=this.configuration.denoiseRadius*(this.configuration.halfRes?.5:1),this.poissonBlurQuad.material.uniforms.worldRadius.value=C,this.poissonBlurQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.poissonBlurQuad.material.uniforms.index.value=n,this.poissonBlurQuad.material.uniforms.poissonDisk.value=this.samplesDenoise,this.poissonBlurQuad.material.uniforms.near.value=this.camera.near,this.poissonBlurQuad.material.uniforms.far.value=this.camera.far,this.poissonBlurQuad.material.uniforms.logDepth.value=A.capabilities.logarithmicDepthBuffer,this.poissonBlurQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,A.setRenderTarget(this.writeTargetInternal),this.poissonBlurQuad.render(A);A.setRenderTarget(this.accumulationRenderTarget);const a=A.autoClear;A.autoClear=!1,this.accumulationQuad.material.uniforms.tDiffuse.value=this.writeTargetInternal.texture,this.accumulationQuad.material.uniforms.frame.value=this.frame,this.accumulationQuad.render(A),A.autoClear=a}this.configuration.transparencyAware&&(this.effectCompositerQuad.material.uniforms.transparencyDWFalse.value=this.transparencyRenderTargetDWFalse.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrue.value=this.transparencyRenderTargetDWTrue.texture,this.effectCompositerQuad.material.uniforms.transparencyDWTrueDepth.value=this.transparencyRenderTargetDWTrue.depthTexture,this.effectCompositerQuad.material.uniforms.transparencyAware.value=!0),this.effectCompositerQuad.material.uniforms.sceneDiffuse.value=e.texture,this.effectCompositerQuad.material.uniforms.sceneDepth.value=this.depthTexture,this.effectCompositerQuad.material.uniforms.near.value=this.camera.near,this.effectCompositerQuad.material.uniforms.far.value=this.camera.far,this.effectCompositerQuad.material.uniforms.projectionMatrixInv.value=this.camera.projectionMatrixInverse,this.effectCompositerQuad.material.uniforms.viewMatrixInv.value=this.camera.matrixWorld,this.effectCompositerQuad.material.uniforms.logDepth.value=A.capabilities.logarithmicDepthBuffer,this.effectCompositerQuad.material.uniforms.ortho.value=this.camera.isOrthographicCamera,this.effectCompositerQuad.material.uniforms.downsampledDepth.value=this.configuration.halfRes?this.depthDownsampleTarget.texture[0]:this.depthTexture,this.effectCompositerQuad.material.uniforms.resolution.value=this._r,this.effectCompositerQuad.material.uniforms.blueNoise.value=this.bluenoise,this.effectCompositerQuad.material.uniforms.intensity.value=this.configuration.intensity,this.effectCompositerQuad.material.uniforms.renderMode.value=this.configuration.renderMode,this.effectCompositerQuad.material.uniforms.screenSpaceRadius.value=this.configuration.screenSpaceRadius,this.effectCompositerQuad.material.uniforms.radius.value=C,this.effectCompositerQuad.material.uniforms.distanceFalloff.value=this.configuration.distanceFalloff,this.effectCompositerQuad.material.uniforms.gammaCorrection.value=this.autosetGamma?this.renderToScreen:this.configuration.gammaCorrection,this.effectCompositerQuad.material.uniforms.tDiffuse.value=this.accumulationRenderTarget.texture,this.effectCompositerQuad.material.uniforms.color.value=this._c.copy(this.configuration.color).convertSRGBToLinear(),this.effectCompositerQuad.material.uniforms.colorMultiply.value=this.configuration.colorMultiply,this.effectCompositerQuad.material.uniforms.cameraPos.value=this.camera.getWorldPosition(new f),this.effectCompositerQuad.material.uniforms.fog.value=!!this.scene.fog,this.scene.fog&&(this.scene.fog.isFog?(this.effectCompositerQuad.material.uniforms.fogExp.value=!1,this.effectCompositerQuad.material.uniforms.fogNear.value=this.scene.fog.near,this.effectCompositerQuad.material.uniforms.fogFar.value=this.scene.fog.far):this.scene.fog.isFogExp2?(this.effectCompositerQuad.material.uniforms.fogExp.value=!0,this.effectCompositerQuad.material.uniforms.fogDensity.value=this.scene.fog.density):console.error(`Unsupported fog type ${this.scene.fog.constructor.name} in SSAOPass.`)),A.setRenderTarget(this.outputTargetInternal),this.effectCompositerQuad.render(A),A.setRenderTarget(this.renderToScreen?null:i),this.copyQuad.material.uniforms.tDiffuse.value=this.outputTargetInternal.texture,this.copyQuad.render(A),this.debugMode&&(I.endQuery(o.TIME_ELAPSED_EXT),Nj(s,I,this)),A.xr.enabled=g}enableDebugMode(){this.debugMode=!0}disableDebugMode(){this.debugMode=!1}setDisplayMode(A){this.configuration.renderMode=["Combined","AO","No AO","Split","Split AO"].indexOf(A)}setQualityMode(A){A==="Performance"?(this.configuration.aoSamples=8,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):A==="Low"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=4,this.configuration.denoiseRadius=12):A==="Medium"?(this.configuration.aoSamples=16,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=12):A==="High"?(this.configuration.aoSamples=64,this.configuration.denoiseSamples=8,this.configuration.denoiseRadius=6):A==="Ultra"&&(this.configuration.aoSamples=64,this.configuration.denoiseSamples=16,this.configuration.denoiseRadius=6)}}Uint8Array.from(atob(Uj),t=>t.charCodeAt(0));const zm=tA("debugpost"),Qv=Symbol("needle:postprocessing-handler"),Ev=Symbol("needle:previous-autoclear-state");class Xm{constructor(A){r(this,"_composer",null),r(this,"_lastVolumeComponents"),r(this,"_effects",[]),r(this,"_isActive",!1),r(this,"context"),this.context=A}get isActive(){return this._isActive}get composer(){return this._composer}apply(A){this._isActive=!0,this.onApply(this.context,A)}unapply(){var A;if(this._isActive=!1,this._lastVolumeComponents){for(const i of this._lastVolumeComponents)i.unapply();this._lastVolumeComponents.length=0}const e=this.context;e[Qv]===this&&delete e[Qv],e.composer===this._composer&&((A=e.composer)==null||A.dispose(),e.composer=null),typeof e.renderer[Ev]=="boolean"&&(e.renderer.autoClear=e.renderer[Ev])}dispose(){this.unapply();for(const A of this._effects)A.dispose();this._effects.length=0,this._composer=null}onApply(A,e){if(e){A[Qv]=this,zm&&console.log("refreshing volume profile",e),this._lastVolumeComponents=[...e],this._effects.length=0;for(const i of e)if(i.context=A,i.apply){if(i.active){if(!A.mainCameraComponent){console.error("No camera in scene found or available yet - can not create postprocessing effects");return}const g=i.apply();if(!g)continue;Array.isArray(g)?this._effects.push(...g):this._effects.push(g)}}else i.active&&Bi("Volume component is not a VolumeComponent: "+i.__type);this.applyEffects(A)}}applyEffects(A){const e=this._effects;if(e.length<=0)return;const i=A.mainCameraComponent,g=A.renderer,I=A.scene,o=i.cam;g[Ev]=g.autoClear;const s=g.capabilities.maxSamples;this._composer||(this._composer=new oF(g,{frameBufferType:Ci,stencilBuffer:!0,multisampling:Math.min(Is()?4:8,s)})),A.composer=this._composer;const C=A.composer;C.setMainCamera(o),C.setRenderer(g),C.setMainScene(I);for(const n of C.passes)n.dispose();C.removeAllPasses();const a=new j0(I,o);a.name="Render To Screen",a.mainScene=I,C.addPass(a);try{this.orderEffects();const n=[];for(const B of e)if(B instanceof hs)n.push(B);else if(B instanceof Yg){const Q=new Z2(o,...n);Q.mainScene=I,Q.name=n.map(E=>E.constructor.name).join(", "),Q.enabled=!0,n.length=0,C.addPass(B)}if(n.length>0){const B=new Z2(o,...n);B.name=n.map(Q=>Q.name).join(" "),B.mainScene=I,B.enabled=!0,C.addPass(B)}}catch(n){console.error("Error while applying postprocessing effects",n),C.removeAllPasses()}zm&&console.log("PostProcessing Passes",e,"->",C.passes)}orderEffects(){var A;zm&&console.log("Before ordering effects",[...this._effects]);const e=this._effects;e.sort((i,g)=>{const I=hv.indexOf(i.constructor),o=hv.indexOf(g.constructor);return I<0&&o<0?-1:I<0?1:o<0?-1:I-o}),zm&&console.log("After ordering effects",[...this._effects]);for(let i=0;i<e.length;i++){const g=e[i];if(((A=g?.configuration)==null?void 0:A.gammaCorrection)!==void 0){const I=i===e.length-1;g.configuration.gammaCorrection=I}}}}const hv=[z2,gF,s1,a1,Fj,e1,A1,CF,g1,r1,n1,t1,$2,i1];var khA=Object.defineProperty,GhA=Object.getOwnPropertyDescriptor,MhA=(t,A,e,i)=>{for(var g=i>1?void 0:i?GhA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&khA(A,e,g),g};const xp=tA("debugpost");class Lp extends bA{constructor(){super(...arguments),r(this,"sharedProfile"),r(this,"_postprocessing"),r(this,"_effects",[]),r(this,"_lastApplyTime"),r(this,"_rapidApplyCount",0),r(this,"_isDirty",!1),r(this,"_modificationQueue"),r(this,"_recreateId",-1)}get effects(){return this._effects}markDirty(){this._isDirty=!0}awake(){var A;xp&&(console.log(this),console.log("Press P to toggle post processing"),window.addEventListener("keydown",e=>{e.key==="p"&&(this.enabled=!this.enabled,ri("Toggle PostProcessing "+this.name+": Enabled="+this.enabled),this.markDirty())})),(A=this.sharedProfile)==null||A.init()}onDisable(){var A;(A=this._postprocessing)==null||A.unapply()}onBeforeRender(){if(!this.context.isInXR){if(this.context.composer&&!(this.context.composer instanceof oF)){xp&&console.warn("PostProcessing: The current composer is not an EffectComposer - this is not supported");return}this.context.mainCamera&&(!this._postprocessing||!this._postprocessing.isActive||this._isDirty)&&this.apply(),this.context.composer&&(this.context.composer.setRenderer(this.context.renderer),this.context.composer.setMainScene(this.context.scene),this.context.mainCamera&&this.context.composer.setMainCamera(this.context.mainCamera))}}onDestroy(){var A;(A=this._postprocessing)==null||A.dispose()}apply(){var A,e;xp&&console.log("Apply PostProcessing",this,(A=this.context.mainCamera)==null?void 0:A.name),Be()&&(this._lastApplyTime!==void 0&&Date.now()-this._lastApplyTime<100&&(this._rapidApplyCount++,this._rapidApplyCount===5&&console.warn("Detected rapid post processing modifications - this might be a bug",this)),this._lastApplyTime=Date.now()),this._isDirty=!1,this.unapply(),this._effects.length=0,(e=this.sharedProfile)!=null&&e.components&&this._effects.push(...this.sharedProfile.components);const i=this.gameObject.getComponentsInChildren(fI);if(xp&&i!=null&&i.length&&console.log("Additional",i),i)for(const g of i)g.active&&this._effects.push(g);this._effects.length>0&&(this._postprocessing||(this._postprocessing=new Xm(this.context)),this._postprocessing.apply(this._effects),this._applyPostQueue())}unapply(){var A;xp&&console.log("Unapply PostProcessing",this),(A=this._postprocessing)==null||A.unapply()}_applyPostQueue(){if(this._modificationQueue){for(const A of this._modificationQueue.values())this.onEditorModification(A);this._modificationQueue.clear()}}onEditorModification(A){var e,i;if(A.propertyName.startsWith("postprocessing.")){if(!this._postprocessing)return this._modificationQueue||(this._modificationQueue=new Map),this._modificationQueue.set(A.propertyName,A),!0;if(!((e=this._effects)!=null&&e.length))return;const g=A.propertyName.split(".");if(g.length===3||g.length===4){const I=g[1],o=g[2];for(const s of this._effects)if(((i=s.typeName)==null?void 0:i.toLowerCase())===I.toLowerCase()){if(o==="active"){s.active=A.value,this.scheduleRecreate();return}if(!$m.has(I)){const C=new Array;$m.set(I,C);const a=Object.keys(s);for(const n of a)s[n]instanceof Ue&&C.push(n)}if($m.has(I)){const C=o.toLowerCase(),a=$m.get(I);for(const n of a)if(n.toLowerCase()===C){const B=s[n];B instanceof Ue&&(g.length===4&&g[3]==="active"?(B.overrideState=A.value,this.scheduleRecreate()):B&&B.value!==void 0&&(B.value=A.value));return}}console.warn("Unknown modification",o);return}}return!0}return!1}scheduleRecreate(){const A=++this._recreateId;setTimeout(()=>{A===this._recreateId&&(this.onDisable(),this.onEnable())},200)}}MhA([qh(Dp)],Lp.prototype,"sharedProfile",2);const $m=new Map;var RhA=Object.defineProperty,UhA=Object.getOwnPropertyDescriptor,Af=(t,A,e,i)=>{for(var g=i>1?void 0:i?UhA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&RhA(A,e,g),g};class iB extends fI{constructor(){super(...arguments),r(this,"postExposure"),r(this,"contrast"),r(this,"hueShift"),r(this,"saturation"),r(this,"toneMappingEffect",null)}get typeName(){return"ColorAdjustments"}init(){this.postExposure.valueProcessor=A=>(A=Math.pow(2,A),A),this.postExposure.defaultValue=0,this.contrast.valueProcessor=A=>{let e=1;return A>0?e=200:A<0&&(e=100),A/e},this.contrast.defaultValue=0,this.hueShift.valueProcessor=A=>Math.PI*A/180,this.hueShift.defaultValue=0,this.saturation.valueProcessor=A=>A<0?A/100:A/(100*Math.PI),this.saturation.defaultValue=0}unapply(){var A,e,i;const g=(e=(A=this.toneMappingEffect)==null?void 0:A.mode)==null?void 0:e.value,I=(i=this.toneMappingEffect)==null?void 0:i.getThreeToneMapping(g);this.context.renderer.toneMapping=I??vE}threeToneMappingToEffectMode(A){switch(A){case vE:return Tg.LINEAR;case hw:return Tg.ACES_FILMIC;case MG:return Tg.AGX;case cw:return Tg.NEUTRAL;default:return Tg.LINEAR}}onCreateEffect(){var A,e,i,g,I;const o=[];this.context.renderer.toneMapping!==to&&this.postExposure.overrideState&&(this.context.renderer.toneMapping=to),this.toneMappingEffect=(e=(A=aA.findObjectOfType(Lp))==null?void 0:A.sharedProfile)==null?void 0:e.components.find(Q=>Q.typeName==="ToneMapping");const s=(g=(i=this.toneMappingEffect)==null?void 0:i.mode)==null?void 0:g.value,C=(I=this.toneMappingEffect)==null?void 0:I.getThreeToneMapping(s),a=new n1({mode:this.threeToneMappingToEffectMode(C)});this.postExposure.onValueChanged=Q=>{var E,h,l;this.postExposure.overrideState&&(this.context.renderer.toneMappingExposure=Q);const d=(h=(E=this.toneMappingEffect)==null?void 0:E.mode)==null?void 0:h.value,c=(l=this.toneMappingEffect)==null?void 0:l.getThreeToneMapping(d),u=this.threeToneMappingToEffectMode(c);u!==void 0&&(a.mode=u)};const n=new $2;this.contrast.onValueChanged=Q=>n.contrast=Q;const B=new t1;return o.push(n),o.push(B),o.push(a),this.hueShift.onValueChanged=Q=>B.hue=Q,this.saturation.onValueChanged=Q=>B.saturation=Q,o}}Af([w(Ue)],iB.prototype,"postExposure",2),Af([w(Ue)],iB.prototype,"contrast",2),Af([w(Ue)],iB.prototype,"hueShift",2),Af([w(Ue)],iB.prototype,"saturation",2),ms("ColorAdjustments",iB);const NhA=(Math.sqrt(5)-1)/4,$g=(5-Math.sqrt(5))/20,ef=t=>Math.floor(t)|0,tf=new Float64Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);function FhA(t=Math.random){const A=bhA(t),e=new Float64Array(A).map(o=>tf[o%32*4]),i=new Float64Array(A).map(o=>tf[o%32*4+1]),g=new Float64Array(A).map(o=>tf[o%32*4+2]),I=new Float64Array(A).map(o=>tf[o%32*4+3]);return function(o,s,C,a){let n,B,Q,E,h;const l=(o+s+C+a)*NhA,d=ef(o+l),c=ef(s+l),u=ef(C+l),p=ef(a+l),D=(d+c+u+p)*$g,m=d-D,M=c-D,k=u-D,R=p-D,F=o-m,S=s-M,U=C-k,T=a-R;let Y=0,K=0,O=0,J=0;F>S?Y++:K++,F>U?Y++:O++,F>T?Y++:J++,S>U?K++:O++,S>T?K++:J++,U>T?O++:J++;const v=Y>=3?1:0,_=K>=3?1:0,X=O>=3?1:0,Z=J>=3?1:0,IA=Y>=2?1:0,yA=K>=2?1:0,KA=O>=2?1:0,CA=J>=2?1:0,SA=Y>=1?1:0,vA=K>=1?1:0,ZA=O>=1?1:0,XA=J>=1?1:0,JA=F-v+$g,Ie=S-_+$g,lA=U-X+$g,j=T-Z+$g,_A=F-IA+2*$g,GA=S-yA+2*$g,kA=U-KA+2*$g,OA=T-CA+2*$g,pA=F-SA+3*$g,$A=S-vA+3*$g,oe=U-ZA+3*$g,me=T-XA+3*$g,H=F-1+4*$g,b=S-1+4*$g,QA=U-1+4*$g,fA=T-1+4*$g,qA=d&255,FA=c&255,ce=u&255,se=p&255;let TA=.6-F*F-S*S-U*U-T*T;if(TA<0)n=0;else{const xA=qA+A[FA+A[ce+A[se]]];TA*=TA,n=TA*TA*(e[xA]*F+i[xA]*S+g[xA]*U+I[xA]*T)}let HA=.6-JA*JA-Ie*Ie-lA*lA-j*j;if(HA<0)B=0;else{const xA=qA+v+A[FA+_+A[ce+X+A[se+Z]]];HA*=HA,B=HA*HA*(e[xA]*JA+i[xA]*Ie+g[xA]*lA+I[xA]*j)}let ue=.6-_A*_A-GA*GA-kA*kA-OA*OA;if(ue<0)Q=0;else{const xA=qA+IA+A[FA+yA+A[ce+KA+A[se+CA]]];ue*=ue,Q=ue*ue*(e[xA]*_A+i[xA]*GA+g[xA]*kA+I[xA]*OA)}let LA=.6-pA*pA-$A*$A-oe*oe-me*me;if(LA<0)E=0;else{const xA=qA+SA+A[FA+vA+A[ce+ZA+A[se+XA]]];LA*=LA,E=LA*LA*(e[xA]*pA+i[xA]*$A+g[xA]*oe+I[xA]*me)}let We=.6-H*H-b*b-QA*QA-fA*fA;if(We<0)h=0;else{const xA=qA+1+A[FA+1+A[ce+1+A[se+1]]];We*=We,h=We*We*(e[xA]*H+i[xA]*b+g[xA]*QA+I[xA]*fA)}return 27*(n+B+Q+E+h)}}function bhA(t){const A=new Uint8Array(512);for(let e=0;e<512/2;e++)A[e]=e;for(let e=0;e<512/2-1;e++){const i=e+~~(t()*(256-e)),g=A[e];A[e]=A[i],A[i]=g}for(let e=256;e<512;e++)A[e]=A[e-256];return A}const cv=tA("debugstencil");function KhA(t,A){return(t&1<<A.layer)!=0}const vhA=Symbol("stencils"),jc=class{constructor(t,A){r(this,"parser"),r(this,"source"),this.parser=t,this.source=A}get name(){return"NEEDLE_render_objects"}static applyStencil(t){if(!t)return;const A=t.sourceId;if(cv&&console.log(A,jc.stencils),!A)return;const e=jc.stencils[A];if(e)for(let i=e.length-1;i>=0;i--){const g=e[i];if(KhA(g.layer,t)){cv&&console.log(g),setTimeout(()=>{ho()&&cm(t.gameObject)&&(Bi("Stencil not supported on instanced objects"),console.warn("Stencil not supported on instanced objects",t))},500);for(let I=0;I<t.sharedMaterials.length;I++){let o=t.sharedMaterials[I];o&&(o=o.clone(),o[vhA]=!0,o.stencilWrite=!0,o.stencilWriteMask=255,o.stencilFuncMask=255,o.stencilRef=g.value,o.stencilFunc=g.compareFunc,o.stencilZPass=g.passOp,o.stencilFail=g.failOp,o.stencilZFail=g.zFailOp,t.sharedMaterials[I]=o)}t.gameObject.renderOrder=g.event*1e3+g.index*50;break}}}afterRoot(t){const A=this.parser.json.extensions;if(A){const e=A[qhA];if(e){cv&&console.log(e);const i=e.stencil;if(i&&Array.isArray(i))for(const g of i){const I={...g};I.compareFunc=JhA(I.compareFunc),I.passOp=dv(I.passOp),I.failOp=dv(I.failOp),I.zFailOp=dv(I.zFailOp),jc.stencils[this.source]||(jc.stencils[this.source]=[]),jc.stencils[this.source].push(I)}}}return null}};let lv=jc;r(lv,"stencils",{});function dv(t){switch(t){case 0:return Vn;case 1:return Fx;case 2:return bx;case 3:return Kx;case 4:return vx;case 6:return Jx;case 7:return qx;case 5:return xx}return 0}function JhA(t){switch(t){case 1:return oM;case 2:return Lx;case 3:return _x;case 4:return Tx;case 5:return Yx;case 6:return Hx;case 7:return Ox;case 8:return Nw}return oM}const qhA="NEEDLE_render_objects",bj=Symbol("customVisibilityFlag");function iE(t,A){t.layers[bj]=A}const Kj=Symbol("DidPatchLayers");function xhA(){const t=rI.prototype;if(t[Kj])return;t[Kj]=!0;const A=t.test;t.test=function(e){return this[bj]===!1?!1:A.call(this,e)}}xhA();var LhA=Object.defineProperty,_hA=Object.getOwnPropertyDescriptor,vj=(t,A,e,i)=>{for(var g=i>1?void 0:i?_hA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&LhA(A,e,g),g};const _p=tA("debugreflectionprobe"),Jj=tA("noreflectionprobe"),ThA=Symbol("reflectionProbeKey"),YhA=Symbol("original material");var gf;const un=(gf=class extends bA{constructor(){var t;super(),r(this,"_texture"),r(this,"center"),r(this,"size"),r(this,"_boxHelper"),un._probes.has(this.context)||un._probes.set(this.context,[]),(t=un._probes.get(this.context))==null||t.push(this)}static get(t,A,e,i){if(!t||t.isObject3D!==!0||Jj)return null;const g=un._probes.get(A);if(g){for(const I of g)if(I.__didAwake||I.__internalAwake(),I.enabled){if(i){if(I.gameObject===i)return I}else if(I.isInBox(t,void 0))return _p&&console.log("Found reflection probe",t.name,I.name),I}}return _p&&console.debug("Did not find reflection probe",t.name,e,t),null}set texture(t){if(t&&!(t instanceof He)){console.error("ReflectionProbe.texture must be a Texture",t);return}this._texture=t,t&&(t.mapping=As,t.colorSpace=he,t.needsUpdate=!0)}get texture(){return this._texture}isInBox(t,A){var e;return(e=this._boxHelper)==null?void 0:e.isInBox(t,A)}awake(){this._boxHelper=this.gameObject.addNewComponent(zC),this._boxHelper.updateBox(!0),_p&&this._boxHelper.showHelper(5592320,!0),this.texture&&(this.texture.mapping=As,this.texture.colorSpace=he,this.texture.needsUpdate=!0)}onDestroy(){const t=un._probes.get(this.context);if(t){const A=t.indexOf(this);A>=0&&t.splice(A,1)}}onSet(t){var A;if(Jj||!this.enabled||((A=t.sharedMaterials)==null?void 0:A.length)<=0||!this.texture)return;let e=un._rendererMaterialsCache.get(t);e||(e=[],un._rendererMaterialsCache.set(t,e));for(let i=0;i<t.sharedMaterials.length;i++){const g=t.sharedMaterials[i];if(!g||g.envMap===void 0)continue;let I=e[i];const o=g===I?.copy,s=!I||I.material.uuid!==g.uuid||I.copy.version!==g.version;if(!o&&s){if(_p){let n="";I?I.material!==g?n="reference changed; cached instance?: "+o:I.copy.version!==g.version&&(n="version changed"):n="not cached",console.warn("Cloning material",g.name,g.version,"Reason:",n,`
|
|
6218
6218
|
`,g.uuid,`
|
|
6219
6219
|
`,I?.copy.uuid,`
|
|
6220
|
-
`,t.name)}const a=g.clone();a.version=g.version,I?(I.copy=a,I.material=g):(I={material:g,copy:a},e.push(I)),a[ThA]=this,a[YhA]=g,_p&&console.log("Set reflection",t.name,t.guid)}const C=I?.copy;C.envMap=this.texture,t.sharedMaterials[i]=C}}onUnset(t){const A=un._rendererMaterialsCache.get(t);if(A)for(let e=0;e<A.length;e++){const i=A[e];t.sharedMaterials[e]=i.material}}},r(gf,"_probes",new Map),r(gf,"_rendererMaterialsCache",new Map),gf);let Wc=un;vj([w(f)],Wc.prototype,"center",2),vj([w(f)],Wc.prototype,"size",2);const uv=tA("debugexr");class HhA{constructor(A){r(this,"parser"),this.parser=A,uv&&console.log(A)}get name(){return"EXT_texture_exr"}loadTexture(A){const e=this.name,i=this.parser,g=i.json.textures[A];if(uv&&console.log("EXT_texture_exr.loadTexture",A,g),!g.extensions||!g.extensions[e])return null;const I=g.extensions[e],o=new wS(i.options.manager);return uv&&console.log("EXT_texture_exr.loadTexture",I),i.loadTextureImage(A,I.source,o)}}typeof window<"u"&&window.addEventListener("unhandledrejection",t=>{});const pn=Hg,If="$___Export_Components",OhA="NEEDLE_components";var qj;class PhA{constructor(){r(this,qj)}}qj=oQ;class jhA{constructor(A,e,i){r(this,"node"),r(this,"nodeIndex"),r(this,"nodeDef"),this.node=A,this.nodeIndex=e,this.nodeDef=i}}class WhA{constructor(){r(this,"parser"),r(this,"nodeToObjectMap",{}),r(this,"exportContext"),r(this,"objectToNodeMap",{}),r(this,"context"),r(this,"writer")}get name(){return OhA}registerExport(A){A.register(e=>{if("serializeUserData"in e){const i=e.serializeUserData.bind(e);this.writer=e,e.serializeUserData=(g,I)=>{try{this.serializeUserData(g,I),i(g,I)}finally{this.afterSerializeUserData(g,I)}}}return this})}beforeParse(){this.exportContext={},this.objectToNodeMap={}}serializeUserData(A,e){var i;const g=(i=A.userData)==null?void 0:i.components;!g||g.length<=0||(delete A.userData.components,A[If]=g)}afterSerializeUserData(A,e){if(A.type==="Scene"&&pn&&console.log("DONE",JSON.stringify(e)),A[If]===void 0)return;const i=A[If];delete A[If],i!==null&&(A.userData.components=i)}writeNode(A,e){const i=this.writer.json.nodes.length;pn&&console.log(A.name,i,A.uuid);const g=new jhA(A,i,e);this.exportContext[i]=g,this.objectToNodeMap[A.uuid]=i}afterParse(A){var e;pn&&console.log("AFTER",A);for(const i in this.exportContext){const g=this.exportContext[i],I=g.node,o=g.nodeDef,s=g.nodeIndex,C=(e=I.userData)==null?void 0:e.components;if(!C||C.length<=0)continue;const a=new PhA;o.extensions=o.extensions||{},o.extensions[this.name]=a,this.context.object=I,this.context.nodeId=s,this.context.objectToNode=this.objectToNodeMap;const n=[];for(const B of C){this.context.target=B;const Q=qs().writeBuiltinComponentData(B,this.context);Q!==null&&n.push(Q)}n.length>0&&(a[oQ]=n,pn&&console.log("DID WRITE",I,"nodeIndex",s,n))}}beforeRoot(){return pn&&console.log("BEGIN LOAD"),this.nodeToObjectMap={},null}async afterRoot(A){const e=A.parser,i=e?.extensions;if(!i)return;const g=i[this.name];pn&&console.log("After root",A,this.parser,i);const I=[];if(g===!0){const o=e.json.nodes;if(o){for(let s=0;s<o.length;s++){const C=await e.getDependency("node",s);this.nodeToObjectMap[s]=C}for(let s=0;s<o.length;s++){const C=o[s],a=s,n=C.extensions;if(!n)continue;const B=n[this.name];if(!B)continue;pn&&console.log("NODE",C);const Q=this.nodeToObjectMap[a];if(!Q){console.error("Could not find object for node index: "+a,C,e);continue}um(Q),I.push(this.createComponents(Q,B))}}}await Promise.all(I)}async createComponents(A,e){if(!e)return;const i=e[oQ];if(i){const g=new Array;pn&&console.log(A.name,i);for(const I in i){const o=i[I];pn&&console.log("Serialized data",JSON.parse(JSON.stringify(o))),o&&this.parser&&g.push(aF(this.parser,o).catch(s=>console.error(`Error while resolving references (see console for details)
|
|
6220
|
+
`,t.name)}const a=g.clone();a.version=g.version,I?(I.copy=a,I.material=g):(I={material:g,copy:a},e.push(I)),a[ThA]=this,a[YhA]=g,_p&&console.log("Set reflection",t.name,t.guid)}I&&I.copy&&(I.copy.onBeforeCompile=g.onBeforeCompile);const C=I?.copy;C.envMap=this.texture,t.sharedMaterials[i]=C}}onUnset(t){const A=un._rendererMaterialsCache.get(t);if(A)for(let e=0;e<A.length;e++){const i=A[e];t.sharedMaterials[e]=i.material}}},r(gf,"_probes",new Map),r(gf,"_rendererMaterialsCache",new Map),gf);let Wc=un;vj([w(f)],Wc.prototype,"center",2),vj([w(f)],Wc.prototype,"size",2);const uv=tA("debugexr");class HhA{constructor(A){r(this,"parser"),this.parser=A,uv&&console.log(A)}get name(){return"EXT_texture_exr"}loadTexture(A){const e=this.name,i=this.parser,g=i.json.textures[A];if(uv&&console.log("EXT_texture_exr.loadTexture",A,g),!g.extensions||!g.extensions[e])return null;const I=g.extensions[e],o=new wS(i.options.manager);return uv&&console.log("EXT_texture_exr.loadTexture",I),i.loadTextureImage(A,I.source,o)}}typeof window<"u"&&window.addEventListener("unhandledrejection",t=>{});const pn=Hg,If="$___Export_Components",OhA="NEEDLE_components";var qj;class PhA{constructor(){r(this,qj)}}qj=oQ;class jhA{constructor(A,e,i){r(this,"node"),r(this,"nodeIndex"),r(this,"nodeDef"),this.node=A,this.nodeIndex=e,this.nodeDef=i}}class WhA{constructor(){r(this,"parser"),r(this,"nodeToObjectMap",{}),r(this,"exportContext"),r(this,"objectToNodeMap",{}),r(this,"context"),r(this,"writer")}get name(){return OhA}registerExport(A){A.register(e=>{if("serializeUserData"in e){const i=e.serializeUserData.bind(e);this.writer=e,e.serializeUserData=(g,I)=>{try{this.serializeUserData(g,I),i(g,I)}finally{this.afterSerializeUserData(g,I)}}}return this})}beforeParse(){this.exportContext={},this.objectToNodeMap={}}serializeUserData(A,e){var i;const g=(i=A.userData)==null?void 0:i.components;!g||g.length<=0||(delete A.userData.components,A[If]=g)}afterSerializeUserData(A,e){if(A.type==="Scene"&&pn&&console.log("DONE",JSON.stringify(e)),A[If]===void 0)return;const i=A[If];delete A[If],i!==null&&(A.userData.components=i)}writeNode(A,e){const i=this.writer.json.nodes.length;pn&&console.log(A.name,i,A.uuid);const g=new jhA(A,i,e);this.exportContext[i]=g,this.objectToNodeMap[A.uuid]=i}afterParse(A){var e;pn&&console.log("AFTER",A);for(const i in this.exportContext){const g=this.exportContext[i],I=g.node,o=g.nodeDef,s=g.nodeIndex,C=(e=I.userData)==null?void 0:e.components;if(!C||C.length<=0)continue;const a=new PhA;o.extensions=o.extensions||{},o.extensions[this.name]=a,this.context.object=I,this.context.nodeId=s,this.context.objectToNode=this.objectToNodeMap;const n=[];for(const B of C){this.context.target=B;const Q=qs().writeBuiltinComponentData(B,this.context);Q!==null&&n.push(Q)}n.length>0&&(a[oQ]=n,pn&&console.log("DID WRITE",I,"nodeIndex",s,n))}}beforeRoot(){return pn&&console.log("BEGIN LOAD"),this.nodeToObjectMap={},null}async afterRoot(A){const e=A.parser,i=e?.extensions;if(!i)return;const g=i[this.name];pn&&console.log("After root",A,this.parser,i);const I=[];if(g===!0){const o=e.json.nodes;if(o){for(let s=0;s<o.length;s++){const C=await e.getDependency("node",s);this.nodeToObjectMap[s]=C}for(let s=0;s<o.length;s++){const C=o[s],a=s,n=C.extensions;if(!n)continue;const B=n[this.name];if(!B)continue;pn&&console.log("NODE",C);const Q=this.nodeToObjectMap[a];if(!Q){console.error("Could not find object for node index: "+a,C,e);continue}um(Q),I.push(this.createComponents(Q,B))}}}await Promise.all(I)}async createComponents(A,e){if(!e)return;const i=e[oQ];if(i){const g=new Array;pn&&console.log(A.name,i);for(const I in i){const o=i[I];pn&&console.log("Serialized data",JSON.parse(JSON.stringify(o))),o&&this.parser&&g.push(aF(this.parser,o).catch(s=>console.error(`Error while resolving references (see console for details)
|
|
6221
6221
|
`,s,A,o))),A.userData=A.userData||{},A.userData[oQ]=A.userData[oQ]||[],A.userData[oQ].push(o)}await Promise.all(g).catch(I=>{console.error("Error while loading components",I)})}}}const xj="NEEDLE_gameobject_data";class ZhA{constructor(A){r(this,"parser"),this.parser=A}get name(){return xj}afterRoot(A){var e;const i=[];for(let g=0;g<((e=this.parser.json.nodes)==null?void 0:e.length);g++){const I=this.parser.json.nodes[g];if(I&&I.extensions){const o=I.extensions[xj];if(o){const s=this.findAndApplyExtensionData(g,o);i.push(s)}}}return Promise.all(i).then(()=>null)}async findAndApplyExtensionData(A,e){const i=await this.parser.getDependency("node",A);i&&this.applyExtensionData(i,e)}applyExtensionData(A,e){e.layers===void 0&&(e.layers=0),A.userData.layer=e.layers,A.layers.disableAll(),A.layers.set(e.layers),A.userData.tag=e.tag??"none",A.userData.hideFlags=e.hideFlags??0,A.userData.static=e.static??!1,A.visible=e.activeSelf??!0,A.guid=e.guid}}const Lj="NEEDLE_lighting_settings",Zc=tA("debugenvlight");class VhA{constructor(A,e,i){r(this,"parser"),r(this,"sourceId"),r(this,"context"),this.parser=A,this.sourceId=e,this.context=i}get name(){return Lj}afterRoot(A){const e=this.parser.json.extensions;if(e){const i=e[Lj];if(i){Zc&&console.log('Loaded "'+this.name+'", src: "'+this.sourceId+'"',i);let g;if(A.scene.children.length===1){const I=A.scene.children[0];g=aA.addNewComponent(I,of,{},!1)}else{const I=new wA;I.name="LightSettings "+this.sourceId,A.scene.add(I),g=aA.addNewComponent(I,of,{},!1)}g.sourceId=this.sourceId,g.ambientIntensity=i.ambientIntensity,g.ambientLight=new MA().fromArray(i.ambientLight),Array.isArray(i.ambientTrilight)&&(g.ambientTrilight=i.ambientTrilight.map(I=>new MA().fromArray(I))),g.ambientMode=i.ambientMode,g.environmentReflectionSource=i.environmentReflectionSource}}return null}}Bt.registerCallback(ki.ContextCreated,t=>{const A=t.context,e=aA.findObjectOfType(of,A);e!=null&&e.sourceId&&(e.enabled=!0)});class of extends bA{constructor(){super(...arguments),r(this,"ambientMode",wc.Skybox),r(this,"ambientLight"),r(this,"ambientTrilight"),r(this,"ambientIntensity",1),r(this,"environmentReflectionSource",om.Skybox),r(this,"_hasReflection",!1),r(this,"_ambientLightObj"),r(this,"_hemisphereLightObj")}awake(){var A;if(this.sourceId){const i=this.environmentReflectionSource===om.Skybox?Sr.Skybox:Sr.Reflection,g=this.context.lightmaps.tryGet(this.sourceId,i,0);this._hasReflection=g!=null,g&&this.context.sceneLighting.internalRegisterReflection(this.sourceId,g)}this.enabled=!1,this.context.sceneLighting.internalRegisterSceneLightSettings(this),Zc&&window.addEventListener("keydown",i=>{if(!this.destroyed)switch(i.key){case"l":this.enabled=!this.enabled;break}});const e=(A=this.gameObject.userData)==null?void 0:A.components;if(e){const i=e.indexOf(this);e.splice(i,1),e.push(this)}}onDestroy(){this.context.sceneLighting.internalUnregisterSceneLightSettings(this)}calculateIntensityFactor(A){const e=Math.max(A.r,A.g,A.b);return 2.2*ee.lerp(0,1.33,e)}onEnable(){if(Zc&&console.warn("\u{1F4A1}\u{1F7E1} >>> Enable lighting",this.sourceId,this.enabled,this),this.ambientMode==wc.Flat){if(this.ambientLight&&!this._ambientLightObj){const A=this.calculateIntensityFactor(this.ambientLight);this._ambientLightObj=new fR(this.ambientLight,this.ambientIntensity*A),Zc&&console.log("Created ambient light",this.sourceId,this._ambientLightObj,this.ambientIntensity,A)}this._ambientLightObj&&this.gameObject.add(this._ambientLightObj)}else if(this.ambientMode===wc.Trilight){if(this.ambientTrilight){const A=this.ambientTrilight[0],e=this.ambientTrilight[this.ambientTrilight.length-1],i=this.calculateIntensityFactor(e);this._hemisphereLightObj=new wR(e,A,this.ambientIntensity*i),this.gameObject.add(this._hemisphereLightObj),Zc&&console.log("Created hemisphere ambient light",this.sourceId,this._hemisphereLightObj,this.ambientIntensity,i)}}else this._ambientLightObj&&this._ambientLightObj.removeFromParent(),this._hemisphereLightObj&&this._hemisphereLightObj.removeFromParent();this.sourceId&&this.context.sceneLighting.internalEnableReflection(this.sourceId)}onDisable(){Zc&&console.warn("\u{1F4A1}\u26AB <<< Disable lighting:",this.sourceId,this),this._ambientLightObj&&this._ambientLightObj.removeFromParent(),this._hemisphereLightObj&&this._hemisphereLightObj.removeFromParent(),this.sourceId&&this.context.sceneLighting.internalDisableReflection(this.sourceId)}}var _j=(t=>(t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_3D=35680]="SAMPLER_3D",t[t.SAMPLER_CUBE=35681]="SAMPLER_CUBE",t[t.UNKNOWN=0]="UNKNOWN",t))(_j||{});const gB=tA("debugcustomshader"),Vc="NEEDLE_techniques_webgl";class zhA{constructor(){r(this,"objectToWorldMatrix",new NA),r(this,"worldToObjectMatrix",new NA),r(this,"objectToWorld",new Array),r(this,"worldToObject",new Array)}updateFrom(A){this.objectToWorldMatrix.copy(A.matrixWorld),Im(this.objectToWorldMatrix,this.objectToWorld),this.worldToObjectMatrix.copy(A.matrixWorld).invert(),Im(this.worldToObjectMatrix,this.worldToObject)}}const ci=class extends Fy{constructor(t,...A){super(...A),r(this,"identifier"),r(this,"onBeforeRenderSceneCallback",this.onBeforeRenderScene.bind(this)),r(this,"_sphericalHarmonicsName","unity_SpecCube0"),r(this,"_objToWorldName","hlslcc_mtx4x4unity_ObjectToWorld"),r(this,"_worldToObjectName","hlslcc_mtx4x4unity_WorldToObject"),r(this,"_viewProjectionName","hlslcc_mtx4x4unity_MatrixVP"),r(this,"_viewMatrixName","hlslcc_mtx4x4unity_MatrixV"),r(this,"_rendererData",new zhA),this.identifier=t,gB&&console.log(this),this.type="NEEDLE_CUSTOM_SHADER",this.uniforms[this._objToWorldName]||(this.uniforms[this._objToWorldName]={value:[]}),this.uniforms[this._worldToObjectName]||(this.uniforms[this._worldToObjectName]={value:[]}),this.uniforms[this._viewProjectionName]||(this.uniforms[this._viewProjectionName]={value:[]}),this.uniforms[this._sphericalHarmonicsName],(this.depthTextureUniform||this.opaqueTextureUniform)&&Ke.Current.pre_render_callbacks.push(this.onBeforeRenderSceneCallback)}clone(){const t=super.clone();return Tj(t),t}dispose(){super.dispose();const t=Ke.Current.pre_render_callbacks.indexOf(this.onBeforeRenderSceneCallback);t>=0&&Ke.Current.pre_render_callbacks.splice(t,1)}get depthTextureUniform(){if(this.uniforms)return this.uniforms._CameraDepthTexture}get opaqueTextureUniform(){if(this.uniforms)return this.uniforms._CameraOpaqueTexture}onBeforeRenderScene(){this.opaqueTextureUniform&&Ke.Current.setRequireColor(!0),this.depthTextureUniform&&Ke.Current.setRequireDepth(!0)}onBeforeRender(t,A,e,i,g,I){i.attributes.tangent||i.computeTangents(),this.onUpdateUniforms(e,g)}onUpdateUniforms(t,A){const e=Ke.Current;if(t&&(ci.viewProjection&&this.uniforms[this._viewProjectionName]&&(ci.viewProjection.copy(t.projectionMatrix).multiply(t.matrixWorldInverse),Im(ci.viewProjection,ci._viewProjectionValues)),ci.viewMatrix&&this.uniforms[this._viewMatrixName]&&(ci.viewMatrix.copy(t.matrixWorldInverse),Im(ci.viewMatrix,ci._viewMatrixValues)),this.uniforms[ci._worldSpaceCameraPosName]&&ci._worldSpaceCameraPos.setFromMatrixPosition(t.matrixWorld)),this.uniforms._TimeParameters&&(this.uniforms._TimeParameters.value=e.sceneLighting.timeVec4),this.uniforms._Time){const o=this.uniforms._Time.value;o.x=e.sceneLighting.timeVec4.x/20,o.y=e.sceneLighting.timeVec4.x,o.z=e.sceneLighting.timeVec4.x*2,o.w=e.sceneLighting.timeVec4.x*3}if(this.uniforms._SinTime){const o=this.uniforms._SinTime.value;o.x=Math.sin(e.sceneLighting.timeVec4.x/8),o.y=Math.sin(e.sceneLighting.timeVec4.x/4),o.z=Math.sin(e.sceneLighting.timeVec4.x/2),o.w=Math.sin(e.sceneLighting.timeVec4.x)}if(this.uniforms._CosTime){const o=this.uniforms._CosTime.value;o.x=Math.cos(e.sceneLighting.timeVec4.x/8),o.y=Math.cos(e.sceneLighting.timeVec4.x/4),o.z=Math.cos(e.sceneLighting.timeVec4.x/2),o.w=Math.cos(e.sceneLighting.timeVec4.x)}if(this.uniforms.unity_DeltaTime){const o=this.uniforms.unity_DeltaTime.value;o.x=e.time.deltaTime,o.y=1/e.time.deltaTime,o.z=e.time.smoothedDeltaTime,o.w=1/e.time.smoothedDeltaTime}const i=e.mainLight;if(i){const o=be(i.gameObject,ci._mainLightPosition);this.uniforms._MainLightPosition={value:o.normalize()},ci._mainLightColor.set(i.color.r,i.color.g,i.color.b,0),this.uniforms._MainLightColor={value:ci._mainLightColor};const s=i.intensity;ci._lightData.z=s,this.uniforms.unity_LightData={value:ci._lightData}}if(t&&(ci.viewProjection&&this.uniforms[this._viewProjectionName]&&(this.uniforms[this._viewProjectionName].value=ci._viewProjectionValues),ci.viewMatrix&&this.uniforms[this._viewMatrixName]&&(this.uniforms[this._viewMatrixName].value=ci._viewMatrixValues),this.uniforms[ci._worldSpaceCameraPosName]&&(this.uniforms[ci._worldSpaceCameraPosName]={value:ci._worldSpaceCameraPos}),e.mainCameraComponent)){if(this.uniforms._ProjectionParams){const o=this.uniforms._ProjectionParams.value;o.x=1,o.y=e.mainCameraComponent.nearClipPlane,o.z=e.mainCameraComponent.farClipPlane,o.w=1/o.z,this.uniforms._ProjectionParams.value=o}if(this.uniforms._ZBufferParams){const o=this.uniforms._ZBufferParams.value,s=e.mainCameraComponent;o.x=1-s.farClipPlane/s.nearClipPlane,o.y=s.farClipPlane/s.nearClipPlane,o.z=o.x/s.farClipPlane,o.w=o.y/s.farClipPlane,this.uniforms._ZBufferParams.value=o}if(this.uniforms._ScreenParams){const o=this.uniforms._ScreenParams.value;o.x=e.domWidth,o.y=e.domHeight,o.z=1+1/o.x,o.w=1+1/o.y,this.uniforms._ScreenParams.value=o}if(this.uniforms._ScaledScreenParams){const o=this.uniforms._ScaledScreenParams.value;o.x=e.domWidth,o.y=e.domHeight,o.z=1+1/o.x,o.w=1+1/o.y,this.uniforms._ScaledScreenParams.value=o}}const g=this.depthTextureUniform;g&&(g.value=e.depthTexture);const I=this.opaqueTextureUniform;if(I&&(I.value=e.opaqueColorTexture),A){const o=this._rendererData;o.updateFrom(A),this.uniforms[this._worldToObjectName].value=o.worldToObject,this.uniforms[this._objToWorldName].value=o.objectToWorld}this.uniformsNeedUpdate=!0}};let rC=ci;r(rC,"viewProjection",new NA),r(rC,"_viewProjectionValues",[]),r(rC,"viewMatrix",new NA),r(rC,"_viewMatrixValues",[]),r(rC,"_worldSpaceCameraPosName","_WorldSpaceCameraPos"),r(rC,"_worldSpaceCameraPos",new f),r(rC,"_mainLightColor",new Ae),r(rC,"_mainLightPosition",new f),r(rC,"_lightData",new Ae);class XhA{constructor(A,e){r(this,"parser"),r(this,"identifier"),this.parser=A,this.identifier=e}get name(){return Vc}loadMaterial(A){const e=this.parser.json.materials[A];if(!e)return gB&&console.log(A,this.parser.json.materials),null;if(!e.extensions||!e.extensions[Vc])return gB&&console.log("material "+A+" does not use NEEDLE_techniques_webgl"),null;const i=e.extensions[Vc].technique;if(i<0)return null;const g=this.parser.json.extensions[Vc];if(!g)return null;gB&&console.log(g);const I=g.techniques[i];return I?new Promise(async(o,s)=>{var C,a,n;const B=await mBA(g,I.program),Q=B?.fragmentShader,E=B?.vertexShader;if(!Q||!E)return s();gB&&console.log("loadMaterial",e,B);const h={},l=I.uniforms;(E.includes("_Time")||Q.includes("_Time"))&&(h._Time={value:new Ae(0,0,0,0)}),(E.includes("_SinTime")||Q.includes("_SinTime"))&&(h._SinTime={value:new Ae(0,0,0,0)}),(E.includes("_CosTime")||Q.includes("_CosTime"))&&(h._CosTime={value:new Ae(0,0,0,0)}),(E.includes("unity_DeltaTime")||Q.includes("unity_DeltaTime"))&&(h.unity_DeltaTime={value:new Ae(0,0,0,0)});for(const u in l){const p=u;switch(p){case"_TimeParameters":const D=new Ae;h[p]={value:D};break;case"hlslcc_mtx4x4unity_MatrixV":case"hlslcc_mtx4x4unity_MatrixVP":h[p]={value:[]};break;case"_MainLightPosition":case"_MainLightColor":case"_WorldSpaceCameraPos":h[p]={value:[0,0,0,1]};break;case"unity_OrthoParams":break;case"unity_SpecCube0":h[p]={value:null};break;default:case"_ScreenParams":case"_ZBufferParams":case"_ProjectionParams":h[p]={value:[0,0,0,0]};break;case"_CameraOpaqueTexture":case"_CameraDepthTexture":h[p]={value:null};break}}let d=!1;if(e.extensions&&e.extensions[Vc]){const u=e.extensions[Vc];if(u.technique===i){gB&&console.log(e.name,"Material Properties",u);for(const p in u.values){const D=u.values[p];if(typeof D=="string"){if(D.startsWith("/textures/")){const m=D.substring(10),M=Number.parseInt(m);if(M>=0){let k=await this.parser.getDependency("texture",M);k instanceof He&&(k=k.clone(),k.colorSpace=Dt,k.needsUpdate=!0),h[p]={value:k};continue}}switch(p){case"alphaMode":D==="BLEND"&&(d=!0);continue}}if(Array.isArray(D)&&D.length===4){h[p]={value:new Ae(D[0],D[1],D[2],D[3])};continue}h[p]={value:D}}}}const c=new rC(this.identifier,{name:e.name??"",uniforms:h,vertexShader:E,fragmentShader:Q,lights:!1});switch(c.glslVersion=Fw,c.vertexShader=c.vertexShader.replace("#version 300 es",""),c.fragmentShader=c.fragmentShader.replace("#version 300 es",""),(C=h._Cull)==null?void 0:C.value){case 0:c.side=ht;break;case 1:c.side=yi;break;case 2:c.side=lg;break;default:c.side=lg;break}switch((a=h._ZTest)==null?void 0:a.value){case 3:c.depthTest=!0,c.depthFunc=KE;break;case 6:c.depthTest=!0,c.depthFunc=Ll;break;case 2:c.depthTest=!0,c.depthFunc=xl;break;case 4:c.depthTest=!0,c.depthFunc=fB;break;case 5:c.depthTest=!0,c.depthFunc=Ew;break;case 7:c.depthTest=!0,c.depthFunc=Qw;break;case 8:c.depthTest=!1,c.depthFunc=Bw;break}c.transparent=d,d&&(c.depthWrite=!1),yBA(h),c.onUpdateUniforms();for(const u in l){const p=u,D=l[u].type;if(((n=h[p])==null?void 0:n.value)===void 0)switch(D){case _j.SAMPLER_2D:h[p]={value:DBA},console.warn("Missing/unassigned texture, fallback to white: "+p);break;default:p==="unity_OrthoParams"||console.warn("TODO: EXPECTED UNIFORM / fallback NOT SET: "+p,l[u]);break}}gB&&console.log(c.uuid,h),Tj(c),o(c)}):null}}function Tj(t){if(t.uniforms){gB&&console.log("Uniforms:",t.uniforms);for(const e in t.uniforms)switch(A(e,e),e){case"_Color":A("color",e);break}}function A(e,i){Object.getOwnPropertyDescriptor(t,e)||Object.defineProperty(t,e,{get:()=>t.uniforms[i].value,set:g=>{t.uniforms[i].value=g,t.needsUpdate=!0}})}}const $hA=tA("debugextensions");let sf;const AcA=Promise.resolve().then(()=>pwA).then(async t=>(sf=t.GLTFAnimationPointerExtension,sf)).catch(t=>{console.warn("Failed to import GLTFLoaderAnimationPointer. Please use @needle-tools/three for full KHR_animation support",t)}),gE=new Array;function ecA(t){gE.includes(t)||gE.push(t)}function tcA(t){const A=gE.indexOf(t);A>=0&&gE.splice(A,1)}function pv(t){const A=new WhA;return t.register(e=>(A.parser=e,A)),A}class icA{resolvePath(A){return A.includes("/extensions/builtin_components/")?A.replace("/extensions/builtin_components/","/userData/components/"):A.includes("extensions/builtin_components/")?A.replace("extensions/builtin_components/","/userData/components/"):A}}async function Dv(t,A,e){const i=e.indexOf("?");i>=0&&(e=e.substring(0,i)),t.register(g=>new ZhA(g)),t.register(g=>new TsA(g)),t.register(g=>new caA(g,A.lightmaps,e)),t.register(g=>new VhA(g,e,A)),t.register(g=>new XhA(g,e)),t.register(g=>new lv(g,e)),t.register(g=>new ut(g,e)),t.register(g=>new HhA(g)),U2()&&t.register(g=>new ON(g)),await AcA.catch(g=>{}),t.register(g=>{if(sf){const I=new sf(g);return I.setAnimationPointerResolver.bind(I)(new icA),I}else return($hA||Be())&&console.error("Missing KHR_animation_pointer extension..."),{name:"KHR_animation_pointer_NOT_AVAILABLE"}});for(const g of gE)g.onImport&&g.onImport(t,e,A)}function Yj(t,A){for(const e of gE)e.onExport&&e.onExport(t,A)}function wv(t,A,e){for(const i of gE)i.onLoaded&&i.onLoaded(t,A,e)}const BC=tA("debuginstancing"),Hj=class{constructor(){r(this,"objs",[])}setup(t,A,e,i,g,I=0){t.applySettings(A);const o=this.tryCreateOrAddInstance(A,e,g);if(o)ut.assignTextureLOD(o.renderer.material,0),i===null&&(i=[]),i.push(o);else if(I<=0&&A.type!=="Mesh"){const s=I+1;for(const C of A.children)i=this.setup(t,C,e,i,g,s)}return I===0&&g.useMatrixWorldAutoUpdate&&i&&i.length>=0&&this.autoUpdateInstanceMatrix(A),i}tryCreateOrAddInstance(t,A,e){if(t.type==="Mesh"){const i=e.foundMeshes;if(e.foundMeshes+=1,!e.rend.enableInstancing)return null;if(e.rend.enableInstancing!==!0){if(i>=e.rend.enableInstancing.length)return BC&&console.error("Something is wrong with instance setup",t,e.rend.enableInstancing,i),null;if(!e.rend.enableInstancing[i])return null}const g=t,I=g.material;for(const a of this.objs)if(!!a.canAdd(g.geometry,I))return a.addInstance(g);const o=16;let s=t.name;s!=null&&s.length||(s=TR());const C=new Oj(s,g.geometry,I,o,A);return this.objs.push(C),C.addInstance(g)}return null}autoUpdateInstanceMatrix(t){const A=t.matrixWorld.multiplyMatrices.bind(t.matrixWorld),e=t.matrixWorld.clone(),i=(g,I)=>{const o=A(g,I);return(t[su]||e.equals(o)===!1)&&(e.copy(o),t[su]=!0),o};t.matrixWorld.multiplyMatrices=i}};let Tp=Hj;r(Tp,"instance",new Hj);const Cf=class{constructor(t,A){r(this,"object"),r(this,"renderer"),r(this,"__instanceIndex",-1),r(this,"__reservedVertexRange",0),r(this,"__reservedIndexRange",0),r(this,"meshInformation"),this.__instanceIndex=-1,this.object=t,this.renderer=A,t[J2]=A,this.meshInformation=zc(t.geometry),Cf.all.push(this)}get name(){return this.object.name}get isActive(){return this.__instanceIndex>=0}get vertexCount(){return this.object.geometry.attributes.position.count}get maxVertexCount(){return this.meshInformation.vertexCount}get reservedVertexCount(){return this.__reservedVertexRange}get indexCount(){return this.object.geometry.index?this.object.geometry.index.count:0}get maxIndexCount(){return this.meshInformation.indexCount}get reservedIndexCount(){return this.__reservedIndexRange}updateInstanceMatrix(t=!1,A=!0){this.__instanceIndex<0||(A&&this.object.updateWorldMatrix(!0,t),this.renderer.updateInstance(this.object.matrixWorld,this.__instanceIndex))}setMatrix(t){this.__instanceIndex<0||this.renderer.updateInstance(t,this.__instanceIndex)}setGeometry(t){return this.__instanceIndex<0?!1:this.vertexCount>this.__reservedVertexRange?(console.error(`Cannot update geometry, reserved range is too small: ${this.__reservedVertexRange} < ${this.vertexCount} vertices for ${this.name}`),!1):this.indexCount>this.__reservedIndexRange?(console.error(`Cannot update geometry, reserved range is too small: ${this.__reservedIndexRange} < ${this.indexCount} indices for ${this.name}`),!1):this.renderer.updateGeometry(t,this.__instanceIndex)}add(){this.__instanceIndex>=0||(this.renderer.add(this),aA.markAsInstancedRendered(this.object,!0))}remove(t){if(!(this.__instanceIndex<0)&&(this.renderer.remove(this,t),aA.markAsInstancedRendered(this.object,!1),t)){const A=Cf.all.indexOf(this);A>=0&&Cf.all.splice(A,1)}}};let Yp=Cf;r(Yp,"all",[]);class Oj{constructor(A,e,i,g,I){r(this,"allowResize",!0),r(this,"name",""),r(this,"geometry"),r(this,"material"),r(this,"context"),r(this,"inst"),r(this,"handles",[]),r(this,"maxInstanceCount"),r(this,"_currentInstanceCount",0),r(this,"_currentVertexCount",0),r(this,"_currentIndexCount",0),r(this,"_maxVertexCount"),r(this,"_maxIndexCount"),r(this,"_needUpdateBounds",!1),r(this,"_debugMaterial",null),r(this,"onBeforeRender",()=>{this.inst.layers.enableAll(),this._needUpdateBounds&&this.inst[Cu]===!0&&(BC&&console.log("Update instancing bounds",this.name,this.inst.matrixWorldNeedsUpdate),this.updateBounds())}),r(this,"onAfterRender",()=>{this.inst.layers.disableAll()}),r(this,"_availableBuckets",new Array),r(this,"_usedBuckets",new Array),this.name=A,this.geometry=e,this.material=i,this.context=I,this.maxInstanceCount=Math.max(2,g),BC&&(this._debugMaterial=Pj());const o=this.tryEstimateVertexCountSize(this.maxInstanceCount,[e],g);this._maxVertexCount=o.vertexCount,this._maxIndexCount=o.indexCount,this.inst=new dy(this.maxInstanceCount,this._maxVertexCount,this._maxIndexCount,this._debugMaterial??this.material),this.inst[Cu]=!0,this.inst.visible=!0,this.context.scene.add(this.inst),i instanceof Fy&&(i.defines.USE_INSTANCING=!0,i.needsUpdate=!0),I.pre_render_callbacks.push(this.onBeforeRender),I.post_render_callbacks.push(this.onAfterRender),BC&&console.log(`Instanced renderer created with ${this.maxInstanceCount} instances, ${this._maxVertexCount} max vertices and ${this._maxIndexCount} max indices for "${A}"`)}get mesh(){return this.inst}get visible(){return this.inst.visible}set visible(A){this.inst.visible=A}get castShadow(){return this.inst.castShadow}set castShadow(A){this.inst.castShadow=A}set receiveShadow(A){this.inst.receiveShadow=A}updateBounds(A=!0,e=!0){this._needUpdateBounds=!1,A&&this.inst.computeBoundingBox(),e&&this.inst.computeBoundingSphere()}get count(){return this._currentInstanceCount}canAdd(A,e){return this._maxVertexCount>1e7||e!==this.material?!1:!!(!this.mustGrow(A)||this.allowResize)}dispose(){BC&&console.warn("Dispose instanced renderer",this.name),this.context.scene.remove(this.inst),this.inst.dispose(),this.inst=null,this.handles=[]}addInstance(A){const e=new Yp(A,this);A.castShadow===!0&&this.inst.castShadow===!1&&(this.inst.castShadow=!0),A.receiveShadow===!0&&this.inst.receiveShadow===!1&&(this.inst.receiveShadow=!0);try{this.add(e)}catch(i){return console.error(`Failed adding mesh to instancing
|
|
6222
6222
|
`,i),Be()&&PU("Failed instancing mesh. See the browser console for details."),null}return e}add(A){const e=A.object.geometry;if(!this.validateGeometry(e)){BC&&console.error("Cannot add instance, invalid geometry",this.name,e);return}if(this.mustGrow(e))if(this.allowResize)this.grow(e);else{console.error("Cannot add instance, max count reached",this.name,this.count,this.maxInstanceCount);return}A.object.updateWorldMatrix(!0,!0),this.addGeometry(A),this.handles[A.__instanceIndex]=A,this._currentInstanceCount+=1,this.markNeedsUpdate(),this._currentInstanceCount>0&&(this.inst.visible=!0)}remove(A,e){A&&(A.__instanceIndex<0||this.handles[A.__instanceIndex]!=A||this._currentInstanceCount<=0||(this.removeGeometry(A,e),this.handles[A.__instanceIndex]=null,A.__instanceIndex=-1,this._currentInstanceCount>0&&(this._currentInstanceCount-=1),this._currentInstanceCount<=0&&(this.inst.visible=!1),this.markNeedsUpdate()))}updateInstance(A,e){this.inst.setMatrixAt(e,A),this.markNeedsUpdate()}updateGeometry(A,e){return this.validateGeometry(A)?(this.mustGrow()&&this.grow(A),BC&&console.debug("UPDATE MESH",e,A.name,zc(A),A.attributes.position.count,A.index?A.index.count:0),this.inst.setGeometryAt(e,A),this.markNeedsUpdate(),!0):!1}validateGeometry(A){return this.geometry,!0}markNeedsUpdate(){this._needUpdateBounds=!0}mustGrow(A){if(this.count>=this.maxInstanceCount)return!0;if(!A)return!1;const e=zc(A),i=e.vertexCount,g=e.indexCount;return this._currentVertexCount+i>this._maxVertexCount||this._currentIndexCount+g>this._maxIndexCount}grow(A){const e=this.maxInstanceCount*2,i=this.tryEstimateVertexCountSize(e,[A]),g=Math.max(this._maxVertexCount,i.vertexCount),I=Math.max(this._maxIndexCount,i.indexCount,this._maxVertexCount*2);if(BC){const s=zc(A);console.warn(`Growing batched mesh for "${this.name}/${A.name}" ${s.vertexCount} vertices, ${s.indexCount} indices
|
|
6223
6223
|
Max count ${this.maxInstanceCount} \u2192 ${e}
|
|
@@ -6316,10 +6316,10 @@ Texture:`,i),this.setLightmapDebugMaterial()):Hp&&console.log("Use debuglightmap
|
|
|
6316
6316
|
|
|
6317
6317
|
gl_FragColor = sum;
|
|
6318
6318
|
|
|
6319
|
-
}`};var BcA=Object.defineProperty,QcA=Object.getOwnPropertyDescriptor,Xc=(t,A,e,i)=>{for(var g=i>1?void 0:i?QcA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&BcA(A,e,g),g};const Ef=tA("debugcontactshadows");var fv;const zj=(fv=class extends bA{constructor(){super(...arguments),r(this,"autoFit",!1),r(this,"darkness",.5),r(this,"opacity",.5),r(this,"blur",4),r(this,"occludeBelowGround",!0),r(this,"backfaceShadows",!0),r(this,"shadowCamera"),r(this,"shadowGroup"),r(this,"renderTarget"),r(this,"renderTargetBlur"),r(this,"plane"),r(this,"occluderMesh"),r(this,"blurPlane"),r(this,"depthMaterial"),r(this,"horizontalBlurMaterial"),r(this,"verticalBlurMaterial")}static auto(t){if(!this._instance||this._instance.destroyed){const A=new wA;this._instance=_r(A,zj,{autoFit:!1,occludeBelowGround:!1})}return t||(t=Ke.Current),t.scene.add(this._instance.gameObject),this._instance.fitShadows(),this._instance}fitShadows(){Ef&&console.log("Fitting shadows to scene"),vU(this.gameObject,!1);const t=OU(this.context.scene.children,[this.gameObject]);
|
|
6319
|
+
}`};var BcA=Object.defineProperty,QcA=Object.getOwnPropertyDescriptor,Xc=(t,A,e,i)=>{for(var g=i>1?void 0:i?QcA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&BcA(A,e,g),g};const Ef=tA("debugcontactshadows");var fv;const zj=(fv=class extends bA{constructor(){super(...arguments),r(this,"autoFit",!1),r(this,"darkness",.5),r(this,"opacity",.5),r(this,"blur",4),r(this,"occludeBelowGround",!0),r(this,"backfaceShadows",!0),r(this,"shadowCamera"),r(this,"shadowGroup"),r(this,"renderTarget"),r(this,"renderTargetBlur"),r(this,"plane"),r(this,"occluderMesh"),r(this,"blurPlane"),r(this,"depthMaterial"),r(this,"horizontalBlurMaterial"),r(this,"verticalBlurMaterial")}static auto(t){if(!this._instance||this._instance.destroyed){const A=new wA;this._instance=_r(A,zj,{autoFit:!1,occludeBelowGround:!1})}return t||(t=Ke.Current),t.scene.add(this._instance.gameObject),this._instance.fitShadows(),this._instance}fitShadows(){Ef&&console.log("Fitting shadows to scene"),vU(this.gameObject,!1);const t=OU(this.context.scene.children,[this.gameObject]),A=.01;t.expandByVector(new f(A,0,A));const e=t.min,i=Math.max(1e-5,(t.max.y-e.y)*.002);t.max.y+=i,Ef&&Se.DrawWireBox3(t,16776960,60),this.gameObject.position.set((e.x+t.max.x)/2,e.y-i,(e.z+t.max.z)/2),this.gameObject.scale.set(t.max.x-e.x,t.max.y-e.y,t.max.z-e.z)}awake(){vU(this.gameObject,!1)}start(){Ef&&console.log("Create ContactShadows on "+this.gameObject.name,this);const t=512;this.shadowGroup=new Io,this.gameObject.add(this.shadowGroup),this.renderTarget=new Pe(t,t),this.renderTarget.texture.generateMipmaps=!1,this.renderTargetBlur=new Pe(t,t),this.renderTargetBlur.texture.generateMipmaps=!1;const A=new gg(1,1).rotateX(Math.PI/2);this.gameObject instanceof dA&&(console.warn("ContactShadows can not be added to a Mesh. Please add it to a Group or an empty Object"),iE(this.gameObject,!1));const e=new st({map:this.renderTarget.texture,opacity:this.opacity,color:0,transparent:!0,depthWrite:!1});this.plane=new dA(A,e),this.plane.scale.y=-1,this.gameObject.add(this.plane),this.plane&&(this.plane.renderOrder=1),this.occluderMesh=new dA(this.plane.geometry,new st({depthWrite:!0,stencilWrite:!0,colorWrite:!1})).translateY(-1e-4),this.occluderMesh.renderOrder=-100,this.gameObject.add(this.occluderMesh),this.blurPlane=new dA(A),this.blurPlane.visible=!1,this.shadowGroup.add(this.blurPlane),this.shadowCamera=new Na(-1/2,1/2,1/2,-1/2,0,1),this.shadowCamera.rotation.x=Math.PI/2,this.shadowGroup.add(this.shadowCamera),this.depthMaterial=new ad,this.depthMaterial.userData.darkness={value:this.darkness},this.depthMaterial.blending=fG,this.depthMaterial.blendEquation=aw,this.depthMaterial.onBeforeCompile=i=>{this.depthMaterial&&(i.uniforms.darkness=this.depthMaterial.userData.darkness,i.fragmentShader=`
|
|
6320
6320
|
uniform float darkness;
|
|
6321
6321
|
${i.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 1.0 ), ( 1.0 - fragCoordZ ) * darkness * opacity * (gl_FrontFacing ? 1.0 : 0.66) );")}
|
|
6322
|
-
`)},this.depthMaterial.depthTest=!1,this.depthMaterial.depthWrite=!1,this.horizontalBlurMaterial=new Me(ncA),this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial=new Me(rcA),this.verticalBlurMaterial.depthTest=!1,this.shadowGroup.visible=!1,this.autoFit&&this.fitShadows()}onDestroy(){var t,A,e,i,g,I,o,s;(t=this.renderTarget)==null||t.dispose(),(A=this.renderTargetBlur)==null||A.dispose(),(e=this.depthMaterial)==null||e.dispose(),(i=this.horizontalBlurMaterial)==null||i.dispose(),(g=this.verticalBlurMaterial)==null||g.dispose(),(I=this.blurPlane)==null||I.geometry.dispose(),(o=this.plane)==null||o.geometry.dispose(),(s=this.occluderMesh)==null||s.geometry.dispose()}onBeforeRender(t){if(!this.renderTarget||!this.renderTargetBlur||!this.depthMaterial||!this.shadowCamera||!this.blurPlane||!this.shadowGroup||!this.plane||!this.horizontalBlurMaterial||!this.verticalBlurMaterial){Ef&&console.error("ContactShadows: not initialized yet");return}const A=this.context.scene,e=this.context.renderer,i=e.getRenderTarget();this.shadowGroup.visible=!0,this.occluderMesh&&(this.occluderMesh.visible=!1);const g=this.plane.visible;this.plane.visible=!1,this.gameObject instanceof dA&&iE(this.gameObject,!1);const I=A.background;A.background=null,A.overrideMaterial=this.depthMaterial,this.backfaceShadows?this.depthMaterial.side=ht:this.depthMaterial.side=lg;const o=e.getClearAlpha();e.setClearAlpha(0);const s=e.xr.enabled;e.xr.enabled=!1;const C=e.renderLists.get(A,0),a=C.transparent;C.transparent=[],e.setRenderTarget(this.renderTarget),e.clear(),e.render(A,this.shadowCamera),C.transparent=a,A.overrideMaterial=null,this.blurShadow(this.blur),this.blurShadow(this.blur*.4),this.shadowGroup.visible=!1,this.occluderMesh&&(this.occluderMesh.visible=this.occludeBelowGround),this.plane.visible=g,e.setRenderTarget(i),e.setClearAlpha(o),A.background=I,e.xr.enabled=s}blurShadow(t){if(!this.blurPlane||!this.shadowCamera||!this.renderTarget||!this.renderTargetBlur||!this.horizontalBlurMaterial||!this.verticalBlurMaterial)return;this.blurPlane.visible=!0,this.blurPlane.material=this.horizontalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTarget.texture,this.horizontalBlurMaterial.uniforms.h.value=t*1/256;const A=this.context.renderer,e=A.getRenderTarget();A.setRenderTarget(this.renderTargetBlur),A.render(this.blurPlane,this.shadowCamera),this.blurPlane.material=this.verticalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTargetBlur.texture,this.verticalBlurMaterial.uniforms.v.value=t*1/256,A.setRenderTarget(this.renderTarget),A.render(this.blurPlane,this.shadowCamera),this.blurPlane.visible=!1,A.setRenderTarget(e)}},r(fv,"_instance"),fv);let yn=zj;Xc([w()],yn.prototype,"autoFit",2),Xc([w()],yn.prototype,"darkness",2),Xc([w()],yn.prototype,"opacity",2),Xc([w()],yn.prototype,"blur",2),Xc([w()],yn.prototype,"occludeBelowGround",2),Xc([w()],yn.prototype,"backfaceShadows",2);var EcA=Object.defineProperty,hcA=Object.getOwnPropertyDescriptor,Xp=(t,A,e,i)=>{for(var g=i>1?void 0:i?hcA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&EcA(A,e,g),g};const Xj=tA("debugwebxr"),ccA=new NA().makeRotationY(Math.PI);class To extends bA{constructor(){super(...arguments),r(this,"_arScale",1),r(this,"invertForward",!1),r(this,"customReticle"),r(this,"useXRAnchor",!1),r(this,"arTouchTransform",!1),r(this,"_isPlacing",!0),r(this,"_startOffset",new NA),r(this,"_createdPlacementObject",null),r(this,"_reparentedComponents",[]),r(this,"_placementScene",new QI),r(this,"_reticle",[]),r(this,"_hits",[]),r(this,"_placementStartTime",-1),r(this,"_rigPlacementMatrix"),r(this,"_anchor",null),r(this,"userInput"),r(this,"onPlaceScene",A=>{var e;if(this._isPlacing==!1||A.used)return;let i=this._reticle[0],g=this._hits[0];if(A.origin instanceof SF){const I=this._reticle[A.origin.index];I&&(i=I,g=this._hits[A.origin.index])}if(!i){console.warn("No reticle to place...");return}if(!i.visible){console.warn("Reticle is not visible (can not place)");return}if((e=pe.active)!=null&&e.isTrackingImages){console.warn("Scene Placement is disabled while images are being tracked");return}A.stopImmediatePropagation(),A.use(),this._isPlacing=!1,this.context.input.removeEventListener("pointerup",this.onPlaceScene),this.onRevertSceneChanges(),i.position.copy(i.lastPos),i.quaternion.copy(i.lastQuat),this.onApplyPose(i),this.useXRAnchor&&this.onCreateAnchor(pe.active,g)}),r(this,"upVec",new f(0,1,0)),r(this,"lookPoint",new f),r(this,"worldUpVec",new f(0,1,0))}get arScale(){return this._arScale}set arScale(A){A!==this._arScale&&(this._arScale=A,this.onScaleChanged())}onEnable(){var A;(A=this.customReticle)==null||A.preload()}supportsXR(A){return A==="immersive-ar"}onEnterXR(A){Xj&&console.log("ENTER WEBXR: SessionRoot start..."),this._anchor=null,this.gameObject.updateMatrixWorld(),this._startOffset.copy(this.gameObject.matrixWorld);const e=new wA;this._createdPlacementObject=e,e.name="AR Session Root",this._placementScene.name="AR Placement Scene",this._placementScene.children.length=0;for(let i=this.context.scene.children.length-1;i>=0;i--){const g=this.context.scene.children[i];this._placementScene.add(g)}this.context.scene.add(e),this._reparentedComponents.length=0,this._reparentedComponents.push({comp:this,originalObject:this.gameObject}),aA.addComponent(e,this);for(const i of this._reticle)CC(i);this._reticle.length=0,this._isPlacing=!0,this.context.input.addEventListener("pointerup",this.onPlaceScene,{queue:vC.Late})}onLeaveXR(){this.context.input.removeEventListener("pointerup",this.onPlaceScene,{queue:vC.Late}),this.onRevertSceneChanges(),this._anchor=null,this._rigPlacementMatrix=void 0}onUpdateXR(A){var e,i,g,I;if(A.xr.isTrackingImages){for(const o of this._reticle)o.visible=!1;return}if(this._isPlacing){const o=(e=A.xr.rig)==null?void 0:e.gameObject;o&&o.parent!==this.context.scene&&this.context.scene.add(o);let s=!1;if(A.xr.isPassThrough&&A.xr.controllers.length>0)for(const C of A.xr.controllers){const a=C.getHitTest();a&&(s=!0,this.updateReticleAndHits(A.xr,C.index,a,A.xr.rigScale))}if(!s){const C=A.xr.getHitTest();C&&this.updateReticleAndHits(A.xr,0,C,A.xr.rigScale)}}else{if(this._anchor&&A.xr.referenceSpace){const o=A.xr.frame.getPose(this._anchor.anchorSpace,A.xr.referenceSpace);if(o&&this.context.time.frame%20===0){const s=A.xr.convertSpace(o.transform),C=this._reticle[0];C&&(C.position.copy(s.position),C.quaternion.copy(s.quaternion),this.onApplyPose(C))}}if(this.arTouchTransform?(this.userInput||(this.userInput=new hf(this.context)),(i=this.userInput)==null||i.enable()):(g=this.userInput)==null||g.disable(),this.arTouchTransform&&(I=this.userInput)!=null&&I.hasChanged){if(A.xr.rig){const o=A.xr.rig.gameObject;this.userInput.applyMatrixTo(o.matrix,!0),o.matrix.decompose(o.position,o.quaternion,o.scale),this.userInput.factor=o.scale.x}this.userInput.reset()}}}updateReticleAndHits(A,e,i,g){this._hits[e]=i.hit;let I=this._reticle[e];if(!I){if(this.customReticle)if(this.customReticle.asset)I=mc(this.customReticle.asset);else{this.customReticle.loadAssetAsync();return}else I=new dA(new RE(.07,.09,32).rotateX(-Math.PI/2),new st({side:ht})),I.name="AR Placement Reticle";if(Xj){const o=new is(1);o.position.y+=.01,I.add(o)}this._reticle[e]=I,I.matrixAutoUpdate=!1,I.visible=!1}I.lastPos=I.lastPos||i.position.clone(),I.lastQuat=I.lastQuat||i.quaternion.clone(),I.position.copy(I.lastPos.lerp(i.position,this.context.time.deltaTime/.1)),I.lastPos.copy(I.position),I.quaternion.copy(I.lastQuat.slerp(i.quaternion,this.context.time.deltaTime/.05)),I.lastQuat.copy(I.quaternion),I.scale.set(g,g,g),this.customReticle&&this.applyViewBasedTransform(I),I.updateMatrix(),I.visible=!0,I.parent!==this.context.scene&&this.context.scene.add(I),this._placementStartTime<0&&(this._placementStartTime=this.context.time.realtimeSinceStartup)}onScaleChanged(){}onRevertSceneChanges(){var A;for(const e of this._reticle)e&&(e.visible=!1,e?.removeFromParent());this._reticle.length=0;for(let e=this._placementScene.children.length-1;e>=0;e--){const i=this._placementScene.children[e];this.context.scene.add(i)}(A=this._createdPlacementObject)==null||A.removeFromParent();for(const e of this._reparentedComponents)aA.addComponent(e.originalObject,e.comp)}async onCreateAnchor(A,e){if(e.createAnchor===void 0){console.warn("Hit does not support creating an anchor",e),Be()&&Bi("Hit does not support creating an anchor");return}else{const i=await e.createAnchor(A.viewerPose.transform);A.running&&i&&(this._anchor=i)}}applyViewBasedTransform(A){const e=this.context.mainCamera,i=A,g=e.worldPosition,I=i.worldPosition;this.upVec.set(0,1,0).applyQuaternion(A.quaternion);const o=e.worldPosition;o&&A.position.clone().sub(o).angleTo(this.upVec)<Math.PI/2&&this.upVec.negate();const s=this.upVec.angleTo(this.worldUpVec)*180/Math.PI,C=30;s>C&&s<180-C||s<-C&&s>-180+C?(this.lookPoint.copy(A.position).add(this.upVec),this.lookPoint.y=A.position.y,A.lookAt(this.lookPoint)):(g.y=I.y,A.lookAt(g))}onApplyPose(A){var e,i,g,I;const o=(i=(e=pe.active)==null?void 0:e.rig)==null?void 0:i.gameObject;if(!o){console.warn("No rig object to place");return}(g=pe.active)!=null&&g.rigScale;const s=o.parent||this.context.scene;this._rigPlacementMatrix?(I=this._rigPlacementMatrix)==null||I.decompose(o.position,o.quaternion,o.scale):this._rigPlacementMatrix=o.matrix.clone(),this.applyViewBasedTransform(A),A.updateMatrix(),this.context.scene.add(A),A.attach(o),A.removeFromParent(),o.scale.set(this.arScale,this.arScale,this.arScale),o.position.multiplyScalar(this.arScale),o.updateMatrix(),this.invertForward&&o.matrix.premultiply(ccA),o.matrix.premultiply(this._startOffset),o.matrix.decompose(o.position,o.quaternion,o.scale),s.add(o)}}Xp([w()],To.prototype,"arScale",1),Xp([w()],To.prototype,"invertForward",2),Xp([w(et)],To.prototype,"customReticle",2),Xp([w()],To.prototype,"useXRAnchor",2),Xp([w()],To.prototype,"arTouchTransform",2);const kv=class{constructor(t){r(this,"oneFingerDrag",!0),r(this,"twoFingerRotate",!0),r(this,"twoFingerScale",!0),r(this,"factor",1),r(this,"context"),r(this,"offset"),r(this,"plane"),r(this,"_scale",1),r(this,"_hasChanged",!1),r(this,"_enabled",!1),r(this,"currentlyUsedPointerIds",new Set),r(this,"currentlyUnusedPointerIds",new Set),r(this,"onPointerDownEarly",A=>{this.isActive&&A.stopPropagation()}),r(this,"onPointerDownLate",A=>{A.used?this.currentlyUsedPointerIds.add(A.pointerId):this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.add(A.pointerId)}),r(this,"onPointerUpEarly",A=>{this.currentlyUsedPointerIds.delete(A.pointerId),this.currentlyUnusedPointerIds.delete(A.pointerId)}),r(this,"prev",new Map),r(this,"_didMultitouch",!1),r(this,"touchStart",A=>{for(let e=0;e<A.changedTouches.length;e++){const i=A.changedTouches[e],g=KT()&&i.clientY<window.innerHeight*.1;this.prev.has(i.identifier)||this.prev.set(i.identifier,{ignore:g,x:0,z:0,screenx:0,screeny:0});const I=this.prev.get(i.identifier);if(I){const o=this.getPositionOnPlane(i.clientX,i.clientY);I.x=o.x,I.z=o.z,I.screenx=i.clientX,I.screeny=i.clientY}}}),r(this,"touchEnd",A=>{A.touches.length<=0&&(this._didMultitouch=!1);for(let e=0;e<A.changedTouches.length;e++){const i=A.changedTouches[e];this.prev.delete(i.identifier)}}),r(this,"touchMove",A=>{if(!A.defaultPrevented&&this.isActive){if(A.touches.length===1){if(this._didMultitouch)return;const e=A.touches[0],i=this.prev.get(e.identifier);if(!i||i.ignore)return;const g=this.getPositionOnPlane(e.clientX,e.clientY),I=g.x-i.x,o=g.z-i.z;if(I===0&&o===0)return;this.oneFingerDrag&&this.addMovement(I,o),i.x=g.x,i.z=g.z,i.screenx=e.clientX,i.screeny=e.clientY;return}else if(A.touches.length===2){this._didMultitouch=!0;const e=A.touches[0],i=A.touches[1],g=this.prev.get(e.identifier),I=this.prev.get(i.identifier);if(!g||!I)return;if(this.twoFingerRotate){const o=Math.atan2(e.clientY-i.clientY,e.clientX-i.clientX),s=Math.atan2(g.screeny-I.screeny,g.screenx-I.screenx),C=o-s;Math.abs(C)>.001&&this.addRotation(C)}if(this.twoFingerScale){const o=e.clientX-i.clientX,s=e.clientY-i.clientY,C=Math.sqrt(o*o+s*s),a=g.screenx-I.screenx,n=g.screeny-I.screeny,B=Math.sqrt(a*a+n*n),Q=C-B;Math.abs(Q)>2&&this.addScale(Q)}g.screenx=e.clientX,g.screeny=e.clientY,I.screenx=i.clientX,I.screeny=i.clientY}}}),r(this,"_raycaster",new XB),r(this,"_intersection",new f),r(this,"_screenPos",new f),r(this,"_tempMatrix",new NA),this.context=t,this.offset=new NA,this.plane=new bI,this.plane.setFromNormalAndCoplanarPoint(kv.up,kv.zero)}reset(){this._scale=1,this.offset.identity()}get hasChanged(){return this._hasChanged}applyMatrixTo(t,A){this._hasChanged=!1,A?(this.offset.invert(),t.premultiply(this.offset)):t.multiply(this.offset)}get isActive(){return this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.size>0}enable(){this._enabled||(this._enabled=!0,this.context.input.addEventListener("pointerdown",this.onPointerDownEarly,{queue:vC.Early}),this.context.input.addEventListener("pointerdown",this.onPointerDownLate,{queue:vC.Late}),this.context.input.addEventListener("pointerup",this.onPointerUpEarly,{queue:vC.Early}),window.addEventListener("touchstart",this.touchStart,{passive:!1}),window.addEventListener("touchmove",this.touchMove,{passive:!1}),window.addEventListener("touchend",this.touchEnd,{passive:!1}))}disable(){this._enabled&&(this._enabled=!1,this.context.input.removeEventListener("pointerdown",this.onPointerDownEarly,{queue:vC.Early}),this.context.input.removeEventListener("pointerdown",this.onPointerDownLate,{queue:vC.Late}),this.context.input.removeEventListener("pointerup",this.onPointerUpEarly,{queue:vC.Early}),window.removeEventListener("touchstart",this.touchStart),window.removeEventListener("touchmove",this.touchMove),window.removeEventListener("touchend",this.touchEnd))}getPositionOnPlane(t,A){const e=this.context.mainCamera;return this._screenPos.x=t/window.innerWidth*2-1,this._screenPos.y=-(A/window.innerHeight)*2+1,this._screenPos.z=1,this._screenPos.unproject(e),this._raycaster.set(e.position,this._screenPos.sub(e.position)),this._raycaster.ray.intersectPlane(this.plane,this._intersection),this._intersection}addMovement(t,A){t/=this._scale,A/=this._scale,t*=this.factor,A*=this.factor,this.offset.elements[12]+=t,this.offset.elements[14]+=A,(t!==0||A!==0)&&(this._hasChanged=!0)}addScale(t){t/=window.innerWidth,t*=-1,this._scale*=1+t,this._tempMatrix.makeScale(1-t,1-t,1-t),this.offset.premultiply(this._tempMatrix),t!==0&&(this._hasChanged=!0)}addRotation(t){t*=-1,this._tempMatrix.makeRotationY(t),this.offset.premultiply(this._tempMatrix),t!==0&&(this._hasChanged=!0)}};let hf=kv;r(hf,"up",new f(0,1,0)),r(hf,"zero",new f(0,0,0)),r(hf,"one",new f(1,1,1));const Ri={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function $j(t){const A=await fetch(t);if(A.ok)return A.json();throw new Error(A.statusText)}async function lcA(t){if(!t)throw new Error("No basePath supplied");return await $j(`${t}/profilesList.json`)}async function dcA(t,A,e=null,i=!0){if(!t)throw new Error("No xrInputSource supplied");if(!A)throw new Error("No basePath supplied");const g=await lcA(A);let I;if(t.profiles.some(C=>{const a=g[C];return a&&(I={profileId:C,profilePath:`${A}/${a.path}`,deprecated:!!a.deprecated}),!!I}),!I){if(!e)throw new Error("No matching profile name found");const C=g[e];if(!C)throw new Error(`No matching profile name found and default profile "${e}" missing.`);I={profileId:e,profilePath:`${A}/${C.path}`,deprecated:!!C.deprecated}}const o=await $j(I.profilePath);let s;if(i){let C;if(t.handedness==="any"?C=o.layouts[Object.keys(o.layouts)[0]]:C=o.layouts[t.handedness],!C)throw new Error(`No matching handedness, ${t.handedness}, in profile ${I.profileId}`);C.assetPath&&(s=I.profilePath.replace("profile.json",C.assetPath))}return{profile:o,assetPath:s}}const ucA={xAxis:0,yAxis:0,button:0,state:Ri.ComponentState.DEFAULT};function pcA(t=0,A=0){let e=t,i=A;if(Math.sqrt(t*t+A*A)>1){const g=Math.atan2(A,t);e=Math.cos(g),i=Math.sin(g)}return{normalizedXAxis:e*.5+.5,normalizedYAxis:i*.5+.5}}class DcA{constructor(A){this.componentProperty=A.componentProperty,this.states=A.states,this.valueNodeName=A.valueNodeName,this.valueNodeProperty=A.valueNodeProperty,this.valueNodeProperty===Ri.VisualResponseProperty.TRANSFORM&&(this.minNodeName=A.minNodeName,this.maxNodeName=A.maxNodeName),this.value=0,this.updateFromComponent(ucA)}updateFromComponent({xAxis:A,yAxis:e,button:i,state:g}){const{normalizedXAxis:I,normalizedYAxis:o}=pcA(A,e);switch(this.componentProperty){case Ri.ComponentProperty.X_AXIS:this.value=this.states.includes(g)?I:.5;break;case Ri.ComponentProperty.Y_AXIS:this.value=this.states.includes(g)?o:.5;break;case Ri.ComponentProperty.BUTTON:this.value=this.states.includes(g)?i:0;break;case Ri.ComponentProperty.STATE:this.valueNodeProperty===Ri.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(g):this.value=this.states.includes(g)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class wcA{constructor(A,e){if(!A||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=A,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(i=>{const g=new DcA(e.visualResponses[i]);this.visualResponses[i]=g}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Ri.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(A){if(this.values.state=Ri.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&A.buttons.length>this.gamepadIndices.button){const e=A.buttons[this.gamepadIndices.button];this.values.button=e.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,e.pressed||this.values.button===1?this.values.state=Ri.ComponentState.PRESSED:(e.touched||this.values.button>Ri.ButtonTouchThreshold)&&(this.values.state=Ri.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&A.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=A.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Ri.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Ri.AxisTouchThreshold&&(this.values.state=Ri.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&A.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=A.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Ri.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Ri.AxisTouchThreshold&&(this.values.state=Ri.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}}class ycA{constructor(A,e,i){if(!A)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=A,this.assetUrl=i,this.id=e.profileId,this.layoutDescription=e.layouts[A.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(g=>{const I=this.layoutDescription.components[g];this.components[g]=new wcA(g,I)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const A=[];return Object.values(this.components).forEach(e=>{A.push(e.data)}),A}updateFromGamepad(){Object.values(this.components).forEach(A=>{A.updateFromGamepad(this.xrInputSource.gamepad)})}}const ScA="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",mcA="generic-trigger";let fcA=class extends wA{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(t){return this.envMap==t?this:(this.envMap=t,this.traverse(A=>{A.isMesh&&(A.material.envMap=this.envMap,A.material.needsUpdate=!0)}),this)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(A=>{Object.values(A.visualResponses).forEach(e=>{const{valueNode:i,minNode:g,maxNode:I,value:o,valueNodeProperty:s}=e;i&&(s===Ri.VisualResponseProperty.VISIBILITY?i.visible=o:s===Ri.VisualResponseProperty.TRANSFORM&&(i.quaternion.slerpQuaternions(g.quaternion,I.quaternion,o),i.position.lerpVectors(g.position,I.position,o)))})}))}};function kcA(t,A){Object.values(t.components).forEach(e=>{const{type:i,touchPointNodeName:g,visualResponses:I}=e;if(i===Ri.ComponentType.TOUCHPAD)if(e.touchPointNode=A.getObjectByName(g),e.touchPointNode){const o=new lC(.001),s=new st({color:255}),C=new dA(o,s);e.touchPointNode.add(C)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(I).forEach(o=>{const{valueNodeName:s,minNodeName:C,maxNodeName:a,valueNodeProperty:n}=o;if(n===Ri.VisualResponseProperty.TRANSFORM){if(o.minNode=A.getObjectByName(C),o.maxNode=A.getObjectByName(a),!o.minNode){console.warn(`Could not find ${C} in the model`);return}if(!o.maxNode){console.warn(`Could not find ${a} in the model`);return}}o.valueNode=A.getObjectByName(s),o.valueNode||console.warn(`Could not find ${s} in the model`)})})}function A8(t,A){kcA(t.motionController,A),t.envMap&&A.traverse(e=>{e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)}),t.layers.mask!=0&&A.traverse(e=>{e.layers.mask=t.layers.mask}),t.add(A)}class GcA{constructor(A=null,e=null){this.gltfLoader=A,this.path=ScA,this._assetCache={},this.onLoad=e,this.gltfLoader||(this.gltfLoader=new jd)}setPath(A){return this.path=A,this}createControllerModel(A){const e=new fcA;let i=null;return A.addEventListener("connected",g=>{const I=g.data;I.targetRayMode!=="tracked-pointer"||!I.gamepad||dcA(I,this.path,mcA).then(({profile:o,assetPath:s})=>{e.motionController=new ycA(I,o,s);const C=this._assetCache[e.motionController.assetUrl];if(C)i=C.scene.clone(),A8(e,i),this.onLoad&&this.onLoad(i);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(e.motionController.assetUrl,a=>{this._assetCache[e.motionController.assetUrl]=a,i=a.scene.clone(),A8(e,i),this.onLoad&&this.onLoad(i)},null,()=>{throw new Error(`Asset ${e.motionController.assetUrl} missing or malformed.`)})}}).catch(o=>{console.warn(o)})}),A.addEventListener("disconnected",()=>{e.motionController=null,e.remove(i),i=null}),e}}const McA="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/";class RcA{constructor(A,e,i,g,I=null,o=null){this.controller=e,this.handModel=A,this.bones=[],I===null&&(I=new jd,I.setPath(i||McA)),I.load(`${g}.glb`,s=>{const C=s.scene.children[0];this.handModel.add(C),C.layers.mask=this.handModel.layers.mask;const a=C.getObjectByProperty("type","SkinnedMesh");a.frustumCulled=!1,a.castShadow=!0,a.receiveShadow=!0,["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"].forEach(n=>{const B=C.getObjectByName(n);B!==void 0?B.jointName=n:console.warn(`Couldn't find ${n} in ${g} hand mesh`),this.bones.push(B)}),o&&o(C)})}updateMesh(){const A=this.controller.joints;for(let e=0;e<this.bones.length;e++){const i=this.bones[e];if(i){const g=A[i.jointName];if(g.visible){const I=g.position;i.position.copy(I),i.quaternion.copy(g.quaternion)}}}}}var UcA=Object.defineProperty,NcA=Object.getOwnPropertyDescriptor,cf=(t,A,e,i)=>{for(var g=i>1?void 0:i?NcA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&UcA(A,e,g),g};const ea=tA("debugwebxr"),CB=new Array;class ta extends bA{constructor(){super(...arguments),r(this,"createControllerModel",!0),r(this,"createHandModel",!0),r(this,"customLeftHand"),r(this,"customRightHand"),r(this,"_models",new Array)}supportsXR(A){return A==="immersive-vr"||A==="immersive-ar"}async onXRControllerAdded(A){var e,i,g;if(!(A.xr.isVR||A.xr.isPassThrough))return;const{controller:I}=A;if(ea&&console.warn("Add Controller Model for",I.side,I.index),this.createControllerModel){if(I.hand){if(this.createHandModel){const o=await this.loadHandModel(I);if(!o||!I.connected||!I.isHand){(e=o?.handObject)==null||e.removeFromParent(),(g=(i=o?.handmesh)==null?void 0:i.controller)==null||g.removeFromParent();return}this._models.push({controller:I,model:o.handObject,handmesh:o.handmesh}),this._models.sort((s,C)=>s.controller.index-C.controller.index),this.scene.add(o.handObject)}}else if(this.createControllerModel){const o=await I.getModelUrl();if(o){const s=await this.loadModel(I,o);if(!s||!I.connected||I.isHand)return;this._models.push({controller:I,model:s}),this._models.sort((C,a)=>C.controller.index-a.controller.index),this.scene.add(s),s.traverse(C=>{C.layers.set(2)})}else I.targetRayMode!=="transient-pointer"&&console.warn("XRControllerModel: no model found for "+I.side)}}}onXRControllerRemoved(A){var e;const i=this._models.findIndex(I=>I.controller===A.controller),g=this._models[i];g&&(this._models.splice(i,1),g.handmesh&&((e=g.handmesh.handModel)==null||e.removeFromParent(),g.handmesh=void 0),g.model&&(g.model.removeFromParent(),g.model=void 0))}onBeforeRender(){if(pe.active&&(ea&&(CB[0]=Date.now()),this.updateRendering(pe.active),ea)){const A=Date.now()-CB[0];if(CB.push(A),CB.length>=30){CB[0]=0;const e=CB.reduce((i,g)=>i+g,0)/CB.length;CB.length=0,console.log("[XRControllerModel] "+e.toFixed(2)+" ms")}}}onLeaveXR(A){var e;for(const i of this._models)i&&((e=i.model)==null||e.removeFromParent());this._models.length=0}updateRendering(A){var e,i,g,I,o;for(let s=0;s<this._models.length;s++){const C=this._models[s];if(!C)continue;const a=C.controller;if(!a.connected){ea&&console.warn("XRControllerModel.onUpdateXR: controller is not connected anymore",a.side,a.hand);continue}if(C.model&&!C.handmesh)C.model.position.copy(a.gripPosition),C.model.quaternion.copy(a.gripQuaternion),C.model.visible=a.isTracking,(e=A.rig)==null||e.gameObject.add(C.model);else if(a.inputSource.hand&&C.handmesh){const n=A.referenceSpace,B=this.context.renderer.xr.getHand(a.index);if(n&&A.frame.getJointPose){for(const Q of a.inputSource.hand.values()){const E=B.joints[Q.jointName];if(E){const h=a.getHandJointPose(Q);if(h){const{position:l,quaternion:d}=A.convertSpace(h.transform);E.position.copy(l),E.quaternion.copy(d),E.matrixWorldAutoUpdate=!1}E.visible=h!=null}}C.model&&(C.model.visible=a.isTracking,C.model.visible&&C.model.parent!==((i=A.rig)==null?void 0:i.gameObject)&&((g=A.rig)==null||g.gameObject.add(C.model)),C.model.position.set(0,0,0)),(I=C.model)!=null&&I.visible&&((o=C.handmesh)==null||o.updateMesh())}}}}async loadModel(A,e){var i;if(!A.connected)return console.warn("XRControllerModel.onXRControllerAdded: controller is not connected anymore",A.side),null;const g=await et.getOrCreate("",e).instantiate();return pK(g),(i=pe.active)!=null&&i.isPassThrough&&g.traverseVisible(I=>{this.makeOccluder(I)}),g}async loadHandModel(A){const e=this.context,i=e.renderer.xr.getHand(A.index);i||(ea?Se.DrawLabel(A.rayWorldPosition,"No hand found for index "+A.index,.05,5):console.warn("No hand found for index "+A.index));const g=new jd;D0(g,e),await Dv(g,e,this.sourceId??""),g.setPath("https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/");const I=A.side==="left"?"left.":"right.",o=A.side==="left"?this.customLeftHand:this.customRightHand;if(o)if(!o.uri.includes(I))console.warn("XRControllerModel: custom hand model must be named "+I),Bi("Custom Hand: unexpected name, please see the console for details");else{const a=o.uri.substring(0,o.uri.indexOf(I));g.setPath(a),ea&&console.log("XRControllerModel: loading custom hand model from "+a)}const s=new wA;pK(s);const C=new RcA(s,i,g.path,A.inputSource.handedness,g,a=>{a.traverse(n=>{var B;n.layers.set(2),(B=pe.active)!=null&&B.isPassThrough&&this.makeOccluder(n),n instanceof dA&&ut.assignMeshLOD(n,0)}),A.connected||(ea&&Se.DrawLabel(A.rayWorldPosition,"Hand is loaded but not connected anymore",.05,5),a.removeFromParent())});if(ea&&s.add(new is(.5)),A.inputSource.hand){ea&&console.log(A.inputSource.hand);for(const a of A.inputSource.hand.values())if(i.joints[a.jointName]===void 0){const n=new Io;n.matrixAutoUpdate=!1,n.visible=!0,i.joints[a.jointName]=n,i.add(n)}}else ea&&Se.DrawLabel(A.rayWorldPosition,"No inputSource.hand found for index "+A.index,.05,5);return{handObject:s,handmesh:C}}makeOccluder(A){if(A instanceof dA){let e=A.material;e instanceof qe&&(e=A.material=e.clone(),e.depthWrite=!0,e.depthTest=!0,e.colorWrite=!1,A.renderOrder=-100)}}}r(ta,"factory",new GcA),cf([w()],ta.prototype,"createControllerModel",2),cf([w()],ta.prototype,"createHandModel",2),cf([w(et)],ta.prototype,"customLeftHand",2),cf([w(et)],ta.prototype,"customRightHand",2);const e8=new St,lf=new f;class t8 extends qy{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const A=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new ae(A,3)),this.setAttribute("uv",new ae(e,2))}applyMatrix4(A){const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(A),i.applyMatrix4(A),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(A){let e;A instanceof Float32Array?e=A:Array.isArray(A)&&(e=new Float32Array(A));const i=new Yy(e,6,1);return this.setAttribute("instanceStart",new po(i,3,0)),this.setAttribute("instanceEnd",new po(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(A){let e;A instanceof Float32Array?e=A:Array.isArray(A)&&(e=new Float32Array(A));const i=new Yy(e,6,1);return this.setAttribute("instanceColorStart",new po(i,3,0)),this.setAttribute("instanceColorEnd",new po(i,3,3)),this}fromWireframeGeometry(A){return this.setPositions(A.attributes.position.array),this}fromEdgesGeometry(A){return this.setPositions(A.attributes.position.array),this}fromMesh(A){return this.fromWireframeGeometry(new lR(A.geometry)),this}fromLineSegments(A){const e=A.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new St);const A=this.attributes.instanceStart,e=this.attributes.instanceEnd;A!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(A),e8.setFromBufferAttribute(e),this.boundingBox.union(e8))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new mi),this.boundingBox===null&&this.computeBoundingBox();const A=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(A!==void 0&&e!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let g=0;for(let I=0,o=A.count;I<o;I++)lf.fromBufferAttribute(A,I),g=Math.max(g,i.distanceToSquared(lf)),lf.fromBufferAttribute(e,I),g=Math.max(g,i.distanceToSquared(lf));this.boundingSphere.radius=Math.sqrt(g),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(A){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(A)}}YA.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new eA(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},vg.line={uniforms:ih.merge([YA.common,YA.fog,YA.line]),vertexShader:`
|
|
6322
|
+
`)},this.depthMaterial.depthTest=!1,this.depthMaterial.depthWrite=!1,this.horizontalBlurMaterial=new Me(ncA),this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial=new Me(rcA),this.verticalBlurMaterial.depthTest=!1,this.shadowGroup.visible=!1,this.autoFit&&this.fitShadows()}onDestroy(){var t,A,e,i,g,I,o,s;(t=this.renderTarget)==null||t.dispose(),(A=this.renderTargetBlur)==null||A.dispose(),(e=this.depthMaterial)==null||e.dispose(),(i=this.horizontalBlurMaterial)==null||i.dispose(),(g=this.verticalBlurMaterial)==null||g.dispose(),(I=this.blurPlane)==null||I.geometry.dispose(),(o=this.plane)==null||o.geometry.dispose(),(s=this.occluderMesh)==null||s.geometry.dispose()}onBeforeRender(t){if(!this.renderTarget||!this.renderTargetBlur||!this.depthMaterial||!this.shadowCamera||!this.blurPlane||!this.shadowGroup||!this.plane||!this.horizontalBlurMaterial||!this.verticalBlurMaterial){Ef&&console.error("ContactShadows: not initialized yet");return}const A=this.context.scene,e=this.context.renderer,i=e.getRenderTarget();this.shadowGroup.visible=!0,this.occluderMesh&&(this.occluderMesh.visible=!1);const g=this.plane.visible;this.plane.visible=!1,this.gameObject instanceof dA&&iE(this.gameObject,!1);const I=A.background;A.background=null,A.overrideMaterial=this.depthMaterial,this.backfaceShadows?this.depthMaterial.side=ht:this.depthMaterial.side=lg;const o=e.getClearAlpha();e.setClearAlpha(0);const s=e.xr.enabled;e.xr.enabled=!1;const C=e.renderLists.get(A,0),a=C.transparent;C.transparent=[],e.setRenderTarget(this.renderTarget),e.clear(),e.render(A,this.shadowCamera),C.transparent=a,A.overrideMaterial=null;const n=this.gameObject.scale.x,B=Math.min(this.blur,this.blur/n);this.blurShadow(B*.4),this.shadowGroup.visible=!1,this.occluderMesh&&(this.occluderMesh.visible=this.occludeBelowGround),this.plane.visible=g,e.setRenderTarget(i),e.setClearAlpha(o),A.background=I,e.xr.enabled=s}blurShadow(t){if(!this.blurPlane||!this.shadowCamera||!this.renderTarget||!this.renderTargetBlur||!this.horizontalBlurMaterial||!this.verticalBlurMaterial)return;this.blurPlane.visible=!0,this.blurPlane.material=this.horizontalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTarget.texture,this.horizontalBlurMaterial.uniforms.h.value=t*1/256;const A=this.context.renderer,e=A.getRenderTarget();A.setRenderTarget(this.renderTargetBlur),A.render(this.blurPlane,this.shadowCamera),this.blurPlane.material=this.verticalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTargetBlur.texture,this.verticalBlurMaterial.uniforms.v.value=t*1/256,A.setRenderTarget(this.renderTarget),A.render(this.blurPlane,this.shadowCamera),this.blurPlane.visible=!1,A.setRenderTarget(e)}},r(fv,"_instance"),fv);let yn=zj;Xc([w()],yn.prototype,"autoFit",2),Xc([w()],yn.prototype,"darkness",2),Xc([w()],yn.prototype,"opacity",2),Xc([w()],yn.prototype,"blur",2),Xc([w()],yn.prototype,"occludeBelowGround",2),Xc([w()],yn.prototype,"backfaceShadows",2);var EcA=Object.defineProperty,hcA=Object.getOwnPropertyDescriptor,Xp=(t,A,e,i)=>{for(var g=i>1?void 0:i?hcA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&EcA(A,e,g),g};const Xj=tA("debugwebxr"),ccA=new NA().makeRotationY(Math.PI);class To extends bA{constructor(){super(...arguments),r(this,"_arScale",1),r(this,"invertForward",!1),r(this,"customReticle"),r(this,"useXRAnchor",!1),r(this,"arTouchTransform",!1),r(this,"_isPlacing",!0),r(this,"_startOffset",new NA),r(this,"_createdPlacementObject",null),r(this,"_reparentedComponents",[]),r(this,"_placementScene",new QI),r(this,"_reticle",[]),r(this,"_hits",[]),r(this,"_placementStartTime",-1),r(this,"_rigPlacementMatrix"),r(this,"_anchor",null),r(this,"userInput"),r(this,"onPlaceScene",A=>{var e;if(this._isPlacing==!1||A.used)return;let i=this._reticle[0],g=this._hits[0];if(A.origin instanceof SF){const I=this._reticle[A.origin.index];I&&(i=I,g=this._hits[A.origin.index])}if(!i){console.warn("No reticle to place...");return}if(!i.visible){console.warn("Reticle is not visible (can not place)");return}if((e=pe.active)!=null&&e.isTrackingImages){console.warn("Scene Placement is disabled while images are being tracked");return}A.stopImmediatePropagation(),A.use(),this._isPlacing=!1,this.context.input.removeEventListener("pointerup",this.onPlaceScene),this.onRevertSceneChanges(),i.position.copy(i.lastPos),i.quaternion.copy(i.lastQuat),this.onApplyPose(i),this.useXRAnchor&&this.onCreateAnchor(pe.active,g)}),r(this,"upVec",new f(0,1,0)),r(this,"lookPoint",new f),r(this,"worldUpVec",new f(0,1,0))}get arScale(){return this._arScale}set arScale(A){A!==this._arScale&&(this._arScale=A,this.onScaleChanged())}onEnable(){var A;(A=this.customReticle)==null||A.preload()}supportsXR(A){return A==="immersive-ar"}onEnterXR(A){Xj&&console.log("ENTER WEBXR: SessionRoot start..."),this._anchor=null,this.gameObject.updateMatrixWorld(),this._startOffset.copy(this.gameObject.matrixWorld);const e=new wA;this._createdPlacementObject=e,e.name="AR Session Root",this._placementScene.name="AR Placement Scene",this._placementScene.children.length=0;for(let i=this.context.scene.children.length-1;i>=0;i--){const g=this.context.scene.children[i];this._placementScene.add(g)}this.context.scene.add(e),this._reparentedComponents.length=0,this._reparentedComponents.push({comp:this,originalObject:this.gameObject}),aA.addComponent(e,this);for(const i of this._reticle)CC(i);this._reticle.length=0,this._isPlacing=!0,this.context.input.addEventListener("pointerup",this.onPlaceScene,{queue:vC.Late})}onLeaveXR(){this.context.input.removeEventListener("pointerup",this.onPlaceScene,{queue:vC.Late}),this.onRevertSceneChanges(),this._anchor=null,this._rigPlacementMatrix=void 0}onUpdateXR(A){var e,i,g,I;if(A.xr.isTrackingImages){for(const o of this._reticle)o.visible=!1;return}if(this._isPlacing){const o=(e=A.xr.rig)==null?void 0:e.gameObject;o&&o.parent!==this.context.scene&&this.context.scene.add(o);let s=!1;if(A.xr.isPassThrough&&A.xr.controllers.length>0)for(const C of A.xr.controllers){const a=C.getHitTest();a&&(s=!0,this.updateReticleAndHits(A.xr,C.index,a,A.xr.rigScale))}if(!s){const C=A.xr.getHitTest();C&&this.updateReticleAndHits(A.xr,0,C,A.xr.rigScale)}}else{if(this._anchor&&A.xr.referenceSpace){const o=A.xr.frame.getPose(this._anchor.anchorSpace,A.xr.referenceSpace);if(o&&this.context.time.frame%20===0){const s=A.xr.convertSpace(o.transform),C=this._reticle[0];C&&(C.position.copy(s.position),C.quaternion.copy(s.quaternion),this.onApplyPose(C))}}if(this.arTouchTransform?(this.userInput||(this.userInput=new hf(this.context)),(i=this.userInput)==null||i.enable()):(g=this.userInput)==null||g.disable(),this.arTouchTransform&&(I=this.userInput)!=null&&I.hasChanged){if(A.xr.rig){const o=A.xr.rig.gameObject;this.userInput.applyMatrixTo(o.matrix,!0),o.matrix.decompose(o.position,o.quaternion,o.scale),this.userInput.factor=o.scale.x}this.userInput.reset()}}}updateReticleAndHits(A,e,i,g){this._hits[e]=i.hit;let I=this._reticle[e];if(!I){if(this.customReticle)if(this.customReticle.asset)I=mc(this.customReticle.asset);else{this.customReticle.loadAssetAsync();return}else I=new dA(new RE(.07,.09,32).rotateX(-Math.PI/2),new st({side:ht})),I.name="AR Placement Reticle";if(Xj){const o=new is(1);o.position.y+=.01,I.add(o)}this._reticle[e]=I,I.matrixAutoUpdate=!1,I.visible=!1}I.lastPos=I.lastPos||i.position.clone(),I.lastQuat=I.lastQuat||i.quaternion.clone(),I.position.copy(I.lastPos.lerp(i.position,this.context.time.deltaTime/.1)),I.lastPos.copy(I.position),I.quaternion.copy(I.lastQuat.slerp(i.quaternion,this.context.time.deltaTime/.05)),I.lastQuat.copy(I.quaternion),I.scale.set(g,g,g),this.customReticle&&this.applyViewBasedTransform(I),I.updateMatrix(),I.visible=!0,I.parent!==this.context.scene&&this.context.scene.add(I),this._placementStartTime<0&&(this._placementStartTime=this.context.time.realtimeSinceStartup)}onScaleChanged(){}onRevertSceneChanges(){var A;for(const e of this._reticle)e&&(e.visible=!1,e?.removeFromParent());this._reticle.length=0;for(let e=this._placementScene.children.length-1;e>=0;e--){const i=this._placementScene.children[e];this.context.scene.add(i)}(A=this._createdPlacementObject)==null||A.removeFromParent();for(const e of this._reparentedComponents)aA.addComponent(e.originalObject,e.comp)}async onCreateAnchor(A,e){if(e.createAnchor===void 0){console.warn("Hit does not support creating an anchor",e),Be()&&Bi("Hit does not support creating an anchor");return}else{const i=await e.createAnchor(A.viewerPose.transform);A.running&&i&&(this._anchor=i)}}applyViewBasedTransform(A){const e=this.context.mainCamera,i=A,g=e.worldPosition,I=i.worldPosition;this.upVec.set(0,1,0).applyQuaternion(A.quaternion);const o=e.worldPosition;o&&A.position.clone().sub(o).angleTo(this.upVec)<Math.PI/2&&this.upVec.negate();const s=this.upVec.angleTo(this.worldUpVec)*180/Math.PI,C=30;s>C&&s<180-C||s<-C&&s>-180+C?(this.lookPoint.copy(A.position).add(this.upVec),this.lookPoint.y=A.position.y,A.lookAt(this.lookPoint)):(g.y=I.y,A.lookAt(g))}onApplyPose(A){var e,i,g,I;const o=(i=(e=pe.active)==null?void 0:e.rig)==null?void 0:i.gameObject;if(!o){console.warn("No rig object to place");return}(g=pe.active)!=null&&g.rigScale;const s=o.parent||this.context.scene;this._rigPlacementMatrix?(I=this._rigPlacementMatrix)==null||I.decompose(o.position,o.quaternion,o.scale):this._rigPlacementMatrix=o.matrix.clone(),this.applyViewBasedTransform(A),A.updateMatrix(),this.context.scene.add(A),A.attach(o),A.removeFromParent(),o.scale.set(this.arScale,this.arScale,this.arScale),o.position.multiplyScalar(this.arScale),o.updateMatrix(),this.invertForward&&o.matrix.premultiply(ccA),o.matrix.premultiply(this._startOffset),o.matrix.decompose(o.position,o.quaternion,o.scale),s.add(o)}}Xp([w()],To.prototype,"arScale",1),Xp([w()],To.prototype,"invertForward",2),Xp([w(et)],To.prototype,"customReticle",2),Xp([w()],To.prototype,"useXRAnchor",2),Xp([w()],To.prototype,"arTouchTransform",2);const kv=class{constructor(t){r(this,"oneFingerDrag",!0),r(this,"twoFingerRotate",!0),r(this,"twoFingerScale",!0),r(this,"factor",1),r(this,"context"),r(this,"offset"),r(this,"plane"),r(this,"_scale",1),r(this,"_hasChanged",!1),r(this,"_enabled",!1),r(this,"currentlyUsedPointerIds",new Set),r(this,"currentlyUnusedPointerIds",new Set),r(this,"onPointerDownEarly",A=>{this.isActive&&A.stopPropagation()}),r(this,"onPointerDownLate",A=>{A.used?this.currentlyUsedPointerIds.add(A.pointerId):this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.add(A.pointerId)}),r(this,"onPointerUpEarly",A=>{this.currentlyUsedPointerIds.delete(A.pointerId),this.currentlyUnusedPointerIds.delete(A.pointerId)}),r(this,"prev",new Map),r(this,"_didMultitouch",!1),r(this,"touchStart",A=>{for(let e=0;e<A.changedTouches.length;e++){const i=A.changedTouches[e],g=KT()&&i.clientY<window.innerHeight*.1;this.prev.has(i.identifier)||this.prev.set(i.identifier,{ignore:g,x:0,z:0,screenx:0,screeny:0});const I=this.prev.get(i.identifier);if(I){const o=this.getPositionOnPlane(i.clientX,i.clientY);I.x=o.x,I.z=o.z,I.screenx=i.clientX,I.screeny=i.clientY}}}),r(this,"touchEnd",A=>{A.touches.length<=0&&(this._didMultitouch=!1);for(let e=0;e<A.changedTouches.length;e++){const i=A.changedTouches[e];this.prev.delete(i.identifier)}}),r(this,"touchMove",A=>{if(!A.defaultPrevented&&this.isActive){if(A.touches.length===1){if(this._didMultitouch)return;const e=A.touches[0],i=this.prev.get(e.identifier);if(!i||i.ignore)return;const g=this.getPositionOnPlane(e.clientX,e.clientY),I=g.x-i.x,o=g.z-i.z;if(I===0&&o===0)return;this.oneFingerDrag&&this.addMovement(I,o),i.x=g.x,i.z=g.z,i.screenx=e.clientX,i.screeny=e.clientY;return}else if(A.touches.length===2){this._didMultitouch=!0;const e=A.touches[0],i=A.touches[1],g=this.prev.get(e.identifier),I=this.prev.get(i.identifier);if(!g||!I)return;if(this.twoFingerRotate){const o=Math.atan2(e.clientY-i.clientY,e.clientX-i.clientX),s=Math.atan2(g.screeny-I.screeny,g.screenx-I.screenx),C=o-s;Math.abs(C)>.001&&this.addRotation(C)}if(this.twoFingerScale){const o=e.clientX-i.clientX,s=e.clientY-i.clientY,C=Math.sqrt(o*o+s*s),a=g.screenx-I.screenx,n=g.screeny-I.screeny,B=Math.sqrt(a*a+n*n),Q=C-B;Math.abs(Q)>2&&this.addScale(Q)}g.screenx=e.clientX,g.screeny=e.clientY,I.screenx=i.clientX,I.screeny=i.clientY}}}),r(this,"_raycaster",new XB),r(this,"_intersection",new f),r(this,"_screenPos",new f),r(this,"_tempMatrix",new NA),this.context=t,this.offset=new NA,this.plane=new bI,this.plane.setFromNormalAndCoplanarPoint(kv.up,kv.zero)}reset(){this._scale=1,this.offset.identity()}get hasChanged(){return this._hasChanged}applyMatrixTo(t,A){this._hasChanged=!1,A?(this.offset.invert(),t.premultiply(this.offset)):t.multiply(this.offset)}get isActive(){return this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.size>0}enable(){this._enabled||(this._enabled=!0,this.context.input.addEventListener("pointerdown",this.onPointerDownEarly,{queue:vC.Early}),this.context.input.addEventListener("pointerdown",this.onPointerDownLate,{queue:vC.Late}),this.context.input.addEventListener("pointerup",this.onPointerUpEarly,{queue:vC.Early}),window.addEventListener("touchstart",this.touchStart,{passive:!1}),window.addEventListener("touchmove",this.touchMove,{passive:!1}),window.addEventListener("touchend",this.touchEnd,{passive:!1}))}disable(){this._enabled&&(this._enabled=!1,this.context.input.removeEventListener("pointerdown",this.onPointerDownEarly,{queue:vC.Early}),this.context.input.removeEventListener("pointerdown",this.onPointerDownLate,{queue:vC.Late}),this.context.input.removeEventListener("pointerup",this.onPointerUpEarly,{queue:vC.Early}),window.removeEventListener("touchstart",this.touchStart),window.removeEventListener("touchmove",this.touchMove),window.removeEventListener("touchend",this.touchEnd))}getPositionOnPlane(t,A){const e=this.context.mainCamera;return this._screenPos.x=t/window.innerWidth*2-1,this._screenPos.y=-(A/window.innerHeight)*2+1,this._screenPos.z=1,this._screenPos.unproject(e),this._raycaster.set(e.position,this._screenPos.sub(e.position)),this._raycaster.ray.intersectPlane(this.plane,this._intersection),this._intersection}addMovement(t,A){t/=this._scale,A/=this._scale,t*=this.factor,A*=this.factor,this.offset.elements[12]+=t,this.offset.elements[14]+=A,(t!==0||A!==0)&&(this._hasChanged=!0)}addScale(t){t/=window.innerWidth,t*=-1,this._scale*=1+t,this._tempMatrix.makeScale(1-t,1-t,1-t),this.offset.premultiply(this._tempMatrix),t!==0&&(this._hasChanged=!0)}addRotation(t){t*=-1,this._tempMatrix.makeRotationY(t),this.offset.premultiply(this._tempMatrix),t!==0&&(this._hasChanged=!0)}};let hf=kv;r(hf,"up",new f(0,1,0)),r(hf,"zero",new f(0,0,0)),r(hf,"one",new f(1,1,1));const Ri={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function $j(t){const A=await fetch(t);if(A.ok)return A.json();throw new Error(A.statusText)}async function lcA(t){if(!t)throw new Error("No basePath supplied");return await $j(`${t}/profilesList.json`)}async function dcA(t,A,e=null,i=!0){if(!t)throw new Error("No xrInputSource supplied");if(!A)throw new Error("No basePath supplied");const g=await lcA(A);let I;if(t.profiles.some(C=>{const a=g[C];return a&&(I={profileId:C,profilePath:`${A}/${a.path}`,deprecated:!!a.deprecated}),!!I}),!I){if(!e)throw new Error("No matching profile name found");const C=g[e];if(!C)throw new Error(`No matching profile name found and default profile "${e}" missing.`);I={profileId:e,profilePath:`${A}/${C.path}`,deprecated:!!C.deprecated}}const o=await $j(I.profilePath);let s;if(i){let C;if(t.handedness==="any"?C=o.layouts[Object.keys(o.layouts)[0]]:C=o.layouts[t.handedness],!C)throw new Error(`No matching handedness, ${t.handedness}, in profile ${I.profileId}`);C.assetPath&&(s=I.profilePath.replace("profile.json",C.assetPath))}return{profile:o,assetPath:s}}const ucA={xAxis:0,yAxis:0,button:0,state:Ri.ComponentState.DEFAULT};function pcA(t=0,A=0){let e=t,i=A;if(Math.sqrt(t*t+A*A)>1){const g=Math.atan2(A,t);e=Math.cos(g),i=Math.sin(g)}return{normalizedXAxis:e*.5+.5,normalizedYAxis:i*.5+.5}}class DcA{constructor(A){this.componentProperty=A.componentProperty,this.states=A.states,this.valueNodeName=A.valueNodeName,this.valueNodeProperty=A.valueNodeProperty,this.valueNodeProperty===Ri.VisualResponseProperty.TRANSFORM&&(this.minNodeName=A.minNodeName,this.maxNodeName=A.maxNodeName),this.value=0,this.updateFromComponent(ucA)}updateFromComponent({xAxis:A,yAxis:e,button:i,state:g}){const{normalizedXAxis:I,normalizedYAxis:o}=pcA(A,e);switch(this.componentProperty){case Ri.ComponentProperty.X_AXIS:this.value=this.states.includes(g)?I:.5;break;case Ri.ComponentProperty.Y_AXIS:this.value=this.states.includes(g)?o:.5;break;case Ri.ComponentProperty.BUTTON:this.value=this.states.includes(g)?i:0;break;case Ri.ComponentProperty.STATE:this.valueNodeProperty===Ri.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(g):this.value=this.states.includes(g)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class wcA{constructor(A,e){if(!A||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=A,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(i=>{const g=new DcA(e.visualResponses[i]);this.visualResponses[i]=g}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:Ri.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(A){if(this.values.state=Ri.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&A.buttons.length>this.gamepadIndices.button){const e=A.buttons[this.gamepadIndices.button];this.values.button=e.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,e.pressed||this.values.button===1?this.values.state=Ri.ComponentState.PRESSED:(e.touched||this.values.button>Ri.ButtonTouchThreshold)&&(this.values.state=Ri.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&A.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=A.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Ri.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Ri.AxisTouchThreshold&&(this.values.state=Ri.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&A.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=A.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Ri.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Ri.AxisTouchThreshold&&(this.values.state=Ri.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}}class ycA{constructor(A,e,i){if(!A)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=A,this.assetUrl=i,this.id=e.profileId,this.layoutDescription=e.layouts[A.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(g=>{const I=this.layoutDescription.components[g];this.components[g]=new wcA(g,I)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const A=[];return Object.values(this.components).forEach(e=>{A.push(e.data)}),A}updateFromGamepad(){Object.values(this.components).forEach(A=>{A.updateFromGamepad(this.xrInputSource.gamepad)})}}const ScA="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",mcA="generic-trigger";let fcA=class extends wA{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(t){return this.envMap==t?this:(this.envMap=t,this.traverse(A=>{A.isMesh&&(A.material.envMap=this.envMap,A.material.needsUpdate=!0)}),this)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(A=>{Object.values(A.visualResponses).forEach(e=>{const{valueNode:i,minNode:g,maxNode:I,value:o,valueNodeProperty:s}=e;i&&(s===Ri.VisualResponseProperty.VISIBILITY?i.visible=o:s===Ri.VisualResponseProperty.TRANSFORM&&(i.quaternion.slerpQuaternions(g.quaternion,I.quaternion,o),i.position.lerpVectors(g.position,I.position,o)))})}))}};function kcA(t,A){Object.values(t.components).forEach(e=>{const{type:i,touchPointNodeName:g,visualResponses:I}=e;if(i===Ri.ComponentType.TOUCHPAD)if(e.touchPointNode=A.getObjectByName(g),e.touchPointNode){const o=new lC(.001),s=new st({color:255}),C=new dA(o,s);e.touchPointNode.add(C)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(I).forEach(o=>{const{valueNodeName:s,minNodeName:C,maxNodeName:a,valueNodeProperty:n}=o;if(n===Ri.VisualResponseProperty.TRANSFORM){if(o.minNode=A.getObjectByName(C),o.maxNode=A.getObjectByName(a),!o.minNode){console.warn(`Could not find ${C} in the model`);return}if(!o.maxNode){console.warn(`Could not find ${a} in the model`);return}}o.valueNode=A.getObjectByName(s),o.valueNode||console.warn(`Could not find ${s} in the model`)})})}function A8(t,A){kcA(t.motionController,A),t.envMap&&A.traverse(e=>{e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)}),t.layers.mask!=0&&A.traverse(e=>{e.layers.mask=t.layers.mask}),t.add(A)}class GcA{constructor(A=null,e=null){this.gltfLoader=A,this.path=ScA,this._assetCache={},this.onLoad=e,this.gltfLoader||(this.gltfLoader=new jd)}setPath(A){return this.path=A,this}createControllerModel(A){const e=new fcA;let i=null;return A.addEventListener("connected",g=>{const I=g.data;I.targetRayMode!=="tracked-pointer"||!I.gamepad||dcA(I,this.path,mcA).then(({profile:o,assetPath:s})=>{e.motionController=new ycA(I,o,s);const C=this._assetCache[e.motionController.assetUrl];if(C)i=C.scene.clone(),A8(e,i),this.onLoad&&this.onLoad(i);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(e.motionController.assetUrl,a=>{this._assetCache[e.motionController.assetUrl]=a,i=a.scene.clone(),A8(e,i),this.onLoad&&this.onLoad(i)},null,()=>{throw new Error(`Asset ${e.motionController.assetUrl} missing or malformed.`)})}}).catch(o=>{console.warn(o)})}),A.addEventListener("disconnected",()=>{e.motionController=null,e.remove(i),i=null}),e}}const McA="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/";class RcA{constructor(A,e,i,g,I=null,o=null){this.controller=e,this.handModel=A,this.bones=[],I===null&&(I=new jd,I.setPath(i||McA)),I.load(`${g}.glb`,s=>{const C=s.scene.children[0];this.handModel.add(C),C.layers.mask=this.handModel.layers.mask;const a=C.getObjectByProperty("type","SkinnedMesh");a.frustumCulled=!1,a.castShadow=!0,a.receiveShadow=!0,["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"].forEach(n=>{const B=C.getObjectByName(n);B!==void 0?B.jointName=n:console.warn(`Couldn't find ${n} in ${g} hand mesh`),this.bones.push(B)}),o&&o(C)})}updateMesh(){const A=this.controller.joints;for(let e=0;e<this.bones.length;e++){const i=this.bones[e];if(i){const g=A[i.jointName];if(g.visible){const I=g.position;i.position.copy(I),i.quaternion.copy(g.quaternion)}}}}}var UcA=Object.defineProperty,NcA=Object.getOwnPropertyDescriptor,cf=(t,A,e,i)=>{for(var g=i>1?void 0:i?NcA(A,e):A,I=t.length-1,o;I>=0;I--)(o=t[I])&&(g=(i?o(A,e,g):o(g))||g);return i&&g&&UcA(A,e,g),g};const ea=tA("debugwebxr"),CB=new Array;class ta extends bA{constructor(){super(...arguments),r(this,"createControllerModel",!0),r(this,"createHandModel",!0),r(this,"customLeftHand"),r(this,"customRightHand"),r(this,"_models",new Array)}supportsXR(A){return A==="immersive-vr"||A==="immersive-ar"}async onXRControllerAdded(A){var e,i,g;if(!(A.xr.isVR||A.xr.isPassThrough))return;const{controller:I}=A;if(ea&&console.warn("Add Controller Model for",I.side,I.index),this.createControllerModel){if(I.hand){if(this.createHandModel){const o=await this.loadHandModel(I);if(!o||!I.connected||!I.isHand){(e=o?.handObject)==null||e.removeFromParent(),(g=(i=o?.handmesh)==null?void 0:i.controller)==null||g.removeFromParent();return}this._models.push({controller:I,model:o.handObject,handmesh:o.handmesh}),this._models.sort((s,C)=>s.controller.index-C.controller.index),this.scene.add(o.handObject)}}else if(this.createControllerModel){const o=await I.getModelUrl();if(o){const s=await this.loadModel(I,o);if(!s||!I.connected||I.isHand)return;this._models.push({controller:I,model:s}),this._models.sort((C,a)=>C.controller.index-a.controller.index),this.scene.add(s),s.traverse(C=>{C.layers.set(2)})}else I.targetRayMode!=="transient-pointer"&&console.warn("XRControllerModel: no model found for "+I.side)}}}onXRControllerRemoved(A){var e;const i=this._models.findIndex(I=>I.controller===A.controller),g=this._models[i];g&&(this._models.splice(i,1),g.handmesh&&((e=g.handmesh.handModel)==null||e.removeFromParent(),g.handmesh=void 0),g.model&&(g.model.removeFromParent(),g.model=void 0))}onBeforeRender(){if(pe.active&&(ea&&(CB[0]=Date.now()),this.updateRendering(pe.active),ea)){const A=Date.now()-CB[0];if(CB.push(A),CB.length>=30){CB[0]=0;const e=CB.reduce((i,g)=>i+g,0)/CB.length;CB.length=0,console.log("[XRControllerModel] "+e.toFixed(2)+" ms")}}}onLeaveXR(A){var e;for(const i of this._models)i&&((e=i.model)==null||e.removeFromParent());this._models.length=0}updateRendering(A){var e,i,g,I,o;for(let s=0;s<this._models.length;s++){const C=this._models[s];if(!C)continue;const a=C.controller;if(!a.connected){ea&&console.warn("XRControllerModel.onUpdateXR: controller is not connected anymore",a.side,a.hand);continue}if(C.model&&!C.handmesh)C.model.position.copy(a.gripPosition),C.model.quaternion.copy(a.gripQuaternion),C.model.visible=a.isTracking,(e=A.rig)==null||e.gameObject.add(C.model);else if(a.inputSource.hand&&C.handmesh){const n=A.referenceSpace,B=this.context.renderer.xr.getHand(a.index);if(n&&A.frame.getJointPose){for(const Q of a.inputSource.hand.values()){const E=B.joints[Q.jointName];if(E){const h=a.getHandJointPose(Q);if(h){const{position:l,quaternion:d}=A.convertSpace(h.transform);E.position.copy(l),E.quaternion.copy(d),E.matrixWorldAutoUpdate=!1}E.visible=h!=null}}C.model&&(C.model.visible=a.isTracking,C.model.visible&&C.model.parent!==((i=A.rig)==null?void 0:i.gameObject)&&((g=A.rig)==null||g.gameObject.add(C.model)),C.model.position.set(0,0,0)),(I=C.model)!=null&&I.visible&&((o=C.handmesh)==null||o.updateMesh())}}}}async loadModel(A,e){var i;if(!A.connected)return console.warn("XRControllerModel.onXRControllerAdded: controller is not connected anymore",A.side),null;const g=await et.getOrCreate("",e).instantiate();return pK(g),(i=pe.active)!=null&&i.isPassThrough&&g.traverseVisible(I=>{this.makeOccluder(I)}),g}async loadHandModel(A){const e=this.context,i=e.renderer.xr.getHand(A.index);i||(ea?Se.DrawLabel(A.rayWorldPosition,"No hand found for index "+A.index,.05,5):console.warn("No hand found for index "+A.index));const g=new jd;D0(g,e),await Dv(g,e,this.sourceId??""),g.setPath("https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/");const I=A.side==="left"?"left.":"right.",o=A.side==="left"?this.customLeftHand:this.customRightHand;if(o)if(!o.uri.includes(I))console.warn("XRControllerModel: custom hand model must be named "+I),Bi("Custom Hand: unexpected name, please see the console for details");else{const a=o.uri.substring(0,o.uri.indexOf(I));g.setPath(a),ea&&console.log("XRControllerModel: loading custom hand model from "+a)}const s=new wA;pK(s);const C=new RcA(s,i,g.path,A.inputSource.handedness,g,a=>{a.traverse(n=>{var B;n.layers.set(2),(B=pe.active)!=null&&B.isPassThrough&&this.makeOccluder(n),n instanceof dA&&ut.assignMeshLOD(n,0)}),A.connected||(ea&&Se.DrawLabel(A.rayWorldPosition,"Hand is loaded but not connected anymore",.05,5),a.removeFromParent())});if(ea&&s.add(new is(.5)),A.inputSource.hand){ea&&console.log(A.inputSource.hand);for(const a of A.inputSource.hand.values())if(i.joints[a.jointName]===void 0){const n=new Io;n.matrixAutoUpdate=!1,n.visible=!0,i.joints[a.jointName]=n,i.add(n)}}else ea&&Se.DrawLabel(A.rayWorldPosition,"No inputSource.hand found for index "+A.index,.05,5);return{handObject:s,handmesh:C}}makeOccluder(A){if(A instanceof dA){let e=A.material;e instanceof qe&&(e=A.material=e.clone(),e.depthWrite=!0,e.depthTest=!0,e.colorWrite=!1,A.renderOrder=-100)}}}r(ta,"factory",new GcA),cf([w()],ta.prototype,"createControllerModel",2),cf([w()],ta.prototype,"createHandModel",2),cf([w(et)],ta.prototype,"customLeftHand",2),cf([w(et)],ta.prototype,"customRightHand",2);const e8=new St,lf=new f;class t8 extends qy{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const A=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],e=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new ae(A,3)),this.setAttribute("uv",new ae(e,2))}applyMatrix4(A){const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return e!==void 0&&(e.applyMatrix4(A),i.applyMatrix4(A),e.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(A){let e;A instanceof Float32Array?e=A:Array.isArray(A)&&(e=new Float32Array(A));const i=new Yy(e,6,1);return this.setAttribute("instanceStart",new po(i,3,0)),this.setAttribute("instanceEnd",new po(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(A){let e;A instanceof Float32Array?e=A:Array.isArray(A)&&(e=new Float32Array(A));const i=new Yy(e,6,1);return this.setAttribute("instanceColorStart",new po(i,3,0)),this.setAttribute("instanceColorEnd",new po(i,3,3)),this}fromWireframeGeometry(A){return this.setPositions(A.attributes.position.array),this}fromEdgesGeometry(A){return this.setPositions(A.attributes.position.array),this}fromMesh(A){return this.fromWireframeGeometry(new lR(A.geometry)),this}fromLineSegments(A){const e=A.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new St);const A=this.attributes.instanceStart,e=this.attributes.instanceEnd;A!==void 0&&e!==void 0&&(this.boundingBox.setFromBufferAttribute(A),e8.setFromBufferAttribute(e),this.boundingBox.union(e8))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new mi),this.boundingBox===null&&this.computeBoundingBox();const A=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(A!==void 0&&e!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let g=0;for(let I=0,o=A.count;I<o;I++)lf.fromBufferAttribute(A,I),g=Math.max(g,i.distanceToSquared(lf)),lf.fromBufferAttribute(e,I),g=Math.max(g,i.distanceToSquared(lf));this.boundingSphere.radius=Math.sqrt(g),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(A){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(A)}}YA.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new eA(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},vg.line={uniforms:ih.merge([YA.common,YA.fog,YA.line]),vertexShader:`
|
|
6323
6323
|
#include <common>
|
|
6324
6324
|
#include <color_pars_vertex>
|
|
6325
6325
|
#include <fog_pars_vertex>
|