@needle-tools/engine 4.0.2-alpha → 4.0.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/needle-engine.js +313 -297
- package/dist/needle-engine.light.js +23 -7
- package/dist/needle-engine.light.min.js +23 -23
- package/dist/needle-engine.light.umd.cjs +2 -2
- package/dist/needle-engine.min.js +2 -2
- package/dist/needle-engine.umd.cjs +2 -2
- package/lib/engine-components/OrbitControls.js +8 -2
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/package.json +1 -1
- package/src/engine-components/OrbitControls.ts +6 -2
|
@@ -4345,7 +4345,7 @@ Open this page to get the console: `+A.toString())}const i=De.isMobileDevice()||
|
|
|
4345
4345
|
#__vconsole .vc-mask {
|
|
4346
4346
|
overflow: hidden;
|
|
4347
4347
|
}
|
|
4348
|
-
`,Ps?.prepend(g),i===!0&&FN()<=0&&NO(),console.log("\u{1F335} Debug console has loaded")}},A.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Np=!1,qI=null},A.src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js",document.body.appendChild(A)}function pnA(){if(!globalThis.VConsole)return;const i=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),A=()=>document.querySelector("#__vc_plug_"+i._id+" iframe");return i.on("renderTab",function(t){const g=globalThis["needle:codegen_files"];if(!g||g.length===0)return;let o=globalThis["needle:codegen_files"][0];const I=o.indexOf("?");I>-1&&(o=o.substring(0,I));const s=location.protocol+"//"+location.host+location.pathname+"/"+o,n=encodeURIComponent(s);i.fullUrl="https://viewer.needle.tools?inspect&file="+n;var a='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(a)}),i.on("show",function(){const t=A();t&&t.src!==i.fullUrl&&(t.src=i.fullUrl)}),i.on("hide",function(){const t=A();t&&(t.src="")}),i.on("addTopBar",function(t){var g=new Array;g.push({name:"Open in new window \u2197",onClick:function(o){window.open(i.fullUrl,"_blank"),qI?.hide()}}),g.push({name:"Reload",onClick:function(o){const I=A();I&&(I.src=i.fullUrl)}}),g.push({name:"Fullscreen",onClick:function(o){const I=A();I.requestFullscreen?I.requestFullscreen():I.webkitRequestFullscreen instanceof Function&&I.webkitRequestFullscreen()}}),t(g)}),i}function DnA(){return document.querySelector("#__vconsole .vc-switch")||null}function ynA(){return document.querySelector("#__vconsole")||null}const JO=iA("debugdefines");lB('if(!globalThis[""4.0.2-alpha""]) globalThis[""4.0.2-alpha""] = "0.0.0";'),lB('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),lB('if(!globalThis[""Thu Dec 12 2024 16:
|
|
4348
|
+
`,Ps?.prepend(g),i===!0&&FN()<=0&&NO(),console.log("\u{1F335} Debug console has loaded")}},A.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Np=!1,qI=null},A.src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js",document.body.appendChild(A)}function pnA(){if(!globalThis.VConsole)return;const i=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),A=()=>document.querySelector("#__vc_plug_"+i._id+" iframe");return i.on("renderTab",function(t){const g=globalThis["needle:codegen_files"];if(!g||g.length===0)return;let o=globalThis["needle:codegen_files"][0];const I=o.indexOf("?");I>-1&&(o=o.substring(0,I));const s=location.protocol+"//"+location.host+location.pathname+"/"+o,n=encodeURIComponent(s);i.fullUrl="https://viewer.needle.tools?inspect&file="+n;var a='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(a)}),i.on("show",function(){const t=A();t&&t.src!==i.fullUrl&&(t.src=i.fullUrl)}),i.on("hide",function(){const t=A();t&&(t.src="")}),i.on("addTopBar",function(t){var g=new Array;g.push({name:"Open in new window \u2197",onClick:function(o){window.open(i.fullUrl,"_blank"),qI?.hide()}}),g.push({name:"Reload",onClick:function(o){const I=A();I&&(I.src=i.fullUrl)}}),g.push({name:"Fullscreen",onClick:function(o){const I=A();I.requestFullscreen?I.requestFullscreen():I.webkitRequestFullscreen instanceof Function&&I.webkitRequestFullscreen()}}),t(g)}),i}function DnA(){return document.querySelector("#__vconsole .vc-switch")||null}function ynA(){return document.querySelector("#__vconsole")||null}const JO=iA("debugdefines");lB('if(!globalThis[""4.0.2-alpha.1""]) globalThis[""4.0.2-alpha.1""] = "0.0.0";'),lB('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),lB('if(!globalThis[""Thu Dec 12 2024 16:54:42 GMT+0100 (Central European Standard Time)""]) globalThis[""Thu Dec 12 2024 16:54:42 GMT+0100 (Central European Standard Time)""] = "unknown";'),lB('if(!globalThis[""npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9""]) globalThis[""npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9""] = "unknown";'),lB('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.0.2-alpha.1";'),lB('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),lB('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Thu Dec 12 2024 16:54:42 GMT+0100 (Central European Standard Time)";'),lB('globalThis["__NEEDLE_PUBLIC_KEY__"] = "npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9";');const Kn="4.0.2-alpha.1",mS="undefined",NF="Thu Dec 12 2024 16:54:42 GMT+0100 (Central European Standard Time)";JO&&console.log(`Engine version: ${Kn} (generator: ${mS})
|
|
4349
4349
|
Project built at ${NF}`);const Kp="npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9",qr="needle_isActiveInHierarchy",Gl="builtin_components",vp="needle_editor_guid";function lB(i){try{(0,eval)(i)}catch(A){JO&&console.error(A)}}const mnA='<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>',wnA=btoa(mnA),SnA="data:image/svg+xml;base64,"+wnA,fnA=SnA,GnA=`<?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(GnA);const knA='<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>',MnA=btoa(knA),RnA="data:image/svg+xml;charset=utf-8;base64,"+MnA,UnA=RnA;/**
|
|
4350
4350
|
* postprocessing v6.36.2 build Tue Sep 10 2024
|
|
4351
4351
|
* https://github.com/pmndrs/postprocessing
|
|
@@ -5953,7 +5953,7 @@ ${t.path}! : AssetReference;
|
|
|
5953
5953
|
Could not find method ${r.method} on object ${B.name}. Please rename ${r.method} to ${c}?
|
|
5954
5954
|
`,B[c],`
|
|
5955
5955
|
in script: `,B),Tt("EventList methods must start with lowercase letter, see console for details");return}else console.warn(`EventList method:
|
|
5956
|
-
Could not find method ${r.method} on object ${B.name}`,B,typeof B[r.method])};if(typeof B[r.method]!="function"){let c=!1,d=B;for(;d;){const E=Object.getOwnPropertyDescriptor(d,r.method);if(E&&(E.writable===!0||E.set)){c=!0;break}d=Object.getPrototypeOf(d)}!c&&(WA()||Wg)&&h()}}if(B){let h=r.argument;if(h!==void 0?h=C(h):r.arguments!==void 0&&(h=r.arguments.map(C)),!B[r.method])console.warn(`EventList method not found: "${r.method}" on ${B?.name}`);else{h!==void 0&&!Array.isArray(h)&&(h=[h]);const c=new Ha(B,r.method,h,r.enabled);s.push(c)}}else WA()&&console.warn("[Debug] EventList: Could not find event listener in scene",r,t.object,A)}const n=new $t(s);Wg&&console.log(n);const a=t.target;return a!==void 0&&t.path!==void 0&&n.setEventTarget(t.path,a),n}}}const uuA=new duA,ZG=new WeakMap,puA=_e.prototype.clone;_e.prototype.clone=function(){const i=puA.call(this);return ZG.has(i)||ZG.set(i,this),i};class eV extends en{constructor(){super([Ad,ze])}onSerialize(A,t){}onDeserialize(A,t){if(A instanceof _e&&t.type===Ad){let g=A;ZG.has(g)&&(g=ZG.get(g)),g.isRenderTargetTexture=!0,g.flipY=!0,g.offset.y=1,g.repeat.y=-1,g.needsUpdate=!0,g.mipmaps=[],g instanceof sB&&(g.isCompressedTexture=!1,g.format=kt);const o=new Ad(g.image.width,g.image.height,{colorSpace:Lt});return o.texture=g,o}}}new eV;class tV extends en{constructor(){super([URL])}onSerialize(A,t){return null}onDeserialize(A,t){if(typeof A=="string"&&A.length>0)return BB(t.gltfId,A)}}new tV;var DuA=Object.defineProperty,yuA=Object.getOwnPropertyDescriptor,muA=(i,A,t,g)=>{for(var o=g>1?void 0:g?yuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&DuA(A,t,o),o};class r0 extends vA{awake(){sn.createIfNoneExists(this.context)}onEnable(){var A;(A=sn.get(this.context))==null||A.register(this)}onDisable(){var A;(A=sn.get(this.context))==null||A.unregister(this)}}class us extends r0{constructor(){super(...arguments),Q(this,"targets",null),Q(this,"raycastHits",[]),Q(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(A=null){if(!this.targets)return null;A??(A=new Ka),A.targets=this.targets,A.results=this.raycastHits,A.useAcceleratedRaycast=!0;const t=A.testObject;this.ignoreSkinnedMeshes&&(A.testObject=o=>o instanceof vI?"continue in children":t?t(o):!0);const g=this.context.physics.raycast(A);return A.testObject=t,g}}muA([G()],us.prototype,"ignoreSkinnedMeshes",2);class WG extends us{constructor(){super(),this.ignoreSkinnedMeshes=!0}}const iV=class extends r0{performRaycast(i){if(!ke.active||!iV.allow||!(i!=null&&i.ray))return null;const A=i.ray.origin,t=.015;return this.context.physics.sphereOverlap(A,t,!1,!0)}};let td=iV;Q(td,"allow",!0);class XG{static getObject(A){const t=A[In];return t&&(t.isComponent===!0?A=t.gameObject:A=t),A}static isInteractable(A,t){if(t&&(t.canvasGroup=void 0,t.graphic=void 0),A==null||!A.visible||(A=this.getObject(A),!A.visible))return!1;const g=this.tryFindCanvasGroup(A);if(g?.isCanvasGroup===!0&&(t&&(t.canvasGroup=g),g.blocksRaycasts===!1||g.interactable===!1))return!1;const o=$l(A,I=>{if(I.isGraphic===!0)return I},!1);return t&&o?.isGraphic===!0&&(t.graphic=o),!(o?.raycastTarget===!1||o?.layer===2)}static tryFindCanvasGroup(A){if(!A)return null;const t=$l(A,g=>{const o=g;if(o.blocksRaycasts!==void 0&&o.interactable!==void 0)return o},!1);return t!==void 0?t:this.tryFindCanvasGroup(A.parent)}}function wx(i){return i[In]||(i.parent?wx(i.parent):null)}function wuA(i){return i.isUI===!0||typeof i[In]=="object"}function VG(i,A){if(!i)return;const t=i.material;if(t?.isMaterial===!0){const g=i.parent;g&&g.isText,t.side=A.doubleSided??!0?St:Ag,t.shadowSide=A.doubleSided?St:Ag,i.castShadow=A.castShadows?A.castShadows:!1,i.receiveShadow=A.receiveShadows?A.receiveShadows:!1}for(const g of i.children)VG(g,A)}function id(i,A,t){i[A]===void 0&&console.warn("Field",A,"is undefined on",i);const g=Proxy.revocable(i[A],{set(s,n,a,r){const C=s[n],B=Reflect.set(s,n,a,r);return t(a,C),B}}),o=g.revoke,I=i[A];return g.revoke=()=>{i[A]=I,o()},i[A]=g.proxy,g}const gV=Symbol("Scheduled action");function SuA(i,A,t=gi.OnBeforeRender){let g=i[gV];g||(g=i[gV]={});const o=A.name;g[t]||(g[t]={});const I=g[t];if(I[o])return;function*s(){A?.call(i),I[o]=null}const n=i.startCoroutine(s(),t);I[o]=n}const aC=iA("debugeventsystem");var Sx=(i=>(i.BeforeHandleInput="BeforeHandleInput",i.AfterHandleInput="AfterHandleInput",i))(Sx||{});const rC=class extends vA{constructor(){super(),Q(this,"raycaster",[]),Q(this,"pressedByID",new Map),Q(this,"hoveredByID",new Map),Q(this,"onPointerEvent",i=>{if(i===void 0||i.propagationStopped||i.defaultPrevented||i.used)return;const A=new Du(this.context.input,i);this._currentPointerEventName=i.type,A.inputSource=this.context.input,A.isClick=i.isClick,A.isDoubleClick=i.isDoubleClick,A.isDown=i.type==wi.PointerDown,A.isUp=i.type==wi.PointerUp,A.isPressed=this.context.input.getPointerPressed(i.pointerId),aC&&(A.isDown?console.log("DOWN",A.pointerId):A.isUp&&console.log("UP",A.pointerId),A.isClick&&console.log("CLICK",A.pointerId));const t=new Ka;i.hasRay?t.ray=i.ray:t.screenPoint=this.context.input.getPointerPositionRC(i.pointerId);const g=this.performRaycast(t);if(g){for(const I of g)I.event=i,i.intersections.push(I);i.origin.onPointerHits&&i.origin.onPointerHits({sender:this,event:i,hits:g})}aC&&A.isClick&&mi("EventSystem: "+A.pointerId+" - "+this.context.time.frame+" - Up:"+A.isUp+", Down:"+A.isDown);const o={sender:this,args:A,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:o})),this.handleIntersections(g,A),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:o}))}),Q(this,"_sortedHits",[]),Q(this,"_testObjectsCache",new Map),Q(this,"_currentlyActiveRaycaster",null),Q(this,"_currentPointerEventName",null),Q(this,"shouldRaycastObject",i=>{var A;let t=null;if(wuA(i)&&(t=(A=i[In])==null?void 0:A.gameObject),this._testObjectsCache.has(i)||t&&this._testObjectsCache.has(t))return this._testObjectsCache.get(i)===!1?"continue in children":!0;{let g=_G(i,this._currentPointerEventName);if(!g&&t&&(g=_G(t,this._currentPointerEventName)),g){this._testObjectsCache.set(i,!0);for(const o of i.children)this.shouldRaycastObject_AddToYesCache(o);return!0}return this._testObjectsCache.set(i,!1),"continue in children"}}),Q(this,"_sortingBuffer",[]),Q(this,"_noDepthTestingResults",[]),Q(this,"out",{}),Q(this,"_capturedPointer",{}),Q(this,"pointerEnterSymbol",Symbol("pointerEnter")),Q(this,"pointerExitSymbol",Symbol("pointerExit")),Q(this,"currentActiveMeshUIComponents",[]),rC.systems.push(this)}static createIfNoneExists(i){this.didSearchEventSystem||(this.didSearchEventSystem=!0,rC.systems.length<=0&&rC.systems.push(...gA.findObjectsOfType(rC,i)));for(const t of rC.systems)if(t.context===i)return;const A=new pA;gA.addComponent(A,rC),i.scene.add(A)}static get systems(){const i=Ne.Current;return this._eventSystemMap.has(i)||this._eventSystemMap.set(i,[]),this._eventSystemMap.get(i)}static get(i){const A=this._eventSystemMap.get(i);return A&&A.length>0?A[0]:null}static get instance(){return this.systems[0]}static ensureUpdateMeshUI(i,A,t=!1){$B.update(i,A,t)}static markUIDirty(i){$B.markDirty()}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}onDestroy(){rC.systems.splice(rC.systems.indexOf(this),1)}start(){if(this.raycaster.length<=0&&!gA.findObjectOfType(r0,this.context)){const i=gA.addComponent(this.context.scene,us);this.raycaster.push(i),(WA()||aC)&&console.warn("Added an ObjectRaycaster to the scene because no raycaster was found.")}}register(i){var A;i&&this.raycaster&&!this.raycaster.includes(i)&&((A=this.raycaster)==null||A.push(i))}unregister(i){var A,t;const g=(A=this.raycaster)==null?void 0:A.indexOf(i);g!==void 0&&g!==-1&&((t=this.raycaster)==null||t.splice(g,1))}onEnable(){this.context.input.addEventListener(wi.PointerDown,this.onPointerEvent),this.context.input.addEventListener(wi.PointerUp,this.onPointerEvent),this.context.input.addEventListener(wi.PointerMove,this.onPointerEvent)}onDisable(){this.context.input.removeEventListener(wi.PointerDown,this.onPointerEvent),this.context.input.removeEventListener(wi.PointerUp,this.onPointerEvent),this.context.input.removeEventListener(wi.PointerMove,this.onPointerEvent)}onBeforeRender(){this.resetMeshUIStates()}shouldRaycastObject_AddToYesCache(i){this._testObjectsCache.set(i,!0);for(const A of i.children)this.shouldRaycastObject_AddToYesCache(A)}performRaycast(i){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,i||(i=new Ka),i.testObject=this.shouldRaycastObject;for(const A of this.raycaster){if(!A.activeAndEnabled)continue;this._currentlyActiveRaycaster=A;const t=A.performRaycast(i);this._currentlyActiveRaycaster=null,t&&t.length>0&&this._sortedHits.push(...t)}return this._sortedHits.sort((A,t)=>A.distance-t.distance),this._sortedHits}assignHitInformation(i,A){A?(i.intersection=A,i.point=A.point,i.normal=A.normal,i.face=A.face,i.distance=A.distance,i.instanceId=A.instanceId):(i.intersection=void 0,i.point=void 0,i.normal=void 0,i.face=void 0,i.distance=void 0,i.instanceId=void 0)}handleIntersections(i,A){var t;if(i!=null&&i.length){i=this.sortCandidates(i);for(const o of i){if(A.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(A,o),this.handleEventOnObject(o.object,A))return!0}}this.assignHitInformation(A,i?.[0]),this.invokePointerCapture(A);const g=this.hoveredByID.get(A.pointerId);return g&&this.propagatePointerExit(g.obj,g.data,null),this.hoveredByID.delete(A.pointerId),A.isUp&&((t=this.pressedByID.get(A.pointerId))==null||t.handlers.forEach(o=>this.invokeOnPointerUp(A,o)),this.pressedByID.delete(A.pointerId)),!1}sortCandidates(i){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let A=0;A<i.length;A++){const t=i[A],g=t.object;if(g.material&&g.material.depthTest===!1){this._noDepthTestingResults.push(t);continue}this._sortingBuffer.push(t)}for(const A of this._sortingBuffer)this._noDepthTestingResults.push(A);return this._noDepthTestingResults}handleEventOnObject(i,A){if(!this.testIsVisible(i))return A.isClick&&aC&&console.log("not allowed",i),!1;if(A.pointerId===void 0)return aC&&console.error("Event without pointer can't be handled",A),!1;A.object=i;const t=i.parent,g=A.isClick??!1;let o=null;if(t&&t.isUI){const a=(A.isPressed||A.isClick)??!1;if(t[In]){const r=t[In].gameObject;if(r){if(!XG.isInteractable(r,this.out))return!1;o=this.out.canvasGroup??null,this.handleMeshUIIntersection(i,a),i=r}}}g&&aC&&console.log(this.context.time.frame,i);const I=this.hoveredByID.get(A.pointerId),s=I?.obj;s!==i&&s&&this.propagatePointerExit(s,I.data,i);const n=this.hoveredByID.get(A.pointerId);if(n?(n.obj=i,n.data=A):this.hoveredByID.set(A.pointerId,{obj:i,data:A}),A.isDown){const a=this.pressedByID.get(A.pointerId);a?(a.obj=i,a.data=A):this.pressedByID.set(A.pointerId,{obj:i,data:A,handlers:new Set})}return(o===null||o.interactable)&&this.handleMainInteraction(i,A,s??null),!0}propagate(i,A){for(;i;)gA.foreachComponent(i,t=>{A(t)},!1),i=i.parent}handleMainInteraction(i,A,t){const g=this.pressedByID.get(A.pointerId),o=t!==i;let I=!0;switch(A.event.pointerType){case"mouse":case"touch":const s=this.context.input.getPointerPositionLastFrame(A.pointerId),n=this.context.input.getPointerPosition(A.pointerId);I=s&&!te.approximately(s,n);break}this.propagate(i,s=>{var n;const a=s;a.interactable!==!1&&(!a.activeAndEnabled||!a.enabled||(a.onPointerEnter&&o&&this.handlePointerEnter(a,A),A.isDown&&a.onPointerDown&&(a.onPointerDown(A),g?.handlers.add(a),this.handlePointerCapture(A,a)),a.onPointerMove&&(I&&a.onPointerMove(A),this.handlePointerCapture(A,a)),A.isUp&&(a.onPointerUp&&(this.invokeOnPointerUp(A,a),g?.handlers.delete(a)),a.onPointerExit&&((n=A.event)==null?void 0:n.pointerType)===Ef.Touch&&(this.handlePointerExit(a,A),this.hoveredByID.delete(A.pointerId))),A.isClick&&a.onPointerClick&&a.onPointerClick(A)))}),A.isUp&&(g?.handlers.forEach(s=>{this.invokeOnPointerUp(A,s)}),this.pressedByID.delete(A.pointerId))}propagatePointerExit(i,A,t){this.propagate(i,g=>{if(!g.gameObject||g.destroyed)return;const o=g;if(o.onPointerExit||o.onPointerEnter){if(t&&this.isChild(t,g.gameObject))return;this.handlePointerExit(o,A)}})}invokeOnPointerUp(i,A){var t;(t=A.onPointerUp)==null||t.call(A,i),this.releasePointerCapture(i,A)}handlePointerEnter(i,A){i.onPointerEnter&&this.updatePointerState(i,A.pointerId,this.pointerEnterSymbol,!0)&&i.onPointerEnter(A),this.updatePointerState(i,A.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(i,A){i.onPointerExit&&this.updatePointerState(i,A.pointerId,this.pointerExitSymbol,!0)&&i.onPointerExit(A),this.updatePointerState(i,A.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(i,A,t,g){let o=i[t];if(g)return o&&o.includes(A)?!1:(o=o||[],o.push(A),i[t]=o,!0);{if(!o||!o.includes(A))return!1;const I=o.indexOf(A);return I!==-1&&o.splice(I,1),!0}}handlePointerCapture(i,A){if(i.z__pointer_ctured){i.z__pointer_ctured=!1;const t=i.pointerId;if(A.onPointerMove){const g=this._capturedPointer[t]||[];g.push(A),this._capturedPointer[t]=g}else WA()&&!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 i.z__pointer_cture_rleased&&(i.z__pointer_cture_rleased=!1,this.releasePointerCapture(i,A))}releasePointerCapture(i,A){const t=i.pointerId;if(this._capturedPointer[t]){const g=this._capturedPointer[t].indexOf(A);g!==-1&&(this._capturedPointer[t].splice(g,1),aC&&console.log("released pointer capture",t,A,this._capturedPointer))}}invokePointerCapture(i){var A;if(i.event.type===wi.PointerMove){const t=i.pointerId,g=this._capturedPointer[t];if(g){aC&&console.log("Captured",t,g);for(let o=0;o<g.length;o++){const I=g[o];if(I.destroyed){g.splice(o,1),o--;continue}(A=I.onPointerMove)==null||A.call(I,i)}}}}isChild(i,A){return!i||!A?!1:i===A?!0:i.parent?this.isChild(i.parent,A):!1}handleMeshUiObjectWithoutShadowDom(i,A){return!i||!i.isUI?!0:this.handleMeshUIIntersection(i,A)}handleMeshUIIntersection(i,A){const t=$B.updateState(i,A);return t&&this.currentActiveMeshUIComponents.push(t),t!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&$B.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let i=0;i<this.currentActiveMeshUIComponents.length;i++){const A=this.currentActiveMeshUIComponents[i];$B.resetState(A)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(i){return i?gA.isActiveSelf(i)?this.testIsVisible(i.parent):!1:!0}};let sn=rC;Q(sn,"_eventSystemMap",new Map),Q(sn,"didSearchEventSystem",!1);class $B{static markDirty(){this.needsUpdate=!0}static update(A,t,g=!1){if(g){A.update();return}const o=t.time.frameCount;for(const I of this.lastUpdateFrame)if(I.context===t){if(o===I.frame)return;I.frame=o;let s=this.needsUpdate||o<1;I.nextUpdate<=o&&(s=!0),s&&(aC&&console.log("Update threemeshui"),this.needsUpdate=!1,I.nextUpdate=o+60,A.update());return}this.lastUpdateFrame=[{context:t,frame:o,nextUpdate:o+60}],A.update(),this.needsUpdate=!1}static updateState(A,t){let g=null;if(A&&(g=this.findBlockInParent(A),g&&g!==this.lastSelected)){if(g.interactable===!1)return null;this.needsUpdate=!0}return g}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}}Q($B,"lastSelected",null),Q($B,"lastUpdateFrame",[]),Q($B,"needsUpdate",!1);var fuA=Object.defineProperty,GuA=Object.getOwnPropertyDescriptor,Gi=(i,A,t,g)=>{for(var o=g>1?void 0:g?GuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&fuA(A,t,o),o};const fx=iA("debugorbit"),Gx=iA("freecam"),jG=iA("debugcamerafit"),zG=iA("smoothcam"),kuA={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let kx;class C0 extends CustomEvent{constructor(A,t){super("target-reached",{detail:{controls:A,type:t}})}}class Nt extends vA{constructor(){super(...arguments),Q(this,"autoTarget",!0),Q(this,"autoFit",!1),Q(this,"enableRotate",!0),Q(this,"autoRotate",!1),Q(this,"autoRotateSpeed",1),Q(this,"minAzimuthAngle",1/0),Q(this,"maxAzimuthAngle",1/0),Q(this,"minPolarAngle",0),Q(this,"maxPolarAngle",Math.PI),Q(this,"enableKeys",!1),Q(this,"enableDamping",!0),Q(this,"dampingFactor",.1),Q(this,"enableZoom",!0),Q(this,"minZoom",0),Q(this,"maxZoom",1/0),Q(this,"zoomSpeed",1),Q(this,"zoomToCursor",!1),Q(this,"enablePan",!0),Q(this,"lookAtConstraint",null),Q(this,"lookAtConstraint01",1),Q(this,"allowInterrupt",!0),Q(this,"middleClickToFocus",!0),Q(this,"doubleClickToFocus",!0),Q(this,"clickBackgroundToFitScene",2),Q(this,"debugLog",!1),Q(this,"targetLerpDuration",1),Q(this,"_controls",null),Q(this,"_cameraObject",null),Q(this,"_lookTargetLerpActive",!1),Q(this,"_lookTargetStartPosition",new f),Q(this,"_lookTargetEndPosition",new f),Q(this,"_lookTargetLerp01",0),Q(this,"_lookTargetLerpDuration",0),Q(this,"_cameraLerpActive",!1),Q(this,"_cameraStartPosition",new f),Q(this,"_cameraEndPosition",new f),Q(this,"_cameraLerp01",0),Q(this,"_cameraLerpDuration",0),Q(this,"_fovLerpActive",!1),Q(this,"_fovLerpStartValue",0),Q(this,"_fovLerpEndValue",0),Q(this,"_fovLerp01",0),Q(this,"_fovLerpDuration",0),Q(this,"_inputs",0),Q(this,"_enableTime",0),Q(this,"_startedListeningToKeyEvents",!1),Q(this,"_eventSystem"),Q(this,"_afterHandleInputFn"),Q(this,"_camera",null),Q(this,"_syncedTransform"),Q(this,"_didSetTarget",0),Q(this,"targetElement",null),Q(this,"_activePointerEvents"),Q(this,"_lastTimeClickOnBackground",-1),Q(this,"_clickOnBackgroundCount",0),Q(this,"_onPointerDown",A=>{this._activePointerEvents.push(A)}),Q(this,"_onPointerUp",A=>{for(let t=this._activePointerEvents.length-1;t>=0;t--){const g=this._activePointerEvents[t];if(g.pointerId===A.pointerId&&g.button===A.button){this._activePointerEvents.splice(t,1);break}}if(this.clickBackgroundToFitScene>0&&A.isClick&&A.button===0){if(A.hasRay||A.intersections.push(...this.context.physics.raycast()),A.intersections.length<=0){const t=this.context.time.time-this._lastTimeClickOnBackground;this._lastTimeClickOnBackground=this.context.time.time,this.clickBackgroundToFitScene<=1||t<this.clickBackgroundToFitScene*.15?(this._clickOnBackgroundCount+=1,this._clickOnBackgroundCount>=this.clickBackgroundToFitScene-1&&this.fitCamera(this.context.scene.children,{immediate:!1})):this._clickOnBackgroundCount=0}fx&&console.log(this.clickBackgroundToFitScene,A.intersections.length,this._clickOnBackgroundCount)}}),Q(this,"_onPointerUpLate",A=>{this.doubleClickToFocus&&A.isDoubleClick&&!A.used&&this.setTargetFromRaycast()}),Q(this,"onControlsChangeStarted",()=>{this._syncedTransform&&this._syncedTransform.requestOwnership()}),Q(this,"_shouldDisable",!1),Q(this,"__onPreRender",()=>{const A=this.context.pre_render_callbacks.indexOf(this.__onPreRender);A>=0&&this.context.pre_render_callbacks.splice(A,1),this.autoFit&&(this.autoFit=!1,this.fitCamera({centerCamera:"y",immediate:!0,objects:this.scene.children}))}),Q(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(A){var t;(t=this.controls)==null||t.addEventListener("start",A)}get targetLerpSpeed(){return 5}set targetLerpSpeed(A){this.targetLerpDuration=1/A}awake(){this._didSetTarget=0,this._startedListeningToKeyEvents=!1}start(){this._eventSystem=sn.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener(Sx.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var A,t;(A=this._controls)==null||A.dispose(),(t=this._eventSystem)==null||t.removeEventListener(Sx.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._didSetTarget=0,this._enableTime=this.context.time.time;const A=gA.getComponent(this.gameObject,Ot);this._camera=A;let t=A?.threeCamera;if(!t&&this.gameObject instanceof be&&(t=this.gameObject),t&&cF(t,this,!0),!this._controls&&t instanceof be){this._cameraObject=t;const g=this.targetElement??this.context.renderer.domElement,o=t?.quaternion.clone();this._controls=new VX(t,g),t?.quaternion.copy(o),kx===void 0&&(kx={...this._controls.keys})}this._controls&&(Gx&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,De.isMobileDevice()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),!this._startedListeningToKeyEvents&&this.enableKeys?(this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(this.context.domElement)):this._controls.stopListenToKeyEvents()),this._syncedTransform=gA.getComponent(this.gameObject,Ya)??void 0,this.context.pre_render_callbacks.push(this.__onPreRender),this._activePointerEvents=[],this.context.input.addEventListener("pointerdown",this._onPointerDown,{queue:Qs.Early}),this.context.input.addEventListener("pointerup",this._onPointerUp,{queue:Qs.Early}),this.context.input.addEventListener("pointerup",this._onPointerUpLate,{queue:Qs.Late})}onDisable(){var A;(A=this._camera)!=null&&A.threeCamera&&cF(this._camera.threeCamera,this,!1),this._controls&&(this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted),this._controls.stopListenToKeyEvents(),this._startedListeningToKeyEvents=!1),this._activePointerEvents.length=0,this.context.input.removeEventListener("pointerdown",this._onPointerDown),this.context.input.removeEventListener("pointerup",this._onPointerUp),this.context.input.removeEventListener("pointerup",this._onPointerUpLate)}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,t,g,o;if(!!this._controls){if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}if(this._controls.enabled=!0,(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,this.autoTarget&&this._didSetTarget++===0){const I=gA.getComponent(this.gameObject,Ot);if(I&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const s=Le(I.threeCamera),n=Math.max(.01,s.length()),a=new f(0,0,-n).applyMatrix4(I.threeCamera.matrixWorld);this.setLookTargetPosition(a,!0)}if(!this.setLookTargetFromConstraint()){const s=new Ka;s.screenPoint=new j(0,0),s.lineThreshold=.1;const n=this.context.physics.raycast(s);n.length>0&&this.setLookTargetPosition(n[0].point,!0),jG&&console.log("OrbitControls hits",...n)}}if(this.middleClickToFocus&&this.context.input.getPointerClicked(1)&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive||this._fovLerpActive){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 C0(this,"camera"));else{const I=te.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,I)}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 C0(this,"lookat"));else{const I=te.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,I)}if(this._fovLerpActive&&this._cameraObject){const I=this._cameraObject;if(this._fovLerp01+=this.context.time.deltaTime/this._fovLerpDuration,this._fovLerp01>=1)I.fov=this._fovLerpEndValue,this._fovLerpActive=!1;else{const s=te.easeInOutCubic(this._fovLerp01);I.fov=te.lerp(this._fovLerpStartValue,this._fovLerpEndValue,s)}I.updateProjectionMatrix()}}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._activePointerEvents.some(I=>I.used),this._controls.keys=this.enableKeys?kx:kuA,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.zoomSpeed=this.zoomSpeed,this._controls.zoomToCursor=this.zoomToCursor,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,Gx||(((g=(t=this._camera)==null?void 0:t.threeCamera)==null?void 0:g.type)==="PerspectiveCamera"?(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom,this._controls.minZoom=0,this._controls.maxZoom=1/0):(this._controls.minDistance=0,this._controls.maxDistance=1/0,this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom)),typeof zG=="number"||zG===!0){this._controls.enableDamping=!0;const I=typeof zG=="number"?zG:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,I))}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||(!Gx&&(o=this.lookAtConstraint)!=null&&o.locked&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(this.context.time.deltaTime),fx&&ce.DrawWireSphere(this._controls.target,.1,65280))}}}setCameraAndLookTarget(A){if(!A||!(A instanceof pA))return;const t=Le(A),g=mF(A);this.setTargetFromRaycast(new nI(t,g)),this.setCameraTargetPosition(t)}setCameraTargetPosition(A,t=!1){var g;A&&(A instanceof pA&&(A=Le(A)),this._cameraEndPosition||(this._cameraEndPosition=new f),this._cameraEndPosition.copy(A),t===!0?(this._cameraLerpActive=!1,this._cameraObject&&this._cameraObject.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((g=this._cameraObject)==null?void 0:g.position),typeof t=="number"?this._cameraLerpDuration=t:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setFieldOfView(A,t=!1){var g;if(!this._controls||typeof A!="number")return;const o=(g=this._camera)==null?void 0:g.threeCamera;o&&(t===!0?o.fov=A:(this._fovLerpActive=!0,this._fovLerp01=0,this._fovLerpStartValue=o.fov,this._fovLerpEndValue=A,typeof t=="number"?this._fovLerpDuration=t:this._fovLerpDuration=this.targetLerpDuration))}setLookTargetPosition(A=null,t=!1){this._controls&&A&&(A instanceof pA&&(A=Le(A)),this._lookTargetEndPosition.copy(A),this._didSetTarget++,fx&&(console.warn("OrbitControls: setLookTargetPosition",A,t),ce.DrawWireSphere(this._lookTargetEndPosition,.2,16711680,2)),t===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof t=="number"?this._lookTargetLerpDuration=t:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(A=0,t=1){var g;if(!this._controls)return!1;const o=(g=this.lookAtConstraint)==null?void 0:g.sources;if(o&&o.length>0){const I=o[A];if(I)return I.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,t),!0}return!1}lerpTarget(A,t){return this.lerpLookTarget(A,t)}lerpLookTarget(A,t){this._controls&&(t>=1?this._controls.target.copy(A):this._controls.target.lerp(A,t))}setTargetFromRaycast(A){if(!this.controls)return;const t=A?this.context.physics.raycastFromRay(A):this.context.physics.raycast();for(const g of t)if(g.distance>0&&gA.isActiveInHierarchy(g.object)){const o=wx(g.object);if(o){const I=o.canvas;if(I!=null&&I.screenspace)break}this.setLookTargetPosition(g.point);break}}fitCamera(A,t){var g,o;if(this.context.isInXR)return;let I;if(Array.isArray(A)?I=A:A&&"type"in A?I=A.children:A&&"objects"in A&&(I=A?.objects,t=A),I&&!Array.isArray(I)&&(I=I.children),(!Array.isArray(I)||I&&I.length<=0)&&(I=this.context.scene.children),!Array.isArray(I)||I.length<=0){console.warn("No objects to fit camera to...");return}const s=this._cameraObject,n=this._controls;if(!s||!n){console.warn("No camera or controls found to fit camera to objects...");return}t||(t={});const{immediate:a=!1,centerCamera:r="y",cameraNearFar:C="auto",fitOffset:B=1.1,fov:l=s?.fov}=t,h=new f,c=new f,d=ss(I,void 0,(o=(g=this._camera)==null?void 0:g.threeCamera)==null?void 0:o.layers),E=d.clone();s.updateMatrixWorld(),s.updateProjectionMatrix(),d.getCenter(c);const u=new f;if(d.getSize(u),d.applyMatrix4(s.matrixWorldInverse),d.getSize(h),d.setFromCenterAndSize(c,h),Number.isNaN(h.x)||Number.isNaN(h.y)||Number.isNaN(h.z)){console.warn("Camera fit size resultet in NaN",s,d,[...I]);return}if(h.length()<=1e-10){jG&&console.warn("Camera fit size is zero",d,[...I]);return}const p=t.fov||s.fov,D=2*Math.atan(Math.tan(p*Math.PI/360/2)*s.aspect)/Math.PI*360,y=h.y/(2*Math.atan(Math.PI*p/360)),m=h.x/(2*Math.atan(Math.PI*D/360)),w=B*Math.max(y,m)+h.z/2;jG&&console.log("Fit camera to objects",{fitHeightDistance:y,fitWidthDistance:m,distance:w,verticalFov:p,horizontalFov:D}),this.maxZoom=w*10,this.minZoom=w*.01;const S=.05,M=c.clone();if(M.y-=h.y*S,this.setLookTargetPosition(M,a),this.setFieldOfView(t.fov,a),this.autoTarget=!1,C==null||C=="auto"){const x=gA.findObjectOfType(qa),v=x?x.radius:0,O=Math.max(u.x,u.y,u.z,v);s.near=w/100,s.far=O+w*10,x&&(this.maxZoom=Math.max(Math.min(this.maxZoom,v*.5),w))}const N=n.getDistance();N<this.minZoom&&(this.minZoom=N*.9),N>this.maxZoom&&(this.maxZoom=N*1.1),s.updateMatrixWorld(),s.updateProjectionMatrix();const k=Le(s),b=c.clone();b.sub(k),r==="y"&&(b.y=0),b.normalize(),b.multiplyScalar(w),r==="y"&&(b.y+=-S*4*w);let F=c.clone().sub(b);if(s.parent&&(F=s.parent.worldToLocal(F)),this.setCameraTargetPosition(F,a),jG){const x=new wN(d);this.context.scene.add(x),fF(x,Mp(s)),setTimeout(()=>{this.context.scene.remove(x)},1e4),ce.DrawWireBox3(E,65280,10),this._haveAttachedKeyboardEvents||(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",v=>{if(v.code==="KeyF"){let O;this._cameraObject instanceof be&&(O=Math.random()*Math.random()*170+10),this.fitCamera({objects:I,fitOffset:B,immediate:!1,fov:O})}v.code==="KeyV"&&this._cameraObject instanceof be&&(this._cameraObject.fov=60)}))}n.update()}}Gi([G()],Nt.prototype,"autoTarget",2),Gi([G()],Nt.prototype,"autoFit",2),Gi([G()],Nt.prototype,"enableRotate",2),Gi([G()],Nt.prototype,"autoRotate",2),Gi([G()],Nt.prototype,"autoRotateSpeed",2),Gi([G()],Nt.prototype,"minAzimuthAngle",2),Gi([G()],Nt.prototype,"maxAzimuthAngle",2),Gi([G()],Nt.prototype,"minPolarAngle",2),Gi([G()],Nt.prototype,"maxPolarAngle",2),Gi([G()],Nt.prototype,"enableKeys",2),Gi([G()],Nt.prototype,"enableDamping",2),Gi([G()],Nt.prototype,"dampingFactor",2),Gi([G()],Nt.prototype,"enableZoom",2),Gi([G()],Nt.prototype,"minZoom",2),Gi([G()],Nt.prototype,"maxZoom",2),Gi([G()],Nt.prototype,"zoomSpeed",2),Gi([G()],Nt.prototype,"enablePan",2),Gi([G(sh)],Nt.prototype,"lookAtConstraint",2),Gi([G()],Nt.prototype,"lookAtConstraint01",2),Gi([G()],Nt.prototype,"allowInterrupt",2),Gi([G()],Nt.prototype,"middleClickToFocus",2),Gi([G()],Nt.prototype,"doubleClickToFocus",2),Gi([G()],Nt.prototype,"clickBackgroundToFitScene",2),Gi([G()],Nt.prototype,"targetLerpDuration",2);var MuA=Object.defineProperty,RuA=Object.getOwnPropertyDescriptor,wI=(i,A,t,g)=>{for(var o=g>1?void 0:g?RuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&MuA(A,t,o),o},AQ=(i=>(i[i.None=0]="None",i[i.Skybox=1]="Skybox",i[i.SolidColor=2]="SolidColor",i[i.Uninitialized=4]="Uninitialized",i))(AQ||{});const eQ=iA("debugcam"),oV=iA("debugscreenpointtoray");var $G;const B0=($G=class extends vA{constructor(){super(...arguments),Q(this,"_nearClipPlane",.1),Q(this,"_farClipPlane",1e3),Q(this,"orthographic",!1),Q(this,"orthographicSize",5),Q(this,"ARBackgroundAlpha",0),Q(this,"_cullingMask",4294967295),Q(this,"_backgroundBlurriness"),Q(this,"_backgroundIntensity"),Q(this,"_backgroundRotation"),Q(this,"_environmentIntensity"),Q(this,"_targetTexture",null),Q(this,"_backgroundColor"),Q(this,"_fov"),Q(this,"_cam",null),Q(this,"_clearFlags",2),Q(this,"_skybox"),Q(this,"_frustum"),Q(this,"_projScreenMatrix",new lA)}get isCamera(){return!0}get aspect(){return this._cam instanceof be?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(i){this._cam instanceof be&&this._cam.aspect!==i&&(this._cam.aspect=i,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof be?this._cam.fov:this._fov}set fieldOfView(i){const A=this.fieldOfView!=i;if(this._fov=i,A&&this._cam&&this._cam instanceof be){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(i){const A=this._nearClipPlane!=i;this._nearClipPlane=i,this._cam&&(A||this._cam.near!=i)&&(this._cam.near=i,this._cam.updateProjectionMatrix())}applyClippingPlane(){this._cam&&(this._cam.near=this._nearClipPlane,this._cam.far=this._farClipPlane,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(i){const A=this._farClipPlane!=i;this._farClipPlane=i,this._cam&&(A||this._cam.far!=i)&&(this._cam.far=i,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(i){i!==this._clearFlags&&(this._clearFlags=i,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(i){this._cullingMask=i,this._cam&&(this._cam.layers.mask=i)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(i){this.cullingMask=(1<<i|0)>>>0}set backgroundBlurriness(i){i!==this._backgroundBlurriness&&(i===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(i,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(i){i!==this._backgroundIntensity&&(i===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(i,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set backgroundRotation(i){i!==this._backgroundRotation&&(i===void 0?this._backgroundRotation=void 0:this._backgroundRotation=i,this.applyClearFlagsIfIsActiveCamera())}get backgroundRotation(){return this._backgroundRotation}set environmentIntensity(i){this._environmentIntensity=i}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(i){if(i){if(this._backgroundColor)this._backgroundColor.copy(i);else{if(!i.clone)return;this._backgroundColor=i.clone()}i.alpha===void 0&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera()}}set targetTexture(i){this._targetTexture=i}get targetTexture(){return this._targetTexture}get cam(){return this.threeCamera}get threeCamera(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(i,A,t){const g=this.threeCamera,o=B0._origin;o.set(i,A,-1),this.context.input.convertScreenspaceToRaycastSpace(o),oV&&console.log("screenPointToRay",i.toFixed(2),A.toFixed(2),"now:",o.x.toFixed(2),o.y.toFixed(2),"isInXR:"+this.context.isInXR),o.z=-1,o.unproject(g);const I=B0._direction.set(o.x,o.y,o.z),s=Le(g);return I.sub(s),I.normalize(),t?(t.set(s,I),t):new nI(s.clone(),I.clone())}getFrustum(){return this._frustum||(this._frustum=new gl,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new gl),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(i,A){return A&&this._projScreenMatrix.multiplyMatrices(this.threeCamera.projectionMatrix,this.threeCamera.matrixWorldInverse),i===this._projScreenMatrix?i:i.copy(this._projScreenMatrix)}awake(){oV&&window.addEventListener("pointerdown",i=>{const A=i.clientX,t=i.clientY;console.log("touch",A.toFixed(2),t.toFixed(2));const g=this.screenPointToRay(A,t),o="#"+Math.floor(Math.random()*16777215).toString(16);ce.DrawRay(g.origin,g.direction,o,10)})}onEnable(){eQ&&console.log(`Camera enabled: "${this.name}". ClearFlags=${AQ[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),buA(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 i=this.context.renderer;if(i){const A=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,i),A?.applyClearFlags()}}}buildCamera(){if(this._cam)return;const i=this.gameObject.isCamera;let A=null;if(i?(A=this.gameObject,A?.layers.enableAll(),A instanceof be&&(this._fov=A.fov)):A=this.gameObject.children[0],A&&A.isCamera)A instanceof be&&(this._fov&&(A.fov=this._fov),A.near=this._nearClipPlane,A.far=this._farClipPlane,A.updateProjectionMatrix());else if(!this.orthographic)A=new be(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(A.fov=this.fieldOfView),this.gameObject.add(A);else{const t=this.orthographicSize*100;A=new Da(window.innerWidth/-t,window.innerWidth/t,window.innerHeight/t,window.innerHeight/-t,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(i){this.context.mainCameraComponent===this&&this.applyClearFlags(i)}applyClearFlags(i){var A;if(!this._cam){eQ&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,eQ){const t=`Camera "${this.name}" clear flags: ${AQ[this._clearFlags]}`;console.debug(t)}switch(this._clearFlags){case 0:return;case 1:if(B0.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||i?.applySkybox===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:eQ&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0&&(this.context.scene.backgroundIntensity=this._backgroundIntensity),this._backgroundRotation!==void 0?this.context.scene.backgroundRotation=this._backgroundRotation:eQ&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor){let t=this._backgroundColor.alpha;B0.backgroundShouldBeTransparent(this.context)&&(t=this.ARBackgroundAlpha??0),this.context.scene.background=null,(A=this.context.xr)!=null&&A.isVR?this.context.renderer.setClearColor(uO(this._backgroundColor).convertLinearToSRGB()):this.context.renderer.setClearColor(this._backgroundColor,t)}else eQ&&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 UuA(this)),this._skybox.apply()}static backgroundShouldBeTransparent(i){var A,t,g,o;const I=(A=i.renderer.xr)==null?void 0:A.getSession();if(!I)return!1;if(typeof I._transparent=="boolean")return I._transparent;const s=I.environmentBlendMode;eQ&&mi("Environment blend mode: "+s+" on "+navigator.userAgent);let n=s==="additive"||s==="alpha-blend";return i.isInAR&&s==="opaque"&&((t=navigator.userAgent)!=null&&t.includes("OculusBrowser")||(g=navigator.userAgent)!=null&&g.includes("Mozilla")&&(o=navigator.userAgent)!=null&&o.includes("Mobile WebXRViewer/v2"))&&(n=!0),I._transparent=n,n}},Q($G,"_origin",new f),Q($G,"_direction",new f),$G);let Ot=B0;wI([G()],Ot.prototype,"aspect",1),wI([G()],Ot.prototype,"fieldOfView",1),wI([G()],Ot.prototype,"nearClipPlane",1),wI([G()],Ot.prototype,"farClipPlane",1),wI([G()],Ot.prototype,"clearFlags",1),wI([G()],Ot.prototype,"orthographic",2),wI([G()],Ot.prototype,"orthographicSize",2),wI([G()],Ot.prototype,"ARBackgroundAlpha",2),wI([G()],Ot.prototype,"cullingMask",1),wI([G()],Ot.prototype,"backgroundBlurriness",1),wI([G()],Ot.prototype,"backgroundIntensity",1),wI([G(st)],Ot.prototype,"backgroundRotation",1),wI([G()],Ot.prototype,"environmentIntensity",1),wI([G(vt)],Ot.prototype,"backgroundColor",1),wI([G(Ad)],Ot.prototype,"targetTexture",1);class UuA{constructor(A){Q(this,"_camera"),Q(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&&(eQ&&console.log(`Camera "${this._camera.name}" set skybox`,this._camera,this._skybox),this._skybox.mapping=II,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}" has no skybox texture. ${this._camera.sourceId}`))}}function buA(i){iA("freecam")&&i.context.mainCameraComponent===i&&gA.getOrAddComponent(i.gameObject,Nt)}class tQ extends vA{constructor(){super(...arguments),Q(this,"_listener",null),Q(this,"onInteraction",()=>{this.destroyed||this.listener==null||this.addListenerIfItExists()})}get listener(){return this._listener==null&&(this._listener=new R1),this._listener}onEnable(){gC.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){gC.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}addListenerIfItExists(){const A=this._listener;if(!A||A!=null&&A.parent)return;const t=this.context.mainCameraComponent||gA.getComponentInParent(this.gameObject,Ot);t!=null&&t.threeCamera?t.threeCamera.add(A):this.gameObject.add(A),A.filter?(A.gain.connect(A.filter),A.filter.connect(A.context.destination)):A.gain.connect(A.context.destination)}removeListenerIfItExists(){const A=this._listener;A&&(A.removeFromParent(),A.filter&&A.filter.disconnect(),A.gain&&A.gain.disconnect())}}var NuA=Object.defineProperty,FuA=Object.getOwnPropertyDescriptor,Aa=(i,A,t,g)=>{for(var o=g>1?void 0:g?FuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&NuA(A,t,o),o};const $o=iA("debugaudio"),iQ=class extends vA{constructor(){super(...arguments),Q(this,"clip",""),Q(this,"playOnAwake",!1),Q(this,"preload",!1),Q(this,"playInBackground",!0),Q(this,"_spatialBlend",0),Q(this,"_minDistance",1),Q(this,"_maxDistance",100),Q(this,"_volume",1),Q(this,"rollOffMode",0),Q(this,"_loop",!1),Q(this,"sound",null),Q(this,"helper",null),Q(this,"wasPlaying",!1),Q(this,"audioLoader",null),Q(this,"shouldPlay",!1),Q(this,"_lastClipStartedLoading",null),Q(this,"_audioElement",null),Q(this,"onVisibilityChanged",()=>{switch(document.visibilityState){case"hidden":(this.playInBackground===!1||De.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case"visible":$o&&console.log("visible",this.enabled,this.playOnAwake,!this.isPlaying,iQ.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&iQ.userInteractionRegistered&&this.wasPlaying&&this.play();break}}),Q(this,"onApplicationMuteChanged",()=>{var i,A;this.context.application.muted?(i=this.sound)==null||i.setVolume(0):(A=this.sound)==null||A.setVolume(this.volume)}),Q(this,"createAudio",i=>{$o&&console.log("AudioBuffer finished loading",i);const A=this.Sound;if(!A){$o&&console.warn("Failed getting sound?",this.name);return}A.isPlaying&&A.stop(),i&&A.setBuffer(i),A.loop=this._loop,this.context.application.muted?A.setVolume(0):A.setVolume(this.volume),A.autoplay=this.shouldPlay&&iQ.userInteractionRegistered,this.applySpatialDistanceSettings(),A.isPlaying&&A.stop(),iQ.registerWaitForAllowAudio(this.__onAllowAudioCallback)}),Q(this,"__onAllowAudioCallback",()=>{this.shouldPlay&&this.play()}),Q(this,"_lastContextTime",0),Q(this,"_hasEnded",!0),Q(this,"_needUpdateSpatialDistanceSettings",!1)}static get userInteractionRegistered(){return gC.userInteractionRegistered}static registerWaitForAllowAudio(i){gC.registerWaitForInteraction(i)}get isPlaying(){var i;return((i=this.sound)==null?void 0:i.isPlaying)??!1}get duration(){var i,A;return(A=(i=this.sound)==null?void 0:i.buffer)==null?void 0:A.duration}get time01(){var i;const A=this.duration;return A&&this.sound?((i=this.sound)==null?void 0:i.context.currentTime)/A:0}set time01(i){const A=this.duration;A&&this.sound&&(this.time=i*A)}get time(){var i,A;return(i=this.sound)!=null&&i.source?((A=this.sound.source)==null?void 0:A.context.currentTime)-this._lastContextTime+this.sound.offset:0}set time(i){if(this.sound){if(i===this.sound.offset)return;const A=this.isPlaying;this.stop(),this.sound.offset=i,A&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(i){this._loop=i,this.sound&&this.sound.setLoop(i)}get spatialBlend(){return this._spatialBlend}set spatialBlend(i){i!==this._spatialBlend&&(this._spatialBlend=i,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(i){this._minDistance!==i&&(this._minDistance=i,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(i){this._maxDistance!==i&&(this._maxDistance=i,this._needUpdateSpatialDistanceSettings=!0)}get volume(){return this._volume}set volume(i){this._volume=i,this.sound&&!this.context.application.muted&&($o&&console.log(this.name,"audio set volume",i),this.sound.setVolume(i))}set pitch(i){this.sound&&this.sound.setPlaybackRate(i)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}get Sound(){var i;if(!this.sound&&iQ.userInteractionRegistered){let A=gA.getComponent(this.context.mainCamera,tQ)??gA.findObjectOfType(tQ,this.context);!A&&this.context.mainCamera&&(A=gA.addComponent(this.context.mainCamera,tQ)),A!=null&&A.listener?(this.sound=new b1(A.listener),(i=this.gameObject)==null||i.add(this.sound)):$o&&console.warn("No audio listener found in scene - can not play audio")}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){var i;return(i=this.sound)==null?void 0:i.context}awake(){$o&&console.log(this),this.audioLoader=new _w,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip=="string"&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),iQ.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():iQ.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.addEventListener(rG.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.removeEventListener(rG.MuteChanged,this.onApplicationMuteChanged),this.pause()}applySpatialDistanceSettings(){const i=this.sound;if(!i)return;this._needUpdateSpatialDistanceSettings=!1;const A=te.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch($o&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,"Ref distance="+A),i.setRefDistance(A),i.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case 0:i.setDistanceModel("exponential");break;case 1:i.setDistanceModel("linear");break;case 2:console.warn("Custom rolloff for AudioSource is not supported: "+this.name);break}this.spatialBlend>0?$o&&!this.helper&&(this.helper=new OdA(i,i.getRefDistance()),i.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(i){if(i&&(this.clip=i),typeof i=="string")if($o&&console.log(i),i.endsWith(".mp3")||i.endsWith(".wav")){if(this.audioLoader||(this.audioLoader=new _w),this.shouldPlay=!0,this._lastClipStartedLoading===i){$o&&console.log("Is currently loading:",this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=i,$o&&console.log("load audio",i);const A=await this.audioLoader.loadAsync(i).catch(console.error);this._lastClipStartedLoading=null,A&&this.createAudio(A)}else console.warn("Unsupported audio clip type",i);else this.shouldPlay=!0,this.createAudio()}play(i=void 0){var A,t,g;!i&&this.clip&&(i=this.clip),i!==void 0&&typeof i!="string"&&!(i instanceof MediaStream)&&(WA()&&console.warn("Called play on AudioSource with unknown argument type:",i+`
|
|
5956
|
+
Could not find method ${r.method} on object ${B.name}`,B,typeof B[r.method])};if(typeof B[r.method]!="function"){let c=!1,d=B;for(;d;){const E=Object.getOwnPropertyDescriptor(d,r.method);if(E&&(E.writable===!0||E.set)){c=!0;break}d=Object.getPrototypeOf(d)}!c&&(WA()||Wg)&&h()}}if(B){let h=r.argument;if(h!==void 0?h=C(h):r.arguments!==void 0&&(h=r.arguments.map(C)),!B[r.method])console.warn(`EventList method not found: "${r.method}" on ${B?.name}`);else{h!==void 0&&!Array.isArray(h)&&(h=[h]);const c=new Ha(B,r.method,h,r.enabled);s.push(c)}}else WA()&&console.warn("[Debug] EventList: Could not find event listener in scene",r,t.object,A)}const n=new $t(s);Wg&&console.log(n);const a=t.target;return a!==void 0&&t.path!==void 0&&n.setEventTarget(t.path,a),n}}}const uuA=new duA,ZG=new WeakMap,puA=_e.prototype.clone;_e.prototype.clone=function(){const i=puA.call(this);return ZG.has(i)||ZG.set(i,this),i};class eV extends en{constructor(){super([Ad,ze])}onSerialize(A,t){}onDeserialize(A,t){if(A instanceof _e&&t.type===Ad){let g=A;ZG.has(g)&&(g=ZG.get(g)),g.isRenderTargetTexture=!0,g.flipY=!0,g.offset.y=1,g.repeat.y=-1,g.needsUpdate=!0,g.mipmaps=[],g instanceof sB&&(g.isCompressedTexture=!1,g.format=kt);const o=new Ad(g.image.width,g.image.height,{colorSpace:Lt});return o.texture=g,o}}}new eV;class tV extends en{constructor(){super([URL])}onSerialize(A,t){return null}onDeserialize(A,t){if(typeof A=="string"&&A.length>0)return BB(t.gltfId,A)}}new tV;var DuA=Object.defineProperty,yuA=Object.getOwnPropertyDescriptor,muA=(i,A,t,g)=>{for(var o=g>1?void 0:g?yuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&DuA(A,t,o),o};class r0 extends vA{awake(){sn.createIfNoneExists(this.context)}onEnable(){var A;(A=sn.get(this.context))==null||A.register(this)}onDisable(){var A;(A=sn.get(this.context))==null||A.unregister(this)}}class us extends r0{constructor(){super(...arguments),Q(this,"targets",null),Q(this,"raycastHits",[]),Q(this,"ignoreSkinnedMeshes",!1)}start(){this.targets=[this.gameObject]}performRaycast(A=null){if(!this.targets)return null;A??(A=new Ka),A.targets=this.targets,A.results=this.raycastHits,A.useAcceleratedRaycast=!0;const t=A.testObject;this.ignoreSkinnedMeshes&&(A.testObject=o=>o instanceof vI?"continue in children":t?t(o):!0);const g=this.context.physics.raycast(A);return A.testObject=t,g}}muA([G()],us.prototype,"ignoreSkinnedMeshes",2);class WG extends us{constructor(){super(),this.ignoreSkinnedMeshes=!0}}const iV=class extends r0{performRaycast(i){if(!ke.active||!iV.allow||!(i!=null&&i.ray))return null;const A=i.ray.origin,t=.015;return this.context.physics.sphereOverlap(A,t,!1,!0)}};let td=iV;Q(td,"allow",!0);class XG{static getObject(A){const t=A[In];return t&&(t.isComponent===!0?A=t.gameObject:A=t),A}static isInteractable(A,t){if(t&&(t.canvasGroup=void 0,t.graphic=void 0),A==null||!A.visible||(A=this.getObject(A),!A.visible))return!1;const g=this.tryFindCanvasGroup(A);if(g?.isCanvasGroup===!0&&(t&&(t.canvasGroup=g),g.blocksRaycasts===!1||g.interactable===!1))return!1;const o=$l(A,I=>{if(I.isGraphic===!0)return I},!1);return t&&o?.isGraphic===!0&&(t.graphic=o),!(o?.raycastTarget===!1||o?.layer===2)}static tryFindCanvasGroup(A){if(!A)return null;const t=$l(A,g=>{const o=g;if(o.blocksRaycasts!==void 0&&o.interactable!==void 0)return o},!1);return t!==void 0?t:this.tryFindCanvasGroup(A.parent)}}function wx(i){return i[In]||(i.parent?wx(i.parent):null)}function wuA(i){return i.isUI===!0||typeof i[In]=="object"}function VG(i,A){if(!i)return;const t=i.material;if(t?.isMaterial===!0){const g=i.parent;g&&g.isText,t.side=A.doubleSided??!0?St:Ag,t.shadowSide=A.doubleSided?St:Ag,i.castShadow=A.castShadows?A.castShadows:!1,i.receiveShadow=A.receiveShadows?A.receiveShadows:!1}for(const g of i.children)VG(g,A)}function id(i,A,t){i[A]===void 0&&console.warn("Field",A,"is undefined on",i);const g=Proxy.revocable(i[A],{set(s,n,a,r){const C=s[n],B=Reflect.set(s,n,a,r);return t(a,C),B}}),o=g.revoke,I=i[A];return g.revoke=()=>{i[A]=I,o()},i[A]=g.proxy,g}const gV=Symbol("Scheduled action");function SuA(i,A,t=gi.OnBeforeRender){let g=i[gV];g||(g=i[gV]={});const o=A.name;g[t]||(g[t]={});const I=g[t];if(I[o])return;function*s(){A?.call(i),I[o]=null}const n=i.startCoroutine(s(),t);I[o]=n}const aC=iA("debugeventsystem");var Sx=(i=>(i.BeforeHandleInput="BeforeHandleInput",i.AfterHandleInput="AfterHandleInput",i))(Sx||{});const rC=class extends vA{constructor(){super(),Q(this,"raycaster",[]),Q(this,"pressedByID",new Map),Q(this,"hoveredByID",new Map),Q(this,"onPointerEvent",i=>{if(i===void 0||i.propagationStopped||i.defaultPrevented||i.used)return;const A=new Du(this.context.input,i);this._currentPointerEventName=i.type,A.inputSource=this.context.input,A.isClick=i.isClick,A.isDoubleClick=i.isDoubleClick,A.isDown=i.type==wi.PointerDown,A.isUp=i.type==wi.PointerUp,A.isPressed=this.context.input.getPointerPressed(i.pointerId),aC&&(A.isDown?console.log("DOWN",A.pointerId):A.isUp&&console.log("UP",A.pointerId),A.isClick&&console.log("CLICK",A.pointerId));const t=new Ka;i.hasRay?t.ray=i.ray:t.screenPoint=this.context.input.getPointerPositionRC(i.pointerId);const g=this.performRaycast(t);if(g){for(const I of g)I.event=i,i.intersections.push(I);i.origin.onPointerHits&&i.origin.onPointerHits({sender:this,event:i,hits:g})}aC&&A.isClick&&mi("EventSystem: "+A.pointerId+" - "+this.context.time.frame+" - Up:"+A.isUp+", Down:"+A.isDown);const o={sender:this,args:A,hasActiveUI:this.currentActiveMeshUIComponents.length>0};this.dispatchEvent(new CustomEvent("BeforeHandleInput",{detail:o})),this.handleIntersections(g,A),this.dispatchEvent(new CustomEvent("AfterHandleInput",{detail:o}))}),Q(this,"_sortedHits",[]),Q(this,"_testObjectsCache",new Map),Q(this,"_currentlyActiveRaycaster",null),Q(this,"_currentPointerEventName",null),Q(this,"shouldRaycastObject",i=>{var A;let t=null;if(wuA(i)&&(t=(A=i[In])==null?void 0:A.gameObject),this._testObjectsCache.has(i)||t&&this._testObjectsCache.has(t))return this._testObjectsCache.get(i)===!1?"continue in children":!0;{let g=_G(i,this._currentPointerEventName);if(!g&&t&&(g=_G(t,this._currentPointerEventName)),g){this._testObjectsCache.set(i,!0);for(const o of i.children)this.shouldRaycastObject_AddToYesCache(o);return!0}return this._testObjectsCache.set(i,!1),"continue in children"}}),Q(this,"_sortingBuffer",[]),Q(this,"_noDepthTestingResults",[]),Q(this,"out",{}),Q(this,"_capturedPointer",{}),Q(this,"pointerEnterSymbol",Symbol("pointerEnter")),Q(this,"pointerExitSymbol",Symbol("pointerExit")),Q(this,"currentActiveMeshUIComponents",[]),rC.systems.push(this)}static createIfNoneExists(i){this.didSearchEventSystem||(this.didSearchEventSystem=!0,rC.systems.length<=0&&rC.systems.push(...gA.findObjectsOfType(rC,i)));for(const t of rC.systems)if(t.context===i)return;const A=new pA;gA.addComponent(A,rC),i.scene.add(A)}static get systems(){const i=Ne.Current;return this._eventSystemMap.has(i)||this._eventSystemMap.set(i,[]),this._eventSystemMap.get(i)}static get(i){const A=this._eventSystemMap.get(i);return A&&A.length>0?A[0]:null}static get instance(){return this.systems[0]}static ensureUpdateMeshUI(i,A,t=!1){$B.update(i,A,t)}static markUIDirty(i){$B.markDirty()}get hasActiveUI(){return this.currentActiveMeshUIComponents.length>0}get isHoveringObjects(){return this.hoveredByID.size>0}onDestroy(){rC.systems.splice(rC.systems.indexOf(this),1)}start(){if(this.raycaster.length<=0&&!gA.findObjectOfType(r0,this.context)){const i=gA.addComponent(this.context.scene,us);this.raycaster.push(i),(WA()||aC)&&console.warn("Added an ObjectRaycaster to the scene because no raycaster was found.")}}register(i){var A;i&&this.raycaster&&!this.raycaster.includes(i)&&((A=this.raycaster)==null||A.push(i))}unregister(i){var A,t;const g=(A=this.raycaster)==null?void 0:A.indexOf(i);g!==void 0&&g!==-1&&((t=this.raycaster)==null||t.splice(g,1))}onEnable(){this.context.input.addEventListener(wi.PointerDown,this.onPointerEvent),this.context.input.addEventListener(wi.PointerUp,this.onPointerEvent),this.context.input.addEventListener(wi.PointerMove,this.onPointerEvent)}onDisable(){this.context.input.removeEventListener(wi.PointerDown,this.onPointerEvent),this.context.input.removeEventListener(wi.PointerUp,this.onPointerEvent),this.context.input.removeEventListener(wi.PointerMove,this.onPointerEvent)}onBeforeRender(){this.resetMeshUIStates()}shouldRaycastObject_AddToYesCache(i){this._testObjectsCache.set(i,!0);for(const A of i.children)this.shouldRaycastObject_AddToYesCache(A)}performRaycast(i){if(!this.raycaster)return null;this._testObjectsCache.clear(),this._sortedHits.length=0,i||(i=new Ka),i.testObject=this.shouldRaycastObject;for(const A of this.raycaster){if(!A.activeAndEnabled)continue;this._currentlyActiveRaycaster=A;const t=A.performRaycast(i);this._currentlyActiveRaycaster=null,t&&t.length>0&&this._sortedHits.push(...t)}return this._sortedHits.sort((A,t)=>A.distance-t.distance),this._sortedHits}assignHitInformation(i,A){A?(i.intersection=A,i.point=A.point,i.normal=A.normal,i.face=A.face,i.distance=A.distance,i.instanceId=A.instanceId):(i.intersection=void 0,i.point=void 0,i.normal=void 0,i.face=void 0,i.distance=void 0,i.instanceId=void 0)}handleIntersections(i,A){var t;if(i!=null&&i.length){i=this.sortCandidates(i);for(const o of i){if(A.event.immediatePropagationStopped)return!1;if(this.assignHitInformation(A,o),this.handleEventOnObject(o.object,A))return!0}}this.assignHitInformation(A,i?.[0]),this.invokePointerCapture(A);const g=this.hoveredByID.get(A.pointerId);return g&&this.propagatePointerExit(g.obj,g.data,null),this.hoveredByID.delete(A.pointerId),A.isUp&&((t=this.pressedByID.get(A.pointerId))==null||t.handlers.forEach(o=>this.invokeOnPointerUp(A,o)),this.pressedByID.delete(A.pointerId)),!1}sortCandidates(i){this._sortingBuffer.length=0,this._noDepthTestingResults.length=0;for(let A=0;A<i.length;A++){const t=i[A],g=t.object;if(g.material&&g.material.depthTest===!1){this._noDepthTestingResults.push(t);continue}this._sortingBuffer.push(t)}for(const A of this._sortingBuffer)this._noDepthTestingResults.push(A);return this._noDepthTestingResults}handleEventOnObject(i,A){if(!this.testIsVisible(i))return A.isClick&&aC&&console.log("not allowed",i),!1;if(A.pointerId===void 0)return aC&&console.error("Event without pointer can't be handled",A),!1;A.object=i;const t=i.parent,g=A.isClick??!1;let o=null;if(t&&t.isUI){const a=(A.isPressed||A.isClick)??!1;if(t[In]){const r=t[In].gameObject;if(r){if(!XG.isInteractable(r,this.out))return!1;o=this.out.canvasGroup??null,this.handleMeshUIIntersection(i,a),i=r}}}g&&aC&&console.log(this.context.time.frame,i);const I=this.hoveredByID.get(A.pointerId),s=I?.obj;s!==i&&s&&this.propagatePointerExit(s,I.data,i);const n=this.hoveredByID.get(A.pointerId);if(n?(n.obj=i,n.data=A):this.hoveredByID.set(A.pointerId,{obj:i,data:A}),A.isDown){const a=this.pressedByID.get(A.pointerId);a?(a.obj=i,a.data=A):this.pressedByID.set(A.pointerId,{obj:i,data:A,handlers:new Set})}return(o===null||o.interactable)&&this.handleMainInteraction(i,A,s??null),!0}propagate(i,A){for(;i;)gA.foreachComponent(i,t=>{A(t)},!1),i=i.parent}handleMainInteraction(i,A,t){const g=this.pressedByID.get(A.pointerId),o=t!==i;let I=!0;switch(A.event.pointerType){case"mouse":case"touch":const s=this.context.input.getPointerPositionLastFrame(A.pointerId),n=this.context.input.getPointerPosition(A.pointerId);I=s&&!te.approximately(s,n);break}this.propagate(i,s=>{var n;const a=s;a.interactable!==!1&&(!a.activeAndEnabled||!a.enabled||(a.onPointerEnter&&o&&this.handlePointerEnter(a,A),A.isDown&&a.onPointerDown&&(a.onPointerDown(A),g?.handlers.add(a),this.handlePointerCapture(A,a)),a.onPointerMove&&(I&&a.onPointerMove(A),this.handlePointerCapture(A,a)),A.isUp&&(a.onPointerUp&&(this.invokeOnPointerUp(A,a),g?.handlers.delete(a)),a.onPointerExit&&((n=A.event)==null?void 0:n.pointerType)===Ef.Touch&&(this.handlePointerExit(a,A),this.hoveredByID.delete(A.pointerId))),A.isClick&&a.onPointerClick&&a.onPointerClick(A)))}),A.isUp&&(g?.handlers.forEach(s=>{this.invokeOnPointerUp(A,s)}),this.pressedByID.delete(A.pointerId))}propagatePointerExit(i,A,t){this.propagate(i,g=>{if(!g.gameObject||g.destroyed)return;const o=g;if(o.onPointerExit||o.onPointerEnter){if(t&&this.isChild(t,g.gameObject))return;this.handlePointerExit(o,A)}})}invokeOnPointerUp(i,A){var t;(t=A.onPointerUp)==null||t.call(A,i),this.releasePointerCapture(i,A)}handlePointerEnter(i,A){i.onPointerEnter&&this.updatePointerState(i,A.pointerId,this.pointerEnterSymbol,!0)&&i.onPointerEnter(A),this.updatePointerState(i,A.pointerId,this.pointerExitSymbol,!1)}handlePointerExit(i,A){i.onPointerExit&&this.updatePointerState(i,A.pointerId,this.pointerExitSymbol,!0)&&i.onPointerExit(A),this.updatePointerState(i,A.pointerId,this.pointerEnterSymbol,!1)}updatePointerState(i,A,t,g){let o=i[t];if(g)return o&&o.includes(A)?!1:(o=o||[],o.push(A),i[t]=o,!0);{if(!o||!o.includes(A))return!1;const I=o.indexOf(A);return I!==-1&&o.splice(I,1),!0}}handlePointerCapture(i,A){if(i.z__pointer_ctured){i.z__pointer_ctured=!1;const t=i.pointerId;if(A.onPointerMove){const g=this._capturedPointer[t]||[];g.push(A),this._capturedPointer[t]=g}else WA()&&!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 i.z__pointer_cture_rleased&&(i.z__pointer_cture_rleased=!1,this.releasePointerCapture(i,A))}releasePointerCapture(i,A){const t=i.pointerId;if(this._capturedPointer[t]){const g=this._capturedPointer[t].indexOf(A);g!==-1&&(this._capturedPointer[t].splice(g,1),aC&&console.log("released pointer capture",t,A,this._capturedPointer))}}invokePointerCapture(i){var A;if(i.event.type===wi.PointerMove){const t=i.pointerId,g=this._capturedPointer[t];if(g){aC&&console.log("Captured",t,g);for(let o=0;o<g.length;o++){const I=g[o];if(I.destroyed){g.splice(o,1),o--;continue}(A=I.onPointerMove)==null||A.call(I,i)}}}}isChild(i,A){return!i||!A?!1:i===A?!0:i.parent?this.isChild(i.parent,A):!1}handleMeshUiObjectWithoutShadowDom(i,A){return!i||!i.isUI?!0:this.handleMeshUIIntersection(i,A)}handleMeshUIIntersection(i,A){const t=$B.updateState(i,A);return t&&this.currentActiveMeshUIComponents.push(t),t!==null}resetMeshUIStates(){if(this.context.input.getPointerPressedCount()>0&&$B.resetLastSelected(),!(!this.currentActiveMeshUIComponents||this.currentActiveMeshUIComponents.length<=0)){for(let i=0;i<this.currentActiveMeshUIComponents.length;i++){const A=this.currentActiveMeshUIComponents[i];$B.resetState(A)}this.currentActiveMeshUIComponents.length=0}}testIsVisible(i){return i?gA.isActiveSelf(i)?this.testIsVisible(i.parent):!1:!0}};let sn=rC;Q(sn,"_eventSystemMap",new Map),Q(sn,"didSearchEventSystem",!1);class $B{static markDirty(){this.needsUpdate=!0}static update(A,t,g=!1){if(g){A.update();return}const o=t.time.frameCount;for(const I of this.lastUpdateFrame)if(I.context===t){if(o===I.frame)return;I.frame=o;let s=this.needsUpdate||o<1;I.nextUpdate<=o&&(s=!0),s&&(aC&&console.log("Update threemeshui"),this.needsUpdate=!1,I.nextUpdate=o+60,A.update());return}this.lastUpdateFrame=[{context:t,frame:o,nextUpdate:o+60}],A.update(),this.needsUpdate=!1}static updateState(A,t){let g=null;if(A&&(g=this.findBlockInParent(A),g&&g!==this.lastSelected)){if(g.interactable===!1)return null;this.needsUpdate=!0}return g}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}}Q($B,"lastSelected",null),Q($B,"lastUpdateFrame",[]),Q($B,"needsUpdate",!1);var fuA=Object.defineProperty,GuA=Object.getOwnPropertyDescriptor,Gi=(i,A,t,g)=>{for(var o=g>1?void 0:g?GuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&fuA(A,t,o),o};const fx=iA("debugorbit"),Gx=iA("freecam"),jG=iA("debugcamerafit"),zG=iA("smoothcam"),kuA={LEFT:"",UP:"",RIGHT:"",BOTTOM:""};let kx;class C0 extends CustomEvent{constructor(A,t){super("target-reached",{detail:{controls:A,type:t}})}}class Nt extends vA{constructor(){super(...arguments),Q(this,"autoTarget",!0),Q(this,"autoFit",!1),Q(this,"enableRotate",!0),Q(this,"autoRotate",!1),Q(this,"autoRotateSpeed",1),Q(this,"minAzimuthAngle",1/0),Q(this,"maxAzimuthAngle",1/0),Q(this,"minPolarAngle",0),Q(this,"maxPolarAngle",Math.PI),Q(this,"enableKeys",!1),Q(this,"enableDamping",!0),Q(this,"dampingFactor",.1),Q(this,"enableZoom",!0),Q(this,"minZoom",0),Q(this,"maxZoom",1/0),Q(this,"zoomSpeed",1),Q(this,"zoomToCursor",!1),Q(this,"enablePan",!0),Q(this,"lookAtConstraint",null),Q(this,"lookAtConstraint01",1),Q(this,"allowInterrupt",!0),Q(this,"middleClickToFocus",!0),Q(this,"doubleClickToFocus",!0),Q(this,"clickBackgroundToFitScene",2),Q(this,"debugLog",!1),Q(this,"targetLerpDuration",1),Q(this,"_controls",null),Q(this,"_cameraObject",null),Q(this,"_lookTargetLerpActive",!1),Q(this,"_lookTargetStartPosition",new f),Q(this,"_lookTargetEndPosition",new f),Q(this,"_lookTargetLerp01",0),Q(this,"_lookTargetLerpDuration",0),Q(this,"_cameraLerpActive",!1),Q(this,"_cameraStartPosition",new f),Q(this,"_cameraEndPosition",new f),Q(this,"_cameraLerp01",0),Q(this,"_cameraLerpDuration",0),Q(this,"_fovLerpActive",!1),Q(this,"_fovLerpStartValue",0),Q(this,"_fovLerpEndValue",0),Q(this,"_fovLerp01",0),Q(this,"_fovLerpDuration",0),Q(this,"_inputs",0),Q(this,"_enableTime",0),Q(this,"_startedListeningToKeyEvents",!1),Q(this,"_eventSystem"),Q(this,"_afterHandleInputFn"),Q(this,"_camera",null),Q(this,"_syncedTransform"),Q(this,"_didSetTarget",0),Q(this,"targetElement",null),Q(this,"_activePointerEvents"),Q(this,"_lastTimeClickOnBackground",-1),Q(this,"_clickOnBackgroundCount",0),Q(this,"_onPointerDown",A=>{this._activePointerEvents.push(A)}),Q(this,"_onPointerUp",A=>{for(let t=this._activePointerEvents.length-1;t>=0;t--){const g=this._activePointerEvents[t];if(g.pointerId===A.pointerId&&g.button===A.button){this._activePointerEvents.splice(t,1);break}}if(this.clickBackgroundToFitScene>0&&A.isClick&&A.button===0){if(A.hasRay||A.intersections.push(...this.context.physics.raycast()),A.intersections.length<=0){const t=this.context.time.time-this._lastTimeClickOnBackground;this._lastTimeClickOnBackground=this.context.time.time,this.clickBackgroundToFitScene<=1||t<this.clickBackgroundToFitScene*.15?(this._clickOnBackgroundCount+=1,this._clickOnBackgroundCount>=this.clickBackgroundToFitScene-1&&this.fitCamera(this.context.scene.children,{immediate:!1})):this._clickOnBackgroundCount=0}fx&&console.log(this.clickBackgroundToFitScene,A.intersections.length,this._clickOnBackgroundCount)}}),Q(this,"_onPointerUpLate",A=>{this.doubleClickToFocus&&A.isDoubleClick&&!A.used&&this.setTargetFromRaycast()}),Q(this,"onControlsChangeStarted",()=>{this._syncedTransform&&this._syncedTransform.requestOwnership()}),Q(this,"_shouldDisable",!1),Q(this,"__onPreRender",()=>{const A=this.context.pre_render_callbacks.indexOf(this.__onPreRender);A>=0&&this.context.pre_render_callbacks.splice(A,1),this.autoFit&&(this.autoFit=!1,this.fitCamera({centerCamera:"y",immediate:!0,objects:this.scene.children}))}),Q(this,"_haveAttachedKeyboardEvents",!1)}get isCameraController(){return!0}get controls(){return this._controls}get controllerObject(){return this._cameraObject}onStartInteraction(A){var t;(t=this.controls)==null||t.addEventListener("start",A)}get targetLerpSpeed(){return 5}set targetLerpSpeed(A){this.targetLerpDuration=1/A}awake(){this._didSetTarget=0,this._startedListeningToKeyEvents=!1}start(){this._eventSystem=sn.get(this.context)??void 0,this._eventSystem&&(this._afterHandleInputFn=this.afterHandleInput.bind(this),this._eventSystem.addEventListener(Sx.AfterHandleInput,this._afterHandleInputFn))}onDestroy(){var A,t;(A=this._controls)==null||A.dispose(),(t=this._eventSystem)==null||t.removeEventListener(Sx.AfterHandleInput,this._afterHandleInputFn)}onEnable(){this._didSetTarget=0,this._enableTime=this.context.time.time;const A=gA.getComponent(this.gameObject,Ot);this._camera=A;let t=A?.threeCamera;if(!t&&this.gameObject instanceof be&&(t=this.gameObject),t&&cF(t,this,!0),!this._controls&&t instanceof be){this._cameraObject=t;const g=this.targetElement??this.context.renderer.domElement,o=t?.quaternion.clone();this._controls=new VX(t,g),t?.quaternion.copy(o),kx===void 0&&(kx={...this._controls.keys})}if(this._controls)if(Gx&&(this.enablePan=!0,this.enableZoom=!0,this.middleClickToFocus=!0,De.isMobileDevice()&&(this.doubleClickToFocus=!0)),this._controls.addEventListener("start",this.onControlsChangeStarted),!this._startedListeningToKeyEvents&&this.enableKeys)this._startedListeningToKeyEvents=!0,this._controls.listenToKeyEvents(this.context.domElement);else try{this._controls.stopListenToKeyEvents()}catch{}this._syncedTransform=gA.getComponent(this.gameObject,Ya)??void 0,this.context.pre_render_callbacks.push(this.__onPreRender),this._activePointerEvents=[],this.context.input.addEventListener("pointerdown",this._onPointerDown,{queue:Qs.Early}),this.context.input.addEventListener("pointerup",this._onPointerUp,{queue:Qs.Early}),this.context.input.addEventListener("pointerup",this._onPointerUpLate,{queue:Qs.Late})}onDisable(){var A;if((A=this._camera)!=null&&A.threeCamera&&cF(this._camera.threeCamera,this,!1),this._controls){this._controls.enabled=!1,this._controls.autoRotate=!1,this._controls.removeEventListener("start",this.onControlsChangeStarted);try{this._controls.stopListenToKeyEvents()}catch{}this._startedListeningToKeyEvents=!1}this._activePointerEvents.length=0,this.context.input.removeEventListener("pointerdown",this._onPointerDown),this.context.input.removeEventListener("pointerup",this._onPointerUp),this.context.input.removeEventListener("pointerup",this._onPointerUpLate)}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,t,g,o;if(!!this._controls){if(this._cameraObject!==this.context.mainCamera){this._controls.enabled=!1;return}if(this._controls.enabled=!0,(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,this.autoTarget&&this._didSetTarget++===0){const I=gA.getComponent(this.gameObject,Ot);if(I&&!this.setLookTargetFromConstraint()){this.debugLog&&console.log("NO TARGET");const s=Le(I.threeCamera),n=Math.max(.01,s.length()),a=new f(0,0,-n).applyMatrix4(I.threeCamera.matrixWorld);this.setLookTargetPosition(a,!0)}if(!this.setLookTargetFromConstraint()){const s=new Ka;s.screenPoint=new j(0,0),s.lineThreshold=.1;const n=this.context.physics.raycast(s);n.length>0&&this.setLookTargetPosition(n[0].point,!0),jG&&console.log("OrbitControls hits",...n)}}if(this.middleClickToFocus&&this.context.input.getPointerClicked(1)&&this.setTargetFromRaycast(),this._lookTargetLerpActive||this._cameraLerpActive||this._fovLerpActive){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 C0(this,"camera"));else{const I=te.easeInOutCubic(this._cameraLerp01);this._cameraObject.position.lerpVectors(this._cameraStartPosition,this._cameraEndPosition,I)}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 C0(this,"lookat"));else{const I=te.easeInOutCubic(this._lookTargetLerp01);this._controls.target.lerpVectors(this._lookTargetStartPosition,this._lookTargetEndPosition,I)}if(this._fovLerpActive&&this._cameraObject){const I=this._cameraObject;if(this._fovLerp01+=this.context.time.deltaTime/this._fovLerpDuration,this._fovLerp01>=1)I.fov=this._fovLerpEndValue,this._fovLerpActive=!1;else{const s=te.easeInOutCubic(this._fovLerp01);I.fov=te.lerp(this._fovLerpStartValue,this._fovLerpEndValue,s)}I.updateProjectionMatrix()}}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._activePointerEvents.some(I=>I.used),this._controls.keys=this.enableKeys?kx:kuA,this._controls.autoRotate=this.autoRotate,this._controls.autoRotateSpeed=this.autoRotateSpeed,this._controls.enableZoom=this.enableZoom,this._controls.zoomSpeed=this.zoomSpeed,this._controls.zoomToCursor=this.zoomToCursor,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,Gx||(((g=(t=this._camera)==null?void 0:t.threeCamera)==null?void 0:g.type)==="PerspectiveCamera"?(this._controls.minDistance=this.minZoom,this._controls.maxDistance=this.maxZoom,this._controls.minZoom=0,this._controls.maxZoom=1/0):(this._controls.minDistance=0,this._controls.maxDistance=1/0,this._controls.minZoom=this.minZoom,this._controls.maxZoom=this.maxZoom)),typeof zG=="number"||zG===!0){this._controls.enableDamping=!0;const I=typeof zG=="number"?zG:.99;this._controls.dampingFactor=Math.max(.001,1-Math.min(1,I))}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||(!Gx&&(o=this.lookAtConstraint)!=null&&o.locked&&this.setLookTargetFromConstraint(0,this.lookAtConstraint01),this._controls.update(this.context.time.deltaTime),fx&&ce.DrawWireSphere(this._controls.target,.1,65280))}}}setCameraAndLookTarget(A){if(!A||!(A instanceof pA))return;const t=Le(A),g=mF(A);this.setTargetFromRaycast(new nI(t,g)),this.setCameraTargetPosition(t)}setCameraTargetPosition(A,t=!1){var g;A&&(A instanceof pA&&(A=Le(A)),this._cameraEndPosition||(this._cameraEndPosition=new f),this._cameraEndPosition.copy(A),t===!0?(this._cameraLerpActive=!1,this._cameraObject&&this._cameraObject.position.copy(this._cameraEndPosition)):this._cameraObject&&(this._cameraLerpActive=!0,this._cameraLerp01=0,this._cameraStartPosition.copy((g=this._cameraObject)==null?void 0:g.position),typeof t=="number"?this._cameraLerpDuration=t:this._cameraLerpDuration=this.targetLerpDuration))}get cameraLerpActive(){return this._cameraLerpActive}stopCameraLerp(){this._cameraLerpActive=!1}setFieldOfView(A,t=!1){var g;if(!this._controls||typeof A!="number")return;const o=(g=this._camera)==null?void 0:g.threeCamera;o&&(t===!0?o.fov=A:(this._fovLerpActive=!0,this._fovLerp01=0,this._fovLerpStartValue=o.fov,this._fovLerpEndValue=A,typeof t=="number"?this._fovLerpDuration=t:this._fovLerpDuration=this.targetLerpDuration))}setLookTargetPosition(A=null,t=!1){this._controls&&A&&(A instanceof pA&&(A=Le(A)),this._lookTargetEndPosition.copy(A),this._didSetTarget++,fx&&(console.warn("OrbitControls: setLookTargetPosition",A,t),ce.DrawWireSphere(this._lookTargetEndPosition,.2,16711680,2)),t===!0?this._controls.target.copy(this._lookTargetEndPosition):(this._lookTargetLerpActive=!0,this._lookTargetLerp01=0,this._lookTargetStartPosition.copy(this._controls.target),typeof t=="number"?this._lookTargetLerpDuration=t:this._lookTargetLerpDuration=this.targetLerpDuration))}get lookTargetLerpActive(){return this._lookTargetLerpActive}stopLookTargetLerp(){this._lookTargetLerpActive=!1}setLookTargetFromConstraint(A=0,t=1){var g;if(!this._controls)return!1;const o=(g=this.lookAtConstraint)==null?void 0:g.sources;if(o&&o.length>0){const I=o[A];if(I)return I.getWorldPosition(this._lookTargetEndPosition),this.lerpLookTarget(this._lookTargetEndPosition,t),!0}return!1}lerpTarget(A,t){return this.lerpLookTarget(A,t)}lerpLookTarget(A,t){this._controls&&(t>=1?this._controls.target.copy(A):this._controls.target.lerp(A,t))}setTargetFromRaycast(A){if(!this.controls)return;const t=A?this.context.physics.raycastFromRay(A):this.context.physics.raycast();for(const g of t)if(g.distance>0&&gA.isActiveInHierarchy(g.object)){const o=wx(g.object);if(o){const I=o.canvas;if(I!=null&&I.screenspace)break}this.setLookTargetPosition(g.point);break}}fitCamera(A,t){var g,o;if(this.context.isInXR)return;let I;if(Array.isArray(A)?I=A:A&&"type"in A?I=A.children:A&&"objects"in A&&(I=A?.objects,t=A),I&&!Array.isArray(I)&&(I=I.children),(!Array.isArray(I)||I&&I.length<=0)&&(I=this.context.scene.children),!Array.isArray(I)||I.length<=0){console.warn("No objects to fit camera to...");return}const s=this._cameraObject,n=this._controls;if(!s||!n){console.warn("No camera or controls found to fit camera to objects...");return}t||(t={});const{immediate:a=!1,centerCamera:r="y",cameraNearFar:C="auto",fitOffset:B=1.1,fov:l=s?.fov}=t,h=new f,c=new f,d=ss(I,void 0,(o=(g=this._camera)==null?void 0:g.threeCamera)==null?void 0:o.layers),E=d.clone();s.updateMatrixWorld(),s.updateProjectionMatrix(),d.getCenter(c);const u=new f;if(d.getSize(u),d.applyMatrix4(s.matrixWorldInverse),d.getSize(h),d.setFromCenterAndSize(c,h),Number.isNaN(h.x)||Number.isNaN(h.y)||Number.isNaN(h.z)){console.warn("Camera fit size resultet in NaN",s,d,[...I]);return}if(h.length()<=1e-10){jG&&console.warn("Camera fit size is zero",d,[...I]);return}const p=t.fov||s.fov,D=2*Math.atan(Math.tan(p*Math.PI/360/2)*s.aspect)/Math.PI*360,y=h.y/(2*Math.atan(Math.PI*p/360)),m=h.x/(2*Math.atan(Math.PI*D/360)),w=B*Math.max(y,m)+h.z/2;jG&&console.log("Fit camera to objects",{fitHeightDistance:y,fitWidthDistance:m,distance:w,verticalFov:p,horizontalFov:D}),this.maxZoom=w*10,this.minZoom=w*.01;const S=.05,M=c.clone();if(M.y-=h.y*S,this.setLookTargetPosition(M,a),this.setFieldOfView(t.fov,a),this.autoTarget=!1,C==null||C=="auto"){const x=gA.findObjectOfType(qa),v=x?x.radius:0,O=Math.max(u.x,u.y,u.z,v);s.near=w/100,s.far=O+w*10,x&&(this.maxZoom=Math.max(Math.min(this.maxZoom,v*.5),w))}const N=n.getDistance();N<this.minZoom&&(this.minZoom=N*.9),N>this.maxZoom&&(this.maxZoom=N*1.1),s.updateMatrixWorld(),s.updateProjectionMatrix();const k=Le(s),b=c.clone();b.sub(k),r==="y"&&(b.y=0),b.normalize(),b.multiplyScalar(w),r==="y"&&(b.y+=-S*4*w);let F=c.clone().sub(b);if(s.parent&&(F=s.parent.worldToLocal(F)),this.setCameraTargetPosition(F,a),jG){const x=new wN(d);this.context.scene.add(x),fF(x,Mp(s)),setTimeout(()=>{this.context.scene.remove(x)},1e4),ce.DrawWireBox3(E,65280,10),this._haveAttachedKeyboardEvents||(this._haveAttachedKeyboardEvents=!0,document.body.addEventListener("keydown",v=>{if(v.code==="KeyF"){let O;this._cameraObject instanceof be&&(O=Math.random()*Math.random()*170+10),this.fitCamera({objects:I,fitOffset:B,immediate:!1,fov:O})}v.code==="KeyV"&&this._cameraObject instanceof be&&(this._cameraObject.fov=60)}))}n.update()}}Gi([G()],Nt.prototype,"autoTarget",2),Gi([G()],Nt.prototype,"autoFit",2),Gi([G()],Nt.prototype,"enableRotate",2),Gi([G()],Nt.prototype,"autoRotate",2),Gi([G()],Nt.prototype,"autoRotateSpeed",2),Gi([G()],Nt.prototype,"minAzimuthAngle",2),Gi([G()],Nt.prototype,"maxAzimuthAngle",2),Gi([G()],Nt.prototype,"minPolarAngle",2),Gi([G()],Nt.prototype,"maxPolarAngle",2),Gi([G()],Nt.prototype,"enableKeys",2),Gi([G()],Nt.prototype,"enableDamping",2),Gi([G()],Nt.prototype,"dampingFactor",2),Gi([G()],Nt.prototype,"enableZoom",2),Gi([G()],Nt.prototype,"minZoom",2),Gi([G()],Nt.prototype,"maxZoom",2),Gi([G()],Nt.prototype,"zoomSpeed",2),Gi([G()],Nt.prototype,"enablePan",2),Gi([G(sh)],Nt.prototype,"lookAtConstraint",2),Gi([G()],Nt.prototype,"lookAtConstraint01",2),Gi([G()],Nt.prototype,"allowInterrupt",2),Gi([G()],Nt.prototype,"middleClickToFocus",2),Gi([G()],Nt.prototype,"doubleClickToFocus",2),Gi([G()],Nt.prototype,"clickBackgroundToFitScene",2),Gi([G()],Nt.prototype,"targetLerpDuration",2);var MuA=Object.defineProperty,RuA=Object.getOwnPropertyDescriptor,wI=(i,A,t,g)=>{for(var o=g>1?void 0:g?RuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&MuA(A,t,o),o},AQ=(i=>(i[i.None=0]="None",i[i.Skybox=1]="Skybox",i[i.SolidColor=2]="SolidColor",i[i.Uninitialized=4]="Uninitialized",i))(AQ||{});const eQ=iA("debugcam"),oV=iA("debugscreenpointtoray");var $G;const B0=($G=class extends vA{constructor(){super(...arguments),Q(this,"_nearClipPlane",.1),Q(this,"_farClipPlane",1e3),Q(this,"orthographic",!1),Q(this,"orthographicSize",5),Q(this,"ARBackgroundAlpha",0),Q(this,"_cullingMask",4294967295),Q(this,"_backgroundBlurriness"),Q(this,"_backgroundIntensity"),Q(this,"_backgroundRotation"),Q(this,"_environmentIntensity"),Q(this,"_targetTexture",null),Q(this,"_backgroundColor"),Q(this,"_fov"),Q(this,"_cam",null),Q(this,"_clearFlags",2),Q(this,"_skybox"),Q(this,"_frustum"),Q(this,"_projScreenMatrix",new lA)}get isCamera(){return!0}get aspect(){return this._cam instanceof be?this._cam.aspect:this.context.domWidth/this.context.domHeight}set aspect(i){this._cam instanceof be&&this._cam.aspect!==i&&(this._cam.aspect=i,this._cam.updateProjectionMatrix())}get fieldOfView(){return this._cam instanceof be?this._cam.fov:this._fov}set fieldOfView(i){const A=this.fieldOfView!=i;if(this._fov=i,A&&this._cam&&this._cam instanceof be){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(i){const A=this._nearClipPlane!=i;this._nearClipPlane=i,this._cam&&(A||this._cam.near!=i)&&(this._cam.near=i,this._cam.updateProjectionMatrix())}applyClippingPlane(){this._cam&&(this._cam.near=this._nearClipPlane,this._cam.far=this._farClipPlane,this._cam.updateProjectionMatrix())}get farClipPlane(){return this._farClipPlane}set farClipPlane(i){const A=this._farClipPlane!=i;this._farClipPlane=i,this._cam&&(A||this._cam.far!=i)&&(this._cam.far=i,this._cam.updateProjectionMatrix())}get clearFlags(){return this._clearFlags}set clearFlags(i){i!==this._clearFlags&&(this._clearFlags=i,this.applyClearFlagsIfIsActiveCamera())}set cullingMask(i){this._cullingMask=i,this._cam&&(this._cam.layers.mask=i)}get cullingMask(){return this._cam?this._cam.layers.mask:this._cullingMask}set cullingLayer(i){this.cullingMask=(1<<i|0)>>>0}set backgroundBlurriness(i){i!==this._backgroundBlurriness&&(i===void 0?this._backgroundBlurriness=void 0:this._backgroundBlurriness=Math.min(Math.max(i,0),1),this.applyClearFlagsIfIsActiveCamera())}get backgroundBlurriness(){return this._backgroundBlurriness}set backgroundIntensity(i){i!==this._backgroundIntensity&&(i===void 0?this._backgroundIntensity=void 0:this._backgroundIntensity=Math.min(Math.max(i,0),10),this.applyClearFlagsIfIsActiveCamera())}get backgroundIntensity(){return this._backgroundIntensity}set backgroundRotation(i){i!==this._backgroundRotation&&(i===void 0?this._backgroundRotation=void 0:this._backgroundRotation=i,this.applyClearFlagsIfIsActiveCamera())}get backgroundRotation(){return this._backgroundRotation}set environmentIntensity(i){this._environmentIntensity=i}get environmentIntensity(){return this._environmentIntensity}get backgroundColor(){return this._backgroundColor??null}set backgroundColor(i){if(i){if(this._backgroundColor)this._backgroundColor.copy(i);else{if(!i.clone)return;this._backgroundColor=i.clone()}i.alpha===void 0&&(this._backgroundColor.alpha=1),this.applyClearFlagsIfIsActiveCamera()}}set targetTexture(i){this._targetTexture=i}get targetTexture(){return this._targetTexture}get cam(){return this.threeCamera}get threeCamera(){return this.activeAndEnabled&&this.buildCamera(),this._cam}screenPointToRay(i,A,t){const g=this.threeCamera,o=B0._origin;o.set(i,A,-1),this.context.input.convertScreenspaceToRaycastSpace(o),oV&&console.log("screenPointToRay",i.toFixed(2),A.toFixed(2),"now:",o.x.toFixed(2),o.y.toFixed(2),"isInXR:"+this.context.isInXR),o.z=-1,o.unproject(g);const I=B0._direction.set(o.x,o.y,o.z),s=Le(g);return I.sub(s),I.normalize(),t?(t.set(s,I),t):new nI(s.clone(),I.clone())}getFrustum(){return this._frustum||(this._frustum=new gl,this.updateFrustum()),this._frustum}updateFrustum(){this._frustum||(this._frustum=new gl),this._frustum.setFromProjectionMatrix(this.getProjectionScreenMatrix(this._projScreenMatrix,!0),this.context.renderer.coordinateSystem)}getProjectionScreenMatrix(i,A){return A&&this._projScreenMatrix.multiplyMatrices(this.threeCamera.projectionMatrix,this.threeCamera.matrixWorldInverse),i===this._projScreenMatrix?i:i.copy(this._projScreenMatrix)}awake(){oV&&window.addEventListener("pointerdown",i=>{const A=i.clientX,t=i.clientY;console.log("touch",A.toFixed(2),t.toFixed(2));const g=this.screenPointToRay(A,t),o="#"+Math.floor(Math.random()*16777215).toString(16);ce.DrawRay(g.origin,g.direction,o,10)})}onEnable(){eQ&&console.log(`Camera enabled: "${this.name}". ClearFlags=${AQ[this._clearFlags]}`,this),this.buildCamera(),(this.tag=="MainCamera"||!this.context.mainCameraComponent)&&(this.context.setCurrentCamera(this),buA(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 i=this.context.renderer;if(i){const A=this.context.mainCameraComponent;this.applyClearFlags(),this._targetTexture.render(this.context.scene,this._cam,i),A?.applyClearFlags()}}}buildCamera(){if(this._cam)return;const i=this.gameObject.isCamera;let A=null;if(i?(A=this.gameObject,A?.layers.enableAll(),A instanceof be&&(this._fov=A.fov)):A=this.gameObject.children[0],A&&A.isCamera)A instanceof be&&(this._fov&&(A.fov=this._fov),A.near=this._nearClipPlane,A.far=this._farClipPlane,A.updateProjectionMatrix());else if(!this.orthographic)A=new be(this.fieldOfView,window.innerWidth/window.innerHeight,this._nearClipPlane,this._farClipPlane),this.fieldOfView&&(A.fov=this.fieldOfView),this.gameObject.add(A);else{const t=this.orthographicSize*100;A=new Da(window.innerWidth/-t,window.innerWidth/t,window.innerHeight/t,window.innerHeight/-t,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(i){this.context.mainCameraComponent===this&&this.applyClearFlags(i)}applyClearFlags(i){var A;if(!this._cam){eQ&&console.log("Camera does not exist (apply clear flags)");return}if(this.fieldOfView=this._fov,eQ){const t=`Camera "${this.name}" clear flags: ${AQ[this._clearFlags]}`;console.debug(t)}switch(this._clearFlags){case 0:return;case 1:if(B0.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||i?.applySkybox===!0)&&this.applySceneSkybox(),this._backgroundBlurriness!==void 0?this.context.scene.backgroundBlurriness=this._backgroundBlurriness:eQ&&console.warn(`Camera "${this.name}" has no background blurriness`),this._backgroundIntensity!==void 0&&(this.context.scene.backgroundIntensity=this._backgroundIntensity),this._backgroundRotation!==void 0?this.context.scene.backgroundRotation=this._backgroundRotation:eQ&&console.warn(`Camera "${this.name}" has no background intensity`);break;case 2:if(this._backgroundColor){let t=this._backgroundColor.alpha;B0.backgroundShouldBeTransparent(this.context)&&(t=this.ARBackgroundAlpha??0),this.context.scene.background=null,(A=this.context.xr)!=null&&A.isVR?this.context.renderer.setClearColor(uO(this._backgroundColor).convertLinearToSRGB()):this.context.renderer.setClearColor(this._backgroundColor,t)}else eQ&&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 UuA(this)),this._skybox.apply()}static backgroundShouldBeTransparent(i){var A,t,g,o;const I=(A=i.renderer.xr)==null?void 0:A.getSession();if(!I)return!1;if(typeof I._transparent=="boolean")return I._transparent;const s=I.environmentBlendMode;eQ&&mi("Environment blend mode: "+s+" on "+navigator.userAgent);let n=s==="additive"||s==="alpha-blend";return i.isInAR&&s==="opaque"&&((t=navigator.userAgent)!=null&&t.includes("OculusBrowser")||(g=navigator.userAgent)!=null&&g.includes("Mozilla")&&(o=navigator.userAgent)!=null&&o.includes("Mobile WebXRViewer/v2"))&&(n=!0),I._transparent=n,n}},Q($G,"_origin",new f),Q($G,"_direction",new f),$G);let Ot=B0;wI([G()],Ot.prototype,"aspect",1),wI([G()],Ot.prototype,"fieldOfView",1),wI([G()],Ot.prototype,"nearClipPlane",1),wI([G()],Ot.prototype,"farClipPlane",1),wI([G()],Ot.prototype,"clearFlags",1),wI([G()],Ot.prototype,"orthographic",2),wI([G()],Ot.prototype,"orthographicSize",2),wI([G()],Ot.prototype,"ARBackgroundAlpha",2),wI([G()],Ot.prototype,"cullingMask",1),wI([G()],Ot.prototype,"backgroundBlurriness",1),wI([G()],Ot.prototype,"backgroundIntensity",1),wI([G(st)],Ot.prototype,"backgroundRotation",1),wI([G()],Ot.prototype,"environmentIntensity",1),wI([G(vt)],Ot.prototype,"backgroundColor",1),wI([G(Ad)],Ot.prototype,"targetTexture",1);class UuA{constructor(A){Q(this,"_camera"),Q(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&&(eQ&&console.log(`Camera "${this._camera.name}" set skybox`,this._camera,this._skybox),this._skybox.mapping=II,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}" has no skybox texture. ${this._camera.sourceId}`))}}function buA(i){iA("freecam")&&i.context.mainCameraComponent===i&&gA.getOrAddComponent(i.gameObject,Nt)}class tQ extends vA{constructor(){super(...arguments),Q(this,"_listener",null),Q(this,"onInteraction",()=>{this.destroyed||this.listener==null||this.addListenerIfItExists()})}get listener(){return this._listener==null&&(this._listener=new R1),this._listener}onEnable(){gC.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){gC.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}addListenerIfItExists(){const A=this._listener;if(!A||A!=null&&A.parent)return;const t=this.context.mainCameraComponent||gA.getComponentInParent(this.gameObject,Ot);t!=null&&t.threeCamera?t.threeCamera.add(A):this.gameObject.add(A),A.filter?(A.gain.connect(A.filter),A.filter.connect(A.context.destination)):A.gain.connect(A.context.destination)}removeListenerIfItExists(){const A=this._listener;A&&(A.removeFromParent(),A.filter&&A.filter.disconnect(),A.gain&&A.gain.disconnect())}}var NuA=Object.defineProperty,FuA=Object.getOwnPropertyDescriptor,Aa=(i,A,t,g)=>{for(var o=g>1?void 0:g?FuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&NuA(A,t,o),o};const $o=iA("debugaudio"),iQ=class extends vA{constructor(){super(...arguments),Q(this,"clip",""),Q(this,"playOnAwake",!1),Q(this,"preload",!1),Q(this,"playInBackground",!0),Q(this,"_spatialBlend",0),Q(this,"_minDistance",1),Q(this,"_maxDistance",100),Q(this,"_volume",1),Q(this,"rollOffMode",0),Q(this,"_loop",!1),Q(this,"sound",null),Q(this,"helper",null),Q(this,"wasPlaying",!1),Q(this,"audioLoader",null),Q(this,"shouldPlay",!1),Q(this,"_lastClipStartedLoading",null),Q(this,"_audioElement",null),Q(this,"onVisibilityChanged",()=>{switch(document.visibilityState){case"hidden":(this.playInBackground===!1||De.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case"visible":$o&&console.log("visible",this.enabled,this.playOnAwake,!this.isPlaying,iQ.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&iQ.userInteractionRegistered&&this.wasPlaying&&this.play();break}}),Q(this,"onApplicationMuteChanged",()=>{var i,A;this.context.application.muted?(i=this.sound)==null||i.setVolume(0):(A=this.sound)==null||A.setVolume(this.volume)}),Q(this,"createAudio",i=>{$o&&console.log("AudioBuffer finished loading",i);const A=this.Sound;if(!A){$o&&console.warn("Failed getting sound?",this.name);return}A.isPlaying&&A.stop(),i&&A.setBuffer(i),A.loop=this._loop,this.context.application.muted?A.setVolume(0):A.setVolume(this.volume),A.autoplay=this.shouldPlay&&iQ.userInteractionRegistered,this.applySpatialDistanceSettings(),A.isPlaying&&A.stop(),iQ.registerWaitForAllowAudio(this.__onAllowAudioCallback)}),Q(this,"__onAllowAudioCallback",()=>{this.shouldPlay&&this.play()}),Q(this,"_lastContextTime",0),Q(this,"_hasEnded",!0),Q(this,"_needUpdateSpatialDistanceSettings",!1)}static get userInteractionRegistered(){return gC.userInteractionRegistered}static registerWaitForAllowAudio(i){gC.registerWaitForInteraction(i)}get isPlaying(){var i;return((i=this.sound)==null?void 0:i.isPlaying)??!1}get duration(){var i,A;return(A=(i=this.sound)==null?void 0:i.buffer)==null?void 0:A.duration}get time01(){var i;const A=this.duration;return A&&this.sound?((i=this.sound)==null?void 0:i.context.currentTime)/A:0}set time01(i){const A=this.duration;A&&this.sound&&(this.time=i*A)}get time(){var i,A;return(i=this.sound)!=null&&i.source?((A=this.sound.source)==null?void 0:A.context.currentTime)-this._lastContextTime+this.sound.offset:0}set time(i){if(this.sound){if(i===this.sound.offset)return;const A=this.isPlaying;this.stop(),this.sound.offset=i,A&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(i){this._loop=i,this.sound&&this.sound.setLoop(i)}get spatialBlend(){return this._spatialBlend}set spatialBlend(i){i!==this._spatialBlend&&(this._spatialBlend=i,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(i){this._minDistance!==i&&(this._minDistance=i,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(i){this._maxDistance!==i&&(this._maxDistance=i,this._needUpdateSpatialDistanceSettings=!0)}get volume(){return this._volume}set volume(i){this._volume=i,this.sound&&!this.context.application.muted&&($o&&console.log(this.name,"audio set volume",i),this.sound.setVolume(i))}set pitch(i){this.sound&&this.sound.setPlaybackRate(i)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}get Sound(){var i;if(!this.sound&&iQ.userInteractionRegistered){let A=gA.getComponent(this.context.mainCamera,tQ)??gA.findObjectOfType(tQ,this.context);!A&&this.context.mainCamera&&(A=gA.addComponent(this.context.mainCamera,tQ)),A!=null&&A.listener?(this.sound=new b1(A.listener),(i=this.gameObject)==null||i.add(this.sound)):$o&&console.warn("No audio listener found in scene - can not play audio")}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){var i;return(i=this.sound)==null?void 0:i.context}awake(){$o&&console.log(this),this.audioLoader=new _w,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip=="string"&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),iQ.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():iQ.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.addEventListener(rG.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener("visibilitychange",this.onVisibilityChanged),this.context.application.removeEventListener(rG.MuteChanged,this.onApplicationMuteChanged),this.pause()}applySpatialDistanceSettings(){const i=this.sound;if(!i)return;this._needUpdateSpatialDistanceSettings=!1;const A=te.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch($o&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,"Ref distance="+A),i.setRefDistance(A),i.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case 0:i.setDistanceModel("exponential");break;case 1:i.setDistanceModel("linear");break;case 2:console.warn("Custom rolloff for AudioSource is not supported: "+this.name);break}this.spatialBlend>0?$o&&!this.helper&&(this.helper=new OdA(i,i.getRefDistance()),i.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(i){if(i&&(this.clip=i),typeof i=="string")if($o&&console.log(i),i.endsWith(".mp3")||i.endsWith(".wav")){if(this.audioLoader||(this.audioLoader=new _w),this.shouldPlay=!0,this._lastClipStartedLoading===i){$o&&console.log("Is currently loading:",this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=i,$o&&console.log("load audio",i);const A=await this.audioLoader.loadAsync(i).catch(console.error);this._lastClipStartedLoading=null,A&&this.createAudio(A)}else console.warn("Unsupported audio clip type",i);else this.shouldPlay=!0,this.createAudio()}play(i=void 0){var A,t,g;!i&&this.clip&&(i=this.clip),i!==void 0&&typeof i!="string"&&!(i instanceof MediaStream)&&(WA()&&console.warn("Called play on AudioSource with unknown argument type:",i+`
|
|
5957
5957
|
Using the assigned clip instead:`,this.clip),i=this.clip);let o=!this.sound||i&&i!==this.clip;if(typeof i=="string"&&!this.audioLoader&&(o=!0),(i instanceof MediaStream||typeof i=="string")&&(this.clip=i),o){this.shouldPlay=!0,this.onNewClip(i);return}if(this.shouldPlay=!0,this._hasEnded=!1,$o&&console.log("play",(A=this.sound)==null?void 0:A.getVolume(),this.sound),this.sound&&!this.sound.isPlaying){const I=this.context.application.muted;I&&this.sound.setVolume(0),(t=this.gameObject)==null||t.add(this.sound),this.clip instanceof MediaStream?(this.sound.setMediaStreamSource(this.clip),this._audioElement||(this._audioElement=document.createElement("audio"),this._audioElement.style.display="none"),this._audioElement.parentNode||(g=this.context.domElement.shadowRoot)==null||g.append(this._audioElement),this._audioElement.srcObject=this.clip,this._audioElement.autoplay=!1):(this._audioElement&&this._audioElement.remove(),this.sound.play(I?.1:0))}}pause(){var i,A;$o&&console.log("Pause",this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.isPlaying&&this.sound.source&&(this._lastContextTime=(i=this.sound)==null?void 0:i.context.currentTime,this.sound.pause()),(A=this._audioElement)==null||A.remove()}stop(){var i,A;$o&&console.log("Pause",this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.source&&(this._lastContextTime=(i=this.sound)==null?void 0:i.context.currentTime,$o&&console.log(this._lastContextTime),this.sound.stop()),(A=this._audioElement)==null||A.remove()}update(){this.helper&&(this.isPlaying&&this.helper.update(),this.helper.visible=this.isPlaying),this._needUpdateSpatialDistanceSettings&&this.applySpatialDistanceSettings(),this.sound&&!this.sound.isPlaying&&this.shouldPlay&&!this._hasEnded&&(this._hasEnded=!0,$o&&console.log("Audio clip ended",this.clip),this.dispatchEvent(new CustomEvent("ended",{detail:this})))}};let bi=iQ;Aa([G(URL)],bi.prototype,"clip",2),Aa([G()],bi.prototype,"playOnAwake",2),Aa([G()],bi.prototype,"preload",2),Aa([G()],bi.prototype,"playInBackground",2),Aa([G()],bi.prototype,"loop",1),Aa([G()],bi.prototype,"spatialBlend",1),Aa([G()],bi.prototype,"minDistance",1),Aa([G()],bi.prototype,"maxDistance",1),Aa([G()],bi.prototype,"volume",1),Aa([G()],bi.prototype,"pitch",1),Aa([G()],bi.prototype,"rollOffMode",2);var KuA=Object.defineProperty,vuA=Object.getOwnPropertyDescriptor,Ak=(i,A,t,g)=>{for(var o=g>1?void 0:g?vuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&KuA(A,t,o),o};const JuA=iA("debugsignals");class Q0{constructor(){Q(this,"guid")}}Ak([G()],Q0.prototype,"guid",2);class gd{constructor(){Q(this,"signal"),Q(this,"reaction")}}Ak([G(Q0)],gd.prototype,"signal",2),Ak([G($t)],gd.prototype,"reaction",2);var Mx;const CC=(Mx=class extends vA{constructor(){super(...arguments),Q(this,"events")}static invoke(i){if(CC.receivers[i]){const A=CC.receivers[i];if(!A)return;for(const t of A)t.invoke(i)}}awake(){JuA&&console.log("SignalReceiver awake",this)}onEnable(){if(this.events)for(const i of this.events)CC.receivers[i.signal.guid]||(CC.receivers[i.signal.guid]=[]),CC.receivers[i.signal.guid].push(this)}onDisable(){if(this.events){for(const i of this.events)if(CC.receivers[i.signal.guid]){const A=CC.receivers[i.signal.guid].indexOf(this);A>=0&&CC.receivers[i.signal.guid].splice(A,1)}}}invoke(i){if(!this.events||!Array.isArray(this.events))return;const A=typeof i=="object"?i.guid:i;for(const t of this.events)if(t.signal.guid===A)try{if(t.reaction){if(!t.reaction.invoke){console.warn("Missing invoke - possibly a serialization error",t,this);continue}}else{console.warn("Missing reaction for signal",t,this);continue}t.reaction.invoke()}catch(g){console.error(g)}}},Q(Mx,"receivers",{}),Mx);let od=CC;Ak([G(gd)],od.prototype,"events",2);var ps=(i=>(i.Activation="ActivationTrack",i.Animation="AnimationTrack",i.Audio="AudioTrack",i.Control="ControlTrack",i.Marker="MarkerTrack",i.Signal="SignalTrack",i))(ps||{}),_a=(i=>(i[i.None=0]="None",i[i.Hold=1]="Hold",i[i.Loop=2]="Loop",i[i.PingPong=3]="PingPong",i[i.Continue=4]="Continue",i))(_a||{}),Rx=(i=>(i.Signal="SignalEmitter",i))(Rx||{}),xuA=Object.defineProperty,LuA=Object.getOwnPropertyDescriptor,IV=(i,A,t,g)=>{for(var o=g>1?void 0:g?LuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&xuA(A,t,o),o};const BC=iA("debugtimeline");var Ux;const bx=(Ux=class extends vA{constructor(){super(...arguments),Q(this,"playableAsset"),Q(this,"playOnAwake"),Q(this,"extrapolationMode",1),Q(this,"waitForAudio",!0),Q(this,"_visibilityChangeEvt"),Q(this,"_clonedPlayableAsset",!1),Q(this,"_speed",1),Q(this,"_guidsMap"),Q(this,"_isPlaying",!1),Q(this,"_internalUpdateRoutine"),Q(this,"_isPaused",!1),Q(this,"_isStopping",!1),Q(this,"_time",0),Q(this,"_duration",0),Q(this,"_weight",1),Q(this,"_animationTracks",[]),Q(this,"_audioTracks",[]),Q(this,"_signalTracks",[]),Q(this,"_controlTracks",[]),Q(this,"_customTracks",[]),Q(this,"_allTracks",[this._animationTracks,this._audioTracks,this._signalTracks,this._controlTracks,this._customTracks]),Q(this,"animationCallbackReceivers",[])}static registerCreateTrack(i,A){this.createTrackFunctions[i]=A}get isPlaying(){return this._isPlaying}get isPaused(){return this._isPaused}get time(){return this._time}set time(i){typeof i=="number"&&!Number.isNaN(i)?this._time=i:(BC||BI())&&console.error("INVALID TIMELINE.TIME VALUE",i,this.name)}get duration(){return this._duration}set duration(i){this._duration=i}get weight(){return this._weight}set weight(i){this._weight=i}get speed(){return this._speed}set speed(i){this._speed=i}awake(){var i,A,t,g,o;BC&&console.log(this,(i=this.playableAsset)==null?void 0:i.tracks),this.rebuildGraph(),!this.isValid()&&(BC||WA())&&(BC?console.warn("PlayableDirector is not valid","Asset?",this.playableAsset,"Tracks:",(A=this.playableAsset)==null?void 0:A.tracks,"IsArray?",Array.isArray((t=this.playableAsset)==null?void 0:t.tracks),this):(o=(g=this.playableAsset)==null?void 0:g.tracks)!=null&&o.length?console.warn("PlayableDirector is not valid"):console.warn("PlayableDirector has no tracks"))}onEnable(){var i,A,t;for(const g of this._audioTracks)(i=g.onEnable)==null||i.call(g);for(const g of this._customTracks)(A=g.onEnable)==null||A.call(g);for(const g of this._animationTracks)(t=g.onEnable)==null||t.call(g);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 i,A,t;this.stop();for(const g of this._audioTracks)(i=g.onDisable)==null||i.call(g);for(const g of this._customTracks)(A=g.onDisable)==null||A.call(g);for(const g of this._animationTracks)(t=g.onDisable)==null||t.call(g);this._visibilityChangeEvt&&window.removeEventListener("visibilitychange",this._visibilityChangeEvt)}onDestroy(){var i;for(const A of this._allTracks)for(const t of A)(i=t.onDestroy)==null||i.call(t)}rebuildGraph(){this.isValid()&&(this.resolveBindings(),this.updateTimelineDuration(),this.setupAndCreateTrackHandlers())}async play(){if(!this.isValid())return;const i=this._isPaused==!0;if(this._isPaused=!1,!this._isPlaying){if(this._isPlaying=!0,i&&this.invokePauseChangedMethodsOnTracks(),this.waitForAudio){const A=[];for(const t of this._audioTracks){const g=t.loadAudio(this._time,1,0);g&&A.push(g)}if(A.length>0&&(await Promise.all(A),!this._isPlaying))return;for(;this._audioTracks.length>0&&this._isPlaying&&!bi.userInteractionRegistered&&this.waitForAudio;)await Un(200)}this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine=this.startCoroutine(this.internalUpdate(),gi.LateUpdate)}}pause(){this.isValid()&&(this._isPlaying=!1,!this._isPaused&&(this._isPaused=!0,this.internalEvaluate(),this.invokePauseChangedMethodsOnTracks(),this.invokeStateChangedMethodsOnTracks()))}stop(){this._isStopping=!0;for(const t of this._audioTracks)t.stop();const i=this._isPaused==!0,A=this._isPlaying;this._isPlaying&&(this._time=0,this._isPlaying=!1,this._isPaused=!1,this.internalEvaluate(),i&&this.invokePauseChangedMethodsOnTracks()),this._isPlaying=!1,this._isPaused=!1,i&&!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 i of this._allTracks)for(const A of i)yield A}get animationTracks(){return this._animationTracks}get audioTracks(){return this._audioTracks}resolveGuids(i){this._guidsMap=i}invokePauseChangedMethodsOnTracks(){var i;for(const A of this.forEachTrack())(i=A.onPauseChanged)==null||i.call(A)}invokeStateChangedMethodsOnTracks(){var i;for(const A of this.forEachTrack())(i=A.onStateChanged)==null||i.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(i=!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 t=this._time;for(const g of this.playableAsset.tracks)if(!g.muted)switch(g.type){case ps.Activation:if(!i&&!this._isPlaying)continue;for(let o=0;o<g.outputs.length;o++){const I=g.outputs[o];if(typeof I=="object"){let s=!1;if(g.clips)for(const a of g.clips)a.start<=t&&t<=a.end&&(s=!0);const n=I;n.visible!==void 0&&n.visible!==s&&(n.visible=s,BC&&console.warn(this.name,"set ActivationTrack-"+o,n.name,s,t))}}break}if(!this._isStopping)for(const g of this._animationTracks)g.evaluate(t);for(const g of this._audioTracks)g.evaluate(t);for(const g of this._signalTracks)g.evaluate(t);for(const g of this._controlTracks)g.evaluate(t);for(const g of this._customTracks)g.evaluate(t)}resolveBindings(){if(this._clonedPlayableAsset||(this._clonedPlayableAsset=!0,this.playableAsset=yp(this.playableAsset)),!this.playableAsset||!this.playableAsset.tracks)return;const i=this.findRoot(this.gameObject);for(const A of this.playableAsset.tracks){for(let t=A.outputs.length-1;t>=0;t--){let g=A.outputs[t];if(typeof g=="string"){this._guidsMap&&this._guidsMap[g]&&(g=this._guidsMap[g]);const o=gA.findByGuid(g,i);o===null||typeof o!="object"?(A.outputs.splice(t,1),console.warn("Failed to resolve binding",g,A.name,A.type)):(BC&&console.log("Resolved binding",g,"to",o),A.outputs[t]=o)}else if(g===null){if(A.outputs.splice(t,1),bx.createTrackFunctions[A.type])continue;A.type!==ps.Audio&&A.type!==ps.Control&&A.type!==ps.Marker&&A.type!==ps.Signal&&console.warn("Missing binding",g,A.name,A.type,this.name,this.playableAsset.name)}}if(A.type===ps.Control&&A.clips)for(let t=0;t<A.clips.length;t++){const g=A.clips[t];let o=g.asset.sourceObject;if(typeof o=="string"){this._guidsMap&&this._guidsMap[o]&&(o=this._guidsMap[o]);const I=gA.findByGuid(o,i);I===null||typeof I!="object"?console.warn("Failed to resolve sourceObject binding",o,A.name,g):(BC&&console.log("Resolved binding",o,"to",I),g.asset.sourceObject=I)}}}}findRoot(i){return i.parent?this.findRoot(i.parent):i}updateTimelineDuration(){if(this._duration=0,!(!this.playableAsset||!this.playableAsset.tracks)){for(const i of this.playableAsset.tracks)if(i.muted!==!0){if(i.clips)for(const A of i.clips)A.end>this._duration&&(this._duration=A.end);if(i.markers)for(const A of i.markers)A.time>this._duration&&(this._duration=A.time+.001)}}}setupAndCreateTrackHandlers(){var i,A,t;if(this._animationTracks.length=0,this._audioTracks.length=0,this._signalTracks.length=0,!this.playableAsset)return;let g=gA.findObjectOfType(tQ,this.context);for(const o of this.playableAsset.tracks){const I=o.type,s=bx.createTrackFunctions[I];if(s!=null){const n=s(this,o);if(typeof n.evaluate=="function"){n.director=this,n.track=o,this._customTracks.push(n);continue}}if(o.type===ps.Animation){if(!o.clips||o.clips.length<=0){BC&&console.warn("Animation track has no clips",o);continue}for(let n=o.outputs.length-1;n>=0;n--){let a=o.outputs[n];if(a instanceof pA){const C=gA.getOrAddComponent(a,Eo);C&&(a=C)}const r=(i=a?.gameObject)==null?void 0:i.animations;if(r){const C=new ek;C.trackOffset=o.trackOffset,C.director=this,C.track=o;for(let B=0;B<o.clips.length;B++){const l=o.clips[B],h=l.asset;if(!h){console.error(`Timeline ${this.name}: clip #${B} on track "${o.name}" has no animation data`);continue}const c=h.clip;let d=c;if((typeof d=="string"||typeof d=="number")&&(d=r.find(u=>u.name===c)),BC&&console.log(h,c,"\u2192",d),!d){console.warn("Could not find animationClip for model",l,o.name,this.name,(A=this.playableAsset)==null?void 0:A.name,r,a);continue}a instanceof Eo&&a.runtimeAnimatorController&&(a.__internalDidAwakeAndStart||a.initializeRuntimeAnimatorController(),a.runtimeAnimatorController.mixer||a.runtimeAnimatorController.bind(a),C.mixer=a.runtimeAnimatorController.mixer),C.mixer||(C.mixer=new Ow(a.gameObject),this.context.animations.registerAnimationMixer(C.mixer)),C.clips.push(d),C.mixer.uncacheAction(d),C.createHooks(l.asset,d);const E=C.mixer.clipAction(d);C.actions.push(E),C.models.push(l)}this._animationTracks.push(C)}}}else if(o.type===ps.Audio){if(!o.clips||o.clips.length<=0)continue;const n=new c0;n.director=this,n.track=o,n.audioSource=o.outputs.find(a=>a instanceof bi),this._audioTracks.push(n),g||(g=(t=this.context.mainCameraComponent)==null?void 0:t.gameObject.addComponent(tQ)),n.listener=g.listener;for(let a=0;a<o.clips.length;a++){const r=o.clips[a];n.addModel(r)}}else if(o.type===ps.Marker){const n=new E0;if(n.director=this,n.track=o,o.markers)for(const a of o.markers)switch(a.type){case Rx.Signal:n.models.push(a),n.didTrigger.push(!1);break}if(n!==null&&n.models.length>0){const a=gA.getComponent(this.gameObject,od);a&&(n.receivers.push(a),this._signalTracks.push(n))}}else if(o.type===ps.Signal){const n=new E0;if(n.director=this,n.track=o,o.markers)for(const a of o.markers)n.models.push(a),n.didTrigger.push(!1);for(const a of o.outputs)n.receivers.push(a);this._signalTracks.push(n)}else if(o.type===ps.Control){const n=new tk;if(n.director=this,n.track=o,o.clips)for(const a of o.clips)n.models.push(a);n.resolveSourceObjects(this.context),this._controlTracks.push(n)}}}setAudioTracksAllowPlaying(i){for(const A of this._audioTracks)A.onAllowAudioChanged(i)}registerAnimationCallback(i){this.animationCallbackReceivers.push(i)}unregisterAnimationCallback(i){const A=this.animationCallbackReceivers.indexOf(i);A!==-1&&this.animationCallbackReceivers.splice(A,1)}},Q(Ux,"createTrackFunctions",{}),Ux);let gQ=bx;IV([G()],gQ.prototype,"playOnAwake",2),IV([G()],gQ.prototype,"extrapolationMode",2);const Oa=iA("debugtimeline");class l0{constructor(){Q(this,"director"),Q(this,"track")}get muted(){return this.track.muted}set muted(A){var t;A!==this.track.muted&&(this.track.muted=A,(t=this.onMuteChanged)==null||t.call(this))}*forEachClip(A=!1){var t;if((t=this.track)!=null&&t.clips)if(A)for(let g=this.track.clips.length-1;g>=0;g--)yield this.track.clips[g];else for(const g of this.track.clips)yield g}getClipTime(A,t){return t.clipIn+(A-t.start)*t.timeScale}getClipTimeNormalized(A,t){return(A-t.start)/t.duration}evaluateWeight(A,t,g,o=!0){if(t<0||t>=g.length)return 0;const I=g[t];if(o||A>=I.start&&A<=I.end){let s=1;const n=!1;if(I.easeInDuration>0){const a=Math.min((A-I.start)/I.easeInDuration,1);s*=a}if(I.easeOutDuration>0&&!n){const a=Math.min((I.end-A)/I.easeOutDuration,1);s*=a}return s}return 0}}class quA{constructor(A){Q(this,"clip"),Q(this,"rootPositionOffset"),Q(this,"rootQuaternionOffset"),Q(this,"rootStartPosition"),Q(this,"rootEndPosition"),Q(this,"rootStartQuaternion"),Q(this,"rootEndQuaternion");const t=A.getClip();this.clip=t;const g=A.getRoot(),o=g.name+".position",I=g.name+".quaternion";Oa&&console.log(t.name,t.tracks,o);for(const s of t.tracks)if(!(s.times.length<=0)){if(s.name.endsWith(o))this.rootStartPosition=new f().fromArray(s.values,0),this.rootEndPosition=new f().fromArray(s.values,s.values.length-3),this.rootPositionOffset=this.rootEndPosition.clone().sub(this.rootStartPosition),Oa&&console.log(this.rootPositionOffset);else if(s.name.endsWith(I)&&(this.rootStartQuaternion=new kA().fromArray(s.values,0),this.rootEndQuaternion=new kA().fromArray(s.values,s.values.length-4),this.rootQuaternionOffset=this.rootEndQuaternion.clone().multiply(this.rootStartQuaternion),Oa)){const n=new st().setFromQuaternion(this.rootQuaternionOffset);console.log("ROT",n)}}}get hasOffsets(){return this.rootPositionOffset!==void 0||this.rootQuaternionOffset!==void 0}}class ek extends l0{constructor(){super(...arguments),Q(this,"models",[]),Q(this,"trackOffset"),Q(this,"target"),Q(this,"mixer"),Q(this,"clips",[]),Q(this,"actions",[]),Q(this,"weight",1),Q(this,"_actionOffsets",[]),Q(this,"_didBind",!1),Q(this,"_animator",null),Q(this,"_useclipOffsets",!0),Q(this,"_totalOffsetPosition",new f),Q(this,"_totalOffsetRotation",new kA),Q(this,"_totalOffsetPosition2",new f),Q(this,"_totalOffsetRotation2",new kA),Q(this,"_summedPos",new f),Q(this,"_tempPos",new f),Q(this,"_summedRot",new kA),Q(this,"_tempRot",new kA),Q(this,"_clipRotQuat",new kA)}onDisable(){var A;(A=this.mixer)==null||A.stopAllAction()}onDestroy(){this.director.context.animations.unregisterAnimationMixer(this.mixer)}onStateChanged(){this._animator&&HX(this._animator.gameObject,this,this.director.isPlaying)}createHooks(A,t){var g,o;if(((g=t.tracks)==null?void 0:g.length)<=0){console.warn("No tracks in AnimationClip",t);return}const I=t.tracks[0].name.split("."),s=I[I.length-2],n=s+".position",a=s+".quaternion";let r=!1,C=!1;for(const B of t.tracks)B.name.endsWith(n)?(r=!0,this.createPositionInterpolant(t,A,B)):B.name.endsWith(a)&&(C=!0,this.createRotationInterpolant(t,A,B));if(!r||!C){const B=(o=this.mixer)==null?void 0:o.getRoot(),l=t.tracks[0],h=l.name.lastIndexOf("."),c=l.name.substring(0,h),d=c.substring(c.lastIndexOf(".")+1),E=B.getObjectByName(d);if(E)if(r){if(!C){const u=t.tracks[0].name.substring(0,h)+".quaternion";Oa&&console.warn("Create quaternion track",d,E);const p=E.quaternion,D=new Mn(u,[0,t.duration],[p.x,p.y,p.z,p.w,p.x,p.y,p.z,p.w]);t.tracks.push(D),this.createRotationInterpolant(t,A,D)}}else{const u=c+".position";Oa&&console.warn("Create position track",d,E);const p=E.position,D=new ya(u,[0,t.duration],[p.x,p.y,p.z,p.x,p.y,p.z]);t.tracks.push(D),this.createPositionInterpolant(t,A,D)}}}bind(){if(!this._didBind){this._didBind=!0,Oa&&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 t=new quA(A);this._actionOffsets.push(t)}this.target&&(this._animator=gA.getComponent(this.target,Eo)??null,this._animator&&HX(this._animator.gameObject,this,!0));for(const A of this.models){const t=A.asset,g=t.position,o=t.rotation;g&&g.x!==void 0&&(g.isVector3||(t.position=new f(g.x,g.y,g.z)),o.isQuaternion||(t.rotation=new kA(o.x,o.y,o.z,o.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 t=this.trackOffset.rotation;t&&(t.isQuaternion||(this.trackOffset.rotation=new kA(t.x,t.y,t.z,t.w)))}}evaluate(A){var t,g,o,I,s,n,a;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 r=0,C=0,B=!1,l=!1,h=0;for(let c=0;c<this.clips.length;c++){const d=this.models[c],E=this.actions[c],u=d.asset;E.weight=0;const p=A>=d.start&&A<=d.end,D=d.preExtrapolationMode,y=d.postExtrapolationMode,m=c<this.clips.length-1?this.models[c+1]:null;let w=p,S=!1;if(!w&&!B&&d.end<A&&y!==_a.None?(!m||m.start>A)&&(w=!0,B=!0):c==0&&!w&&!l&&d.start>A&&D!==_a.None&&(!m||m.start<A)&&(w=!0,S=!0,l=!0),w){let M=this.weight;M*=this.evaluateWeight(A,c,this.models,w),M*=this.director.weight;let N=p;if(S)switch(D){case _a.Hold:break;case _a.Loop:A+=d.start,N=!0;break;default:A+=d.start,N=!0;break}let k=this.getClipTime(A,d),b=0;const F=u.duration;if(S&&D===_a.Hold&&(k=0),N){if(u.loop)for(b+=Math.floor(k/(F+1e-6));k>F;)k-=F}else if(!p&&B)switch(y){case _a.Hold:k=this.getClipTime(d.end,d);break;case _a.Loop:k%=F;break;case _a.PingPong:const v=Math.floor(k/F)%2!==0;k%=F,v&&(k=F-k);break}d.reversed===!0?E.time=E.getClip().duration-k:E.time=k,E.timeScale=0;const x=Math.max(0,M);if(E.weight=x,h+=x,E.clampWhenFinished=!1,E.isRunning()||E.play(),this._useclipOffsets){const v=r==0?this._totalOffsetPosition:this._totalOffsetPosition2,O=r==0?this._totalOffsetRotation:this._totalOffsetRotation2;r<1&&(C=1-M),r+=1;const J=this._summedPos.set(0,0,0),q=this._tempPos.set(0,0,0),Y=this._summedRot.identity(),V=this._tempRot.identity(),AA=u.rotation;AA&&(this._clipRotQuat.identity(),this._clipRotQuat.slerp(AA,M));const rA=this._actionOffsets[c];if(rA.hasOffsets)for(let SA=0;SA<b;SA++)rA.rootPositionOffset?q.copy(rA.rootPositionOffset):q.set(0,0,0),q.applyQuaternion(Y),this._clipRotQuat&&q.applyQuaternion(this._clipRotQuat),rA.rootQuaternionOffset&&(V.copy(rA.rootQuaternionOffset),Y.multiply(V)),J.add(q);this._clipRotQuat&&O.multiply(this._clipRotQuat),O.multiply(Y),u.position&&J.add(u.position),v.add(J)}}}if(this._useclipOffsets&&(this._totalOffsetPosition.lerp(this._totalOffsetPosition2,C),this._totalOffsetRotation.slerp(this._totalOffsetRotation2,C)),this.__mixerError===void 0&&(Oa||WA())&&(g=(t=this._animator)==null?void 0:t.runtimeAnimatorController)!=null&&g.mixer&&this.mixer!==((I=(o=this._animator)==null?void 0:o.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)),(s=this._animator)!=null&&s.runtimeAnimatorController){const c=Math.max(0,1-h);(a=(n=this._animator)==null?void 0:n.runtimeAnimatorController)==null||a.update(c)}else this.mixer.update(A)}createRotationInterpolant(A,t,g){var o;const I=g.createInterpolant.bind(g),s=new kA;this.ensureTrackOffsets();const n=(o=this.trackOffset)==null?void 0:o.rotation;g.createInterpolant=()=>{const a=I(),r=a.evaluate.bind(a);return a.evaluate=C=>{var B;const l=r(C);if(s.set(l[0],l[1],l[2],l[3]),s.premultiply(this._totalOffsetRotation),n&&s.premultiply(n),this.director.animationCallbackReceivers)for(const h of this.director.animationCallbackReceivers)(B=h?.onTimelineRotation)==null||B.call(h,this.director,this.target,C,s);return l[0]=s.x,l[1]=s.y,l[2]=s.z,l[3]=s.w,l},a}}createPositionInterpolant(A,t,g){var o,I;const s=g.createInterpolant.bind(g),n=new f;this.ensureTrackOffsets();const a=(o=this.trackOffset)==null?void 0:o.rotation,r=(I=this.trackOffset)==null?void 0:I.position;let C;g.createInterpolant=()=>{const B=s(),l=B.evaluate.bind(B);return B.evaluate=h=>{var c,d,E;const u=l(h);if(n.set(u[0],u[1],u[2]),t.removeStartOffset&&(C===void 0?(C=null,C=(d=(c=this._actionOffsets.find(p=>p.clip===A))==null?void 0:c.rootStartPosition)==null?void 0:d.clone()):C!=null&&C.isVector3&&n.sub(C)),n.applyQuaternion(this._totalOffsetRotation),n.add(this._totalOffsetPosition),a&&n.applyQuaternion(a),r&&(n.x-=r.x,n.y+=r.y,n.z+=r.z),this.director.animationCallbackReceivers)for(const p of this.director.animationCallbackReceivers)(E=p?.onTimelinePosition)==null||E.call(p,this.director,this.target,h,n);return u[0]=n.x,u[1]=n.y,u[2]=n.z,u},B}}}const TuA=iA("mutetimeline"),h0=class extends l0{constructor(){super(...arguments),Q(this,"models",[]),Q(this,"listener"),Q(this,"audio",[]),Q(this,"audioContextTimeOffset",[]),Q(this,"lastTime",0),Q(this,"audioSource"),Q(this,"_audioLoader",null),Q(this,"_playableDirectorResumed",!1)}getAudioFilePath(i){const A=this.director.sourceId;return BB(A,i)}onAllowAudioChanged(i){for(let A=0;A<this.models.length;A++){const t=this.models[A];this.audio[A].setVolume(i?t.asset.volume:0)}}addModel(i){const A=new dN(this.listener);this.audio.push(A);const t=i;t._didTriggerPlay=!1,this.models.push(t)}onDisable(){for(const i of this.audio)i.isPlaying&&i.stop();for(const i of this.models)i._didTriggerPlay=!1}onDestroy(){for(const i of this.audio)i.source&&i?.disconnect();this.audio.length=0}onMuteChanged(){if(this.muted)for(let i=0;i<this.audio.length;i++){const A=this.audio[i];A!=null&&A.isPlaying&&A.stop()}}stop(){for(let i=0;i<this.audio.length;i++){const A=this.audio[i];A!=null&&A.isPlaying&&A.stop()}for(const i of this.models)i._didTriggerPlay=!1}onPauseChanged(){for(let i=0;i<this.audio.length;i++){const A=this.audio[i];A!=null&&A.isPlaying&&A.stop()}this._playableDirectorResumed=this.director.isPlaying}evaluate(i){if(TuA||this.track.muted||this.director.speed<0)return;const A=this.director.context.application.muted,t=this._playableDirectorResumed;this._playableDirectorResumed=!1;const g=A?.1:0;for(let o=0;o<this.models.length;o++){const I=this.models[o],s=this.audio[o],n=I.asset;if((!s||!s.buffer)&&this.isInTimeRange(I,i-1,i+1)&&this.handleAudioLoading(I,s),bi.userInteractionRegistered!==!1&&!(s===null||!s.buffer))if(s.playbackRate=this.director.context.time.timeScale*this.director.speed,s.loop=n.loop,i>=I.start&&i<=I.end&&i<this.director.duration){if(!s.isPlaying||!this.director.isPlaying)(t||!I._didTriggerPlay&&this.lastTime<i)&&(I.duration*I.timeScale>.3?s.offset=I.clipIn+(i-I.start)*I.timeScale:s.offset=0,Oa&&console.log("Timeline Audio ("+this.track.name+") play with offset "+s.offset+" - "+I.asset.clip),s.play(g),I._didTriggerPlay=!0);else{const r=I.clipIn+(i-I.start)*I.timeScale,C=s.context.currentTime-s._startedAt+s.offset;Math.abs(r-C)>.3&&(s.offset=r,s.stop(),s.play(g))}let a=n.volume;if(this.track.volume!==void 0&&(a*=this.track.volume),A&&(a=0),I.easeInDuration>0){const r=Math.min((i-I.start)/I.easeInDuration,1);a*=r}if(I.easeOutDuration>0){const r=Math.min((I.end-i)/I.easeOutDuration,1);a*=r}s.setVolume(a*this.director.weight)}else I._didTriggerPlay=!1,this.director.isPlaying&&s.isPlaying&&s.stop()}this.lastTime=i}loadAudio(i,A=0,t=0){let g=null;const o=i-t,I=i+A;for(const s of this.models)if(this.isInTimeRange(s,o,I)){const n=this.audio[this.models.indexOf(s)],a=this.handleAudioLoading(s,n);a!==null&&(g===null&&(g=[]),g.push(a))}return g!==null?Promise.all(g):null}isInTimeRange(i,A,t){return A<=i.start&&t>=i.end||A>=i.start&&A<=i.end||t>=i.start&&t<=i.end}static dispose(){h0._audioBuffers.clear()}handleAudioLoading(i,A){this._audioLoader||(this._audioLoader=new _w);const t=this.getAudioFilePath(i.asset.clip);if(h0._audioBuffers.get(t)){const o=h0._audioBuffers.get(t);return o.then(I=>{I&&A.setBuffer(I)}),o}Oa&&console.warn("LOAD audio track",t,this.director.sourceId);const g=new Promise((o,I)=>{this._audioLoader.load(t,s=>{A.setBuffer(s),o(s)},void 0,s=>{console.error("Error loading audio",s),o(null)})});return h0._audioBuffers.set(t,g),g}};let c0=h0;Q(c0,"_audioBuffers",new Map);class E0 extends l0{constructor(){super(...arguments),Q(this,"models",[]),Q(this,"didTrigger",[]),Q(this,"receivers",[])}evaluate(A){var t;if(this.track.muted)return;const g=this.director.context.time.deltaTime*1.5;for(let o=0;o<this.models.length;o++){const I=this.models[o],s=this.didTrigger[o],n=I.time-A;let a=!1;if(I.retroActive)a=n<=1e-6;else{const r=Math.abs(n);(r===0||r>=1e-5&&r<g)&&(a=!0)}if(a){if(!s)if(Oa&&console.log("Trigger signal",A,I.time,I),this.didTrigger[o]=!0,((t=this.receivers)==null?void 0:t.length)<=0)od.invoke(I.asset);else for(const r of this.receivers)r&&r.invoke(I.asset)}else I.emitOnce||(this.didTrigger[o]=!1)}}}class tk extends l0{constructor(){super(...arguments),Q(this,"models",[]),Q(this,"timelines",[]),Q(this,"_previousActiveModel",null)}resolveSourceObjects(A){for(let t=this.models.length-1;t>=0;t--){const g=this.models[t].asset;if(!g.sourceObject||typeof g.sourceObject!="object"){console.log("no source object, removing model",t,g),this.models.splice(t,1);continue}else{const o=gA.getComponent(g.sourceObject,gQ);this.timelines.push(o),o&&g.updateDirector&&(o.playOnAwake=!1)}}}evaluate(A){var t;this._previousActiveModel=null;for(let g=0;g<this.models.length;g++){const o=this.models[g],I=o.asset;if(A>=o.start&&A<=o.end){this._previousActiveModel=o;const s=this.getClipTime(A,o);if(I.controlActivation){const n=I.sourceObject;n.visible=!0}if(I.updateDirector){const n=this.timelines[g];n&&(n.isPlaying&&n.pause(),n.time=s,n.evaluate())}}else{const s=(t=this._previousActiveModel)==null?void 0:t.asset;if(I.controlActivation){const n=I.sourceObject;s?.sourceObject!==n&&(n.visible=!1)}}}}}const YuA=iA("debugpost");let Nx=null;function HuA(i){Nx=i}function sV(i){let A=i.gameObject;for(;A;){for(const t of oG(A))if(t.isPostProcessingManager===!0)return t;A=A.parent}return null}function _uA(i){let A=sV(i);if(!A)if(Nx){YuA&&console.warn("Adding postprocessing manager to the scene.");const t=i.scene;A=hs(t,Nx)}else WA()&&console.warn("No post processing manager found");return A}var OuA=Object.defineProperty,PuA=Object.getOwnPropertyDescriptor,nV=(i,A,t,g)=>{for(var o=g>1?void 0:g?PuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&OuA(A,t,o),o};const ZuA=iA("debugpost");class Ae{constructor(A){Q(this,"isVolumeParameter",!0),Q(this,"_isInitialized",!1),Q(this,"_active",!0),Q(this,"_value"),Q(this,"_valueRaw"),Q(this,"_defaultValue"),Q(this,"valueProcessor"),Q(this,"onValueChanged"),A!==void 0&&this.initialize(A)}get isInitialized(){return this._isInitialized}initialize(A){A!==void 0&&(this._value=A,this._defaultValue=A,this._valueRaw=A,this._isInitialized=!0)}get overrideState(){return this._active}set overrideState(A){if(this._active===A)return;this._active=A;const t=A?this._valueRaw:this._defaultValue;this.processValue(t,!0)}get value(){return this._valueRaw}set value(A){this.isInitialized||this.initialize(A),this.processValue(A,!1)}set defaultValue(A){this._defaultValue=A}__init(){this.processValue(this._valueRaw,!0)}processValue(A,t){if(A==null||!t&&this.testIfValueChanged(A)===!1)return;const g=this._value;ZuA&&typeof g=="number"&&typeof A=="number"&&(g?.toFixed(4),A?.toFixed(4)),!this._active&&this._defaultValue!==void 0?(this._value=this._defaultValue,A=this._defaultValue,this._valueRaw=A):(this._valueRaw=A,this._active&&this.valueProcessor&&(A=this.valueProcessor(A)),this._value=A),this.onValueChanged&&this.onValueChanged(A,g,this)}testIfValueChanged(A){return this._valueRaw!==A}}nV([G()],Ae.prototype,"overrideState",1),nV([G()],Ae.prototype,"value",1);class WuA extends en{constructor(){super([Ae])}onSerialize(A,t){}onDeserialize(A,t){const g=t.target,o=t.path;let I;if(g&&o&&(I=g[o]),(typeof I!="object"||typeof I=="object"&&I.isVolumeParameter!==!0)&&(I=new Ae),typeof A=="object"&&"value"in A){const s=A.value;I.initialize(s),I.overrideState=A.overrideState}else I.value=A;return I}}new WuA;var XuA=Object.defineProperty,VuA=Object.getOwnPropertyDescriptor,juA=(i,A,t,g)=>{for(var o=g>1?void 0:g?VuA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&XuA(A,t,o),o};const zuA=iA("debugpost");class $g extends vA{constructor(A=void 0){if(super(),Q(this,"active",!0),Q(this,"_manager",null),Q(this,"_result"),Q(this,"_postprocessingContext",null),A)for(const t of Object.keys(A)){const g=A[t],o=this[t];o instanceof Ae?o.initialize(g):o!==void 0&&(this[t]=g)}}get isPostProcessingEffect(){return!0}onEnable(){super.onEnable(),this.onEffectEnabled(),this.__internalDidAwakeAndStart&&(this.active=!0)}onDisable(){var A;super.onDisable(),(A=this._manager)==null||A.removeEffect(this),this.active=!1}onEffectEnabled(A){var t;A&&A.isPostProcessingManager===!0?this._manager=A:this._manager||(this._manager=_uA(this)),(t=this._manager)==null||t.addEffect(this)}init(){}get postprocessingContext(){return this._postprocessingContext}apply(A){var t;return this._postprocessingContext=A,this._result||(this.initParameters(),this._result=(t=this.onCreateEffect)==null?void 0:t.call(this)),this._result&&this.initParameters(),this._result}unapply(){}dispose(){zuA&&console.warn("DISPOSE",this),this._result&&(Array.isArray(this._result)?this._result.forEach(A=>A.dispose()):this._result.dispose()),this._result=void 0}initParameters(){const A=Object.keys(this);for(const t of A){const g=this[t];g instanceof Ae&&g.__init()}}onEditorModification(A){const t=A.propertyName;if(this[t]instanceof Ae){const g=A.value;return this[t].value=g,!0}}}juA([G()],$g.prototype,"active",2);var $uA=Object.defineProperty,ApA=Object.getOwnPropertyDescriptor,epA=(i,A,t,g)=>{for(var o=g>1?void 0:g?ApA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&$uA(A,t,o),o};const tpA=iA("debugpost"),Fx={};function nn(i,A){Fx[i]=A}function ipA(i){return i.__type in Fx?Fx[i.__type]:(tpA&&i.__type&&console.warn("Unknown postprocessing type",i.__type,i),$g)}class d0{constructor(){Q(this,"components",[])}init(){var A;(A=this.components)==null||A.forEach(t=>t.init())}addEffect(A){this.components.push(A)}removeEffect(A){const t=this.components.indexOf(A);t>=0&&this.components.splice(t,1)}}epA([$E([i=>ipA(i),$g])],d0.prototype,"components",2);var gpA=Object.defineProperty,opA=Object.getOwnPropertyDescriptor,IpA=(i,A,t,g)=>{for(var o=g>1?void 0:g?opA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&gpA(A,t,o),o};class u0 extends $g{constructor(){super(...arguments),Q(this,"preset",new Ae(Rl.HIGH))}get typeName(){return"Antialiasing"}onCreateEffect(){const A=new AP({preset:Rl.HIGH,edgeDetectionMode:qF.DEPTH});return this.preset.onValueChanged=t=>{A.applyPreset(t)},A}}IpA([G(Ae)],u0.prototype,"preset",2),nn("Antialiasing",u0);const spA=iA("debugusdz");class xQ{constructor(){Q(this,"files",new Array)}static getName(A){var t;const g=A.split(".").pop();let o=(t=A.split(".").slice(0,-1).join(".").split("/").pop())==null?void 0:t.replace(".","_");return o||(o="Audio_"+Math.random().toString(36).substring(2,15)),$n(o)+"."+g}get extensionName(){return"Audio"}onExportObject(A,t,g){const o=gA.getComponents(A,bi);if(o.length)for(const I of o){if(!I.clip||typeof I.clip!="string"||!I.playOnAwake)continue;const s=I.clip.split("/").pop()||"Audio",n=xQ.getName(I.clip),a=$n(n);if(!this.files.some(r=>r.path===I.clip)){this.files.push({path:I.clip,name:n});const r=n.toLowerCase();g.quickLookCompatible&&!r.endsWith(".mp3")&&!r.endsWith(".wav")&&!r.endsWith(".m4a")&&console.error("Audio file "+I.clip+" from "+I.name+" is not an MP3 or WAV file. QuickLook may not support playing it.")}g.quickLookCompatible||t.addEventListener("serialize",(r,C)=>{r.appendLine(),r.beginBlock(`def SpatialAudio "${a}"`,"(",!1),r.appendLine(`displayName = "${s}"`),r.closeBlock(")"),r.beginBlock(),r.appendLine(`uniform asset filePath = @audio/${n}@`),r.appendLine(`uniform token auralMode = "${I.spatialBlend>0?"spatial":"nonSpatial"}"`),r.appendLine(`uniform token playbackMode = "${I.loop?"loopFromStage":"onceFromStart"}"`),r.appendLine(`uniform float gain = ${I.volume}`),r.closeBlock()})}}async onAfterSerialize(A){for(const t of this.files){const g="audio/"+t.name;if(A.files[g]){spA&&console.warn("Audio file with name "+g+" already exists in the context. Skipping.");continue}const o=await(await(await fetch(t.path)).blob()).arrayBuffer(),I=new Uint8Array(o);A.files[g]=I}}}const QC=iA("debugautosync"),Kx=Symbol("syncerId");class npA{constructor(){Q(this,"_syncers",{})}getOrCreateSyncer(A){if(!A.guid)return null;if(this._syncers[A.guid])return this._syncers[A.guid];const t=new apA(A);return t[Kx]=A.guid,this._syncers[t[Kx]]=t,t}removeSyncer(A){delete this._syncers[A[Kx]]}}const vx=new npA;class apA{constructor(A){Q(this,"comp"),Q(this,"hasChanges",!1),Q(this,"changedProperties",{}),Q(this,"_isReceiving",!1),Q(this,"_isInit",!1),Q(this,"onHandleSending",()=>{if(!this.hasChanges)return;this.hasChanges=!1;const t=this.comp.context.connection;if(!t||!t.isConnected||!t.isInRoom){for(const g in this.changedProperties)delete this.changedProperties[g];return}for(const g in this.changedProperties){const o=this.comp.guid+"/"+g,I=this.changedProperties[g];QC&&console.log("SEND",this.comp.name,this.networkingKey),t.send(this.networkingKey,{guid:o,data:I},Pn.Queued)}}),Q(this,"onHandleReceiving",t=>{if(QC&&console.log("RECEIVE",this.comp.name,this.comp.guid,t),!this._isInit||!this.comp||t.guid.startsWith(this.comp.guid)===!1)return;const[g,o]=t.guid.split("/");QC&&console.log("RECEIVED",this.comp.name,this.comp.guid,t);try{this._isReceiving=!0,this.comp[o]=t.data}catch(I){console.error(I)}finally{this._isReceiving=!1}}),this.comp=A}get networkingKey(){return this.comp.guid}init(A){if(this._isInit)return;this._isInit=!0,this.comp=A,this.comp.context.post_render_callbacks.push(this.onHandleSending),this.comp.context.connection.beginListen(this.networkingKey,this.onHandleReceiving);const t=this.comp.context.connection.tryGetState(this.comp.guid);t&&this.onHandleReceiving(t)}destroy(){this._isInit&&(this.comp.context.post_render_callbacks.splice(this.comp.context.post_render_callbacks.indexOf(this.onHandleSending),1),this.comp.context.connection.stopListen(this.networkingKey,this.onHandleReceiving),this.comp=null,this._isInit=!1)}notifyChanged(A,t){this._isReceiving||(QC&&console.log("Property changed: "+A,t),this.hasChanges=!0,this.changedProperties[A]=t)}}function rpA(i,A){let t=A!==i;return!t&&i&&A&&(Array.isArray(i)&&Array.isArray(A)||typeof i=="object"&&typeof A=="object")&&(t=!0),t}const p0=Symbol("AutoSyncHandler");function CpA(i){if(i[p0])return i[p0];const A=vx.getOrCreateSyncer(i);return A?.init(i),i[p0]=A,A}function BpA(i){const A=i[p0];A&&(vx.removeSyncer(A),A.destroy(),delete i[p0])}const Jx=function(i=null){return function(A,t){var g;let o="";typeof t=="string"?o=t:o=t.name;let I=null,s;typeof i=="string"?s=A[i]:typeof i=="function"&&(s=i),s==null&&(WA()||QC)&&i!=null&&console.warn('syncField: no callback function found for property "'+o+'"','"'+i+'"');const n=A,a=n.__internalAwake;if(typeof a!="function"){(QC||WA())&&console.error('@syncField can currently only used on Needle Engine Components, custom object of type "'+((g=A?.constructor)==null?void 0:g.name)+'" is not supported',A);return}QC&&console.log(o);const r=Symbol(o);n.__internalAwake=function(){if(this[r]!==void 0)return;this[r]=this[o],I=vx.getOrCreateSyncer(this);const B=Object.getOwnPropertyDescriptor(this,o);if(B?.set===void 0){let l=!1;Object.defineProperty(this,o,{set:function(h){var c;const d=this[r];if(this[r]=h,l){(WA()||QC)&&console.warn("Recursive call detected",o);return}l=!0;try{const E=rpA(h,d);QC&&console.log("SyncField assignment",o,"changed?",E,h,s),E&&s?.call(this,h,d)!==!1&&((c=CpA(this))==null||c.notifyChanged(o,h))}finally{l=!1}},get:function(){return this[r]},configurable:!0,enumerable:!0})}I?.init(this),a.call(this)};const C=n.__internalDestroy;n.__internalDestroy=function(){BpA(this),C.call(this)}}};var QpA=Object.defineProperty,lpA=Object.getOwnPropertyDescriptor,ik=(i,A,t,g)=>{for(var o=g>1?void 0:g?lpA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&QpA(A,t,o),o};const Ds=iA("debugplayersync"),aV=class extends vA{constructor(){super(...arguments),Q(this,"autoSync",!0),Q(this,"asset"),Q(this,"onPlayerSpawned"),Q(this,"_localInstance"),Q(this,"onJoinedRoom",()=>{Ds&&console.log("PlayerSync.joinedRoom. autoSync is set to "+this.autoSync),this.autoSync&&this.getInstance()}),Q(this,"destroyInstance",()=>{var i;(i=this._localInstance)==null||i.then(A=>{Ds&&console.log("PlayerSync.destroyInstance",A),bD(A,this.context.connection,!0,{saveInRoom:!1})}),this._localInstance=void 0})}static async setupFrom(i,A){const t=it.getOrCreateFromUrl(i);if(!t.asset){const I=await t.loadAssetAsync();gA.getOrAddComponent(I,ys)}const g=new aV;g._internalInit(A),g.asset=t;const o=new pA;return o.guid=i,gA.addComponent(o,g),g}awake(){this.watchTabVisible(),this.onPlayerSpawned||(this.onPlayerSpawned=new $t)}onEnable(){this.context.connection.beginListen(Oe.RoomStateSent,this.onJoinedRoom),this.context.connection.beginListen(Oe.JoinedRoom,this.onJoinedRoom),this.context.connection.beginListen(Oe.LeftRoom,this.destroyInstance),this.context.connection.isInRoom&&this.onJoinedRoom()}onDisable(){this.context.connection.stopListen(Oe.RoomStateSent,this.onJoinedRoom),this.context.connection.stopListen(Oe.JoinedRoom,this.onJoinedRoom),this.context.connection.stopListen(Oe.LeftRoom,this.destroyInstance)}async getInstance(){var i,A,t,g,o,I;if(this._localInstance)return this._localInstance;if(Ds&&console.log("PlayerSync.createInstance",(i=this.asset)==null?void 0:i.url),!((A=this.asset)!=null&&A.asset)&&!((t=this.asset)!=null&&t.url))return console.error('PlayerSync: can not create an instance because "asset" is not set and or has no URL!'),null;this.gameObject.guid||console.warn("PlayerSync: gameObject has no guid! This might cause issues with syncing the player state."),this._localInstance=(g=this.asset)==null?void 0:g.instantiateSynced({parent:this.gameObject,deleteOnDisconnect:!0},!0);const s=await this._localInstance;if(s){const n=gA.getComponentsInChildren(s,ys);if(n!=null&&n.length){for(const a of n)a.owner=this.context.connection.connectionId;(o=this.onPlayerSpawned)==null||o.invoke(s)}else this._localInstance=void 0,console.error("<strong>Failed finding PlayerState on "+((I=this.asset)==null?void 0:I.url)+"</strong>: please make sure the asset has a PlayerState component!"),gA.destroySynced(s)}else this._localInstance=void 0,console.warn("PlayerSync: failed instantiating asset!");return this._localInstance}watchTabVisible(){window.addEventListener("visibilitychange",i=>{if(document.visibilityState==="visible")for(let A=ys.all.length-1;A>=0;A--){const t=ys.all[A];(!t.owner||!this.context.connection.userIsInRoom(t.owner))&&t.doDestroy()}})}};let Id=aV;ik([G()],Id.prototype,"autoSync",2),ik([G(it)],Id.prototype,"asset",2),ik([G($t)],Id.prototype,"onPlayerSpawned",2);var rV=(i=>(i.OwnerChanged="ownerChanged",i))(rV||{}),D0;const po=(D0=class extends vA{constructor(){super(...arguments),Q(this,"onOwnerChangeEvent",new $t),Q(this,"onFirstOwnerChangeEvent",new $t),Q(this,"hasOwner",!1),Q(this,"owner"),Q(this,"dontDestroy",!1),Q(this,"onUserLeftRoom",i=>{if(i.userId===this.owner){Ds&&console.log("PLAYERSYNC LEFT",this.owner),this.doDestroy();return}})}static get all(){return po._all}static get local(){return po._local}static getFor(i){if(i instanceof pA)return gA.getComponentInParent(i,po);if(i instanceof vA)return gA.getComponentInParent(i.gameObject,po)}static isLocalPlayer(i){const A=po.getFor(i);return A?.isLocalPlayer??!1}static addEventListener(i,A){return this._callbacks[i]||(this._callbacks[i]=[]),this._callbacks[i].push(A),A}static removeEventListener(i,A){if(!this._callbacks[i])return;const t=this._callbacks[i].indexOf(A);t>=0&&this._callbacks[i].splice(t,1)}static dispatchEvent(i,A){if(this._callbacks[i])for(const t of this._callbacks[i])t(A)}get isLocalPlayer(){return this.owner===this.context.connection.connectionId}onOwnerChange(i,A){var t,g;Ds&&console.log("PlayerSync.onOwnerChange",this,"newOwner",i,"oldOwner",A);const o=po._local.indexOf(this);o>=0&&po._local.splice(o,1);const I={playerState:this,oldValue:A,newValue:i};if(this.hasOwner||(this.hasOwner=!0,(t=this.onFirstOwnerChangeEvent)==null||t.invoke(I)),(g=this.onOwnerChangeEvent)==null||g.invoke(I),this.owner===this.context.connection.connectionId){po._local.push(this);const n=new CustomEvent("local-owner-changed",{detail:I});this.dispatchEvent(n)}const s=new CustomEvent("owner-changed",{detail:I});this.dispatchEvent(s),po.dispatchEvent("ownerChanged",s)}awake(){po.all.push(this),Ds&&console.log("Registered new PlayerState",this.guid,po.all.length-1,po.all),this.context.connection.beginListen(Oe.UserLeftRoom,this.onUserLeftRoom)}async start(){Ds&&console.log("PLAYERSTATE.START, owner: "+this.owner,this.context.connection.usersInRoom([])),this.owner?(this.context.connection.isInRoom||await Un(300),this.context.connection.userIsInRoom(this.owner)==!1&&(Ds&&console.log(`PlayerSync.start \u2192 doDestroy "${this.name}" because user "${this.owner}" is not in room anymore...`,"Currently in room:",...this.context.connection.usersInRoom()),this.doDestroy())):this.owner||(Ds&&console.warn("PlayerState.start \u2192 owner is undefined!",this.name),setTimeout(()=>{!this.destroyed&&!this.owner?this.dontDestroy?Ds&&console.warn("PlayerState.start \u2192 owner is still undefined but dontDestroy is set to true",this.name):(Ds&&console.warn(`PlayerState.start \u2192 owner is still undefined: destroying "${this.name}" instance now`),this.doDestroy()):Ds&&console.log("PlayerState.start \u2192 owner is assigned",this.owner)},2e3))}doDestroy(){Ds&&console.log("PlayerSync.doDestroy \u2192 syncDestroy",this.name),bD(this.gameObject,this.context.connection,!0,{saveInRoom:!1})}onDestroy(){if(this.context.connection.stopListen(Oe.UserLeftRoom,this.onUserLeftRoom),po.all.splice(po.all.indexOf(this),1),this.isLocalPlayer){const i=po._local.indexOf(this);i>=0&&po._local.splice(i,1)}}},Q(D0,"_all",[]),Q(D0,"_local",[]),Q(D0,"_callbacks",{}),D0);let ys=po;ik([Jx(ys.prototype.onOwnerChange)],ys.prototype,"owner",2);const hpA=iA("debugavatar"),Pa=class extends vA{constructor(){super(...arguments),Q(this,"connectionId"),Q(this,"avatar")}static getAvatar(i){return i>=0&&i<Pa.instances.length?Pa.instances[i]:null}static onAvatarMarkerCreated(i){return Pa._onNewAvatarMarkerAdded.push(i),i}static onAvatarMarkerDestroyed(i){return Pa._onAvatarMarkerDestroyed.push(i),i}awake(){Pa.instances.push(this),hpA&&console.log(this);for(const i of Pa._onNewAvatarMarkerAdded)i({avatarMarker:this,gameObject:this.gameObject})}onDestroy(){Pa.instances.splice(Pa.instances.indexOf(this),1);for(const i of Pa._onAvatarMarkerDestroyed)i({avatarMarker:this,gameObject:this.gameObject})}isLocalAvatar(){return this.connectionId===this.context.connection.connectionId}};let Do=Pa;Q(Do,"instances",[]),Q(Do,"_onNewAvatarMarkerAdded",[]),Q(Do,"_onAvatarMarkerDestroyed",[]);var cpA=Object.defineProperty,EpA=Object.getOwnPropertyDescriptor,dpA=(i,A,t,g)=>{for(var o=g>1?void 0:g?EpA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&cpA(A,t,o),o};const sd=iA("debugxrflags"),CV=iA("disablexrflags");CV&&console.warn("XRFlags are disabled");var Za=(i=>(i[i.Never=0]="Never",i[i.Browser=1]="Browser",i[i.AR=2]="AR",i[i.VR=4]="VR",i[i.FirstPerson=8]="FirstPerson",i[i.ThirdPerson=16]="ThirdPerson",i[i.All=4294967295]="All",i))(Za||{});const BV=class{constructor(){Q(this,"Mask",17)}Has(i){return(this.Mask&i)!==0}Set(i){sd&&console.warn("Set XR flag state to",i),this.Mask=i,ms.Apply()}Enable(i){this.Mask|=i,ms.Apply()}Disable(i){this.Mask&=~i,ms.Apply()}Toggle(i){this.Mask^=i,ms.Apply()}EnableAll(){this.Mask=-1,ms.Apply()}DisableAll(){this.Mask=0,ms.Apply()}};let SI=BV;Q(SI,"Global",new BV);var y0;const lC=(y0=class extends vA{constructor(){super(...arguments),Q(this,"visibleIn")}static Apply(){for(const i of this.registry)i.UpdateVisible(SI.Global)}awake(){lC.registry.push(this)}onEnable(){lC.firstApply?this.UpdateVisible(SI.Global):(lC.firstApply=!0,lC.Apply())}onDestroy(){const i=lC.registry.indexOf(this);i>=0&&lC.registry.splice(i,1)}get isOn(){return this.gameObject.visible}UpdateVisible(i=null){if(CV)return;let A;const t=i;if(t&&typeof t=="number"&&(console.assert(typeof t=="number","XRFlag.UpdateVisible: state must be a number",t),sd&&console.log(t),lC.buffer.Mask=t,i=lC.buffer),i instanceof SI?(sd&&console.warn(this.name,"use passed in mask",i.Mask,this.visibleIn),A=i.Has(this.visibleIn)):(sd&&console.log(this.name,"use global mask"),SI.Global.Has(this.visibleIn)),A!==void 0)if(A)sd&&console.log(this.name,"is visible",this.gameObject.uuid),gA.setActive(this.gameObject,!0);else{if(sd&&console.log(this.name,"is not visible",this.gameObject.uuid),!this.gameObject.visible)return;this.gameObject.visible=!1}}},Q(y0,"registry",[]),Q(y0,"firstApply"),Q(y0,"buffer",new SI),y0);let ms=lC;dpA([G()],ms.prototype,"visibleIn",2);var upA=Object.defineProperty,ppA=Object.getOwnPropertyDescriptor,xx=(i,A,t,g)=>{for(var o=g>1?void 0:g?ppA(A,t):A,I=i.length-1,s;I>=0;I--)(s=i[I])&&(o=(g?s(A,t,o):s(o))||o);return g&&o&&upA(A,t,o),o};const m0=iA("debugwebxr"),QV=new kA().setFromAxisAngle(new f(0,1,0),Math.PI);class oQ extends vA{constructor(){super(...arguments),Q(this,"head"),Q(this,"leftHand"),Q(this,"rightHand"),Q(this,"_leftHandMeshes"),Q(this,"_rightHandMeshes"),Q(this,"_syncTransforms")}async onEnterXR(A){if(!this.activeAndEnabled)return;m0&&console.warn("AVATAR ENTER XR",this.guid,this.sourceId,this,this.activeAndEnabled),this._syncTransforms&&(this._syncTransforms.length=0),await this.prepareAvatar();const t=ys.getFor(this);if(t!=null&&t.owner){const g=this.gameObject.addComponent(Do);g.avatar=this.gameObject,g.connectionId=t.owner}else this.context.connection.isConnected?console.error("No player state found for avatar",this):t&&!this.context.connection.isConnected&&(t.dontDestroy=!0)}onLeaveXR(A){const t=this.gameObject.getComponent(Do);t&&t.destroy()}onUpdateXR(A){var t,g;if(!this.activeAndEnabled)return;const o=ys.isLocalPlayer(this);if(!o)return;const I=A.xr;if(I.rig&&I.rig.gameObject!==this.gameObject.parent&&(this.gameObject.position.set(0,0,0),this.gameObject.rotation.set(0,0,0),this.gameObject.scale.set(1,1,1),I.rig.gameObject.add(this.gameObject)),this._syncTransforms&&o)for(const C of this._syncTransforms)C.fastMode=!0,C.isOwned()||C.requestOwnership();if(this.head&&this.context.mainCamera){const C=this.head.asset;if(C.position.copy(this.context.mainCamera.position),C.position.x*=-1,C.position.z*=-1,C.quaternion.copy(this.context.mainCamera.quaternion),C.quaternion.x*=-1,this.context.time.frameCount%10===0){const B=gA.getComponentsInChildren(this.head.asset,ms);for(const l of B)l.enabled=!1,l.gameObject.visible=!1}}const s=A.xr.leftController,n=(t=this.leftHand)==null?void 0:t.asset;s&&n?(n.position.copy(s.gripPosition),n.quaternion.copy(s.gripQuaternion),n.quaternion.multiply(QV),n.visible=s.isTracking,this.updateHandVisibility(s,n,this._leftHandMeshes)):n&&n.visible&&(n.visible=!1);const a=A.xr.rightController,r=(g=this.rightHand)==null?void 0:g.asset;a&&r?(r.position.copy(a.gripPosition),r.quaternion.copy(a.gripQuaternion),r.quaternion.multiply(QV),r.visible=a.isTracking,this.updateHandVisibility(a,r,this._rightHandMeshes)):r&&r.visible&&(r.visible=!1)}onBeforeRender(){this.context.xr&&this.context.time.frame%10===0&&this.updateRemoteAvatarVisibility()}updateHandVisibility(A,t,g){if(g){const o=A.model&&A.model.visible&&A.model!==t;g.forEach(I=>{iC(I,!o)})}}updateRemoteAvatarVisibility(){var A,t,g;if(this.context.connection.isConnected){const o=ys.getFor(this);if(o&&o.isLocalPlayer==!1){const I=ke.getXRSync(this.context);if(I&&I.hasState(o.owner)){this.tryFindAvatarObjectsIfMissing();const s=(A=this.leftHand)==null?void 0:A.asset;s&&(s.visible=I?.isTracking(o.owner,"left")??!1);const n=(t=this.rightHand)==null?void 0:t.asset;n&&(n.visible=I?.isTracking(o.owner,"right")??!1)}if((g=this.head)!=null&&g.asset){const s=gA.getComponentsInChildren(this.head.asset,ms);for(const n of s)n.enabled=!1,n.gameObject.visible=!0}}}}tryFindAvatarObjectsIfMissing(){if(!this.head||!this.leftHand||!this.rightHand){const A={head:this.head,leftHand:this.leftHand,rightHand:this.rightHand};iW.tryFindAvatarObjects(this.gameObject,this.sourceId||"",A),A.head&&(this.head=A.head),A.leftHand&&(this.leftHand=A.leftHand),A.rightHand&&(this.rightHand=A.rightHand)}}async prepareAvatar(){if(this.tryFindAvatarObjectsIfMissing(),this.head)this.head instanceof pA&&(this.head=new it("",this.sourceId,this.head));else{const A=new pA;A.name="Head";const t=JB.createPrimitive(_l.Cube);A.add(t),this.gameObject.add(A),this.head=new it("",this.sourceId,A),m0&&console.log("Create head",A)}if(this.rightHand)this.rightHand instanceof pA&&(this.rightHand=new it("",this.sourceId,this.rightHand));else{const A=new pA;A.name="Right Hand",this.gameObject.add(A),this.rightHand=new it("",this.sourceId,A),m0&&console.log("Create right hand",A)}if(this.leftHand)this.leftHand instanceof pA&&(this.leftHand=new it("",this.sourceId,this.leftHand));else{const A=new pA;A.name="Left Hand",this.gameObject.add(A),this.leftHand=new it("",this.sourceId,A),m0&&console.log("Create left hand",A)}await this.loadAvatarObjects(this.head,this.leftHand,this.rightHand),this._leftHandMeshes=[],this.leftHand.asset.traverse(A=>{A!=null&&A.isMesh&&this._leftHandMeshes.push(A)}),this._rightHandMeshes=[],this.rightHand.asset.traverse(A=>{A!=null&&A.isMesh&&this._rightHandMeshes.push(A)}),ys.isLocalPlayer(this.gameObject)&&(this._syncTransforms=gA.getComponentsInChildren(this.gameObject,Ya))}async loadAvatarObjects(A,t,g){const o=A.loadAssetAsync(),I=t.loadAssetAsync(),s=g.loadAssetAsync(),n=new Array;o&&n.push(o),I&&n.push(I),s&&n.push(s);const a=await iS(n);m0&&console.log("Avatar loaded results:",a)}}xx([G(it)],oQ.prototype,"head",2),xx([G(it)],oQ.prototype,"leftHand",2),xx([G(it)],oQ.prototype,"rightHand",2);class Wa{static Add(A,t,g=null){if(t){for(const o of this.Pois)if(o.obj===t)return;this.Pois.push({obj:t,avatar:g}),this.LastChangeTime=A.time.time}}static Remove(A,t){var g;if(t){for(const o of this.Pois)if(o.obj===t){this.Pois.splice(this.Pois.indexOf(o),1),this.LastChangeTime=A?.time.time??((g=Ne.Current)==null?void 0:g.time.time);return}}}}Q(Wa,"Pois",[]),Q(Wa,"LastChangeTime",0);class DpA{constructor(){Q(this,"guid"),Q(this,"position",new f)}}class w0 extends vA{constructor(){super(...arguments),Q(this,"target",null),Q(this,"avatar",null),Q(this,"_model",null),Q(this,"_targetModel",new DpA),Q(this,"_currentTargetObject",null),Q(this,"_lastUpdateTime",0),Q(this,"_lookDuration",0),Q(this,"_lastPoiChangedTime",0)}set controlledTarget(A){this.target=A;const t=X.get("MoveRandom");if(t&&this.target){const g=gA.getComponent(this.target,t);g&&g.destroy()}}awake(){if(this.avatar=gA.getComponentInParent(this.gameObject,Do),this.avatar){const A=gA.getComponentInParent(this.gameObject,Do);this._model=new Mv(this.context.connection,this.guid),A!=null&&A.isLocalAvatar&&this._model.requestOwnership()}this.context.connection.beginListen("avatar-look-target-changed",A=>{var t;this.target&&A&&A.guid===((t=this.avatar)==null?void 0:t.guid)&&Ug(this.target,A.position)})}update(){var A;if((!this.context.connection.isConnected||(A=this._model)!=null&&A.hasOwnership)&&(Wa.LastChangeTime!==this._lastPoiChangedTime&&(this._lastPoiChangedTime=Wa.LastChangeTime,this._lookDuration=0),this.selectTarget(),this._currentTargetObject&&this.context.time.frameCount%10===0&&this.target)){const t=Le(this._currentTargetObject);Ug(this.target,t),this.context.connection.isConnected&&this.avatar&&(this.context.connection.send("avatar-look-target-changed",this._targetModel),this._targetModel.guid=this.avatar.guid,this._targetModel.position.copy(t))}}selectTarget(){if(this.context.time.time-this._lastUpdateTime>this._lookDuration){this._lastUpdateTime=this.context.time.time,this._lookDuration=Math.random()*.5+.2;const A=Wa.Pois;if(A.length>0){const t=A[Math.floor(Math.random()*A.length)];if(t&&t.obj){if(t.avatar&&t.avatar===this.avatar)return;this._currentTargetObject=t.obj}}}}}function lV(i){return i&&i.isComponent}const ypA=Symbol("object"),Lx=new os(()=>new f,20);class hV{constructor(A,t,g,o,I,s){Q(this,"_point"),Q(this,"_normal"),Q(this,"_tangentVelocity"),Q(this,"distance"),Q(this,"impulse"),Q(this,"friction"),this._point=A,this.distance=t,this._normal=g,this.impulse=o,this.friction=I,this._tangentVelocity=s}get point(){return Lx.get().set(this._point.x,this._point.y,this._point.z)}get normal(){return Lx.get().set(this._normal.x,this._normal.y,this._normal.z)}get tangentVelocity(){return Lx.get().set(this._tangentVelocity.x,this._tangentVelocity.y,this._tangentVelocity.z)}}class cV{constructor(A,t,g){Q(this,"contacts"),Q(this,"me"),Q(this,"_collider"),Q(this,"_gameObject"),this.me=A,this._collider=t,this._gameObject=t.gameObject,this.contacts=g}get collider(){return this._collider}get gameObject(){return this._gameObject}get rigidBody(){var A;return(A=this.collider)==null?void 0:A.attachedRigidbody}}class EV{constructor(A,t){Q(this,"object"),Q(this,"collider"),this.object=A,this.collider=t}}const Ig=iA("debugnetworkingstreams");var Xa=(i=>(i.Connected="peer-user-connected",i.StreamReceived="receive-stream",i.StreamEnded="call-ended",i.Disconnected="peer-user-disconnected",i.UserJoined="user-joined",i))(Xa||{});class qx{constructor(A,t){Q(this,"type","call-ended"),Q(this,"userId"),Q(this,"direction"),this.userId=A,this.direction=t}}class dV{constructor(A,t,g){Q(this,"type","receive-stream"),Q(this,"userId"),Q(this,"stream"),Q(this,"target"),this.userId=A,this.stream=t,this.target=g}}class mpA{constructor(A,t){Q(this,"guid"),Q(this,"peerId"),Q(this,"dontSave",!0),this.guid=A.id,this.peerId=t}}var uV=(i=>(i.Incoming="incoming",i.Outgoing="outgoing",i))(uV||{});class wpA extends qg{constructor(A,t,g,o=null){super(),Q(this,"peerId"),Q(this,"userId"),Q(this,"direction"),Q(this,"call"),Q(this,"_stream",null),Q(this,"_isDisposed",!1),this.peerId=t.peer,this.userId=A,this.call=t,this.direction=g,this._stream=o,t.on("stream",I=>{if(Ig&&console.log("Receive stream",`
|
|
5958
5958
|
Audio:`,I.getAudioTracks(),`
|
|
5959
5959
|
Video:`,I.getVideoTracks()),this._stream=I,g==="incoming"){const s=new dV(A,I,this);this.dispatchEvent(s)}}),t.on("close",()=>{this.dispatchEvent(new qx(A,g))})}get stream(){return this._stream}close(){this._isDisposed||(this._isDisposed=!0,this.call.close(),Va(this._stream))}get isOpen(){var A;return((A=this.call.peerConnection)==null?void 0:A.connectionState)==="connected"}get isOpening(){var A;return((A=this.call.peerConnection)==null?void 0:A.connectionState)==="connecting"}get isClosed(){return!this.isOpen||this._isDisposed}}function pV(i){return i=i.replace("a=fmtp:111 minptime=10;useinbandfec=1","a=fmtp:111 ptime=5;useinbandfec=1;stereo=1;maxplaybackrate=48000;maxaveragebitrat=128000;sprop-stereo=1"),i}const S0=class extends qg{constructor(i,A){super(),Q(this,"updateCalls",()=>{var t;for(let g=this._incomingCalls.length-1;g>=0;g--){const o=this._incomingCalls[g];o.isClosed&&!o.isOpening&&this._incomingCalls.splice(g,1)}for(let g=this._outgoingCalls.length-1;g>=0;g--){const o=this._outgoingCalls[g];let I=!1;o.isClosed&&!o.isOpening&&((t=o.stream)!=null&&t.active?Ig&&console.warn("!!! Stream is still active, don't remove call",o.userId,"Your id: "+this.context.connection.connectionId):(Ig&&console.warn("!!! Remove closed call",o.userId),I=!0)),this.context.connection.userIsInRoom(o.userId)===!1&&(Ig&&console.warn("!!! User is not in room anymore, remove call",o.userId),I=!0),I&&(o.close(),this._outgoingCalls.splice(g,1))}}),Q(this,"id"),Q(this,"context"),Q(this,"_incomingCalls",[]),Q(this,"_outgoingCalls",[]),Q(this,"_peer"),Q(this,"_enabled",!1),Q(this,"_enabledPeer",!1),Q(this,"onConnectRoomFn",this.onConnectRoom.bind(this)),Q(this,"onPeerConnect",t=>{if(Ig&&console.log("PEER opened as",t),t===null){console.error("Peer connection failed",t);return}this.context.connection.send("peer-user-connected",new mpA(this,t))}),Q(this,"onPeerClose",()=>{Ig&&console.log("PEER closed"),this.updateCalls()}),Q(this,"onPeerDisconnected",()=>{Ig&&console.log("PEER disconnected"),this.updateCalls()}),Q(this,"onPeerError",t=>{Ig&&console.error("PEER error",t)}),Q(this,"onPeerReceivingCall",t=>{t.answer(void 0,{sdpTransform:g=>pV(g)}),this.registerCall(t,"incoming",null)}),this.context=i,this.id=A,this.setupPeer(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia}static getOrCreate(i,A){if(S0.instances.has(A))return S0.instances.get(A);const t=new S0(i,A);return S0.instances.set(A,t),t}getMyPeerId(){if(this.context.connection.connectionId)return this.getPeerIdFromUserId(this.context.connection.connectionId)}getPeerIdFromUserId(i){return this.id+"-"+i}getUserIdFromPeerId(i){return i.substring(this.id.length+1)}makeCall(i,A){var t;if(!(A!=null&&A.id)){Ig?console.warn("Can not make a call: mediastream has no id or is undefined"):console.debug("Can not make a call: mediastream has no id or is undefined");return}const g={metadata:{userId:this.context.connection.connectionId,streamId:A.id},sdpTransform:I=>pV(I)},o=(t=this._peer)==null?void 0:t.call(i,A,g);if(o){const I=this.registerCall(o,"outgoing",A);return Ig&&console.warn(`\u{1F4DE} CALL ${i}`,`
|