@needle-tools/engine 4.7.2-next.37cf642 → 4.7.2-next.d24ebbc

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.
@@ -1,4 +1,4 @@
1
- "use strict";var Hx=Object.defineProperty;var i_=o=>{throw TypeError(o)};var qx=(o,t,e)=>t in o?Hx(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>qx(o,typeof t!="symbol"?t+"":t,e),zf=(o,t,e)=>t.has(o)||i_("Cannot "+e);var ce=(o,t,e)=>(zf(o,t,"read from private field"),e?e.call(o):t.get(o)),on=(o,t,e)=>t.has(o)?i_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),rn=(o,t,e,i)=>(zf(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e),Ol=(o,t,e)=>(zf(o,t,"access private method"),e);const d=require("./three-B_hneGZr.umd.cjs"),le=require("./gltf-progressive-Cyd060gj.umd.cjs"),H=require("./three-examples-X3OadjXB.umd.cjs"),ae=require("./vendor-Cavtu3CP.umd.cjs"),ne=require("./three-mesh-ui-CQiIQIlA.umd.cjs"),Xx=require("./postprocessing-CjW23fio.umd.cjs");var Nf=typeof document<"u"?document.currentScript:null;const $f=new Map;function Yt(o=(t=>(t=globalThis.location)==null?void 0:t.hostname)()){if($f.has(o))return $f.get(o);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(o);return $f.set(o,e),e===!0}function s0(){return window.location.hostname.includes("glitch.me")}const Qx='<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>',Yx=btoa(Qx),Kx="data:image/svg+xml;base64,"+Yx,o0=Kx,Zx=`<?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(Zx);const Jx='<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>',eS=btoa(Jx),tS="data:image/svg+xml;charset=utf-8;base64,"+eS,iS=tS,n_=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var he=(o=>(o.ContextRegistered="ContextRegistered",o.ContextCreationStart="ContextCreationStart",o.ContextCreated="ContextCreated",o.ContextFirstFrameRendered="ContextFirstFrameRendered",o.ContextDestroying="ContextDestroying",o.ContextDestroyed="ContextDestroyed",o.MissingCamera="MissingCamera",o.ContextClearing="ContextClearing",o.ContextCleared="ContextCleared",o))(he||{});class re{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(t){globalThis["NeedleEngine.Context.Current"]=t}static get All(){return this.Registered}static register(t){this.Registered.indexOf(t)===-1&&(n_&&console.warn("Registering context"),this.Registered.push(t),this.dispatchCallback("ContextRegistered",t))}static unregister(t){const e=this.Registered.indexOf(t);e!==-1&&(n_&&console.warn("Unregistering context"),this.Registered.splice(e,1))}static registerCallback(t,e){this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e)}static unregisterCallback(t,e){if(!this._callbacks[t])return;const i=this._callbacks[t].indexOf(e);i!==-1&&this._callbacks[t].splice(i,1)}static dispatchCallback(t,e,i){if(!this._callbacks[t])return!0;const n={event:t,context:e};if(i)for(const a in i)n[a]=i[a];const s=new Array;return this._callbacks[t].forEach(a=>{const l=a(n);l instanceof Promise&&s.push(l)}),Promise.all(s)}static addContextCreatedCallback(t){this.registerCallback("ContextCreated",t)}static addContextDestroyedCallback(t){this.registerCallback("ContextDestroyed",t)}}r(re,"Registered",[]),r(re,"_callbacks",{});const r0=()=>o=>o;function nS(o){return r0()(o)}function sS(){return!!S("debug")}class ki{constructor(t,e){r(this,"_factory");r(this,"_cache",[]);r(this,"_maxSize");r(this,"_index",0);this._factory=t,this._maxSize=e}get(){const t=this._index%this._maxSize;return this._index++,this._cache.length<=t&&(this._cache[t]=this._factory()),this._cache[t]}}let Jo=!1;const qp=new Array;typeof window<"u"&&setTimeout(()=>{if(Jo){const o={},t=new URL(window.location.href),e=new URL(t);e.searchParams.append("console","");const i=e.toString().replace(/=$|=(?=&)/g,"");for(const s of qp){const a=new URL(t);a.searchParams.append(s,""),o[s]=a.toString().replace(/=$|=(?=&)/g,"")}console.log(`🌵 ?help: Debug Options for Needle Engine.
1
+ "use strict";var Hx=Object.defineProperty;var i_=o=>{throw TypeError(o)};var qx=(o,t,e)=>t in o?Hx(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>qx(o,typeof t!="symbol"?t+"":t,e),zf=(o,t,e)=>t.has(o)||i_("Cannot "+e);var ce=(o,t,e)=>(zf(o,t,"read from private field"),e?e.call(o):t.get(o)),on=(o,t,e)=>t.has(o)?i_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),rn=(o,t,e,i)=>(zf(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e),Ol=(o,t,e)=>(zf(o,t,"access private method"),e);const d=require("./three-B_hneGZr.umd.cjs"),le=require("./gltf-progressive-C_oN6wCA.umd.cjs"),H=require("./three-examples-X3OadjXB.umd.cjs"),ae=require("./vendor-Cavtu3CP.umd.cjs"),ne=require("./three-mesh-ui-CQiIQIlA.umd.cjs"),Xx=require("./postprocessing-CjW23fio.umd.cjs");var Nf=typeof document<"u"?document.currentScript:null;const $f=new Map;function Yt(o=(t=>(t=globalThis.location)==null?void 0:t.hostname)()){if($f.has(o))return $f.get(o);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(o);return $f.set(o,e),e===!0}function s0(){return window.location.hostname.includes("glitch.me")}const Qx='<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>',Yx=btoa(Qx),Kx="data:image/svg+xml;base64,"+Yx,o0=Kx,Zx=`<?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(Zx);const Jx='<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>',eS=btoa(Jx),tS="data:image/svg+xml;charset=utf-8;base64,"+eS,iS=tS,n_=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var he=(o=>(o.ContextRegistered="ContextRegistered",o.ContextCreationStart="ContextCreationStart",o.ContextCreated="ContextCreated",o.ContextFirstFrameRendered="ContextFirstFrameRendered",o.ContextDestroying="ContextDestroying",o.ContextDestroyed="ContextDestroyed",o.MissingCamera="MissingCamera",o.ContextClearing="ContextClearing",o.ContextCleared="ContextCleared",o))(he||{});class re{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(t){globalThis["NeedleEngine.Context.Current"]=t}static get All(){return this.Registered}static register(t){this.Registered.indexOf(t)===-1&&(n_&&console.warn("Registering context"),this.Registered.push(t),this.dispatchCallback("ContextRegistered",t))}static unregister(t){const e=this.Registered.indexOf(t);e!==-1&&(n_&&console.warn("Unregistering context"),this.Registered.splice(e,1))}static registerCallback(t,e){this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e)}static unregisterCallback(t,e){if(!this._callbacks[t])return;const i=this._callbacks[t].indexOf(e);i!==-1&&this._callbacks[t].splice(i,1)}static dispatchCallback(t,e,i){if(!this._callbacks[t])return!0;const n={event:t,context:e};if(i)for(const a in i)n[a]=i[a];const s=new Array;return this._callbacks[t].forEach(a=>{const l=a(n);l instanceof Promise&&s.push(l)}),Promise.all(s)}static addContextCreatedCallback(t){this.registerCallback("ContextCreated",t)}static addContextDestroyedCallback(t){this.registerCallback("ContextDestroyed",t)}}r(re,"Registered",[]),r(re,"_callbacks",{});const r0=()=>o=>o;function nS(o){return r0()(o)}function sS(){return!!S("debug")}class ki{constructor(t,e){r(this,"_factory");r(this,"_cache",[]);r(this,"_maxSize");r(this,"_index",0);this._factory=t,this._maxSize=e}get(){const t=this._index%this._maxSize;return this._index++,this._cache.length<=t&&(this._cache[t]=this._factory()),this._cache[t]}}let Jo=!1;const qp=new Array;typeof window<"u"&&setTimeout(()=>{if(Jo){const o={},t=new URL(window.location.href),e=new URL(t);e.searchParams.append("console","");const i=e.toString().replace(/=$|=(?=&)/g,"");for(const s of qp){const a=new URL(t);a.searchParams.append(s,""),o[s]=a.toString().replace(/=$|=(?=&)/g,"")}console.log(`🌵 ?help: Debug Options for Needle Engine.
2
2
  Append any of these parameters to the URL to enable specific debug options.
3
3
  Example: ${i} will show an onscreen console window.`);const n=Jo===!0?"":` (containing "${Jo}")`;console.group("Available URL parameters:"+n);for(const s of Object.keys(o).sort())typeof Jo=="string"&&!s.toLowerCase().includes(Jo.toLowerCase())||(console.groupCollapsed(s),console.log("Reload with this flag enabled:"),console.log(o[s]),console.groupEnd());console.groupEnd()}},100);function Zc(){var o;return new URLSearchParams((o=globalThis.location)==null?void 0:o.search)}function S(o){Jo&&!qp.includes(o)&&qp.push(o);const t=Zc();if(t.has(o)){const e=t.get(o);if(e){const i=Number(e);return isNaN(i)?e:i}else return!0}return!1}Jo=S("help");function oS(o,t){const e=Zc();e.has(o)?e.set(o,t):e.append(o,t),document.location.search=e.toString()}function Oc(o,t,e=!0){const i=Zc();i.has(o)?t===null?i.delete(o):i.set(o,t):t!==null&&i.append(o,t),e?a0(o,i):Vm(o,i)}function Xp(o,t,e){o.has(t)?o.set(t,e.toString()):o.append(t,e.toString())}function a0(o,t,e){window.history.pushState(e,o,"?"+t.toString())}function Vm(o,t,e){window.history.replaceState(e,o,"?"+t.toString())}function rS(o){for(var t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e.length,n=0;n<o;n++)t+=e.charAt(Math.floor(Math.random()*i));return t}function aS(o,t){return Math.floor(Math.random()*(t-o+1))+o}const s_=["smol","tiny","giant","interesting","smart","bright","dull","extreme","beautiful","pretty","dark","epic","salty","silly","funny","lame","lazy","loud","lucky","mad","mean","mighty","mysterious","nasty","odd","old","powerful","quiet","rapid","scary","shiny","shy","silly","smooth","sour","spicy","stupid","sweet","tasty","terrible","ugly","unusual","vast","wet","wild","witty","wrong","zany","zealous","zippy","zombie","zorro"],o_=["cat","dog","mouse","pig","cow","horse","sheep","chicken","duck","goat","panda","tiger","lion","elephant","monkey","bird","fish","snake","frog","turtle","hamster","penguin","kangaroo","whale","dolphin","crocodile","snail","ant","bee","beetle","butterfly","dragon","eagle","fish","giraffe","lizard","panda","penguin","rabbit","snake","spider","tiger","zebra"];function l0(){const o=s_[Math.floor(Math.random()*s_.length)],t=o_[Math.floor(Math.random()*o_.length)];return o+"_"+t}function c0(o){return o=o.replace(/[^a-z0-9áéíóúñü \.,_-]/gim,""),o.trim()}function za(o,t,e=!0,i=!1){var n;if(t==null)return null;if(t.userData&&t.userData.guid===o)return t;if(t.guid==o)return t;if(i&&(n=t.userData)!=null&&n.components){for(const s of t.userData.components)if(s.guid===o)return s}if(e){if(t.scenes)for(const s in t.scenes){const a=t.scenes[s],l=za(o,a,e,i);if(l)return l}if(t.children)for(const s in t.children){const a=t.children[s],l=za(o,a,e,i);if(l)return l}}}function Jc(o,t){if(o!=null&&typeof o=="object"){let e;Array.isArray(o)?e=[]:(e=Object.create(o),Object.assign(e,o));for(const i of Object.keys(o)){const n=o[i];t&&!t(o,i,n)?e[i]=n:(n==null?void 0:n.clone)!==void 0&&typeof n.clone=="function"?e[i]=n.clone():e[i]=Jc(n,t)}return e}return o}function Jn(o){return new Promise((t,e)=>{setTimeout(t,o)})}function eh(o,t){if(o<=0)return Promise.resolve();if(t||(t=re.Current),!t)return Promise.reject("No context");const e=t.time.frameCount+o;return new Promise((i,n)=>{if(!t)return n("No context");const s=()=>{t.time.frameCount>=e&&(t.pre_update_callbacks.splice(t.pre_update_callbacks.indexOf(s),1),i())};t.pre_update_callbacks.push(s)})}const Kh=S("debugresolveurl"),h0="rel:";function lS(o,t){return Eo(o,t)}function Eo(o,t){if(t===void 0)return Kh&&console.warn("getPath: uri is undefined, returning uri",t),t;if(t.startsWith("./"))return t;if(t.startsWith("http"))return Kh&&console.warn("getPath: uri is absolute, returning uri",t),t;if(o===void 0)return Kh&&console.warn("getPath: source is undefined, returning uri",t),t;t.startsWith(h0)&&(t=t.substring(4));const e=o.lastIndexOf("/");if(e>=0){const i=o.substring(0,e+1);for(;i.endsWith("/")&&t.startsWith("/");)t=t.substring(1);const n=i+t;return Kh&&console.log("source:",o,`changed uri
4
4
  from`,t,`
@@ -142,8 +142,8 @@ Open this page to get the console: `+t.toString())}const o=exports.DeviceUtiliti
142
142
  #__vconsole .vc-mask {
143
143
  overflow: hidden;
144
144
  }
145
- `,vi==null||vi.prepend(i),o===!0&&Hm()<=0&&L0(),console.log("🌵 Debug console has loaded")}},t.onerror=()=>{console.warn("🌵 Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Rl=!1,qt=null},t.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(t)}function aC(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","🌵 Inspect glTF"),t=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(e){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const l=location.protocol+"//"+location.host+location.pathname+"/"+n,c=encodeURIComponent(l);o.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';e(h)}),o.on("show",function(){const e=t();e&&e.src!==o.fullUrl&&(e.src=o.fullUrl)}),o.on("hide",function(){const e=t();e&&(e.src="")}),o.on("addTopBar",function(e){var i=new Array;i.push({name:"Open in new window ↗",onClick:function(n){window.open(o.fullUrl,"_blank"),qt==null||qt.hide()}}),i.push({name:"Reload",onClick:function(n){const s=t();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=t();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),e(i)}),o}function lC(){const o=document.querySelector("#__vconsole .vc-switch");return o||null}function cC(){const o=document.querySelector("#__vconsole");return o||null}const j0=S("debugdefines");To('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";');To('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');To('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');To('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');To('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.2-alpha";');To('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');To('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Aug 01 2025 15:29:25 GMT+0000 (Coordinated Universal Time)";');To('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const _n="4.7.2-alpha",Fu="undefined",tg="Fri Aug 01 2025 15:29:25 GMT+0000 (Coordinated Universal Time)";j0&&console.log(`Engine version: ${_n} (generator: ${Fu})
146
- Project built at ${tg}`);const ba=NEEDLE_PUBLIC_KEY,Ts="needle_isActiveInHierarchy",er="builtin_components",cc="needle_editor_guid";function To(o){try{(0,eval)(o)}catch(t){j0&&console.error(t)}}let B0,m_=null;function bn(){return B0}function ig(o){if(o==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}m_!==o&&(m_=o,B0=new o)}const Si=Symbol("shadowDomOwner"),hC=S("debugpatch");function Uu(o,t,e,i){const n=hC===t;if(!e&&!i)return;const s=t+"___needle";uC(o,t,e,i);const a=Object.getOwnPropertyDescriptor(o,t),l=o[t];n&&console.log("Patch",o.constructor.name,t,a,l),a?(n&&console.log("Apply patch with existing descriptor",o.constructor.name,t,a),typeof a.value=="function"&&(o[t]=y_(a.value,o,t))):(n&&console.log("Create patch with new property",o.constructor.name,t,a),Object.defineProperty(o,t,{set:function(c){if(typeof c=="function")this[s]=y_(c,o,t);else{const h=this[s];F0(o,t,this,h,c),this[s]=c,U0(o,t,this,h,c)}},get:function(){const c=this[s];return typeof c=="function"&&c[s]?c[s]:c}}))}function dC(o,t,e){const i=ng(o,t);if(i)for(let n=i.length-1;n>=0;n--){const s=i[n];s.prefix===e&&(s.prefix=null),s.postfix===e&&(s.postfix=null),!s.prefix&&!s.postfix&&i.splice(n,1)}}const g_=Symbol("Needle:Patches:WrappedFunction");function y_(o,t,e){if(o[g_])return o;const i=function(...n){F0(t,e,this,...n);const s=o.apply(this,n);return U0(t,e,this,s,...n),s};return i[g_]=!0,i}const Rd="Needle:Patches";function im(){return globalThis[Rd]||(globalThis[Rd]=new WeakMap),globalThis[Rd]}function ng(o,t){const e=im().get(o);return e?e.get(t):null}function uC(o,t,e,i){let n=im().get(o);n||(n=new Map,im().set(o,n));let s=n.get(t);s||(s=[],n.set(t,s)),s.push({prefix:e,postfix:i})}function F0(o,t,e,...i){var s;if(!e)return;const n=ng(o,t);if(n)for(const a of n)(s=a.prefix)==null||s.call(e,...i)}function U0(o,t,e,i,...n){var a;if(!e)return;const s=ng(o,t);if(s)for(const l of s)(a=l.postfix)==null||a.call(e,i,...n)}const $a=[];function zu(o){$a.indexOf(o)===-1&&$a.push(o)}function fC(o){const t=$a.indexOf(o);t!==-1&&$a.splice(t,1)}const Va=[];function sg(o){Va.indexOf(o)===-1&&Va.push(o)}function pC(o){const t=Va.indexOf(o);t!==-1&&Va.splice(t,1)}function z0(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-start",{detail:o}));for(let t=0;t<$a.length;t++)$a[t](o)}function N0(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-end",{detail:o}));for(let t=0;t<Va.length;t++)Va[t](o)}const et=S("debuginput");var Nu=(o=>(o.Mouse="mouse",o.Touch="touch",o.Controller="controller",o.Hand="hand",o))(Nu||{}),Re=(o=>(o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerMove="pointermove",o.KeyDown="keydown",o.KeyUp="keyup",o.KeyPressed="keypress",o))(Re||{});class _s extends PointerEvent{constructor(e,i,n){super(e,n);r(this,"clientZ");r(this,"deviceIndex");r(this,"origin");r(this,"source");r(this,"mode");r(this,"_ray");r(this,"space");r(this,"isClick",!1);r(this,"isDoubleClick",!1);r(this,"_used",!1);r(this,"_pointerid");r(this,"_pointerType");r(this,"_type");r(this,"metadata",{});r(this,"intersections",new Array);r(this,"_immediatePropagationStopped",!1);r(this,"_propagationStopped",!1);this.clientZ=n.clientZ,this._pointerid=n.pointerId,this._pointerType=n.pointerType,this._type=e,this.deviceIndex=n.deviceIndex,this.origin=n.origin,this.source=i,this.mode=n.mode,this._ray=n.ray,this.space=n.device}get isSpatial(){return this.mode!="screen"}get ray(){return this._ray||(this._ray=new d.Ray(this.space.worldPosition.clone(),this.space.worldForward.clone())),this._ray}set ray(e){this._ray=e}get hasRay(){return this._ray!==void 0}get used(){return this._used}use(){this._used=!0}get pointerId(){return this._pointerid}get pointerType(){return this._pointerType}get type(){return this._type}get immediatePropagationStopped(){return this._immediatePropagationStopped}get propagationStopped(){return this._immediatePropagationStopped||this._propagationStopped}stopImmediatePropagation(){var e;this._immediatePropagationStopped=!0,super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}stopPropagation(){var e;this._propagationStopped=!0,super.stopPropagation(),(e=this.source)==null||e.stopPropagation(),et&&console.warn("Stop propagation...",this.pointerId,this.pointerType)}}class Xl extends KeyboardEvent{constructor(e,i,n){super(e,n);r(this,"source");this.source=i}stopImmediatePropagation(){var e;super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}}class mC{constructor(t){r(this,"key");r(this,"keyType");r(this,"source");this.key=t.key,this.keyType=t.type,this.source=t}}var oi=(o=>(o[o.Early=-100]="Early",o[o.Default=0]="Default",o[o.Late=100]="Late",o))(oi||{});class $0{constructor(t){r(this,"_eventListeners",{});r(this,"_doubleClickTimeThreshold",.2);r(this,"_longPressTimeThreshold",1);r(this,"_setCursorTypes",[]);r(this,"context");r(this,"_pointerDown",[!1]);r(this,"_pointerUp",[!1]);r(this,"_pointerClick",[!1]);r(this,"_pointerDoubleClick",[!1]);r(this,"_pointerPressed",[!1]);r(this,"_pointerPositions",[new d.Vector2]);r(this,"_pointerPositionsLastFrame",[new d.Vector2]);r(this,"_pointerPositionsDelta",[new d.Vector2]);r(this,"_pointerPositionsRC",[new d.Vector2]);r(this,"_pointerPositionDown",[new d.Vector3]);r(this,"_pointerDownTime",[]);r(this,"_pointerUpTime",[]);r(this,"_pointerUpTimestamp",[]);r(this,"_pointerIds",[]);r(this,"_pointerTypes",[""]);r(this,"_mouseWheelChanged",[!1]);r(this,"_mouseWheelDeltaY",[0]);r(this,"_pointerEvent",[]);r(this,"_pointerEventsPressed",[]);r(this,"_pointerSpace",[]);r(this,"_pressedStack",new Map);r(this,"_htmlEventSource");r(this,"onLostFocus",()=>{for(const t in this.keysPressed)this.keysPressed[t].pressed=!1});r(this,"_receivedPointerMoveEventsThisFrame",new Array);r(this,"onEndOfFrame",()=>{this._receivedPointerMoveEventsThisFrame.length=0;for(let t=0;t<this._pointerUp.length;t++)this._pointerUp[t]=!1;for(let t=0;t<this._pointerDown.length;t++)this._pointerDown[t]=!1;for(let t=0;t<this._pointerClick.length;t++)this._pointerClick[t]=!1;for(let t=0;t<this._pointerDoubleClick.length;t++)this._pointerDoubleClick[t]=!1;for(const t of this._pointerPositionsDelta)t.set(0,0);for(let t=0;t<this._mouseWheelChanged.length;t++)this._mouseWheelChanged[t]=!1;for(let t=0;t<this._mouseWheelDeltaY.length;t++)this._mouseWheelDeltaY[t]=0});r(this,"onContextMenu",t=>{this.canReceiveInput(t)!==!1&&t instanceof PointerEvent&&t.pointerType});r(this,"keysPressed",{});r(this,"onKeyDown",t=>{if(et&&console.log(`key down ${t.code}, ${this.context.application.hasFocus}`,t),!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(e&&e.pressed)return;this.keysPressed[t.code]={pressed:!0,frame:this.context.time.frameCount+1,startFrame:this.context.time.frameCount+1,key:t.key,code:t.code};const i=new Xl("keydown",t,t);this.onDispatchEvent(i)});r(this,"onKeyPressed",t=>{if(!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(!e)return;e.pressed=!0,e.frame=this.context.time.frameCount+1;const i=new Xl("keypress",t,t);this.onDispatchEvent(i)});r(this,"onKeyUp",t=>{if(!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(!e)return;e.pressed=!1,e.frame=this.context.time.frameCount+1;const i=new Xl("keyup",t,t);this.onDispatchEvent(i)});r(this,"onWheelWindow",t=>{document.pointerLockElement&&this.onMouseWheel(t)});r(this,"onMouseWheel",t=>{if(this.canReceiveInput(t)===!1)return;this._mouseWheelDeltaY.length<=0&&this._mouseWheelDeltaY.push(0),this._mouseWheelChanged.length<=0&&this._mouseWheelChanged.push(!1),this._mouseWheelChanged[0]=!0;const e=this._mouseWheelDeltaY[0];this._mouseWheelDeltaY[0]=e+t.deltaY});r(this,"onPointerDown",t=>{if(this.context.isInAR||this.canReceiveInput(t)===!1)return;t.target instanceof HTMLElement&&t.target.setPointerCapture(t.pointerId);const e=this.getPointerId(t);et&&Ee(`pointer down #${e}, identifier:${t.pointerId}`);const i=this.getAndUpdateSpatialObjectForScreenPosition(e,t.clientX,t.clientY),n=new _s("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:e,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:i,pressure:t.pressure});this.onDown(n)});r(this,"onPointerMove",t=>{if(this.context.isInAR||this._receivedPointerMoveEventsThisFrame.includes(t.pointerId))return;this._receivedPointerMoveEventsThisFrame.push(t.pointerId);let e=t.button;t.pointerType==="mouse"&&(e=this.getFirstPressedButtonForPointer(0)??0);const i=this.getPointerId(t,e);e===-1&&(e=i);const n=this.getAndUpdateSpatialObjectForScreenPosition(i,t.clientX,t.clientY),s=new _s("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:i,button:e,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:n,pressure:t.pressure});this.onMove(s)});r(this,"onPointerCancel",t=>{this.context.isInAR||(et&&console.log("Pointer cancel",t),this.onPointerUp(t))});r(this,"onPointerUp",t=>{if(this.context.isInAR)return;t.target instanceof HTMLElement&&t.target.releasePointerCapture(t.pointerId);const e=this.getPointerId(t),i=new _s("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:e,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:this.getAndUpdateSpatialObjectForScreenPosition(e,t.clientX,t.clientY),pressure:t.pressure});this.onUp(i),this._pointerIds[e]=-1,et&&console.log("ID="+e,"PointerId="+t.pointerId,"ALL:",[...this._pointerIds])});r(this,"onTouchStart",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),a=new _s("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onDown(a)}});r(this,"onTouchMove",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),a=new _s("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onMove(a)}});r(this,"onTouchEnd",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=new _s("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),pressure:i.force});this.onUp(s),this._pointerIds[n]=-1}});r(this,"tempNearPlaneVector",new d.Vector3);r(this,"tempFarPlaneVector",new d.Vector3);r(this,"tempLookMatrix",new d.Matrix4);this.context=t,this.context.post_render_callbacks.push(this.onEndOfFrame)}addEventListener(t,e,i){if(this._eventListeners[t]||(this._eventListeners[t]=[]),!e||typeof e!="function"){console.error("Invalid call to addEventListener: callback is required and must be a function!");return}i?i={...i}:i={};let n=0;(i==null?void 0:i.queue)!=null&&(n=i.queue);const s=this._eventListeners[t],a=s.find(l=>l.priority===n);a?a.listeners.push({callback:e,options:i}):(s.push({priority:n,listeners:[{callback:e,options:i}]}),s.sort((l,c)=>l.priority-c.priority))}removeEventListener(t,e,i){if(!this._eventListeners[t]||!e)return;const n=this._eventListeners[t];if((i==null?void 0:i.queue)!=null){const s=n.find(l=>l.priority===i.queue);if(!s)return;const a=s.listeners.findIndex(l=>l.callback===e);a>=0&&s.listeners.splice(a,1)}else for(const s of n){const a=s.listeners.findIndex(l=>l.callback===e);a>=0&&s.listeners.splice(a,1)}}dispatchEvent(t){var i,n,s,a;let e=!1;if(t instanceof Xl){const l=this._eventListeners[t.type];if(l)for(const c of l)for(let h=0;h<c.listeners.length;h++){const u=c.listeners[h];if((n=(i=u.options)==null?void 0:i.signal)!=null&&n.aborted){c.listeners.splice(h,1),h--;continue}u.options.once&&(c.listeners.splice(h,1),h--),u.callback(t)}}if(t instanceof _s){const l=this._eventListeners[t.type];if(l)for(const c of l){if(e)break;for(let h=0;h<c.listeners.length;h++){const u=c.listeners[h];if((a=(s=u.options)==null?void 0:s.signal)!=null&&a.aborted){c.listeners.splice(h,1),h--;continue}if(t.immediatePropagationStopped){e=!0,et&&console.log("immediatePropagationStopped",t.type);break}else t.propagationStopped&&(e=!0,et&&console.log("propagationStopped",t.type));u.options.once&&(c.listeners.splice(h,1),h--),u.callback(t)}}}}get mousePosition(){return this._pointerPositions[0]}get mousePositionRC(){return this._pointerPositionsRC[0]}get mouseDown(){return this._pointerDown[0]}get mouseUp(){return this._pointerUp[0]}get mouseClick(){return this._pointerClick[0]}get mouseDoubleClick(){return this._pointerDoubleClick[0]}get mousePressed(){return this._pointerPressed[0]}get mouseWheelChanged(){return this.getMouseWheelChanged(0)}get click(){return this._pointerClick[0]}get doubleClick(){return this._pointerDoubleClick[0]}getGamepad(t=0){return typeof navigator<"u"&&"getGamepads"in navigator&&navigator.getGamepads()[t]||null}setCursorPointer(){this.setCursor("pointer")}setCursorNormal(){this.unsetCursor("pointer")}setCursor(t){this._setCursorTypes.push(t),this._setCursorTypes.length>10&&this._setCursorTypes.shift(),this.updateCursor()}unsetCursor(t){for(let e=this._setCursorTypes.length-1;e>=0;e--)if(this._setCursorTypes[e]===t){this._setCursorTypes.splice(e,1),this.updateCursor();break}}updateCursor(){var t;((t=this._setCursorTypes)==null?void 0:t.length)==0?this.context.domElement.style.cursor="default":this.context.domElement.style.cursor=this._setCursorTypes[this._setCursorTypes.length-1]}getIsPointerIdInUse(t){for(const e of this._pointerEventsPressed)if(e.pointerId===t&&e.used)return!0;return!1}getPointerPressedCount(){let t=0;for(let e=0;e<this._pointerPressed.length;e++)this._pointerPressed[e]&&t++;return t}getPointerPosition(t){return t>=this._pointerPositions.length?null:this._pointerPositions[t]}getPointerPositionLastFrame(t){return t>=this._pointerPositionsLastFrame.length?null:this._pointerPositionsLastFrame[t]}getPointerPositionDelta(t){return t>=this._pointerPositionsDelta.length?null:this._pointerPositionsDelta[t]}getPointerPositionRC(t){return t>=this._pointerPositionsRC.length?null:this._pointerPositionsRC[t]}getPointerDown(t){return t>=this._pointerDown.length?!1:this._pointerDown[t]}getPointerUp(t){return t>=this._pointerUp.length?!1:this._pointerUp[t]}getPointerPressed(t){return t>=this._pointerPressed.length?!1:this._pointerPressed[t]}getPointerClicked(t){return t>=this._pointerClick.length?!1:this._pointerClick[t]}getPointerDoubleClicked(t){return t>=this._pointerDoubleClick.length?!1:this._pointerDoubleClick[t]}getPointerDownTime(t){return t>=this._pointerDownTime.length?-1:this._pointerDownTime[t]}getPointerUpTime(t){return t>=this._pointerUpTime.length?-1:this._pointerUpTime[t]}getPointerLongPress(t){return t>=this._pointerDownTime.length?!1:this.getPointerPressed(t)&&this.context.time.time-this._pointerDownTime[t]>this._longPressTimeThreshold}getIsMouse(t){return t<0||t>=this._pointerTypes.length?!1:this._pointerTypes[t]==="mouse"}getIsTouch(t){return t<0||t>=this._pointerTypes.length?!1:this._pointerTypes[t]==="touch"}getTouchesPressedCount(){let t=0;for(let e=0;e<this._pointerPressed.length;e++)this._pointerPressed[e]&&this.getIsTouch(e)&&t++;return t}getMouseWheelChanged(t=0){return t>=this._mouseWheelChanged.length?!1:this._mouseWheelChanged[t]}getMouseWheelDeltaY(t=0){return t>=this._mouseWheelDeltaY.length?0:this._mouseWheelDeltaY[t]}getPointerEvent(t){if(!(t>=this._pointerEvent.length))return this._pointerEvent[t]??void 0}*foreachPointerId(t){for(let e=0;e<this._pointerTypes.length;e++)if(this._pointerIsActive(e)){if(t!==void 0){const i=this._pointerTypes[e];if(Array.isArray(t)){let n=!1;for(const s of t)if(i===s){n=!0;break}if(!n)continue}else if(t!==i)continue}yield e}}*foreachTouchId(){for(let t=0;t<this._pointerTypes.length;t++)this._pointerTypes[t]==="touch"&&this._pointerIsActive[t]&&(yield t)}_pointerIsActive(t){return t<0?!1:this._pointerPressed[t]||this._pointerDown[t]||this._pointerUp[t]}onDownButton(t,e){let i=this._pressedStack.get(t);i||(i=[],this._pressedStack.set(t,i)),i.push(e)}onReleaseButton(t,e){const i=this._pressedStack.get(t);if(!i)return;const n=i.indexOf(e);n>=0&&i.splice(n,1)}getFirstPressedButtonForPointer(t){const e=this._pressedStack.get(t);if(e)return e[0]}getLatestPressedButtonForPointer(t){const e=this._pressedStack.get(t);if(e)return e[e.length-1]}getKeyDown(t){if(t!==void 0)return this.isKeyDown(t);for(const e in this.keysPressed){const i=this.keysPressed[e];if(i.startFrame===this.context.time.frameCount)return i.key}return null}getKeyPressed(t){if(t!==void 0)return this.isKeyPressed(t);for(const e in this.keysPressed){const i=this.keysPressed[e];if(i.pressed)return i.key}return null}getKeyUp(t){if(t!==void 0)return this.isKeyUp(t);for(const e in this.keysPressed){const i=this.keysPressed[e];return i.pressed===!1&&i.frame===this.context.time.frameCount}return null}isKeyDown(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyDown(n))return!0;return!1}const i=this.keysPressed[t];return i?i.startFrame===this.context.time.frameCount&&i.pressed:!1}isKeyUp(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyUp(n))return!0;return!1}const i=this.keysPressed[t];return i?i.frame===this.context.time.frameCount&&i.pressed===!1:!1}isKeyPressed(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyPressed(n))return!0;return!1}const i=this.keysPressed[t];return i&&i.pressed||!1}getCodeForCommonKeyName(t){if(t.length===1){if(t>="0"&&t<="9")return["Digit"+t];if(t>="a"&&t<="z")return["Key"+t.toUpperCase()];if(t==" ")return["Space"]}switch(t){case"shift":case"Shift":return["ShiftLeft","ShiftRight"];case"control":case"Control":return["ControlLeft","ControlRight"];case"alt":case"Alt":return["AltLeft","AltRight"]}return null}createInputEvent(t){switch(t.type){case"pointerdown":et&&Ee("Create Pointer down"),this.onDownButton(t.deviceIndex,t.button),this.onDown(t);break;case"pointermove":et&&Ee("Create Pointer move"),this.onMove(t);break;case"pointerup":et&&Ee("Create Pointer up"),this.onUp(t),this.onReleaseButton(t.deviceIndex,t.button);break}}convertScreenspaceToRaycastSpace(t){return t.x=(t.x-this.context.domX)/this.context.domWidth*2-1,t.y=-((t.y-this.context.domY)/this.context.domHeight)*2+1,t}bindEvents(){this.unbindEvents(),this._htmlEventSource=this.context.renderer.domElement,window.addEventListener("contextmenu",this.onContextMenu),this._htmlEventSource.addEventListener("pointerdown",this.onPointerDown,{passive:!0}),window.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),window.addEventListener("pointerup",this.onPointerUp,{passive:!0}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!0}),window.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this._htmlEventSource.addEventListener("wheel",this.onMouseWheel,{passive:!0}),window.addEventListener("wheel",this.onWheelWindow,{passive:!0}),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keypress",this.onKeyPressed,!1),window.addEventListener("keyup",this.onKeyUp,!1),window.addEventListener("blur",this.onLostFocus)}unbindEvents(){var t,e;for(const i in this._eventListeners)this._eventListeners[i].length=0;window.removeEventListener("contextmenu",this.onContextMenu),(t=this._htmlEventSource)==null||t.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel),window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),(e=this._htmlEventSource)==null||e.removeEventListener("wheel",this.onMouseWheel,!1),window.removeEventListener("wheel",this.onWheelWindow,!1),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keypress",this.onKeyPressed,!1),window.removeEventListener("keyup",this.onKeyUp,!1),window.removeEventListener("blur",this.onLostFocus)}dispose(){const t=this.context.post_render_callbacks.indexOf(this.onEndOfFrame);t>=0&&this.context.post_render_callbacks.splice(t,1),this.unbindEvents()}canReceiveInput(t){var e;return t.target===((e=this.context.renderer)==null?void 0:e.domElement)||t.target===this.context.domElement||this.context.isInAR||this.context.isInAR&&t.target===document.body&&exports.DeviceUtilities.isMozillaXR()?!0:(et&&console.warn("CanReceiveInput:False for",t.target),!1)}getPointerId(t,e){return t.pointerType==="mouse"?0+(e??t.button):this.getPointerIndex(t.pointerId)}getButtonName(t){const e=t.button;if(t.pointerType==="mouse")switch(e){case 0:return"left";case 1:return"middle";case 2:return"right"}return"unknown"}getAndUpdateSpatialObjectForScreenPosition(t,e,i){let n=this._pointerSpace[t];n||(n=new d.Object3D,this._pointerSpace[t]=n),this._pointerSpace[t]=n;const s=this.context.mainCamera;if(s){const a=this.tempNearPlaneVector.set(e,i,-1);this.convertScreenspaceToRaycastSpace(a);const l=this.tempFarPlaneVector.set(a.x,a.y,1);a.unproject(s),l.unproject(s);const c=s.worldUp||V(0,1,0).applyQuaternion(_e(s));this.tempLookMatrix.lookAt(l,a,c),n.position.set(a.x,a.y,a.z),n.quaternion.setFromRotationMatrix(this.tempLookMatrix)}return n}isInRect(t){if(this.context.isInXR)return!0;const e=this.context.domElement.getBoundingClientRect(),i=t.clientX,n=t.clientY,s=i>=e.x&&i<=e.right&&n>=e.y&&n<=e.bottom;return et&&!s&&console.log("Not in rect",e,i,n),s}onDown(t){const e=t.pointerId;if(this.getPointerPressed(e)&&console.warn(`Received pointerDown for pointerId that is already pressed: ${e}`,et?t:""),et&&console.log(t.pointerType,"DOWN",e),!!this.isInRect(t)){for(this.setPointerState(e,this._pointerPressed,!0),this.setPointerState(e,this._pointerDown,!0),this.setPointerStateT(e,this._pointerEvent,t.source);e>=this._pointerTypes.length;)this._pointerTypes.push(t.pointerType);for(this._pointerTypes[e]=t.pointerType;e>=this._pointerPositionDown.length;)this._pointerPositionDown.push(new d.Vector3);for(this._pointerPositionDown[e].set(t.clientX,t.clientY,t.clientZ??0);e>=this._pointerPositions.length;)this._pointerPositions.push(new d.Vector2);this._pointerPositions[e].set(t.clientX,t.clientY),e>=this._pointerDownTime.length&&this._pointerDownTime.push(0),this._pointerDownTime[e]=this.context.time.realtimeSinceStartup,this.updatePointerPosition(t),this._pointerEventsPressed.push(t),this.onDispatchEvent(t)}}onMove(t){const e=t.pointerId,i=this.getPointerPressed(e);i===!1&&!this.isInRect(t)||t.pointerType==="touch"&&!i||(this.updatePointerPosition(t),this.setPointerStateT(e,this._pointerEvent,t.source),this.onDispatchEvent(t))}onUp(t){const e=t.pointerId;if(!this.getPointerPressed(e)){et&&console.log(t.pointerType,"UP",e,"was not down");return}et&&console.log(t.pointerType,"UP",e),this.setPointerState(e,this._pointerPressed,!1),this.setPointerStateT(e,this._pointerEvent,t.source),this.setPointerState(e,this._pointerUp,!0),this.updatePointerPosition(t);for(let c=this._pointerEventsPressed.length-1;c>=0;c--)if(this._pointerEventsPressed[c].pointerId===e){this._pointerEventsPressed.splice(c,1);break}if(!this._pointerPositionDown[e]){et&&me("Received pointer up event without matching down event for button: "+e),console.warn("Received pointer up event without matching down event for button: "+e);return}const n=this._pointerUpTime[e],s=this._pointerDownTime[e],a=this.context.time.realtimeSinceStartup,l=a-s;if(e>=this._pointerUpTime.length&&this._pointerUpTime.push(-99),this._pointerUpTime[e]=a,l<1){let c=t.clientX-this._pointerPositionDown[e].x,h=t.clientY-this._pointerPositionDown[e].y,u=0;if(t.isSpatial&&t.clientZ!=null&&(u=t.clientZ-this._pointerPositionDown[e].z,c*=200,h*=200,u*=200),Math.abs(c)<5&&Math.abs(h)<5&&Math.abs(u)<5){this.setPointerState(e,this._pointerClick,!0),t.isClick=!0;const f=a-n;et&&console.log("CLICK",e,c,h,u,f),f<this._doubleClickTimeThreshold&&f>0&&(this.setPointerState(e,this._pointerDoubleClick,!0),t.isDoubleClick=!0)}}this.onDispatchEvent(t)}updatePointerPosition(t){const e=t.pointerId;for(;e>=this._pointerPositions.length;)this._pointerPositions.push(new d.Vector2);for(;e>=this._pointerPositionsLastFrame.length;)this._pointerPositionsLastFrame.push(new d.Vector2);for(;e>=this._pointerPositionsDelta.length;)this._pointerPositionsDelta.push(new d.Vector2);const i=this._pointerPositionsLastFrame[e];i.copy(this._pointerPositions[e]);const n=this._pointerPositionsDelta[e];let s=t.clientX-i.x,a=t.clientY-i.y;if(t.source instanceof MouseEvent||t.source instanceof TouchEvent){const u=t.source;s===0&&u.movementX!==0&&(s=u.movementX||0),a===0&&u.movementY!==0&&(a=u.movementY||0)}n.x+=s,n.y+=a,this._pointerPositions[e].x=t.clientX,this._pointerPositions[e].y=t.clientY;const l=t.clientX,c=t.clientY;for(;e>=this._pointerPositionsRC.length;)this._pointerPositionsRC.push(new d.Vector2);const h=this._pointerPositionsRC[e];h.set(l,c),this.convertScreenspaceToRaycastSpace(h)}getPointerIndex(t){let e=-1;for(let i=0;i<this._pointerIds.length;i++){if(this._pointerIds[i]===t)return i;e===-1&&this._pointerIds[i]===-1&&(e=i)}return e!==-1?(this._pointerIds[e]=t,e):(et&&console.log("PUSH pointerId:",t),this._pointerIds.push(t),this._pointerIds.length-1)}setPointerState(t,e,i){e[t]=i}setPointerStateT(t,e,i){return e[t]=i,i}onDispatchEvent(t){const e=X.Current;try{X.Current=this.context,this.dispatchEvent(t)}finally{X.Current=e}}}const Aa=new d.Matrix4().makeRotationY(Math.PI),Ni=new d.Quaternion().setFromAxisAngle(new d.Vector3(0,1,0),Math.PI),gC=S("debugwebxr");class yC{constructor(){r(this,"priority",-1e5);r(this,"gameObject");if(this.gameObject=new d.Object3D,this.gameObject.name="Implicit XR Rig",gC){const t=dg(16733661);t.position.y+=.5,this.gameObject.add(t)}}isXRRig(){return!0}get isActive(){return this.gameObject.visible}}const ds=S("debugwebxr"),Jh=S("debugcustomgesture"),_C="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",bC="generic-trigger",vC=new d.Quaternion().setFromEuler(new d.Euler(d.MathUtils.degToRad(0),d.MathUtils.degToRad(-90),d.MathUtils.degToRad(-90))),wC=new d.Vector3(.04,-.04,0);class og{constructor(t,e,i){r(this,"xr");r(this,"inputSource");r(this,"index",0);r(this,"emitEvents",!0);r(this,"_connected",!0);r(this,"_isTracking",!1);r(this,"__gamepad");r(this,"__hand");r(this,"__side");r(this,"_hitTestSource");r(this,"_hasSelectEvent",!1);r(this,"_isMxInk",!1);r(this,"_isMetaQuestTouchController",!1);r(this,"_handJointPoses",new Map);r(this,"_gripMatrix",new d.Matrix4);r(this,"_gripPosition",new d.Vector3);r(this,"_gripQuaternion",new d.Quaternion);r(this,"_linearVelocity",new d.Vector3);r(this,"_rayPositionRaw",new d.Vector3);r(this,"_rayRotationRaw",new d.Quaternion);r(this,"_rayMatrix",new d.Matrix4);r(this,"_rayPosition",new d.Vector3);r(this,"_rayQuaternion",new d.Quaternion);r(this,"_gripWorldPosition",new d.Vector3);r(this,"_gripWorldQuaternion",new d.Quaternion);r(this,"_rayWorldPosition",new d.Vector3);r(this,"_rayWorldQuaternion",new d.Quaternion);r(this,"_pinchPosition",new d.Vector3);r(this,"_ray");r(this,"_hand_wristDotUp");r(this,"_object");r(this,"_gripSpaceObject");r(this,"_raySpaceObject");r(this,"model",null);r(this,"_debugAxesHelper",new d.AxesHelper(.15));r(this,"_debugGripAxesHelper",new d.AxesHelper(.07));r(this,"_debugRayAxesHelper",new d.AxesHelper(.07));r(this,"_hitTestSourcePromise",null);r(this,"onPointerHits",t=>{});r(this,"_needleGamepadButtons",{});r(this,"_buttonMap",new Map);r(this,"_motioncontroller");r(this,"_layout");r(this,"getMotionController");r(this,"emitPointerDownEvent",!0);r(this,"emitPointerUpEvent",!0);r(this,"emitPointerMoveEvent",!0);r(this,"pointerMoveDistanceThreshold",.03);r(this,"pointerMoveAngleThreshold",.05);r(this,"_selectButtonIndex");r(this,"_squeezeButtonIndex");r(this,"onSelectStart",t=>{var n,s,a,l;if(!this.emitPointerDownEvent||this.inputSource!==t.inputSource)return;this.onUpdateFrame(t.frame),this._hasSelectEvent=!0;const e=(n=this._layout)==null?void 0:n.selectComponentId,i=(l=(a=(s=this._layout)==null?void 0:s.components[e])==null?void 0:a.gamepadIndices)==null?void 0:l.button;i!==void 0&&(this._selectButtonIndex=i),!Jh&&(ds&&$.DrawDirection(this.rayWorldPosition,V(0,.01,1).applyQuaternion(this.rayWorldQuaternion),16711680,10),this.emitPointerEvent(Re.PointerDown,this._selectButtonIndex||0,"xr-standard-trigger",!0,t))});r(this,"onSelectEnd",t=>{this.emitPointerUpEvent&&(Jh||this.inputSource===t.inputSource&&this.emitPointerEvent(Re.PointerUp,this._selectButtonIndex||0,"xr-standard-trigger",!0,t))});r(this,"onSequeezeStart",t=>{var e,i,n;this.emitPointerDownEvent&&this.inputSource===t.inputSource&&(this._squeezeButtonIndex=(n=(i=(e=this._layout)==null?void 0:e.components["xr-standard-squeeze"])==null?void 0:i.gamepadIndices)==null?void 0:n.button,this._squeezeButtonIndex!==void 0&&(ds&&$.DrawDirection(this.rayWorldPosition,V(0,.01,1).applyQuaternion(this.rayWorldQuaternion),255,10),this.emitPointerEvent(Re.PointerDown,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,t)))});r(this,"onSequeezeEnd",t=>{this.emitPointerUpEvent&&this.inputSource===t.inputSource&&this._squeezeButtonIndex!==void 0&&this.emitPointerEvent(Re.PointerUp,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,t)});r(this,"states",{});r(this,"_didMoveLastFrame",!1);r(this,"_lastPointerMovePosition",new d.Vector3);r(this,"_lastPointerMoveQuaternion",new d.Quaternion);r(this,"pointerInit");this.xr=t,this.inputSource=e,this.index=i,this._object=new d.Object3D,this._object.name=`NeedleXRController_${i}`,ds&&(this._object.add(this._debugAxesHelper),this._gripSpaceObject=new d.Object3D,this._raySpaceObject=new d.Object3D,this._gripSpaceObject.name=`NeedleXRController_${i}_gripSpace`,this._raySpaceObject.name=`NeedleXRController_${i}_raySpace`,this._gripSpaceObject.add(this._debugGripAxesHelper),this._raySpaceObject.add(this._debugRayAxesHelper),this.xr.context.scene.add(this._gripSpaceObject),this.xr.context.scene.add(this._raySpaceObject)),this.xr.context.scene.add(this._object),this._ray=new d.Ray,this.pointerInit={origin:this,pointerType:this.hand?"hand":"controller",deviceIndex:this.index,pointerId:-1,mode:this.inputSource.targetRayMode,ray:this._ray,device:this._object,buttonName:"none"},this.initialize(),this.subscribeEvents()}get context(){return this.xr.context}get connected(){return this._connected}get isTracking(){return this._isTracking}get gamepad(){return this.__gamepad??(this.__gamepad=this.inputSource.gamepad)}get isHand(){return this.hand!=null}get hand(){return this.__hand??(this.__hand=this.inputSource.hand)}get handObject(){return this.context.renderer.xr.getHand(this.index)}get profiles(){return this.inputSource.profiles}get layout(){return this._layout}get targetRayMode(){return this.inputSource.targetRayMode}get targetRaySpace(){return this.inputSource.targetRaySpace}get gripSpace(){return this.inputSource.gripSpace}get side(){return this.__side??(this.__side=this.inputSource.handedness)}get isRight(){return this.side==="right"}get isLeft(){return this.side==="left"}get isStylus(){return this._isMxInk}getHitTestSource(){return this._hitTestSource||this._requestHitTestSource(),this._hitTestSource}get hasHitTestSource(){return this._hitTestSource}cancelHitTestSource(){this._hitTestSource&&(this._hitTestSource.cancel(),this._hitTestSource=void 0)}get hasSelectEvent(){return this._hasSelectEvent}getHitTest(){return this.xr.getHitTest(this)}getHandJointPose(t,e){var n;if(e=e||this.xr.frame,!this.hand||!(e!=null&&e.getJointPose)||!this.xr.referenceSpace)return null;let i=(n=this._handJointPoses)==null?void 0:n.get(t);return i||(i=e.getJointPose(t,this.xr.referenceSpace),i&&this._handJointPoses.set(t,i),i)}get gripPosition(){return V(this._gripPosition)}get gripQuaternion(){return un(this._gripQuaternion)}get gripMatrix(){return this._gripMatrix}get gripLinearVelocity(){return V(this._linearVelocity).applyQuaternion(Ni)}get rayPosition(){return V(this._rayPosition)}get rayQuaternion(){return un(this._rayQuaternion)}get gripWorldPosition(){return V(this._gripWorldPosition)}get gripWorldQuaternion(){return un(this._gripWorldQuaternion)}get rayWorldPosition(){return V(this._rayWorldPosition)}updateRayWorldPosition(){var e;const t=(e=this.xr.context.mainCamera)==null?void 0:e.parent;this._rayWorldPosition.copy(this._rayPositionRaw),t&&this._rayWorldPosition.applyMatrix4(t.matrixWorld)}get rayWorldQuaternion(){return un(this._rayWorldQuaternion)}get pinchPosition(){return V(this._pinchPosition)}updateRayWorldQuaternion(){var i;const t=(i=this.xr.context.mainCamera)==null?void 0:i.parent,e=t?_e(t):void 0;this._rayWorldQuaternion.copy(this._rayRotationRaw).multiply(Ni),e&&this._rayWorldQuaternion.premultiply(e)}get ray(){return this._ray.origin.copy(this.rayWorldPosition),this._ray.direction.copy(V(0,0,1).applyQuaternion(this.rayWorldQuaternion)),this._ray}get handWristDotUp(){var e;if(this._hand_wristDotUp!==void 0)return this._hand_wristDotUp;const t=(e=this.handObject)==null?void 0:e.joints.wrist;if(t){const i=V(0,1,0).applyQuaternion(t.quaternion),n=V(0,1,0).dot(i);return this._hand_wristDotUp=n}}get isHandUpsideDown(){return this.handWristDotUp!==void 0?this.handWristDotUp<-.7:!1}get isTeleportGesture(){var t;return this.isHandUpsideDown&&((t=this.getGesture("pinch"))==null?void 0:t.isDown)}get object(){return this._object}async getModelUrl(){var t;return(t=this.getMotionController)==null?void 0:t.then(e=>(e==null?void 0:e.assetUrl)||null)}_requestHitTestSource(){var t;return this._hitTestSourcePromise?this._hitTestSourcePromise:this.xr.mode==="immersive-ar"&&this.inputSource.targetRayMode==="tracked-pointer"&&this.xr.session.requestHitTestSourceForTransientInput?this._hitTestSourcePromise=((t=this.xr.session.requestHitTestSourceForTransientInput({profile:this.inputSource.profiles[0],offsetRay:new XRRay}))==null?void 0:t.then(e=>(this._hitTestSourcePromise=null,this.connected?this._hitTestSource=e:(e.cancel(),null))))??null:null}onUpdate(t){this.onUpdateFrame(t),this.updateInputEvents(),this.onUpdateMove()}onRenderDebug(){var s;$.DrawSphere(this.rayWorldPosition,.003),$.DrawDirection(this.rayWorldPosition,V(0,0,10).applyQuaternion(this.rayWorldQuaternion));const e=(this.inputSource.gripSpace?this.gripWorldPosition:this.object.worldPosition).sub(this.object.worldForward.multiplyScalar(.1)),i=this.inputSource.profiles.join(`
145
+ `,vi==null||vi.prepend(i),o===!0&&Hm()<=0&&L0(),console.log("🌵 Debug console has loaded")}},t.onerror=()=>{console.warn("🌵 Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Rl=!1,qt=null},t.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(t)}function aC(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","🌵 Inspect glTF"),t=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(e){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const l=location.protocol+"//"+location.host+location.pathname+"/"+n,c=encodeURIComponent(l);o.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';e(h)}),o.on("show",function(){const e=t();e&&e.src!==o.fullUrl&&(e.src=o.fullUrl)}),o.on("hide",function(){const e=t();e&&(e.src="")}),o.on("addTopBar",function(e){var i=new Array;i.push({name:"Open in new window ↗",onClick:function(n){window.open(o.fullUrl,"_blank"),qt==null||qt.hide()}}),i.push({name:"Reload",onClick:function(n){const s=t();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=t();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),e(i)}),o}function lC(){const o=document.querySelector("#__vconsole .vc-switch");return o||null}function cC(){const o=document.querySelector("#__vconsole");return o||null}const j0=S("debugdefines");To('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";');To('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');To('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');To('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');To('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.2-alpha";');To('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');To('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Aug 01 2025 14:15:44 GMT+0000 (Coordinated Universal Time)";');To('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const _n="4.7.2-alpha",Fu="undefined",tg="Fri Aug 01 2025 14:15:44 GMT+0000 (Coordinated Universal Time)";j0&&console.log(`Engine version: ${_n} (generator: ${Fu})
146
+ Project built at ${tg}`);const ba=NEEDLE_PUBLIC_KEY,Ts="needle_isActiveInHierarchy",er="builtin_components",cc="needle_editor_guid";function To(o){try{(0,eval)(o)}catch(t){j0&&console.error(t)}}let B0,m_=null;function bn(){return B0}function ig(o){if(o==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}m_!==o&&(m_=o,B0=new o)}const Si=Symbol("shadowDomOwner"),hC=S("debugpatch");function Uu(o,t,e,i){const n=hC===t;if(!e&&!i)return;const s=t+"___needle";uC(o,t,e,i);const a=Object.getOwnPropertyDescriptor(o,t),l=o[t];n&&console.log("Patch",o.constructor.name,t,a,l),a?(n&&console.log("Apply patch with existing descriptor",o.constructor.name,t,a),typeof a.value=="function"&&(o[t]=y_(a.value,o,t))):(n&&console.log("Create patch with new property",o.constructor.name,t,a),Object.defineProperty(o,t,{set:function(c){if(typeof c=="function")this[s]=y_(c,o,t);else{const h=this[s];F0(o,t,this,h,c),this[s]=c,U0(o,t,this,h,c)}},get:function(){const c=this[s];return typeof c=="function"&&c[s]?c[s]:c}}))}function dC(o,t,e){const i=ng(o,t);if(i)for(let n=i.length-1;n>=0;n--){const s=i[n];s.prefix===e&&(s.prefix=null),s.postfix===e&&(s.postfix=null),!s.prefix&&!s.postfix&&i.splice(n,1)}}const g_=Symbol("Needle:Patches:WrappedFunction");function y_(o,t,e){if(o[g_])return o;const i=function(...n){F0(t,e,this,...n);const s=o.apply(this,n);return U0(t,e,this,s,...n),s};return i[g_]=!0,i}const Rd="Needle:Patches";function im(){return globalThis[Rd]||(globalThis[Rd]=new WeakMap),globalThis[Rd]}function ng(o,t){const e=im().get(o);return e?e.get(t):null}function uC(o,t,e,i){let n=im().get(o);n||(n=new Map,im().set(o,n));let s=n.get(t);s||(s=[],n.set(t,s)),s.push({prefix:e,postfix:i})}function F0(o,t,e,...i){var s;if(!e)return;const n=ng(o,t);if(n)for(const a of n)(s=a.prefix)==null||s.call(e,...i)}function U0(o,t,e,i,...n){var a;if(!e)return;const s=ng(o,t);if(s)for(const l of s)(a=l.postfix)==null||a.call(e,i,...n)}const $a=[];function zu(o){$a.indexOf(o)===-1&&$a.push(o)}function fC(o){const t=$a.indexOf(o);t!==-1&&$a.splice(t,1)}const Va=[];function sg(o){Va.indexOf(o)===-1&&Va.push(o)}function pC(o){const t=Va.indexOf(o);t!==-1&&Va.splice(t,1)}function z0(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-start",{detail:o}));for(let t=0;t<$a.length;t++)$a[t](o)}function N0(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-end",{detail:o}));for(let t=0;t<Va.length;t++)Va[t](o)}const et=S("debuginput");var Nu=(o=>(o.Mouse="mouse",o.Touch="touch",o.Controller="controller",o.Hand="hand",o))(Nu||{}),Re=(o=>(o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerMove="pointermove",o.KeyDown="keydown",o.KeyUp="keyup",o.KeyPressed="keypress",o))(Re||{});class _s extends PointerEvent{constructor(e,i,n){super(e,n);r(this,"clientZ");r(this,"deviceIndex");r(this,"origin");r(this,"source");r(this,"mode");r(this,"_ray");r(this,"space");r(this,"isClick",!1);r(this,"isDoubleClick",!1);r(this,"_used",!1);r(this,"_pointerid");r(this,"_pointerType");r(this,"_type");r(this,"metadata",{});r(this,"intersections",new Array);r(this,"_immediatePropagationStopped",!1);r(this,"_propagationStopped",!1);this.clientZ=n.clientZ,this._pointerid=n.pointerId,this._pointerType=n.pointerType,this._type=e,this.deviceIndex=n.deviceIndex,this.origin=n.origin,this.source=i,this.mode=n.mode,this._ray=n.ray,this.space=n.device}get isSpatial(){return this.mode!="screen"}get ray(){return this._ray||(this._ray=new d.Ray(this.space.worldPosition.clone(),this.space.worldForward.clone())),this._ray}set ray(e){this._ray=e}get hasRay(){return this._ray!==void 0}get used(){return this._used}use(){this._used=!0}get pointerId(){return this._pointerid}get pointerType(){return this._pointerType}get type(){return this._type}get immediatePropagationStopped(){return this._immediatePropagationStopped}get propagationStopped(){return this._immediatePropagationStopped||this._propagationStopped}stopImmediatePropagation(){var e;this._immediatePropagationStopped=!0,super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}stopPropagation(){var e;this._propagationStopped=!0,super.stopPropagation(),(e=this.source)==null||e.stopPropagation(),et&&console.warn("Stop propagation...",this.pointerId,this.pointerType)}}class Xl extends KeyboardEvent{constructor(e,i,n){super(e,n);r(this,"source");this.source=i}stopImmediatePropagation(){var e;super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}}class mC{constructor(t){r(this,"key");r(this,"keyType");r(this,"source");this.key=t.key,this.keyType=t.type,this.source=t}}var oi=(o=>(o[o.Early=-100]="Early",o[o.Default=0]="Default",o[o.Late=100]="Late",o))(oi||{});class $0{constructor(t){r(this,"_eventListeners",{});r(this,"_doubleClickTimeThreshold",.2);r(this,"_longPressTimeThreshold",1);r(this,"_setCursorTypes",[]);r(this,"context");r(this,"_pointerDown",[!1]);r(this,"_pointerUp",[!1]);r(this,"_pointerClick",[!1]);r(this,"_pointerDoubleClick",[!1]);r(this,"_pointerPressed",[!1]);r(this,"_pointerPositions",[new d.Vector2]);r(this,"_pointerPositionsLastFrame",[new d.Vector2]);r(this,"_pointerPositionsDelta",[new d.Vector2]);r(this,"_pointerPositionsRC",[new d.Vector2]);r(this,"_pointerPositionDown",[new d.Vector3]);r(this,"_pointerDownTime",[]);r(this,"_pointerUpTime",[]);r(this,"_pointerUpTimestamp",[]);r(this,"_pointerIds",[]);r(this,"_pointerTypes",[""]);r(this,"_mouseWheelChanged",[!1]);r(this,"_mouseWheelDeltaY",[0]);r(this,"_pointerEvent",[]);r(this,"_pointerEventsPressed",[]);r(this,"_pointerSpace",[]);r(this,"_pressedStack",new Map);r(this,"_htmlEventSource");r(this,"onLostFocus",()=>{for(const t in this.keysPressed)this.keysPressed[t].pressed=!1});r(this,"_receivedPointerMoveEventsThisFrame",new Array);r(this,"onEndOfFrame",()=>{this._receivedPointerMoveEventsThisFrame.length=0;for(let t=0;t<this._pointerUp.length;t++)this._pointerUp[t]=!1;for(let t=0;t<this._pointerDown.length;t++)this._pointerDown[t]=!1;for(let t=0;t<this._pointerClick.length;t++)this._pointerClick[t]=!1;for(let t=0;t<this._pointerDoubleClick.length;t++)this._pointerDoubleClick[t]=!1;for(const t of this._pointerPositionsDelta)t.set(0,0);for(let t=0;t<this._mouseWheelChanged.length;t++)this._mouseWheelChanged[t]=!1;for(let t=0;t<this._mouseWheelDeltaY.length;t++)this._mouseWheelDeltaY[t]=0});r(this,"onContextMenu",t=>{this.canReceiveInput(t)!==!1&&t instanceof PointerEvent&&t.pointerType});r(this,"keysPressed",{});r(this,"onKeyDown",t=>{if(et&&console.log(`key down ${t.code}, ${this.context.application.hasFocus}`,t),!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(e&&e.pressed)return;this.keysPressed[t.code]={pressed:!0,frame:this.context.time.frameCount+1,startFrame:this.context.time.frameCount+1,key:t.key,code:t.code};const i=new Xl("keydown",t,t);this.onDispatchEvent(i)});r(this,"onKeyPressed",t=>{if(!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(!e)return;e.pressed=!0,e.frame=this.context.time.frameCount+1;const i=new Xl("keypress",t,t);this.onDispatchEvent(i)});r(this,"onKeyUp",t=>{if(!this.context.application.hasFocus)return;const e=this.keysPressed[t.code];if(!e)return;e.pressed=!1,e.frame=this.context.time.frameCount+1;const i=new Xl("keyup",t,t);this.onDispatchEvent(i)});r(this,"onWheelWindow",t=>{document.pointerLockElement&&this.onMouseWheel(t)});r(this,"onMouseWheel",t=>{if(this.canReceiveInput(t)===!1)return;this._mouseWheelDeltaY.length<=0&&this._mouseWheelDeltaY.push(0),this._mouseWheelChanged.length<=0&&this._mouseWheelChanged.push(!1),this._mouseWheelChanged[0]=!0;const e=this._mouseWheelDeltaY[0];this._mouseWheelDeltaY[0]=e+t.deltaY});r(this,"onPointerDown",t=>{if(this.context.isInAR||this.canReceiveInput(t)===!1)return;t.target instanceof HTMLElement&&t.target.setPointerCapture(t.pointerId);const e=this.getPointerId(t);et&&Ee(`pointer down #${e}, identifier:${t.pointerId}`);const i=this.getAndUpdateSpatialObjectForScreenPosition(e,t.clientX,t.clientY),n=new _s("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:e,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:i,pressure:t.pressure});this.onDown(n)});r(this,"onPointerMove",t=>{if(this.context.isInAR||this._receivedPointerMoveEventsThisFrame.includes(t.pointerId))return;this._receivedPointerMoveEventsThisFrame.push(t.pointerId);let e=t.button;t.pointerType==="mouse"&&(e=this.getFirstPressedButtonForPointer(0)??0);const i=this.getPointerId(t,e);e===-1&&(e=i);const n=this.getAndUpdateSpatialObjectForScreenPosition(i,t.clientX,t.clientY),s=new _s("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:i,button:e,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:n,pressure:t.pressure});this.onMove(s)});r(this,"onPointerCancel",t=>{this.context.isInAR||(et&&console.log("Pointer cancel",t),this.onPointerUp(t))});r(this,"onPointerUp",t=>{if(this.context.isInAR)return;t.target instanceof HTMLElement&&t.target.releasePointerCapture(t.pointerId);const e=this.getPointerId(t),i=new _s("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:e,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:this.getAndUpdateSpatialObjectForScreenPosition(e,t.clientX,t.clientY),pressure:t.pressure});this.onUp(i),this._pointerIds[e]=-1,et&&console.log("ID="+e,"PointerId="+t.pointerId,"ALL:",[...this._pointerIds])});r(this,"onTouchStart",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),a=new _s("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onDown(a)}});r(this,"onTouchMove",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),a=new _s("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onMove(a)}});r(this,"onTouchEnd",t=>{if(this.context.isInAR)for(let e=0;e<t.changedTouches.length;e++){const i=t.changedTouches[e],n=this.getPointerIndex(i.identifier),s=new _s("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),pressure:i.force});this.onUp(s),this._pointerIds[n]=-1}});r(this,"tempNearPlaneVector",new d.Vector3);r(this,"tempFarPlaneVector",new d.Vector3);r(this,"tempLookMatrix",new d.Matrix4);this.context=t,this.context.post_render_callbacks.push(this.onEndOfFrame)}addEventListener(t,e,i){if(this._eventListeners[t]||(this._eventListeners[t]=[]),!e||typeof e!="function"){console.error("Invalid call to addEventListener: callback is required and must be a function!");return}i?i={...i}:i={};let n=0;(i==null?void 0:i.queue)!=null&&(n=i.queue);const s=this._eventListeners[t],a=s.find(l=>l.priority===n);a?a.listeners.push({callback:e,options:i}):(s.push({priority:n,listeners:[{callback:e,options:i}]}),s.sort((l,c)=>l.priority-c.priority))}removeEventListener(t,e,i){if(!this._eventListeners[t]||!e)return;const n=this._eventListeners[t];if((i==null?void 0:i.queue)!=null){const s=n.find(l=>l.priority===i.queue);if(!s)return;const a=s.listeners.findIndex(l=>l.callback===e);a>=0&&s.listeners.splice(a,1)}else for(const s of n){const a=s.listeners.findIndex(l=>l.callback===e);a>=0&&s.listeners.splice(a,1)}}dispatchEvent(t){var i,n,s,a;let e=!1;if(t instanceof Xl){const l=this._eventListeners[t.type];if(l)for(const c of l)for(let h=0;h<c.listeners.length;h++){const u=c.listeners[h];if((n=(i=u.options)==null?void 0:i.signal)!=null&&n.aborted){c.listeners.splice(h,1),h--;continue}u.options.once&&(c.listeners.splice(h,1),h--),u.callback(t)}}if(t instanceof _s){const l=this._eventListeners[t.type];if(l)for(const c of l){if(e)break;for(let h=0;h<c.listeners.length;h++){const u=c.listeners[h];if((a=(s=u.options)==null?void 0:s.signal)!=null&&a.aborted){c.listeners.splice(h,1),h--;continue}if(t.immediatePropagationStopped){e=!0,et&&console.log("immediatePropagationStopped",t.type);break}else t.propagationStopped&&(e=!0,et&&console.log("propagationStopped",t.type));u.options.once&&(c.listeners.splice(h,1),h--),u.callback(t)}}}}get mousePosition(){return this._pointerPositions[0]}get mousePositionRC(){return this._pointerPositionsRC[0]}get mouseDown(){return this._pointerDown[0]}get mouseUp(){return this._pointerUp[0]}get mouseClick(){return this._pointerClick[0]}get mouseDoubleClick(){return this._pointerDoubleClick[0]}get mousePressed(){return this._pointerPressed[0]}get mouseWheelChanged(){return this.getMouseWheelChanged(0)}get click(){return this._pointerClick[0]}get doubleClick(){return this._pointerDoubleClick[0]}getGamepad(t=0){return typeof navigator<"u"&&"getGamepads"in navigator&&navigator.getGamepads()[t]||null}setCursorPointer(){this.setCursor("pointer")}setCursorNormal(){this.unsetCursor("pointer")}setCursor(t){this._setCursorTypes.push(t),this._setCursorTypes.length>10&&this._setCursorTypes.shift(),this.updateCursor()}unsetCursor(t){for(let e=this._setCursorTypes.length-1;e>=0;e--)if(this._setCursorTypes[e]===t){this._setCursorTypes.splice(e,1),this.updateCursor();break}}updateCursor(){var t;((t=this._setCursorTypes)==null?void 0:t.length)==0?this.context.domElement.style.cursor="default":this.context.domElement.style.cursor=this._setCursorTypes[this._setCursorTypes.length-1]}getIsPointerIdInUse(t){for(const e of this._pointerEventsPressed)if(e.pointerId===t&&e.used)return!0;return!1}getPointerPressedCount(){let t=0;for(let e=0;e<this._pointerPressed.length;e++)this._pointerPressed[e]&&t++;return t}getPointerPosition(t){return t>=this._pointerPositions.length?null:this._pointerPositions[t]}getPointerPositionLastFrame(t){return t>=this._pointerPositionsLastFrame.length?null:this._pointerPositionsLastFrame[t]}getPointerPositionDelta(t){return t>=this._pointerPositionsDelta.length?null:this._pointerPositionsDelta[t]}getPointerPositionRC(t){return t>=this._pointerPositionsRC.length?null:this._pointerPositionsRC[t]}getPointerDown(t){return t>=this._pointerDown.length?!1:this._pointerDown[t]}getPointerUp(t){return t>=this._pointerUp.length?!1:this._pointerUp[t]}getPointerPressed(t){return t>=this._pointerPressed.length?!1:this._pointerPressed[t]}getPointerClicked(t){return t>=this._pointerClick.length?!1:this._pointerClick[t]}getPointerDoubleClicked(t){return t>=this._pointerDoubleClick.length?!1:this._pointerDoubleClick[t]}getPointerDownTime(t){return t>=this._pointerDownTime.length?-1:this._pointerDownTime[t]}getPointerUpTime(t){return t>=this._pointerUpTime.length?-1:this._pointerUpTime[t]}getPointerLongPress(t){return t>=this._pointerDownTime.length?!1:this.getPointerPressed(t)&&this.context.time.time-this._pointerDownTime[t]>this._longPressTimeThreshold}getIsMouse(t){return t<0||t>=this._pointerTypes.length?!1:this._pointerTypes[t]==="mouse"}getIsTouch(t){return t<0||t>=this._pointerTypes.length?!1:this._pointerTypes[t]==="touch"}getTouchesPressedCount(){let t=0;for(let e=0;e<this._pointerPressed.length;e++)this._pointerPressed[e]&&this.getIsTouch(e)&&t++;return t}getMouseWheelChanged(t=0){return t>=this._mouseWheelChanged.length?!1:this._mouseWheelChanged[t]}getMouseWheelDeltaY(t=0){return t>=this._mouseWheelDeltaY.length?0:this._mouseWheelDeltaY[t]}getPointerEvent(t){if(!(t>=this._pointerEvent.length))return this._pointerEvent[t]??void 0}*foreachPointerId(t){for(let e=0;e<this._pointerTypes.length;e++)if(this._pointerIsActive(e)){if(t!==void 0){const i=this._pointerTypes[e];if(Array.isArray(t)){let n=!1;for(const s of t)if(i===s){n=!0;break}if(!n)continue}else if(t!==i)continue}yield e}}*foreachTouchId(){for(let t=0;t<this._pointerTypes.length;t++)this._pointerTypes[t]==="touch"&&this._pointerIsActive[t]&&(yield t)}_pointerIsActive(t){return t<0?!1:this._pointerPressed[t]||this._pointerDown[t]||this._pointerUp[t]}onDownButton(t,e){let i=this._pressedStack.get(t);i||(i=[],this._pressedStack.set(t,i)),i.push(e)}onReleaseButton(t,e){const i=this._pressedStack.get(t);if(!i)return;const n=i.indexOf(e);n>=0&&i.splice(n,1)}getFirstPressedButtonForPointer(t){const e=this._pressedStack.get(t);if(e)return e[0]}getLatestPressedButtonForPointer(t){const e=this._pressedStack.get(t);if(e)return e[e.length-1]}getKeyDown(t){if(t!==void 0)return this.isKeyDown(t);for(const e in this.keysPressed){const i=this.keysPressed[e];if(i.startFrame===this.context.time.frameCount)return i.key}return null}getKeyPressed(t){if(t!==void 0)return this.isKeyPressed(t);for(const e in this.keysPressed){const i=this.keysPressed[e];if(i.pressed)return i.key}return null}getKeyUp(t){if(t!==void 0)return this.isKeyUp(t);for(const e in this.keysPressed){const i=this.keysPressed[e];return i.pressed===!1&&i.frame===this.context.time.frameCount}return null}isKeyDown(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyDown(n))return!0;return!1}const i=this.keysPressed[t];return i?i.startFrame===this.context.time.frameCount&&i.pressed:!1}isKeyUp(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyUp(n))return!0;return!1}const i=this.keysPressed[t];return i?i.frame===this.context.time.frameCount&&i.pressed===!1:!1}isKeyPressed(t){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const e=this.getCodeForCommonKeyName(t);if(e!==null){for(const n of e)if(this.isKeyPressed(n))return!0;return!1}const i=this.keysPressed[t];return i&&i.pressed||!1}getCodeForCommonKeyName(t){if(t.length===1){if(t>="0"&&t<="9")return["Digit"+t];if(t>="a"&&t<="z")return["Key"+t.toUpperCase()];if(t==" ")return["Space"]}switch(t){case"shift":case"Shift":return["ShiftLeft","ShiftRight"];case"control":case"Control":return["ControlLeft","ControlRight"];case"alt":case"Alt":return["AltLeft","AltRight"]}return null}createInputEvent(t){switch(t.type){case"pointerdown":et&&Ee("Create Pointer down"),this.onDownButton(t.deviceIndex,t.button),this.onDown(t);break;case"pointermove":et&&Ee("Create Pointer move"),this.onMove(t);break;case"pointerup":et&&Ee("Create Pointer up"),this.onUp(t),this.onReleaseButton(t.deviceIndex,t.button);break}}convertScreenspaceToRaycastSpace(t){return t.x=(t.x-this.context.domX)/this.context.domWidth*2-1,t.y=-((t.y-this.context.domY)/this.context.domHeight)*2+1,t}bindEvents(){this.unbindEvents(),this._htmlEventSource=this.context.renderer.domElement,window.addEventListener("contextmenu",this.onContextMenu),this._htmlEventSource.addEventListener("pointerdown",this.onPointerDown,{passive:!0}),window.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),window.addEventListener("pointerup",this.onPointerUp,{passive:!0}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!0}),window.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this._htmlEventSource.addEventListener("wheel",this.onMouseWheel,{passive:!0}),window.addEventListener("wheel",this.onWheelWindow,{passive:!0}),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keypress",this.onKeyPressed,!1),window.addEventListener("keyup",this.onKeyUp,!1),window.addEventListener("blur",this.onLostFocus)}unbindEvents(){var t,e;window.removeEventListener("contextmenu",this.onContextMenu),(t=this._htmlEventSource)==null||t.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel),window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),(e=this._htmlEventSource)==null||e.removeEventListener("wheel",this.onMouseWheel,!1),window.removeEventListener("wheel",this.onWheelWindow,!1),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keypress",this.onKeyPressed,!1),window.removeEventListener("keyup",this.onKeyUp,!1),window.removeEventListener("blur",this.onLostFocus)}dispose(){const t=this.context.post_render_callbacks.indexOf(this.onEndOfFrame);t>=0&&this.context.post_render_callbacks.splice(t,1),this.unbindEvents()}canReceiveInput(t){var e;return t.target===((e=this.context.renderer)==null?void 0:e.domElement)||t.target===this.context.domElement||this.context.isInAR||this.context.isInAR&&t.target===document.body&&exports.DeviceUtilities.isMozillaXR()?!0:(et&&console.warn("CanReceiveInput:False for",t.target),!1)}getPointerId(t,e){return t.pointerType==="mouse"?0+(e??t.button):this.getPointerIndex(t.pointerId)}getButtonName(t){const e=t.button;if(t.pointerType==="mouse")switch(e){case 0:return"left";case 1:return"middle";case 2:return"right"}return"unknown"}getAndUpdateSpatialObjectForScreenPosition(t,e,i){let n=this._pointerSpace[t];n||(n=new d.Object3D,this._pointerSpace[t]=n),this._pointerSpace[t]=n;const s=this.context.mainCamera;if(s){const a=this.tempNearPlaneVector.set(e,i,-1);this.convertScreenspaceToRaycastSpace(a);const l=this.tempFarPlaneVector.set(a.x,a.y,1);a.unproject(s),l.unproject(s);const c=s.worldUp||V(0,1,0).applyQuaternion(_e(s));this.tempLookMatrix.lookAt(l,a,c),n.position.set(a.x,a.y,a.z),n.quaternion.setFromRotationMatrix(this.tempLookMatrix)}return n}isInRect(t){if(this.context.isInXR)return!0;const e=this.context.domElement.getBoundingClientRect(),i=t.clientX,n=t.clientY,s=i>=e.x&&i<=e.right&&n>=e.y&&n<=e.bottom;return et&&!s&&console.log("Not in rect",e,i,n),s}onDown(t){const e=t.pointerId;if(this.getPointerPressed(e)&&console.warn(`Received pointerDown for pointerId that is already pressed: ${e}`,et?t:""),et&&console.log(t.pointerType,"DOWN",e),!!this.isInRect(t)){for(this.setPointerState(e,this._pointerPressed,!0),this.setPointerState(e,this._pointerDown,!0),this.setPointerStateT(e,this._pointerEvent,t.source);e>=this._pointerTypes.length;)this._pointerTypes.push(t.pointerType);for(this._pointerTypes[e]=t.pointerType;e>=this._pointerPositionDown.length;)this._pointerPositionDown.push(new d.Vector3);for(this._pointerPositionDown[e].set(t.clientX,t.clientY,t.clientZ??0);e>=this._pointerPositions.length;)this._pointerPositions.push(new d.Vector2);this._pointerPositions[e].set(t.clientX,t.clientY),e>=this._pointerDownTime.length&&this._pointerDownTime.push(0),this._pointerDownTime[e]=this.context.time.realtimeSinceStartup,this.updatePointerPosition(t),this._pointerEventsPressed.push(t),this.onDispatchEvent(t)}}onMove(t){const e=t.pointerId,i=this.getPointerPressed(e);i===!1&&!this.isInRect(t)||t.pointerType==="touch"&&!i||(this.updatePointerPosition(t),this.setPointerStateT(e,this._pointerEvent,t.source),this.onDispatchEvent(t))}onUp(t){const e=t.pointerId;if(!this.getPointerPressed(e)){et&&console.log(t.pointerType,"UP",e,"was not down");return}et&&console.log(t.pointerType,"UP",e),this.setPointerState(e,this._pointerPressed,!1),this.setPointerStateT(e,this._pointerEvent,t.source),this.setPointerState(e,this._pointerUp,!0),this.updatePointerPosition(t);for(let c=this._pointerEventsPressed.length-1;c>=0;c--)if(this._pointerEventsPressed[c].pointerId===e){this._pointerEventsPressed.splice(c,1);break}if(!this._pointerPositionDown[e]){et&&me("Received pointer up event without matching down event for button: "+e),console.warn("Received pointer up event without matching down event for button: "+e);return}const n=this._pointerUpTime[e],s=this._pointerDownTime[e],a=this.context.time.realtimeSinceStartup,l=a-s;if(e>=this._pointerUpTime.length&&this._pointerUpTime.push(-99),this._pointerUpTime[e]=a,l<1){let c=t.clientX-this._pointerPositionDown[e].x,h=t.clientY-this._pointerPositionDown[e].y,u=0;if(t.isSpatial&&t.clientZ!=null&&(u=t.clientZ-this._pointerPositionDown[e].z,c*=200,h*=200,u*=200),Math.abs(c)<5&&Math.abs(h)<5&&Math.abs(u)<5){this.setPointerState(e,this._pointerClick,!0),t.isClick=!0;const f=a-n;et&&console.log("CLICK",e,c,h,u,f),f<this._doubleClickTimeThreshold&&f>0&&(this.setPointerState(e,this._pointerDoubleClick,!0),t.isDoubleClick=!0)}}this.onDispatchEvent(t)}updatePointerPosition(t){const e=t.pointerId;for(;e>=this._pointerPositions.length;)this._pointerPositions.push(new d.Vector2);for(;e>=this._pointerPositionsLastFrame.length;)this._pointerPositionsLastFrame.push(new d.Vector2);for(;e>=this._pointerPositionsDelta.length;)this._pointerPositionsDelta.push(new d.Vector2);const i=this._pointerPositionsLastFrame[e];i.copy(this._pointerPositions[e]);const n=this._pointerPositionsDelta[e];let s=t.clientX-i.x,a=t.clientY-i.y;if(t.source instanceof MouseEvent||t.source instanceof TouchEvent){const u=t.source;s===0&&u.movementX!==0&&(s=u.movementX||0),a===0&&u.movementY!==0&&(a=u.movementY||0)}n.x+=s,n.y+=a,this._pointerPositions[e].x=t.clientX,this._pointerPositions[e].y=t.clientY;const l=t.clientX,c=t.clientY;for(;e>=this._pointerPositionsRC.length;)this._pointerPositionsRC.push(new d.Vector2);const h=this._pointerPositionsRC[e];h.set(l,c),this.convertScreenspaceToRaycastSpace(h)}getPointerIndex(t){let e=-1;for(let i=0;i<this._pointerIds.length;i++){if(this._pointerIds[i]===t)return i;e===-1&&this._pointerIds[i]===-1&&(e=i)}return e!==-1?(this._pointerIds[e]=t,e):(et&&console.log("PUSH pointerId:",t),this._pointerIds.push(t),this._pointerIds.length-1)}setPointerState(t,e,i){e[t]=i}setPointerStateT(t,e,i){return e[t]=i,i}onDispatchEvent(t){const e=X.Current;try{X.Current=this.context,this.dispatchEvent(t)}finally{X.Current=e}}}const Aa=new d.Matrix4().makeRotationY(Math.PI),Ni=new d.Quaternion().setFromAxisAngle(new d.Vector3(0,1,0),Math.PI),gC=S("debugwebxr");class yC{constructor(){r(this,"priority",-1e5);r(this,"gameObject");if(this.gameObject=new d.Object3D,this.gameObject.name="Implicit XR Rig",gC){const t=dg(16733661);t.position.y+=.5,this.gameObject.add(t)}}isXRRig(){return!0}get isActive(){return this.gameObject.visible}}const ds=S("debugwebxr"),Jh=S("debugcustomgesture"),_C="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",bC="generic-trigger",vC=new d.Quaternion().setFromEuler(new d.Euler(d.MathUtils.degToRad(0),d.MathUtils.degToRad(-90),d.MathUtils.degToRad(-90))),wC=new d.Vector3(.04,-.04,0);class og{constructor(t,e,i){r(this,"xr");r(this,"inputSource");r(this,"index",0);r(this,"emitEvents",!0);r(this,"_connected",!0);r(this,"_isTracking",!1);r(this,"__gamepad");r(this,"__hand");r(this,"__side");r(this,"_hitTestSource");r(this,"_hasSelectEvent",!1);r(this,"_isMxInk",!1);r(this,"_isMetaQuestTouchController",!1);r(this,"_handJointPoses",new Map);r(this,"_gripMatrix",new d.Matrix4);r(this,"_gripPosition",new d.Vector3);r(this,"_gripQuaternion",new d.Quaternion);r(this,"_linearVelocity",new d.Vector3);r(this,"_rayPositionRaw",new d.Vector3);r(this,"_rayRotationRaw",new d.Quaternion);r(this,"_rayMatrix",new d.Matrix4);r(this,"_rayPosition",new d.Vector3);r(this,"_rayQuaternion",new d.Quaternion);r(this,"_gripWorldPosition",new d.Vector3);r(this,"_gripWorldQuaternion",new d.Quaternion);r(this,"_rayWorldPosition",new d.Vector3);r(this,"_rayWorldQuaternion",new d.Quaternion);r(this,"_pinchPosition",new d.Vector3);r(this,"_ray");r(this,"_hand_wristDotUp");r(this,"_object");r(this,"_gripSpaceObject");r(this,"_raySpaceObject");r(this,"model",null);r(this,"_debugAxesHelper",new d.AxesHelper(.15));r(this,"_debugGripAxesHelper",new d.AxesHelper(.07));r(this,"_debugRayAxesHelper",new d.AxesHelper(.07));r(this,"_hitTestSourcePromise",null);r(this,"onPointerHits",t=>{});r(this,"_needleGamepadButtons",{});r(this,"_buttonMap",new Map);r(this,"_motioncontroller");r(this,"_layout");r(this,"getMotionController");r(this,"emitPointerDownEvent",!0);r(this,"emitPointerUpEvent",!0);r(this,"emitPointerMoveEvent",!0);r(this,"pointerMoveDistanceThreshold",.03);r(this,"pointerMoveAngleThreshold",.05);r(this,"_selectButtonIndex");r(this,"_squeezeButtonIndex");r(this,"onSelectStart",t=>{var n,s,a,l;if(!this.emitPointerDownEvent||this.inputSource!==t.inputSource)return;this.onUpdateFrame(t.frame),this._hasSelectEvent=!0;const e=(n=this._layout)==null?void 0:n.selectComponentId,i=(l=(a=(s=this._layout)==null?void 0:s.components[e])==null?void 0:a.gamepadIndices)==null?void 0:l.button;i!==void 0&&(this._selectButtonIndex=i),!Jh&&(ds&&$.DrawDirection(this.rayWorldPosition,V(0,.01,1).applyQuaternion(this.rayWorldQuaternion),16711680,10),this.emitPointerEvent(Re.PointerDown,this._selectButtonIndex||0,"xr-standard-trigger",!0,t))});r(this,"onSelectEnd",t=>{this.emitPointerUpEvent&&(Jh||this.inputSource===t.inputSource&&this.emitPointerEvent(Re.PointerUp,this._selectButtonIndex||0,"xr-standard-trigger",!0,t))});r(this,"onSequeezeStart",t=>{var e,i,n;this.emitPointerDownEvent&&this.inputSource===t.inputSource&&(this._squeezeButtonIndex=(n=(i=(e=this._layout)==null?void 0:e.components["xr-standard-squeeze"])==null?void 0:i.gamepadIndices)==null?void 0:n.button,this._squeezeButtonIndex!==void 0&&(ds&&$.DrawDirection(this.rayWorldPosition,V(0,.01,1).applyQuaternion(this.rayWorldQuaternion),255,10),this.emitPointerEvent(Re.PointerDown,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,t)))});r(this,"onSequeezeEnd",t=>{this.emitPointerUpEvent&&this.inputSource===t.inputSource&&this._squeezeButtonIndex!==void 0&&this.emitPointerEvent(Re.PointerUp,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,t)});r(this,"states",{});r(this,"_didMoveLastFrame",!1);r(this,"_lastPointerMovePosition",new d.Vector3);r(this,"_lastPointerMoveQuaternion",new d.Quaternion);r(this,"pointerInit");this.xr=t,this.inputSource=e,this.index=i,this._object=new d.Object3D,this._object.name=`NeedleXRController_${i}`,ds&&(this._object.add(this._debugAxesHelper),this._gripSpaceObject=new d.Object3D,this._raySpaceObject=new d.Object3D,this._gripSpaceObject.name=`NeedleXRController_${i}_gripSpace`,this._raySpaceObject.name=`NeedleXRController_${i}_raySpace`,this._gripSpaceObject.add(this._debugGripAxesHelper),this._raySpaceObject.add(this._debugRayAxesHelper),this.xr.context.scene.add(this._gripSpaceObject),this.xr.context.scene.add(this._raySpaceObject)),this.xr.context.scene.add(this._object),this._ray=new d.Ray,this.pointerInit={origin:this,pointerType:this.hand?"hand":"controller",deviceIndex:this.index,pointerId:-1,mode:this.inputSource.targetRayMode,ray:this._ray,device:this._object,buttonName:"none"},this.initialize(),this.subscribeEvents()}get context(){return this.xr.context}get connected(){return this._connected}get isTracking(){return this._isTracking}get gamepad(){return this.__gamepad??(this.__gamepad=this.inputSource.gamepad)}get isHand(){return this.hand!=null}get hand(){return this.__hand??(this.__hand=this.inputSource.hand)}get handObject(){return this.context.renderer.xr.getHand(this.index)}get profiles(){return this.inputSource.profiles}get layout(){return this._layout}get targetRayMode(){return this.inputSource.targetRayMode}get targetRaySpace(){return this.inputSource.targetRaySpace}get gripSpace(){return this.inputSource.gripSpace}get side(){return this.__side??(this.__side=this.inputSource.handedness)}get isRight(){return this.side==="right"}get isLeft(){return this.side==="left"}get isStylus(){return this._isMxInk}getHitTestSource(){return this._hitTestSource||this._requestHitTestSource(),this._hitTestSource}get hasHitTestSource(){return this._hitTestSource}cancelHitTestSource(){this._hitTestSource&&(this._hitTestSource.cancel(),this._hitTestSource=void 0)}get hasSelectEvent(){return this._hasSelectEvent}getHitTest(){return this.xr.getHitTest(this)}getHandJointPose(t,e){var n;if(e=e||this.xr.frame,!this.hand||!(e!=null&&e.getJointPose)||!this.xr.referenceSpace)return null;let i=(n=this._handJointPoses)==null?void 0:n.get(t);return i||(i=e.getJointPose(t,this.xr.referenceSpace),i&&this._handJointPoses.set(t,i),i)}get gripPosition(){return V(this._gripPosition)}get gripQuaternion(){return un(this._gripQuaternion)}get gripMatrix(){return this._gripMatrix}get gripLinearVelocity(){return V(this._linearVelocity).applyQuaternion(Ni)}get rayPosition(){return V(this._rayPosition)}get rayQuaternion(){return un(this._rayQuaternion)}get gripWorldPosition(){return V(this._gripWorldPosition)}get gripWorldQuaternion(){return un(this._gripWorldQuaternion)}get rayWorldPosition(){return V(this._rayWorldPosition)}updateRayWorldPosition(){var e;const t=(e=this.xr.context.mainCamera)==null?void 0:e.parent;this._rayWorldPosition.copy(this._rayPositionRaw),t&&this._rayWorldPosition.applyMatrix4(t.matrixWorld)}get rayWorldQuaternion(){return un(this._rayWorldQuaternion)}get pinchPosition(){return V(this._pinchPosition)}updateRayWorldQuaternion(){var i;const t=(i=this.xr.context.mainCamera)==null?void 0:i.parent,e=t?_e(t):void 0;this._rayWorldQuaternion.copy(this._rayRotationRaw).multiply(Ni),e&&this._rayWorldQuaternion.premultiply(e)}get ray(){return this._ray.origin.copy(this.rayWorldPosition),this._ray.direction.copy(V(0,0,1).applyQuaternion(this.rayWorldQuaternion)),this._ray}get handWristDotUp(){var e;if(this._hand_wristDotUp!==void 0)return this._hand_wristDotUp;const t=(e=this.handObject)==null?void 0:e.joints.wrist;if(t){const i=V(0,1,0).applyQuaternion(t.quaternion),n=V(0,1,0).dot(i);return this._hand_wristDotUp=n}}get isHandUpsideDown(){return this.handWristDotUp!==void 0?this.handWristDotUp<-.7:!1}get isTeleportGesture(){var t;return this.isHandUpsideDown&&((t=this.getGesture("pinch"))==null?void 0:t.isDown)}get object(){return this._object}async getModelUrl(){var t;return(t=this.getMotionController)==null?void 0:t.then(e=>(e==null?void 0:e.assetUrl)||null)}_requestHitTestSource(){var t;return this._hitTestSourcePromise?this._hitTestSourcePromise:this.xr.mode==="immersive-ar"&&this.inputSource.targetRayMode==="tracked-pointer"&&this.xr.session.requestHitTestSourceForTransientInput?this._hitTestSourcePromise=((t=this.xr.session.requestHitTestSourceForTransientInput({profile:this.inputSource.profiles[0],offsetRay:new XRRay}))==null?void 0:t.then(e=>(this._hitTestSourcePromise=null,this.connected?this._hitTestSource=e:(e.cancel(),null))))??null:null}onUpdate(t){this.onUpdateFrame(t),this.updateInputEvents(),this.onUpdateMove()}onRenderDebug(){var s;$.DrawSphere(this.rayWorldPosition,.003),$.DrawDirection(this.rayWorldPosition,V(0,0,10).applyQuaternion(this.rayWorldQuaternion));const e=(this.inputSource.gripSpace?this.gripWorldPosition:this.object.worldPosition).sub(this.object.worldForward.multiplyScalar(.1)),i=this.inputSource.profiles.join(`
147
147
  `);let n=`Controller[${this.index}] (${this.inputSource.targetRayMode}, ${this.side})
148
148
  C:${this.connected?"x":"-"} T:${this.isTracking?"x":"-"} Hand:${this.inputSource.hand?"x":"-"} Pen: ${this._isMxInk?"x":"-"}`;if(this.inputSource.hand&&(n+=`
149
149
  Pinch: ${(s=this.getGesture("pinch"))==null?void 0:s.value.toFixed(3)}`),n+=`
@@ -1386,7 +1386,7 @@ If you need multisampling consider changing 'auto' to a fixed value (e.g. 4).`))
1386
1386
  // be blended onto the scene.
1387
1387
  gl_FragColor = vec4(direct, max);
1388
1388
  return;
1389
- `)},e.userData.isLightBlendMaterial=!0}applyShadowMaterial(){if(this.targetMesh)if(this.targetMesh.material.type!=="ShadowMaterial"){const e=new d.ShadowMaterial;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),this.targetMesh.material=e,e.userData.isShadowCatcherMaterial=!0}else{const e=this.targetMesh.material;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),e.userData.isShadowCatcherMaterial=!0}}applyOccluderMaterial(){if(this.targetMesh){let e=this.targetMesh.material;if(!e){const i=new d.MeshBasicMaterial;this.targetMesh.material=i,e=i}e.depthWrite=!0,e.stencilWrite=!0,e.colorWrite=!1,this.gameObject.renderOrder=-100}}applyMaterialOptions(e){e&&(e.depthWrite=!1,e.stencilWrite=!1)}}xx([m()],zh.prototype,"mode");xx([m(ie)],zh.prototype,"shadowColor");var UR=Object.defineProperty,Nh=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&UR(t,e,n),n};const _t=S("debugskybox");By("background-image");By("environment-image");function $b(o,t,e,i,n){if(t==="transparent"||t!=null&&t.startsWith("rgb")||t!=null&&t.startsWith("#"))return console.warn(`Needle Engine: Invalid ${n} value (${t}). Did you mean to set background-color instead?`),null;const s=new Sf;s.allowDrop=!1,s.allowNetworking=!1,s.background=e,s.environment=i,C.addComponent(o.scene,s);const a=l=>{typeof l=="string"&&(_t&&console.log(n,"CHANGED TO",l),s.setSkybox(l))};return d0(o.domElement,n,a),s.addEventListener("destroy",()=>{_t&&console.log("Destroyed attribute remote skybox",n),u0(o.domElement,n,a)}),s.setSkybox(t)}const Su=new Array;re.registerCallback(he.ContextCreationStart,o=>{const t=o.context,e=t.domElement.getAttribute("background-image"),i=t.domElement.getAttribute("environment-image");if(e){_t&&console.log("Creating remote skybox to load "+e);const n=$b(t,e,!0,!1,"background-image");n&&Su.push(n)}if(i){_t&&console.log("Creating remote environment to load "+i);const n=$b(t,i,!1,!0,"environment-image");n&&Su.push(n)}});re.registerCallback(he.ContextCreationStart,()=>Promise.all(Su).finally(()=>{Su.length=0}));function Sx(){return globalThis.NEEDLE_ENGINE_SKYBOX_TEXTURES||(globalThis.NEEDLE_ENGINE_SKYBOX_TEXTURES=new Array),globalThis.NEEDLE_ENGINE_SKYBOX_TEXTURES}function Vb(o){const e=Sx().find(i=>i.src===o);return e?(_t&&console.log("Skybox: Found previously loaded texture for "+o),e.texture):null}async function zR(o){const t=await o;fg(t,!0),Se(t)}function NR(o,t){const e=Sx();for(;e.length>5;){const i=e.shift();i&&zR(i.texture)}t.then(i=>fg(i,!1)),e.push({src:o,texture:t})}const Lr=class extends D{constructor(){super(...arguments);r(this,"url");r(this,"allowDrop",!0);r(this,"background",!0);r(this,"environment",!0);r(this,"allowNetworking",!0);r(this,"_loader");r(this,"_prevUrl");r(this,"_prevLoadedEnvironment");r(this,"_prevEnvironment",null);r(this,"_prevBackground",null);r(this,"validTextureTypes",[".ktx2",".hdr",".exr",".jpg",".jpeg",".png"]);r(this,"onDragOverEvent",e=>{if(this.allowDrop&&e.dataTransfer)for(const i of e.dataTransfer.types)(i==="text/uri-list"||i==="Files")&&e.preventDefault()});r(this,"onDrop",e=>{var i,n,s,a;if(this.allowDrop&&e.dataTransfer){for(const l of e.dataTransfer.types)if(_t&&console.log(l),l==="text/uri-list"){const c=e.dataTransfer.getData(l);_t&&console.log(l,c);let h=(n=(i=new RegExp(/polyhaven.com\/asset_img\/.+?\/(?<name>.+)\.png/).exec(c))==null?void 0:i.groups)==null?void 0:n.name;if(h||(h=(a=(s=new RegExp(/polyhaven\.com\/a\/(?<name>.+)/).exec(c))==null?void 0:s.groups)==null?void 0:a.name),_t&&console.log(h),h){const u="https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/"+h+"_1k.exr";console.log(`[Remote Skybox] Setting skybox from url: ${u}`),e.preventDefault(),this.setSkybox(u);break}else if(this.isValidTextureType(c)){console.log("[Remote Skybox] Setting skybox from url: "+c),e.preventDefault(),this.setSkybox(c);break}else{console.warn(`[RemoteSkybox] Unknown url ${c}. If you want to load a skybox from a url, make sure it is a valid image url. Url must end with${this.validTextureTypes.join(", ")}.`);const u=new CustomEvent("dropped-unknown-url",{detail:{sender:this,event:e,url:c,apply:f=>{e.preventDefault(),this.setSkybox(f)}}});this.dispatchEvent(u)}}else if(l=="Files"){const c=e.dataTransfer.files.item(0);if(_t&&console.log(l,c),!c)continue;if(!this.isValidTextureType(c.name)){console.warn(`[RemoteSkybox]: File "${c.name}" is not supported. Supported files are ${this.validTextureTypes.join(", ")}`);return}if(Vb(c.name)===null){const h=new Blob([c]),u=URL.createObjectURL(h);e.preventDefault(),this.setSkybox(u,c.name)}else e.preventDefault(),this.setSkybox(c.name);break}}})}onEnable(){this.setSkybox(this.url),this.registerDropEvents()}onDisable(){var e;this.context.scene.environment===this._prevLoadedEnvironment&&(this.context.scene.environment=this._prevEnvironment,ri.backgroundShouldBeTransparent(this.context)||(this.context.scene.background=this._prevBackground),this._prevLoadedEnvironment=void 0),this.unregisterDropEvents(),(e=this.context.mainCameraComponent)==null||e.applyClearFlags()}urlChangedSyncField(){this.allowNetworking&&this.url&&(this.isRemoteTexture(this.url)?this.setSkybox(this.url):_t&&console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`))}async setSkybox(e,i){var a;if(!this.activeAndEnabled||(e=$R(e,this.environment,this.background),!e))return!1;try{e.startsWith("/")||e.startsWith(".")?new URL(e,window.location.href):new URL(e)}catch{return _t&&console.warn("RemoteSkybox: Invalid URL",e,this.name),!1}if(i??(i=e),this.isValidTextureType(i)||console.warn("Potentially invalid skybox url",i,"on",this.name),_t&&console.log("Set remote skybox url: "+e),this._prevUrl===e&&this._prevLoadedEnvironment)return this.apply(),!0;(a=this._prevLoadedEnvironment)==null||a.dispose(),this._prevLoadedEnvironment=void 0,this._prevUrl=e;const n=await this.loadTexture(e,i);if(!n)return _t&&console.warn("RemoteSkybox: Failed to load texture from url",e),!1;if(!this.enabled)return _t&&console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"),!1;if(this._prevUrl!==e)return _t&&console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"),!1;this.url=e;const s=e.lastIndexOf("/");return n.name=e.substring(s>=0?s+1:0),this._loader instanceof d.TextureLoader&&(n.colorSpace=d.SRGBColorSpace),this._prevLoadedEnvironment=n,this.apply(),!0}async loadTexture(e,i){var u,f,p,g,y;if(!e)return Promise.resolve(null);i??(i=e);const n=Vb(i);if(n){const b=await n;if(((f=(u=b.source)==null?void 0:u.data)==null?void 0:f.length)>0||(y=(g=(p=b.source)==null?void 0:p.data)==null?void 0:g.data)!=null&&y.length)return b}const s=i.endsWith(".exr"),a=i.endsWith(".hdr"),l=i.endsWith(".ktx2");if(s)this._loader instanceof H.EXRLoader||(this._loader=new H.EXRLoader);else if(a)this._loader instanceof H.RGBELoader||(this._loader=new H.RGBELoader);else if(l){if(!(this._loader instanceof H.KTX2Loader)){const{ktx2Loader:b}=le.createLoaders(this.context.renderer);this._loader=b}}else this._loader instanceof d.TextureLoader||(this._loader=new d.TextureLoader);_t&&console.log("Loading skybox: "+e);const c=this._loader.loadAsync(e);return NR(i,c),await c}apply(){var i;const e=this._prevLoadedEnvironment;e&&(e instanceof d.CubeTexture||e instanceof d.CompressedCubeTexture||(e.mapping=d.EquirectangularRefractionMapping,e.needsUpdate=!0),this.context.scene.background!==e&&(this._prevBackground=this.context.scene.background),this.context.scene.environment!==e&&(this._prevEnvironment=this.context.scene.environment),_t&&console.log("Set remote skybox",this.url,!ri.backgroundShouldBeTransparent(this.context)),this.environment&&(this.context.scene.environment=e),this.background&&!ri.backgroundShouldBeTransparent(this.context)&&(this.context.scene.background=e),((i=this.context.mainCameraComponent)==null?void 0:i.backgroundBlurriness)!==void 0&&(this.context.scene.backgroundBlurriness=this.context.mainCameraComponent.backgroundBlurriness))}isRemoteTexture(e){return e.startsWith("http://")||e.startsWith("https://")}isValidTextureType(e){for(const i of this.validTextureTypes)if(e.endsWith(i))return!0;return!1}registerDropEvents(){this.unregisterDropEvents(),this.context.domElement.addEventListener("dragover",this.onDragOverEvent),this.context.domElement.addEventListener("drop",this.onDrop)}unregisterDropEvents(){this.context.domElement.removeEventListener("dragover",this.onDragOverEvent),this.context.domElement.removeEventListener("drop",this.onDrop)}};Nh([hy(Lr.prototype.urlChangedSyncField),m(URL)],Lr.prototype,"url");Nh([m()],Lr.prototype,"allowDrop");Nh([m()],Lr.prototype,"background");Nh([m()],Lr.prototype,"environment");Nh([m()],Lr.prototype,"allowNetworking");let Sf=Lr;function $R(o,t,e){const i=t&&!e;switch(o==null?void 0:o.toLowerCase()){case"studio":return i?"https://cdn.needle.tools/static/skybox/modelviewer-Neutral-small.hdr":"https://cdn.needle.tools/static/skybox/modelviewer-Neutral.hdr";case"blurred-skybox":return i?"https://cdn.needle.tools/static/skybox/blurred-skybox-small.exr":"https://cdn.needle.tools/static/skybox/blurred-skybox.exr";case"quicklook-ar":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ARMode-small.exr":"https://cdn.needle.tools/static/skybox/QuickLook-ARMode.exr";case"quicklook":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode-small.exr":"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.exr"}return o===void 0?null:o}var VR=Object.defineProperty,Cf=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&VR(t,e,n),n},ur;const $h=(ur=class extends D{constructor(){super(...arguments);r(this,"target",null);r(this,"followFactor",.1);r(this,"rotateFactor",.1);r(this,"positionAxes",xa.All);r(this,"flipForward",!1);r(this,"_firstUpdate",!0)}onBeforeRender(){this.updateNow(!1)}updateNow(e){if(!(!this.target||this.target===this.gameObject)){if(this.followFactor>0){const i=Q(this.target),n=this._firstUpdate||e?1:z.clamp01(this.context.time.deltaTime*this.followFactor),s=this.worldPosition;this.positionAxes&xa.X&&(s.x=z.lerp(s.x,i.x,n)),this.positionAxes&xa.Y&&(s.y=z.lerp(s.y,i.y,n)),this.positionAxes&xa.Z&&(s.z=z.lerp(s.z,i.z,n)),this.worldPosition=s}if(this.rotateFactor>0){const i=_e(this.target);this.flipForward&&i.premultiply(ur._invertForward);const n=this._firstUpdate||e?1:z.clamp01(this.context.time.deltaTime*this.rotateFactor);this.worldQuaternion=this.worldQuaternion.slerp(i,n)}this._firstUpdate=!1}}},r(ur,"_invertForward",new d.Quaternion().setFromAxisAngle(new d.Vector3(0,1,0),Math.PI)),ur);Cf([m(d.Object3D)],$h.prototype,"target");Cf([m()],$h.prototype,"followFactor");Cf([m()],$h.prototype,"rotateFactor");Cf([m()],$h.prototype,"positionAxes");let Pf=$h;var WR=Object.defineProperty,Vh=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&WR(t,e,n),n};const _c=S("debugspatialtrigger"),Wb=new d.Layers,Gb=new d.Layers;function GR(o,t){return Wb.mask=o,Gb.mask=t,Wb.test(Gb)}class Zn extends D{constructor(){super(...arguments);r(this,"triggerMask",0);r(this,"onEnter");r(this,"onStay");r(this,"onExit");r(this,"currentIntersected",[]);r(this,"lastIntersected",[])}start(){_c&&console.log(this.name,this.triggerMask,this)}update(){this.currentIntersected.length=0;for(const e of Mf.triggers)GR(e.triggerMask,this.triggerMask)&&e.test(this.gameObject)&&this.currentIntersected.push(e);for(let e=this.lastIntersected.length-1;e>=0;e--){const i=this.lastIntersected[e];this.currentIntersected.indexOf(i)<0&&(this.onExitTrigger(i),this.lastIntersected.splice(e,1))}for(const e of this.currentIntersected)this.lastIntersected.indexOf(e)<0&&this.onEnterTrigger(e),this.onStayTrigger(e);this.lastIntersected.length=0,this.lastIntersected.push(...this.currentIntersected)}onEnterTrigger(e){var i;_c&&console.log("ENTER TRIGGER",this.name,e.name,this,e),e.raiseOnEnterEvent(this),(i=this.onEnter)==null||i.invoke()}onExitTrigger(e){var i;_c&&console.log("EXIT TRIGGER",this.name,e.name),e.raiseOnExitEvent(this),(i=this.onExit)==null||i.invoke()}onStayTrigger(e){var i;e.raiseOnStayEvent(this),(i=this.onStay)==null||i.invoke()}}Vh([m()],Zn.prototype,"triggerMask");Vh([m(ye)],Zn.prototype,"onEnter");Vh([m(ye)],Zn.prototype,"onStay");Vh([m(ye)],Zn.prototype,"onExit");var Rs;const Cx=(Rs=class extends D{constructor(){super(...arguments);r(this,"triggerMask");r(this,"boxHelper")}start(){_c&&console.log(this.name,this.triggerMask,this)}onEnable(){var e;Rs.triggers.push(this),this.boxHelper||(this.boxHelper=C.addComponent(this.gameObject,is),(e=this.boxHelper)==null||e.showHelper(null,_c))}onDisable(){Rs.triggers.splice(Rs.triggers.indexOf(this),1)}test(e){return this.boxHelper?this.boxHelper.isInBox(e)??!1:!1}raiseOnEnterEvent(e){C.foreachComponent(this.gameObject,i=>{i!==e&&i instanceof Zn&&i.onEnterTrigger(this)},!1)}raiseOnStayEvent(e){C.foreachComponent(this.gameObject,i=>{i!==e&&i instanceof Zn&&i.onStayTrigger(this)},!1)}raiseOnExitEvent(e){C.foreachComponent(this.gameObject,i=>{i!==e&&i instanceof Zn&&i.onExitTrigger(this)},!1)}},r(Rs,"triggers",[]),Rs);Vh([m()],Cx.prototype,"triggerMask");let Mf=Cx;var HR=Object.defineProperty,qR=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&HR(t,e,n),n};const Pi=S("debugspectator");class Of extends D{constructor(){super(...arguments);r(this,"cam",null);r(this,"useKeys",!0);r(this,"_mode",0);r(this,"orbit",null);r(this,"_handler");r(this,"eventSub_WebXRRequestStartEvent",null);r(this,"eventSub_WebXRStartEvent",null);r(this,"eventSub_WebXREndEvent",null);r(this,"_debug");r(this,"_networking")}get mode(){return this._mode}set mode(e){this._mode=e}get isSpectating(){var e;return((e=this._handler)==null?void 0:e.currentTarget)!==void 0}isSpectatingUser(e){var i;return((i=this.target)==null?void 0:i.userId)===e}isFollowedBy(e){var i;return(i=this.followers)==null?void 0:i.includes(e)}get followers(){return this._networking.followers}stopSpectating(){if(this.context.isInXR){this.followSelf();return}this.target=void 0}get localId(){return this.context.connection.connectionId??"local"}set target(e){var i;if(this._handler){const n=(i=this._handler.currentTarget)==null?void 0:i.userId,s=this.context.players.getPlayerView(this.localId);e===void 0||this.context.isInXR===!1&&(s==null?void 0:s.currentObject)===e.currentObject?this._handler.currentTarget!==void 0&&(this._handler.disable(),C.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),this._networking.onSpectatedObjectChanged(e,n)):this._handler.currentTarget!==e&&(this._handler.set(e),C.setActive(this.gameObject,!0),this.orbit&&(this.orbit.enabled=!1),this._networking.onSpectatedObjectChanged(e,n))}}get target(){var e;return(e=this._handler)==null?void 0:e.currentTarget}requestAllFollowMe(){this._networking.onRequestFollowMe()}get isSpectatingSelf(){var e,i;return this.isSpectating&&((e=this.target)==null?void 0:e.currentObject)===((i=this.context.players.getPlayerView(this.localId))==null?void 0:i.currentObject)}awake(){if(this._debug=new YR(this.context,this),this._networking=new JR(this.context,this),this._networking.awake(),C.setActive(this.gameObject,!1),this.cam=C.getComponent(this.gameObject,ri),!this.cam){console.warn("SpectatorCamera: Spectator camera needs camera component on the same object.",this);return}!this._handler&&this.cam&&(this._handler=new XR(this.context,this.cam,this)),this.orbit=C.getComponent(this.context.mainCamera,ge)}onDestroy(){var e,i;this.stopSpectating(),(e=this._handler)==null||e.destroy(),(i=this._networking)==null||i.destroy()}isSupportedPlatform(){const e=window.navigator.userAgent,i=/Windows|MacOS/.test(e),n=/Windows NT/.test(e)&&/Edg/.test(e)&&!/Win64/.test(e);return i&&!n}onBeforeXR(e){this.isSupportedPlatform()&&C.setActive(this.gameObject,!0)}onEnterXR(e){this.isSupportedPlatform()&&(Pi&&console.log(this.context.mainCamera),this.context.mainCamera&&this.followSelf())}onLeaveXR(e){var i,n;this.context.removeCamera(this.cam),C.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),(i=this._handler)==null||i.set(void 0),(n=this._handler)==null||n.disable(),this.isSpectatingSelf&&this.stopSpectating()}followSelf(){this.target=this.context.players.getPlayerView(this.context.connection.connectionId),this.target||(this.context.players.setPlayerView(this.localId,this.context.mainCamera,wo.Headset),this.target=this.context.players.getPlayerView(this.localId)),Pi&&console.log("Follow self",this.target)}onAfterRender(){var u,f,p;if(!this.cam)return;const e=this.context.renderer,i=e.xr.enabled;if(!e.xr.isPresenting&&!((u=this._handler)!=null&&u.currentTarget))return;(f=this._handler)==null||f.update(this._mode);const n=e.getRenderTarget();let s=null;const a=e.state;if(!n){if(!e.state.bindFramebuffer||!a.bindXRFramebuffer)return;s=e._framebuffer,a.bindXRFramebuffer(null)}this.setAvatarFlagsBeforeRender();const l=this.context.mainCameraComponent;if(l){const g=l.backgroundColor;g&&e.setClearColor(g,g.alpha),this.cam.backgroundColor=g,this.cam.clearFlags=l.clearFlags,this.cam.nearClipPlane=l.nearClipPlane,this.cam.farClipPlane=l.farClipPlane}else e.setClearColor(new d.Color(1,1,1));e.setRenderTarget(null),e.xr.enabled=!1;const c=(p=this.cam)==null?void 0:p.threeCamera;this.context.updateAspect(c);const h=e.xr.isPresenting;e.xr.isPresenting=!1,e.setSize(this.context.domWidth,this.context.domHeight),e.render(this.context.scene,c),e.xr.isPresenting=h,e.xr.enabled=i,n?e.setRenderTarget(n):a.bindXRFramebuffer&&a.bindXRFramebuffer(s),this.resetAvatarFlags()}setAvatarFlagsBeforeRender(){const e=this._mode===0;for(const i of At.instances)if(i.avatar&&"isLocalAvatar"in i.avatar&&"flags"in i.avatar){let n=Bn.All;this.isSpectatingSelf&&(n=e&&i.avatar.isLocalAvatar?Bn.FirstPerson:Bn.ThirdPerson);const s=i.avatar.flags;if(!s)continue;for(const a of s)a.UpdateVisible(n)}}resetAvatarFlags(){var e;for(const i of At.instances)if(i.avatar&&"flags"in i.avatar){const n=i.avatar.flags;if(!n)continue;for(const s of n)"isLocalAvatar"in i.avatar&&((e=i.avatar)!=null&&e.isLocalAvatar)?s.UpdateVisible(Bn.FirstPerson):s.UpdateVisible(Bn.ThirdPerson)}}}qR([m()],Of.prototype,"useKeys");class XR{constructor(t,e,i){r(this,"context");r(this,"cam");r(this,"spectator");r(this,"follow");r(this,"target");r(this,"view");r(this,"currentObject");this.context=t,this.cam=e,this.spectator=i}get currentTarget(){return this.view}set(t){const e=t==null?void 0:t.currentObject;if(!e){this.spectator.stopSpectating();return}e!==this.currentObject&&(this.currentObject=e,this.view=t,this.follow||(this.follow=C.addComponent(this.cam.gameObject,Pf)),this.target||(this.target=new d.Object3D),e.add(this.target),this.follow.enabled=!0,this.follow.target=this.target,Pi&&console.log("FOLLOW",e),this.context.isInXR?this.context.removeCamera(this.cam):this.context.setCurrentCamera(this.cam))}disable(){Pi&&console.log("STOP FOLLOW",this.currentObject),this.view=void 0,this.currentObject=void 0,this.context.removeCamera(this.cam),this.follow&&(this.follow.enabled=!1)}destroy(){var t;(t=this.target)==null||t.removeFromParent(),this.follow&&C.destroy(this.follow)}update(t){var n,s,a,l,c,h;if(((n=this.currentTarget)==null?void 0:n.isConnected)===!1||((s=this.currentTarget)==null?void 0:s.removed)===!0){Pi&&console.log("Target disconnected or timeout",this.currentTarget),this.spectator.stopSpectating();return}this.currentTarget&&((a=this.currentTarget)==null?void 0:a.currentObject)!==this.currentObject&&(Pi&&console.log("Target changed",this.currentObject,"to",this.currentTarget.currentObject),this.set(this.currentTarget));const e=this.context.mainCamera;if(e){const u=this.cam.threeCamera;(u.near!==e.near||u.far!==e.far)&&(u.near=e.near,u.far=e.far,u.updateProjectionMatrix())}const i=(l=this.follow)==null?void 0:l.target;if(!(!i||!this.follow)){switch(t){case 0:((c=this.view)==null?void 0:c.viewDevice)!==wo.Browser?(this.follow.followFactor=5,this.follow.rotateFactor=5):(this.follow.followFactor=50,this.follow.rotateFactor=50),i.position.set(0,0,0);break;case 1:this.follow.followFactor=3,this.follow.rotateFactor=2,i.position.set(0,.5,1.5);break}this.follow.flipForward=!1,((h=this.view)==null?void 0:h.viewDevice)!==wo.Browser?i.quaternion.copy(QR):i.quaternion.identity()}}}const QR=new d.Quaternion().setFromAxisAngle(new d.Vector3(0,1,0),Math.PI);class YR{constructor(t,e){r(this,"context");r(this,"spectator");this.context=t,this.spectator=e,console.log("[Spectator Camera] Click other avatars or cameras to follow them. Press ESC to exit spectator mode."),this.context.domElement.addEventListener("keydown",n=>{if(!this.spectator.useKeys)return;n.key==="Escape"&&this.spectator.stopSpectating()});let i=0;this.context.input.addEventListener(Re.PointerDown,n=>{i=this.context.time.time}),this.context.input.addEventListener(Re.PointerUp,n=>{const s=this.context.time.time-i;s>1?this.spectator.stopSpectating():this.context.input.getPointerClicked(0)&&s<.3&&this.trySelectObject()})}trySelectObject(){const t=new es;t.setMask(16777215);const e=this.context.physics.raycast(t);if(Pi&&console.log(...e),e!=null&&e.length)for(const i of e){if(i.distance<.2)continue;const n=i.object,s=C.getComponentInParent(n,At),a=s==null?void 0:s.connectionId;if(a){const l=this.context.players.getPlayerView(a);this.spectator.target=l,Pi&&console.log("spectate",a,s);break}}}}class KR{constructor(t,e,i){r(this,"guid");r(this,"dontSave",!0);r(this,"targetUserId");r(this,"stoppedFollowing");this.guid=t,this.targetUserId=e,this.stoppedFollowing=i}}class ZR{constructor(t,e){r(this,"guid");r(this,"userId");this.guid=t.guid,this.userId=e}}class JR{constructor(t,e){r(this,"followers",[]);r(this,"context");r(this,"spectator");r(this,"_followerEventMethod");r(this,"_requestFollowMethod");r(this,"_joinedRoomMethod");r(this,"_lastRequestFollowUser");r(this,"_enforceFollowInterval");this.context=t,this.spectator=e,this._followerEventMethod=this.onFollowerEvent.bind(this),this._requestFollowMethod=this.onRequestFollowEvent.bind(this),this._joinedRoomMethod=this.onUserJoinedRoom.bind(this)}awake(){this.context.connection.beginListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.beginListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.beginListen(ee.JoinedRoom,this._joinedRoomMethod),this.context.domElement.addEventListener("keydown",t=>{this.spectator.useKeys&&(t.key==="f"?this.onRequestFollowMe():t.key==="Escape"&&this.onRequestFollowMe(!0))})}destroy(){this.context.connection.stopListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.stopListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.stopListen(ee.JoinedRoom,this._joinedRoomMethod)}onSpectatedObjectChanged(t,e){if(Pi&&console.log(this.context.connection.connectionId,"onSpectatedObjectChanged",t,e),this.context.connection.connectionId){const i=(t==null?void 0:t.userId)===void 0,n=i?e:t==null?void 0:t.userId,s=new KR(this.context.connection.connectionId,n,i);this.context.connection.send("spectator-follower-changed",s)}}onRequestFollowMe(t=!1){if(Pi&&console.log("Request follow",this.context.connection.connectionId),this.context.connection.connectionId){this.spectator.stopSpectating();const e=t?void 0:this.context.connection.connectionId,i=new ZR(this.spectator,e);this.context.connection.send("spectator-request-follow",i)}}onUserJoinedRoom(){S("followme")&&this.onRequestFollowMe()}onFollowerEvent(t){const e=t.targetUserId,i=t.guid;if(Pi&&console.log(t),e===this.context.connection.connectionId)if(t.stoppedFollowing){const n=this.followers.indexOf(i);n!==-1&&(this.followers.splice(n,1),this.removeDisconnectedFollowers(),console.log(i,"unfollows you",this.followers.length))}else this.followers.includes(i)||(this.followers.push(i),this.removeDisconnectedFollowers(),console.log(i,"follows you",this.followers.length))}removeDisconnectedFollowers(){for(let t=this.followers.length-1;t>=0;t--){const e=this.followers[t];this.context.connection.userIsInRoom(e)===!1&&this.followers.splice(t,1)}}onRequestFollowEvent(t){if(this._lastRequestFollowUser=t,t.userId===this.context.connection.connectionId)this.spectator.stopSpectating();else if(t.userId===void 0)this.spectator.stopSpectating();else{const e=this.context.players.getPlayerView(t.userId);if(e)this.spectator.target=e;else return Pi&&console.warn("Could not find view",t.userId),this.enforceFollow(),!1}return!0}enforceFollow(){this._enforceFollowInterval||(this._enforceFollowInterval=setInterval(()=>{this._lastRequestFollowUser===void 0||this._lastRequestFollowUser.userId&&this.spectator.isFollowedBy(this._lastRequestFollowUser.userId)?(clearInterval(this._enforceFollowInterval),this._enforceFollowInterval=void 0):(Pi&&console.log("REQUEST FOLLOW AGAIN",this._lastRequestFollowUser.userId),this.onRequestFollowEvent(this._lastRequestFollowUser))},1e3))}}class jn{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSyncedCameraModel(t,e){return(e||new jn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSyncedCameraModel(t,e){return t.setPosition(t.position()+ae.SIZE_PREFIX_LENGTH),(e||new jn).__init(t.readInt32(t.position())+t.position(),t)}userId(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}guid(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}dontSave(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}pos(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new Sr).__init(this.bb_pos+e,this.bb):null}rot(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new Sr).__init(this.bb_pos+e,this.bb):null}static startSyncedCameraModel(t){t.startObject(5)}static addUserId(t,e){t.addFieldOffset(0,e,0)}static addGuid(t,e){t.addFieldOffset(1,e,0)}static addDontSave(t,e){t.addFieldInt8(2,+e,0)}static addPos(t,e){t.addFieldStruct(3,e,0)}static addRot(t,e){t.addFieldStruct(4,e,0)}static endSyncedCameraModel(t){return t.endObject()}static finishSyncedCameraModelBuffer(t,e){t.finish(e)}static finishSizePrefixedSyncedCameraModelBuffer(t,e){t.finish(e,void 0,!0)}}var eE=Object.defineProperty,tE=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&eE(t,e,n),n};const Cu="SCAM";ag(Cu,jn.getRootAsSyncedCameraModel);const yi=new ae.Builder;class iE{constructor(t,e){r(this,"userId");r(this,"guid");this.guid=e,this.userId=t}send(t,e){if(t){yi.clear();const i=yi.createString(this.guid),n=yi.createString(this.userId);jn.startSyncedCameraModel(yi),jn.addGuid(yi,i),jn.addUserId(yi,n);const s=Q(t),a=Bu(t);jn.addPos(yi,Sr.createVec3(yi,s.x,s.y,s.z)),jn.addRot(yi,Sr.createVec3(yi,a.x,a.y,a.z));const l=jn.endSyncedCameraModel(yi);yi.finish(l,Cu),e.sendBinary(yi.asUint8Array())}}}var bo;const Px=(bo=class extends D{constructor(){super(...arguments);r(this,"cameraPrefab",null);r(this,"_lastWorldPosition");r(this,"_lastWorldQuaternion");r(this,"_model",null);r(this,"_needsUpdate",!0);r(this,"_lastUpdateTime",0);r(this,"remoteCams",{});r(this,"userToCamMap",{});r(this,"_camTimeoutInSeconds",10);r(this,"_receiveCallback",null)}getCameraObject(e){const i=this.userToCamMap[e];return i?this.remoteCams[i].obj:null}async awake(){this._lastWorldPosition=this.worldPosition.clone(),this._lastWorldQuaternion=this.worldQuaternion.clone(),this.cameraPrefab&&("uri"in this.cameraPrefab&&(this.cameraPrefab=await this.cameraPrefab.instantiate(this.gameObject)),this.cameraPrefab&&"isObject3D"in this.cameraPrefab&&(this.cameraPrefab.visible=!1))}onEnable(){this._receiveCallback=this.context.connection.beginListenBinary(Cu,this.onReceivedRemoteCameraInfoBin.bind(this))}onDisable(){this.context.connection.stopListenBinary(Cu,this._receiveCallback)}update(){for(const s in this.remoteCams){const a=this.remoteCams[s],l=this.context.time.realtimeSinceStartup-a.lastUpdate;if(!a||l>this._camTimeoutInSeconds){j()&&console.log("Remote cam timeout",s),a!=null&&a.obj&&C.destroy(a.obj),delete this.remoteCams[s],a&&delete this.userToCamMap[a.userId],bo.instances.push(a),this.context.players.removePlayerView(a.userId,wo.Browser);continue}}if(this.context.isInXR)return;const e=this.context.mainCamera;if(e===null){this.enabled=!1;return}if(!this.context.connection.isConnected||this.context.connection.connectionId===null)return;this._model===null&&(this._model=new iE(this.context.connection.connectionId,this.context.connection.connectionId+"_camera"));const i=Q(e),n=_e(e);(i.distanceTo(this._lastWorldPosition)>.001||n.angleTo(this._lastWorldQuaternion)>.01)&&(this._needsUpdate=!0),this._lastWorldPosition.copy(i),this._lastWorldQuaternion.copy(n),!((!this._needsUpdate||this.context.time.frameCount%2!==0)&&!(this.context.time.realtimeSinceStartup-this._lastUpdateTime>this._camTimeoutInSeconds*.5))&&(this._lastUpdateTime=this.context.time.realtimeSinceStartup,this._needsUpdate=!1,this._model.send(e,this.context.connection),this.context.isInXR||this.context.players.setPlayerView(this.context.connection.connectionId,e,wo.Browser))}onReceivedRemoteCameraInfoBin(e){const i=e.guid();if(!i)return;const n=e.userId();if(!n||!this.context.connection.userIsInRoom(n)||!this.cameraPrefab)return;let s=this.remoteCams[i];if(!s)if("isObject3D"in this.cameraPrefab){const h=new xn;h.context=this.context;const u=C.instantiate(this.cameraPrefab,h);s=this.remoteCams[i]={obj:u,lastUpdate:this.context.time.realtimeSinceStartup,userId:n},s.obj.visible=!0,this.gameObject.add(u),this.userToCamMap[n]=i,bo.instances.push(s);const f=C.getOrAddComponent(u,At);f.connectionId=n,f.avatar=u}else return;const a=s.obj;this.context.players.setPlayerView(n,a,wo.Browser),s.lastUpdate=this.context.time.realtimeSinceStartup,Wi.markDirty(a);const l=e.pos();l&&Pr(a,l.x(),l.y(),l.z());const c=e.rot();c&&ih(a,c.x(),c.y(),c.z())}},r(bo,"instances",[]),bo);tE([m([d.Object3D,te])],Px.prototype,"cameraPrefab");let Fy=Px;var nE=Object.defineProperty,sE=Object.getOwnPropertyDescriptor,Wo=(o,t,e,i)=>{for(var n=i>1?void 0:i?sE(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&nE(t,e,n),n};const zp="view",Np=S("debugsyncedroom");class On extends D{constructor(){super(...arguments);r(this,"roomName","");r(this,"urlParameterName","room");r(this,"joinRandomRoom");r(this,"requireRoomParameter",!1);r(this,"autoRejoin",!0);r(this,"createJoinButton",!0);r(this,"createViewOnlyButton",!1);r(this,"_lastJoinedRoom");r(this,"_roomPrefix","");r(this,"_lastPingTime",0);r(this,"_lastRoomTime",-1);r(this,"_userWantsToBeInARoom",!1);r(this,"_roomButton");r(this,"_roomButtonIconJoin");r(this,"_roomButtonIconLeave");r(this,"updateRoomButtonState",()=>{var e,i;this._roomButton&&(this.context.connection.isInRoom?(this._roomButton.title="Leave the networked room",this._roomButton.textContent="Leave Room",(e=this._roomButtonIconJoin)==null||e.remove(),this._roomButton.prepend(this._roomButtonIconLeave)):(this._roomButton.title="Create or join a networked room",this._roomButton.textContent="Join Room",(i=this._roomButtonIconLeave)==null||i.remove(),this._roomButton.prepend(this._roomButtonIconJoin)))});r(this,"_viewOnlyButton");r(this,"onCreateViewOnlyButton",()=>{if(!this._viewOnlyButton){const e=document.createElement("button");this._viewOnlyButton=e,e.classList.add("view-only-button"),e.setAttribute("priority","90"),e.onclick=()=>{var n;const i=this.getViewOnlyUrl();i!=null&&i.length?navigator.canShare({url:i})?(n=navigator.share({url:i}))==null||n.catch(s=>{console.warn(s)}):(navigator.clipboard.writeText(i),Ee("View only URL copied to clipboard")):me("Could not create view only URL")},e.title="Copy the view only URL: A page accessed by the view only URL can not be modified by visiting users.",e.textContent="Share View URL",e.prepend(bt("visibility"))}this.context.menu.appendChild(this._viewOnlyButton)})}get currentRoomName(){const e=S(zp);return e||S(this.urlParameterName)}set roomPrefix(e){this._roomPrefix=e}get roomPrefix(){return this._roomPrefix}awake(){var e;this.joinRandomRoom===void 0&&((e=this.roomName)==null?void 0:e.length)<=0&&(this.joinRandomRoom=!0),Np&&console.log(`SyncedRoom roomName:${this.roomName}, urlParamName:${this.urlParameterName}, joinRandomRoom:${this.joinRandomRoom}`)}onEnable(){const e=S(zp);if(e&&typeof e=="string"&&e.length>0){console.log("Join as viewer"),this.context.connection.joinRoom(e,!0);return}if(this.tryJoinRoom(),this.createJoinButton){const i=this.createRoomButton();this.context.menu.appendChild(i)}this.createViewOnlyButton&&this.onEnableViewOnlyButton()}onDisable(){var e;(e=this._roomButton)==null||e.remove(),this.onDisableViewOnlyButton(),this.roomName&&this.roomName.length>0&&this.context.connection.leaveRoom(this.roomName)}onDestroy(){this.destroyRoomButton()}tryJoinRandomRoom(){this.setRandomRoomUrlParameter(),this.tryJoinRoom()}tryJoinRoom(e=0){var n;e===void 0&&(e=0);let i=!1;if(((n=this.urlParameterName)==null?void 0:n.length)>0){const s=S(this.urlParameterName);if(s&&(typeof s=="string"||typeof s=="number")){i=!0;const a=c0(s.toString());this.roomName=a}else if(this.joinRandomRoom&&(console.log("No room name found in url, generating random one"),this.setRandomRoomUrlParameter(),e<1))return this.tryJoinRoom(e+1)}else this.joinRandomRoom&&(this.roomName===null||this.roomName===void 0||this.roomName.length<=0)&&(this.roomName=this.generateRoomName());return this.requireRoomParameter&&!i?((Np||j())&&console.warn('[SyncedRoom] Missing required room parameter "'+this.urlParameterName+`" in url - will not connect.
1389
+ `)},e.userData.isLightBlendMaterial=!0}applyShadowMaterial(){if(this.targetMesh)if(this.targetMesh.material.type!=="ShadowMaterial"){const e=new d.ShadowMaterial;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),this.targetMesh.material=e,e.userData.isShadowCatcherMaterial=!0}else{const e=this.targetMesh.material;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),e.userData.isShadowCatcherMaterial=!0}}applyOccluderMaterial(){if(this.targetMesh){let e=this.targetMesh.material;if(!e){const i=new d.MeshBasicMaterial;this.targetMesh.material=i,e=i}e.depthWrite=!0,e.stencilWrite=!0,e.colorWrite=!1,this.gameObject.renderOrder=-100}}applyMaterialOptions(e){e&&(e.depthWrite=!1,e.stencilWrite=!1)}}xx([m()],zh.prototype,"mode");xx([m(ie)],zh.prototype,"shadowColor");var UR=Object.defineProperty,Nh=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&UR(t,e,n),n};const _t=S("debugskybox");By("background-image");By("environment-image");function $b(o,t,e,i,n){if(t==="transparent"||t!=null&&t.startsWith("rgb")||t!=null&&t.startsWith("#")){console.warn(`Needle Engine: Invalid ${n} value (${t}). Did you mean to set background-color instead?`);return}const s=new Sf;s.allowDrop=!1,s.allowNetworking=!1,s.background=e,s.environment=i,C.addComponent(o.scene,s);const a=l=>{typeof l=="string"&&(_t&&console.log(n,"CHANGED TO",l),s.setSkybox(l))};return d0(o.domElement,n,a),s.addEventListener("destroy",()=>{_t&&console.log("Destroyed attribute remote skybox",n),u0(o.domElement,n,a)}),s.setSkybox(t)}const Su=new Array;re.registerCallback(he.ContextCreationStart,o=>{const t=o.context,e=t.domElement.getAttribute("background-image"),i=t.domElement.getAttribute("environment-image");if(e){_t&&console.log("Creating remote skybox to load "+e);const n=$b(t,e,!0,!1,"background-image");n&&Su.push(n)}if(i){_t&&console.log("Creating remote environment to load "+i);const n=$b(t,i,!1,!0,"environment-image");n&&Su.push(n)}});re.registerCallback(he.ContextCreationStart,()=>Promise.all(Su).finally(()=>{Su.length=0}));function Sx(){return globalThis.NEEDLE_ENGINE_SKYBOX_TEXTURES||(globalThis.NEEDLE_ENGINE_SKYBOX_TEXTURES=new Array),globalThis.NEEDLE_ENGINE_SKYBOX_TEXTURES}function Vb(o){const e=Sx().find(i=>i.src===o);return e?(_t&&console.log("Skybox: Found previously loaded texture for "+o),e.texture):null}async function zR(o){const t=await o;fg(t,!0),Se(t)}function NR(o,t){const e=Sx();for(;e.length>5;){const i=e.shift();i&&zR(i.texture)}t.then(i=>fg(i,!1)),e.push({src:o,texture:t})}const Lr=class extends D{constructor(){super(...arguments);r(this,"url");r(this,"allowDrop",!0);r(this,"background",!0);r(this,"environment",!0);r(this,"allowNetworking",!0);r(this,"_loader");r(this,"_prevUrl");r(this,"_prevLoadedEnvironment");r(this,"_prevEnvironment",null);r(this,"_prevBackground",null);r(this,"validTextureTypes",[".ktx2",".hdr",".exr",".jpg",".jpeg",".png"]);r(this,"onDragOverEvent",e=>{if(this.allowDrop&&e.dataTransfer)for(const i of e.dataTransfer.types)(i==="text/uri-list"||i==="Files")&&e.preventDefault()});r(this,"onDrop",e=>{var i,n,s,a;if(this.allowDrop&&e.dataTransfer){for(const l of e.dataTransfer.types)if(_t&&console.log(l),l==="text/uri-list"){const c=e.dataTransfer.getData(l);_t&&console.log(l,c);let h=(n=(i=new RegExp(/polyhaven.com\/asset_img\/.+?\/(?<name>.+)\.png/).exec(c))==null?void 0:i.groups)==null?void 0:n.name;if(h||(h=(a=(s=new RegExp(/polyhaven\.com\/a\/(?<name>.+)/).exec(c))==null?void 0:s.groups)==null?void 0:a.name),_t&&console.log(h),h){const u="https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/"+h+"_1k.exr";console.log(`[Remote Skybox] Setting skybox from url: ${u}`),e.preventDefault(),this.setSkybox(u);break}else if(this.isValidTextureType(c)){console.log("[Remote Skybox] Setting skybox from url: "+c),e.preventDefault(),this.setSkybox(c);break}else{console.warn(`[RemoteSkybox] Unknown url ${c}. If you want to load a skybox from a url, make sure it is a valid image url. Url must end with${this.validTextureTypes.join(", ")}.`);const u=new CustomEvent("dropped-unknown-url",{detail:{sender:this,event:e,url:c,apply:f=>{e.preventDefault(),this.setSkybox(f)}}});this.dispatchEvent(u)}}else if(l=="Files"){const c=e.dataTransfer.files.item(0);if(_t&&console.log(l,c),!c)continue;if(!this.isValidTextureType(c.name)){console.warn(`[RemoteSkybox]: File "${c.name}" is not supported. Supported files are ${this.validTextureTypes.join(", ")}`);return}if(Vb(c.name)===null){const h=new Blob([c]),u=URL.createObjectURL(h);e.preventDefault(),this.setSkybox(u,c.name)}else e.preventDefault(),this.setSkybox(c.name);break}}})}onEnable(){this.setSkybox(this.url),this.registerDropEvents()}onDisable(){var e;this.context.scene.environment===this._prevLoadedEnvironment&&(this.context.scene.environment=this._prevEnvironment,ri.backgroundShouldBeTransparent(this.context)||(this.context.scene.background=this._prevBackground),this._prevLoadedEnvironment=void 0),this.unregisterDropEvents(),(e=this.context.mainCameraComponent)==null||e.applyClearFlags()}urlChangedSyncField(){this.allowNetworking&&this.url&&(this.isRemoteTexture(this.url)?this.setSkybox(this.url):_t&&console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`))}async setSkybox(e,i){var a;if(!this.activeAndEnabled||(e=$R(e,this.environment,this.background),!e))return!1;try{e.startsWith("/")||e.startsWith(".")?new URL(e,window.location.href):new URL(e)}catch{return _t&&console.warn("RemoteSkybox: Invalid URL",e,this.name),!1}if(i??(i=e),this.isValidTextureType(i)||console.warn("Potentially invalid skybox url",i,"on",this.name),_t&&console.log("Set remote skybox url: "+e),this._prevUrl===e&&this._prevLoadedEnvironment)return this.apply(),!0;(a=this._prevLoadedEnvironment)==null||a.dispose(),this._prevLoadedEnvironment=void 0,this._prevUrl=e;const n=await this.loadTexture(e,i);if(!n)return _t&&console.warn("RemoteSkybox: Failed to load texture from url",e),!1;if(!this.enabled)return _t&&console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"),!1;if(this._prevUrl!==e)return _t&&console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"),!1;this.url=e;const s=e.lastIndexOf("/");return n.name=e.substring(s>=0?s+1:0),this._loader instanceof d.TextureLoader&&(n.colorSpace=d.SRGBColorSpace),this._prevLoadedEnvironment=n,this.apply(),!0}async loadTexture(e,i){var u,f,p,g,y;if(!e)return Promise.resolve(null);i??(i=e);const n=Vb(i);if(n){const b=await n;if(((f=(u=b.source)==null?void 0:u.data)==null?void 0:f.length)>0||(y=(g=(p=b.source)==null?void 0:p.data)==null?void 0:g.data)!=null&&y.length)return b}const s=i.endsWith(".exr"),a=i.endsWith(".hdr"),l=i.endsWith(".ktx2");if(s)this._loader instanceof H.EXRLoader||(this._loader=new H.EXRLoader);else if(a)this._loader instanceof H.RGBELoader||(this._loader=new H.RGBELoader);else if(l){if(!(this._loader instanceof H.KTX2Loader)){const{ktx2Loader:b}=le.createLoaders(this.context.renderer);this._loader=b}}else this._loader instanceof d.TextureLoader||(this._loader=new d.TextureLoader);_t&&console.log("Loading skybox: "+e);const c=this._loader.loadAsync(e);return NR(i,c),await c}apply(){var i;const e=this._prevLoadedEnvironment;e&&(e instanceof d.CubeTexture||e instanceof d.CompressedCubeTexture||(e.mapping=d.EquirectangularRefractionMapping,e.needsUpdate=!0),this.context.scene.background!==e&&(this._prevBackground=this.context.scene.background),this.context.scene.environment!==e&&(this._prevEnvironment=this.context.scene.environment),_t&&console.log("Set remote skybox",this.url,!ri.backgroundShouldBeTransparent(this.context)),this.environment&&(this.context.scene.environment=e),this.background&&!ri.backgroundShouldBeTransparent(this.context)&&(this.context.scene.background=e),((i=this.context.mainCameraComponent)==null?void 0:i.backgroundBlurriness)!==void 0&&(this.context.scene.backgroundBlurriness=this.context.mainCameraComponent.backgroundBlurriness))}isRemoteTexture(e){return e.startsWith("http://")||e.startsWith("https://")}isValidTextureType(e){for(const i of this.validTextureTypes)if(e.endsWith(i))return!0;return!1}registerDropEvents(){this.unregisterDropEvents(),this.context.domElement.addEventListener("dragover",this.onDragOverEvent),this.context.domElement.addEventListener("drop",this.onDrop)}unregisterDropEvents(){this.context.domElement.removeEventListener("dragover",this.onDragOverEvent),this.context.domElement.removeEventListener("drop",this.onDrop)}};Nh([hy(Lr.prototype.urlChangedSyncField),m(URL)],Lr.prototype,"url");Nh([m()],Lr.prototype,"allowDrop");Nh([m()],Lr.prototype,"background");Nh([m()],Lr.prototype,"environment");Nh([m()],Lr.prototype,"allowNetworking");let Sf=Lr;function $R(o,t,e){const i=t&&!e;switch(o==null?void 0:o.toLowerCase()){case"studio":return i?"https://cdn.needle.tools/static/skybox/modelviewer-Neutral-small.hdr":"https://cdn.needle.tools/static/skybox/modelviewer-Neutral.hdr";case"blurred-skybox":return i?"https://cdn.needle.tools/static/skybox/blurred-skybox-small.exr":"https://cdn.needle.tools/static/skybox/blurred-skybox.exr";case"quicklook-ar":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ARMode-small.exr":"https://cdn.needle.tools/static/skybox/QuickLook-ARMode.exr";case"quicklook":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode-small.exr":"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.exr"}return o===void 0?null:o}var VR=Object.defineProperty,Cf=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&VR(t,e,n),n},ur;const $h=(ur=class extends D{constructor(){super(...arguments);r(this,"target",null);r(this,"followFactor",.1);r(this,"rotateFactor",.1);r(this,"positionAxes",xa.All);r(this,"flipForward",!1);r(this,"_firstUpdate",!0)}onBeforeRender(){this.updateNow(!1)}updateNow(e){if(!(!this.target||this.target===this.gameObject)){if(this.followFactor>0){const i=Q(this.target),n=this._firstUpdate||e?1:z.clamp01(this.context.time.deltaTime*this.followFactor),s=this.worldPosition;this.positionAxes&xa.X&&(s.x=z.lerp(s.x,i.x,n)),this.positionAxes&xa.Y&&(s.y=z.lerp(s.y,i.y,n)),this.positionAxes&xa.Z&&(s.z=z.lerp(s.z,i.z,n)),this.worldPosition=s}if(this.rotateFactor>0){const i=_e(this.target);this.flipForward&&i.premultiply(ur._invertForward);const n=this._firstUpdate||e?1:z.clamp01(this.context.time.deltaTime*this.rotateFactor);this.worldQuaternion=this.worldQuaternion.slerp(i,n)}this._firstUpdate=!1}}},r(ur,"_invertForward",new d.Quaternion().setFromAxisAngle(new d.Vector3(0,1,0),Math.PI)),ur);Cf([m(d.Object3D)],$h.prototype,"target");Cf([m()],$h.prototype,"followFactor");Cf([m()],$h.prototype,"rotateFactor");Cf([m()],$h.prototype,"positionAxes");let Pf=$h;var WR=Object.defineProperty,Vh=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&WR(t,e,n),n};const _c=S("debugspatialtrigger"),Wb=new d.Layers,Gb=new d.Layers;function GR(o,t){return Wb.mask=o,Gb.mask=t,Wb.test(Gb)}class Zn extends D{constructor(){super(...arguments);r(this,"triggerMask",0);r(this,"onEnter");r(this,"onStay");r(this,"onExit");r(this,"currentIntersected",[]);r(this,"lastIntersected",[])}start(){_c&&console.log(this.name,this.triggerMask,this)}update(){this.currentIntersected.length=0;for(const e of Mf.triggers)GR(e.triggerMask,this.triggerMask)&&e.test(this.gameObject)&&this.currentIntersected.push(e);for(let e=this.lastIntersected.length-1;e>=0;e--){const i=this.lastIntersected[e];this.currentIntersected.indexOf(i)<0&&(this.onExitTrigger(i),this.lastIntersected.splice(e,1))}for(const e of this.currentIntersected)this.lastIntersected.indexOf(e)<0&&this.onEnterTrigger(e),this.onStayTrigger(e);this.lastIntersected.length=0,this.lastIntersected.push(...this.currentIntersected)}onEnterTrigger(e){var i;_c&&console.log("ENTER TRIGGER",this.name,e.name,this,e),e.raiseOnEnterEvent(this),(i=this.onEnter)==null||i.invoke()}onExitTrigger(e){var i;_c&&console.log("EXIT TRIGGER",this.name,e.name),e.raiseOnExitEvent(this),(i=this.onExit)==null||i.invoke()}onStayTrigger(e){var i;e.raiseOnStayEvent(this),(i=this.onStay)==null||i.invoke()}}Vh([m()],Zn.prototype,"triggerMask");Vh([m(ye)],Zn.prototype,"onEnter");Vh([m(ye)],Zn.prototype,"onStay");Vh([m(ye)],Zn.prototype,"onExit");var Rs;const Cx=(Rs=class extends D{constructor(){super(...arguments);r(this,"triggerMask");r(this,"boxHelper")}start(){_c&&console.log(this.name,this.triggerMask,this)}onEnable(){var e;Rs.triggers.push(this),this.boxHelper||(this.boxHelper=C.addComponent(this.gameObject,is),(e=this.boxHelper)==null||e.showHelper(null,_c))}onDisable(){Rs.triggers.splice(Rs.triggers.indexOf(this),1)}test(e){return this.boxHelper?this.boxHelper.isInBox(e)??!1:!1}raiseOnEnterEvent(e){C.foreachComponent(this.gameObject,i=>{i!==e&&i instanceof Zn&&i.onEnterTrigger(this)},!1)}raiseOnStayEvent(e){C.foreachComponent(this.gameObject,i=>{i!==e&&i instanceof Zn&&i.onStayTrigger(this)},!1)}raiseOnExitEvent(e){C.foreachComponent(this.gameObject,i=>{i!==e&&i instanceof Zn&&i.onExitTrigger(this)},!1)}},r(Rs,"triggers",[]),Rs);Vh([m()],Cx.prototype,"triggerMask");let Mf=Cx;var HR=Object.defineProperty,qR=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&HR(t,e,n),n};const Pi=S("debugspectator");class Of extends D{constructor(){super(...arguments);r(this,"cam",null);r(this,"useKeys",!0);r(this,"_mode",0);r(this,"orbit",null);r(this,"_handler");r(this,"eventSub_WebXRRequestStartEvent",null);r(this,"eventSub_WebXRStartEvent",null);r(this,"eventSub_WebXREndEvent",null);r(this,"_debug");r(this,"_networking")}get mode(){return this._mode}set mode(e){this._mode=e}get isSpectating(){var e;return((e=this._handler)==null?void 0:e.currentTarget)!==void 0}isSpectatingUser(e){var i;return((i=this.target)==null?void 0:i.userId)===e}isFollowedBy(e){var i;return(i=this.followers)==null?void 0:i.includes(e)}get followers(){return this._networking.followers}stopSpectating(){if(this.context.isInXR){this.followSelf();return}this.target=void 0}get localId(){return this.context.connection.connectionId??"local"}set target(e){var i;if(this._handler){const n=(i=this._handler.currentTarget)==null?void 0:i.userId,s=this.context.players.getPlayerView(this.localId);e===void 0||this.context.isInXR===!1&&(s==null?void 0:s.currentObject)===e.currentObject?this._handler.currentTarget!==void 0&&(this._handler.disable(),C.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),this._networking.onSpectatedObjectChanged(e,n)):this._handler.currentTarget!==e&&(this._handler.set(e),C.setActive(this.gameObject,!0),this.orbit&&(this.orbit.enabled=!1),this._networking.onSpectatedObjectChanged(e,n))}}get target(){var e;return(e=this._handler)==null?void 0:e.currentTarget}requestAllFollowMe(){this._networking.onRequestFollowMe()}get isSpectatingSelf(){var e,i;return this.isSpectating&&((e=this.target)==null?void 0:e.currentObject)===((i=this.context.players.getPlayerView(this.localId))==null?void 0:i.currentObject)}awake(){if(this._debug=new YR(this.context,this),this._networking=new JR(this.context,this),this._networking.awake(),C.setActive(this.gameObject,!1),this.cam=C.getComponent(this.gameObject,ri),!this.cam){console.warn("SpectatorCamera: Spectator camera needs camera component on the same object.",this);return}!this._handler&&this.cam&&(this._handler=new XR(this.context,this.cam,this)),this.orbit=C.getComponent(this.context.mainCamera,ge)}onDestroy(){var e,i;this.stopSpectating(),(e=this._handler)==null||e.destroy(),(i=this._networking)==null||i.destroy()}isSupportedPlatform(){const e=window.navigator.userAgent,i=/Windows|MacOS/.test(e),n=/Windows NT/.test(e)&&/Edg/.test(e)&&!/Win64/.test(e);return i&&!n}onBeforeXR(e){this.isSupportedPlatform()&&C.setActive(this.gameObject,!0)}onEnterXR(e){this.isSupportedPlatform()&&(Pi&&console.log(this.context.mainCamera),this.context.mainCamera&&this.followSelf())}onLeaveXR(e){var i,n;this.context.removeCamera(this.cam),C.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),(i=this._handler)==null||i.set(void 0),(n=this._handler)==null||n.disable(),this.isSpectatingSelf&&this.stopSpectating()}followSelf(){this.target=this.context.players.getPlayerView(this.context.connection.connectionId),this.target||(this.context.players.setPlayerView(this.localId,this.context.mainCamera,wo.Headset),this.target=this.context.players.getPlayerView(this.localId)),Pi&&console.log("Follow self",this.target)}onAfterRender(){var u,f,p;if(!this.cam)return;const e=this.context.renderer,i=e.xr.enabled;if(!e.xr.isPresenting&&!((u=this._handler)!=null&&u.currentTarget))return;(f=this._handler)==null||f.update(this._mode);const n=e.getRenderTarget();let s=null;const a=e.state;if(!n){if(!e.state.bindFramebuffer||!a.bindXRFramebuffer)return;s=e._framebuffer,a.bindXRFramebuffer(null)}this.setAvatarFlagsBeforeRender();const l=this.context.mainCameraComponent;if(l){const g=l.backgroundColor;g&&e.setClearColor(g,g.alpha),this.cam.backgroundColor=g,this.cam.clearFlags=l.clearFlags,this.cam.nearClipPlane=l.nearClipPlane,this.cam.farClipPlane=l.farClipPlane}else e.setClearColor(new d.Color(1,1,1));e.setRenderTarget(null),e.xr.enabled=!1;const c=(p=this.cam)==null?void 0:p.threeCamera;this.context.updateAspect(c);const h=e.xr.isPresenting;e.xr.isPresenting=!1,e.setSize(this.context.domWidth,this.context.domHeight),e.render(this.context.scene,c),e.xr.isPresenting=h,e.xr.enabled=i,n?e.setRenderTarget(n):a.bindXRFramebuffer&&a.bindXRFramebuffer(s),this.resetAvatarFlags()}setAvatarFlagsBeforeRender(){const e=this._mode===0;for(const i of At.instances)if(i.avatar&&"isLocalAvatar"in i.avatar&&"flags"in i.avatar){let n=Bn.All;this.isSpectatingSelf&&(n=e&&i.avatar.isLocalAvatar?Bn.FirstPerson:Bn.ThirdPerson);const s=i.avatar.flags;if(!s)continue;for(const a of s)a.UpdateVisible(n)}}resetAvatarFlags(){var e;for(const i of At.instances)if(i.avatar&&"flags"in i.avatar){const n=i.avatar.flags;if(!n)continue;for(const s of n)"isLocalAvatar"in i.avatar&&((e=i.avatar)!=null&&e.isLocalAvatar)?s.UpdateVisible(Bn.FirstPerson):s.UpdateVisible(Bn.ThirdPerson)}}}qR([m()],Of.prototype,"useKeys");class XR{constructor(t,e,i){r(this,"context");r(this,"cam");r(this,"spectator");r(this,"follow");r(this,"target");r(this,"view");r(this,"currentObject");this.context=t,this.cam=e,this.spectator=i}get currentTarget(){return this.view}set(t){const e=t==null?void 0:t.currentObject;if(!e){this.spectator.stopSpectating();return}e!==this.currentObject&&(this.currentObject=e,this.view=t,this.follow||(this.follow=C.addComponent(this.cam.gameObject,Pf)),this.target||(this.target=new d.Object3D),e.add(this.target),this.follow.enabled=!0,this.follow.target=this.target,Pi&&console.log("FOLLOW",e),this.context.isInXR?this.context.removeCamera(this.cam):this.context.setCurrentCamera(this.cam))}disable(){Pi&&console.log("STOP FOLLOW",this.currentObject),this.view=void 0,this.currentObject=void 0,this.context.removeCamera(this.cam),this.follow&&(this.follow.enabled=!1)}destroy(){var t;(t=this.target)==null||t.removeFromParent(),this.follow&&C.destroy(this.follow)}update(t){var n,s,a,l,c,h;if(((n=this.currentTarget)==null?void 0:n.isConnected)===!1||((s=this.currentTarget)==null?void 0:s.removed)===!0){Pi&&console.log("Target disconnected or timeout",this.currentTarget),this.spectator.stopSpectating();return}this.currentTarget&&((a=this.currentTarget)==null?void 0:a.currentObject)!==this.currentObject&&(Pi&&console.log("Target changed",this.currentObject,"to",this.currentTarget.currentObject),this.set(this.currentTarget));const e=this.context.mainCamera;if(e){const u=this.cam.threeCamera;(u.near!==e.near||u.far!==e.far)&&(u.near=e.near,u.far=e.far,u.updateProjectionMatrix())}const i=(l=this.follow)==null?void 0:l.target;if(!(!i||!this.follow)){switch(t){case 0:((c=this.view)==null?void 0:c.viewDevice)!==wo.Browser?(this.follow.followFactor=5,this.follow.rotateFactor=5):(this.follow.followFactor=50,this.follow.rotateFactor=50),i.position.set(0,0,0);break;case 1:this.follow.followFactor=3,this.follow.rotateFactor=2,i.position.set(0,.5,1.5);break}this.follow.flipForward=!1,((h=this.view)==null?void 0:h.viewDevice)!==wo.Browser?i.quaternion.copy(QR):i.quaternion.identity()}}}const QR=new d.Quaternion().setFromAxisAngle(new d.Vector3(0,1,0),Math.PI);class YR{constructor(t,e){r(this,"context");r(this,"spectator");this.context=t,this.spectator=e,console.log("[Spectator Camera] Click other avatars or cameras to follow them. Press ESC to exit spectator mode."),this.context.domElement.addEventListener("keydown",n=>{if(!this.spectator.useKeys)return;n.key==="Escape"&&this.spectator.stopSpectating()});let i=0;this.context.input.addEventListener(Re.PointerDown,n=>{i=this.context.time.time}),this.context.input.addEventListener(Re.PointerUp,n=>{const s=this.context.time.time-i;s>1?this.spectator.stopSpectating():this.context.input.getPointerClicked(0)&&s<.3&&this.trySelectObject()})}trySelectObject(){const t=new es;t.setMask(16777215);const e=this.context.physics.raycast(t);if(Pi&&console.log(...e),e!=null&&e.length)for(const i of e){if(i.distance<.2)continue;const n=i.object,s=C.getComponentInParent(n,At),a=s==null?void 0:s.connectionId;if(a){const l=this.context.players.getPlayerView(a);this.spectator.target=l,Pi&&console.log("spectate",a,s);break}}}}class KR{constructor(t,e,i){r(this,"guid");r(this,"dontSave",!0);r(this,"targetUserId");r(this,"stoppedFollowing");this.guid=t,this.targetUserId=e,this.stoppedFollowing=i}}class ZR{constructor(t,e){r(this,"guid");r(this,"userId");this.guid=t.guid,this.userId=e}}class JR{constructor(t,e){r(this,"followers",[]);r(this,"context");r(this,"spectator");r(this,"_followerEventMethod");r(this,"_requestFollowMethod");r(this,"_joinedRoomMethod");r(this,"_lastRequestFollowUser");r(this,"_enforceFollowInterval");this.context=t,this.spectator=e,this._followerEventMethod=this.onFollowerEvent.bind(this),this._requestFollowMethod=this.onRequestFollowEvent.bind(this),this._joinedRoomMethod=this.onUserJoinedRoom.bind(this)}awake(){this.context.connection.beginListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.beginListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.beginListen(ee.JoinedRoom,this._joinedRoomMethod),this.context.domElement.addEventListener("keydown",t=>{this.spectator.useKeys&&(t.key==="f"?this.onRequestFollowMe():t.key==="Escape"&&this.onRequestFollowMe(!0))})}destroy(){this.context.connection.stopListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.stopListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.stopListen(ee.JoinedRoom,this._joinedRoomMethod)}onSpectatedObjectChanged(t,e){if(Pi&&console.log(this.context.connection.connectionId,"onSpectatedObjectChanged",t,e),this.context.connection.connectionId){const i=(t==null?void 0:t.userId)===void 0,n=i?e:t==null?void 0:t.userId,s=new KR(this.context.connection.connectionId,n,i);this.context.connection.send("spectator-follower-changed",s)}}onRequestFollowMe(t=!1){if(Pi&&console.log("Request follow",this.context.connection.connectionId),this.context.connection.connectionId){this.spectator.stopSpectating();const e=t?void 0:this.context.connection.connectionId,i=new ZR(this.spectator,e);this.context.connection.send("spectator-request-follow",i)}}onUserJoinedRoom(){S("followme")&&this.onRequestFollowMe()}onFollowerEvent(t){const e=t.targetUserId,i=t.guid;if(Pi&&console.log(t),e===this.context.connection.connectionId)if(t.stoppedFollowing){const n=this.followers.indexOf(i);n!==-1&&(this.followers.splice(n,1),this.removeDisconnectedFollowers(),console.log(i,"unfollows you",this.followers.length))}else this.followers.includes(i)||(this.followers.push(i),this.removeDisconnectedFollowers(),console.log(i,"follows you",this.followers.length))}removeDisconnectedFollowers(){for(let t=this.followers.length-1;t>=0;t--){const e=this.followers[t];this.context.connection.userIsInRoom(e)===!1&&this.followers.splice(t,1)}}onRequestFollowEvent(t){if(this._lastRequestFollowUser=t,t.userId===this.context.connection.connectionId)this.spectator.stopSpectating();else if(t.userId===void 0)this.spectator.stopSpectating();else{const e=this.context.players.getPlayerView(t.userId);if(e)this.spectator.target=e;else return Pi&&console.warn("Could not find view",t.userId),this.enforceFollow(),!1}return!0}enforceFollow(){this._enforceFollowInterval||(this._enforceFollowInterval=setInterval(()=>{this._lastRequestFollowUser===void 0||this._lastRequestFollowUser.userId&&this.spectator.isFollowedBy(this._lastRequestFollowUser.userId)?(clearInterval(this._enforceFollowInterval),this._enforceFollowInterval=void 0):(Pi&&console.log("REQUEST FOLLOW AGAIN",this._lastRequestFollowUser.userId),this.onRequestFollowEvent(this._lastRequestFollowUser))},1e3))}}class jn{constructor(){r(this,"bb",null);r(this,"bb_pos",0)}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSyncedCameraModel(t,e){return(e||new jn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSyncedCameraModel(t,e){return t.setPosition(t.position()+ae.SIZE_PREFIX_LENGTH),(e||new jn).__init(t.readInt32(t.position())+t.position(),t)}userId(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}guid(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}dontSave(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}pos(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new Sr).__init(this.bb_pos+e,this.bb):null}rot(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new Sr).__init(this.bb_pos+e,this.bb):null}static startSyncedCameraModel(t){t.startObject(5)}static addUserId(t,e){t.addFieldOffset(0,e,0)}static addGuid(t,e){t.addFieldOffset(1,e,0)}static addDontSave(t,e){t.addFieldInt8(2,+e,0)}static addPos(t,e){t.addFieldStruct(3,e,0)}static addRot(t,e){t.addFieldStruct(4,e,0)}static endSyncedCameraModel(t){return t.endObject()}static finishSyncedCameraModelBuffer(t,e){t.finish(e)}static finishSizePrefixedSyncedCameraModelBuffer(t,e){t.finish(e,void 0,!0)}}var eE=Object.defineProperty,tE=(o,t,e,i)=>{for(var n=void 0,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=a(t,e,n)||n);return n&&eE(t,e,n),n};const Cu="SCAM";ag(Cu,jn.getRootAsSyncedCameraModel);const yi=new ae.Builder;class iE{constructor(t,e){r(this,"userId");r(this,"guid");this.guid=e,this.userId=t}send(t,e){if(t){yi.clear();const i=yi.createString(this.guid),n=yi.createString(this.userId);jn.startSyncedCameraModel(yi),jn.addGuid(yi,i),jn.addUserId(yi,n);const s=Q(t),a=Bu(t);jn.addPos(yi,Sr.createVec3(yi,s.x,s.y,s.z)),jn.addRot(yi,Sr.createVec3(yi,a.x,a.y,a.z));const l=jn.endSyncedCameraModel(yi);yi.finish(l,Cu),e.sendBinary(yi.asUint8Array())}}}var bo;const Px=(bo=class extends D{constructor(){super(...arguments);r(this,"cameraPrefab",null);r(this,"_lastWorldPosition");r(this,"_lastWorldQuaternion");r(this,"_model",null);r(this,"_needsUpdate",!0);r(this,"_lastUpdateTime",0);r(this,"remoteCams",{});r(this,"userToCamMap",{});r(this,"_camTimeoutInSeconds",10);r(this,"_receiveCallback",null)}getCameraObject(e){const i=this.userToCamMap[e];return i?this.remoteCams[i].obj:null}async awake(){this._lastWorldPosition=this.worldPosition.clone(),this._lastWorldQuaternion=this.worldQuaternion.clone(),this.cameraPrefab&&("uri"in this.cameraPrefab&&(this.cameraPrefab=await this.cameraPrefab.instantiate(this.gameObject)),this.cameraPrefab&&"isObject3D"in this.cameraPrefab&&(this.cameraPrefab.visible=!1))}onEnable(){this._receiveCallback=this.context.connection.beginListenBinary(Cu,this.onReceivedRemoteCameraInfoBin.bind(this))}onDisable(){this.context.connection.stopListenBinary(Cu,this._receiveCallback)}update(){for(const s in this.remoteCams){const a=this.remoteCams[s],l=this.context.time.realtimeSinceStartup-a.lastUpdate;if(!a||l>this._camTimeoutInSeconds){j()&&console.log("Remote cam timeout",s),a!=null&&a.obj&&C.destroy(a.obj),delete this.remoteCams[s],a&&delete this.userToCamMap[a.userId],bo.instances.push(a),this.context.players.removePlayerView(a.userId,wo.Browser);continue}}if(this.context.isInXR)return;const e=this.context.mainCamera;if(e===null){this.enabled=!1;return}if(!this.context.connection.isConnected||this.context.connection.connectionId===null)return;this._model===null&&(this._model=new iE(this.context.connection.connectionId,this.context.connection.connectionId+"_camera"));const i=Q(e),n=_e(e);(i.distanceTo(this._lastWorldPosition)>.001||n.angleTo(this._lastWorldQuaternion)>.01)&&(this._needsUpdate=!0),this._lastWorldPosition.copy(i),this._lastWorldQuaternion.copy(n),!((!this._needsUpdate||this.context.time.frameCount%2!==0)&&!(this.context.time.realtimeSinceStartup-this._lastUpdateTime>this._camTimeoutInSeconds*.5))&&(this._lastUpdateTime=this.context.time.realtimeSinceStartup,this._needsUpdate=!1,this._model.send(e,this.context.connection),this.context.isInXR||this.context.players.setPlayerView(this.context.connection.connectionId,e,wo.Browser))}onReceivedRemoteCameraInfoBin(e){const i=e.guid();if(!i)return;const n=e.userId();if(!n||!this.context.connection.userIsInRoom(n)||!this.cameraPrefab)return;let s=this.remoteCams[i];if(!s)if("isObject3D"in this.cameraPrefab){const h=new xn;h.context=this.context;const u=C.instantiate(this.cameraPrefab,h);s=this.remoteCams[i]={obj:u,lastUpdate:this.context.time.realtimeSinceStartup,userId:n},s.obj.visible=!0,this.gameObject.add(u),this.userToCamMap[n]=i,bo.instances.push(s);const f=C.getOrAddComponent(u,At);f.connectionId=n,f.avatar=u}else return;const a=s.obj;this.context.players.setPlayerView(n,a,wo.Browser),s.lastUpdate=this.context.time.realtimeSinceStartup,Wi.markDirty(a);const l=e.pos();l&&Pr(a,l.x(),l.y(),l.z());const c=e.rot();c&&ih(a,c.x(),c.y(),c.z())}},r(bo,"instances",[]),bo);tE([m([d.Object3D,te])],Px.prototype,"cameraPrefab");let Fy=Px;var nE=Object.defineProperty,sE=Object.getOwnPropertyDescriptor,Wo=(o,t,e,i)=>{for(var n=i>1?void 0:i?sE(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&nE(t,e,n),n};const zp="view",Np=S("debugsyncedroom");class On extends D{constructor(){super(...arguments);r(this,"roomName","");r(this,"urlParameterName","room");r(this,"joinRandomRoom");r(this,"requireRoomParameter",!1);r(this,"autoRejoin",!0);r(this,"createJoinButton",!0);r(this,"createViewOnlyButton",!1);r(this,"_lastJoinedRoom");r(this,"_roomPrefix","");r(this,"_lastPingTime",0);r(this,"_lastRoomTime",-1);r(this,"_userWantsToBeInARoom",!1);r(this,"_roomButton");r(this,"_roomButtonIconJoin");r(this,"_roomButtonIconLeave");r(this,"updateRoomButtonState",()=>{var e,i;this._roomButton&&(this.context.connection.isInRoom?(this._roomButton.title="Leave the networked room",this._roomButton.textContent="Leave Room",(e=this._roomButtonIconJoin)==null||e.remove(),this._roomButton.prepend(this._roomButtonIconLeave)):(this._roomButton.title="Create or join a networked room",this._roomButton.textContent="Join Room",(i=this._roomButtonIconLeave)==null||i.remove(),this._roomButton.prepend(this._roomButtonIconJoin)))});r(this,"_viewOnlyButton");r(this,"onCreateViewOnlyButton",()=>{if(!this._viewOnlyButton){const e=document.createElement("button");this._viewOnlyButton=e,e.classList.add("view-only-button"),e.setAttribute("priority","90"),e.onclick=()=>{var n;const i=this.getViewOnlyUrl();i!=null&&i.length?navigator.canShare({url:i})?(n=navigator.share({url:i}))==null||n.catch(s=>{console.warn(s)}):(navigator.clipboard.writeText(i),Ee("View only URL copied to clipboard")):me("Could not create view only URL")},e.title="Copy the view only URL: A page accessed by the view only URL can not be modified by visiting users.",e.textContent="Share View URL",e.prepend(bt("visibility"))}this.context.menu.appendChild(this._viewOnlyButton)})}get currentRoomName(){const e=S(zp);return e||S(this.urlParameterName)}set roomPrefix(e){this._roomPrefix=e}get roomPrefix(){return this._roomPrefix}awake(){var e;this.joinRandomRoom===void 0&&((e=this.roomName)==null?void 0:e.length)<=0&&(this.joinRandomRoom=!0),Np&&console.log(`SyncedRoom roomName:${this.roomName}, urlParamName:${this.urlParameterName}, joinRandomRoom:${this.joinRandomRoom}`)}onEnable(){const e=S(zp);if(e&&typeof e=="string"&&e.length>0){console.log("Join as viewer"),this.context.connection.joinRoom(e,!0);return}if(this.tryJoinRoom(),this.createJoinButton){const i=this.createRoomButton();this.context.menu.appendChild(i)}this.createViewOnlyButton&&this.onEnableViewOnlyButton()}onDisable(){var e;(e=this._roomButton)==null||e.remove(),this.onDisableViewOnlyButton(),this.roomName&&this.roomName.length>0&&this.context.connection.leaveRoom(this.roomName)}onDestroy(){this.destroyRoomButton()}tryJoinRandomRoom(){this.setRandomRoomUrlParameter(),this.tryJoinRoom()}tryJoinRoom(e=0){var n;e===void 0&&(e=0);let i=!1;if(((n=this.urlParameterName)==null?void 0:n.length)>0){const s=S(this.urlParameterName);if(s&&(typeof s=="string"||typeof s=="number")){i=!0;const a=c0(s.toString());this.roomName=a}else if(this.joinRandomRoom&&(console.log("No room name found in url, generating random one"),this.setRandomRoomUrlParameter(),e<1))return this.tryJoinRoom(e+1)}else this.joinRandomRoom&&(this.roomName===null||this.roomName===void 0||this.roomName.length<=0)&&(this.roomName=this.generateRoomName());return this.requireRoomParameter&&!i?((Np||j())&&console.warn('[SyncedRoom] Missing required room parameter "'+this.urlParameterName+`" in url - will not connect.
1390
1390
  To allow joining a room without a query parameter you can set "requireRoomParameter" to false.`),!1):(this.context.connection.isConnected||this.context.connection.connect(),this._lastJoinedRoom=this.roomName,this._roomPrefix&&(this.roomName=this._roomPrefix+this.roomName),this.roomName.length<=0?(console.warn(`[SyncedRoom] Room name is not set so we can not join a networked room.
1391
1391
  Please choose one of the following options to fix this:
1392
1392
  A) Set a room name in the SyncedRoom component
@@ -1569,7 +1569,7 @@ Needle Engine: Begin loading `+i+`
1569
1569
  `,e),this.onBeforeBeginLoading();const l=[],c={context:this._context,name:"",progress:{},index:0,count:e.length,totalProgress01:this._loadingProgress01},h=new CustomEvent("progress",{detail:c}),u=new Array,f=new AbortController;this._abortController=f;const p={files:e,abortSignal:f.signal,onLoadingProgress:v=>{var x;if(Ce&&console.debug("Loading progress: ",v),f.signal.aborted)return;const w=v.index;!u[w]&&v.name&&(u[w]=ZE(v.name)),v.name=u[w],a&&((x=this._loadingView)==null||x.onLoadingUpdate(v)),c.name=v.name,c.progress=v.progress,this._loadingProgress01=Yy(v),c.totalProgress01=this._loadingProgress01,this.dispatchEvent(h)},onLoadingFinished:(v,w,x)=>{Ce&&console.debug(`Finished loading "${w}" (aborted? ${f.signal.aborted})`),!f.signal.aborted&&x&&l.push({src:w,file:x})}};JE(this);const g=this.getAttribute("hash");g!=null&&(this._context.hash=g),this._context.alias=n,this._createContextPromise=this._context.create(p);const y=await this._createContextPromise;if(this.applyAttributes(),Ce&&console.warn(`--------------
1570
1570
  Needle Engine: finished loading `+i+`
1571
1571
  `,e,`Aborted? ${f.signal.aborted}`),f.signal.aborted){console.log("Loading finished but aborted...");return}if(this._loadId!==i){console.log("Load id changed during loading process");return}this._loadingProgress01=1,a&&y&&((_=this._loadingView)==null||_.onLoadingUpdate(1,"creating scene")),this._didFullyLoad=!0,this.classList.remove("loading"),this.classList.add("loading-finished"),this.dispatchEvent(new CustomEvent("loadfinished",{detail:{context:this._context,src:n,loadedFiles:l}}))}applyAttributes(){var n,s;if((n=this._context)!=null&&n.renderer){const a=qv(this.toneMapping);a!==void 0&&(this._context.renderer.toneMapping=a);const l=this.getAttribute("tone-mapping-exposure");if(l!=null){const c=parseFloat(l);isNaN(c)||(this._context.renderer.toneMappingExposure=c)}}const e=this.getAttribute("background-blurriness");if(e!=null){const a=parseFloat(e);a!==void 0&&this._context&&(this._context.scene.backgroundBlurriness=a)}const i=this.getAttribute("background-color");if((s=this._context)!=null&&s.renderer&&typeof i=="string"&&i.length>0){const a=ie.fromColorRepresentation(i);Ce&&console.debug("<needle-engine> background-color changed, str:",i,"→",a),this._context.renderer.setClearColor(a,a.alpha),this.context.scene.background=null}}getSourceFiles(){const e=this.getAttribute("src");if(!e)return[];let i;Array.isArray(e)?i=e:e.startsWith("[")&&e.endsWith("]")?i=JSON.parse(e):e.includes(",")?i=e.split(","):i=[e];for(let n=i.length-1;n>=0;n--){const s=i[n];(s==="null"||s==="undefined"||(s==null?void 0:s.length)<=0)&&i.splice(n,1)}return i}checkIfSourceHasChanged(e,i){if((e==null?void 0:e.length)!==(i==null?void 0:i.length)||e==null&&i!==null||e!==null&&i==null)return!0;if(e!==null&&i!==null){for(let n=0;n<(e==null?void 0:e.length);n++)if(e[n]!==i[n])return!0}return!1}ensureLoadStartIsRegistered(){const e=this.getAttribute("loadstart");e&&this.registerEventFromAttribute("loadstart",e)}registerEventFromAttribute(e,i){const n=this._previouslyRegisteredMap.get(e);if(n&&(this._previouslyRegisteredMap.delete(e),this.removeEventListener(e,n)),typeof i=="string"&&i.length>0)try{const s=(0,eval)(i);typeof s=="function"&&(this._previouslyRegisteredMap.set(e,s),this.addEventListener(e,a=>s==null?void 0:s.call(globalThis,this._context,a)))}catch(s){console.error("Error registering event "+e+'="'+i+`" failed with the following error:
1572
- `,s)}}setPublicKey(){ba&&ba.length>0&&this.setAttribute("public-key",ba)}setVersion(){_n.length>0&&this.setAttribute("version",_n)}getAROverlayContainer(){return this._overlay_ar.createOverlayContainer(this)}getVROverlayContainer(){for(let e=0;e<this.children.length;e++){const i=this.children[e];if(i.classList.contains("vr"))return i}return null}onEnterAR(e){var n;this.onSetupAR();const i=this.getAROverlayContainer();this._overlay_ar.onBegin(this._context,i,e),this.dispatchEvent(new CustomEvent("enter-ar",{detail:{session:e,context:this._context,htmlContainer:(n=this._overlay_ar)==null?void 0:n.ARContainer}}))}onExitAR(e){var i;this._overlay_ar.onEnd(this._context),this.onSetupDesktop(),this.dispatchEvent(new CustomEvent("exit-ar",{detail:{session:e,context:this._context,htmlContainer:(i=this._overlay_ar)==null?void 0:i.ARContainer}}))}onEnterVR(e){this.onSetupVR(),this.dispatchEvent(new CustomEvent("enter-vr",{detail:{session:e,context:this._context}}))}onExitVR(e){this.onSetupDesktop(),this.dispatchEvent(new CustomEvent("exit-vr",{detail:{session:e,context:this._context}}))}onSetupAR(){this.classList.add(Wl),this.classList.remove(Gl);const e=this.getAROverlayContainer();Ce&&console.warn("onSetupAR:",e),e&&(e.classList.add(Wl),e.classList.remove(Gl)),this.foreachHtmlElement(i=>this.setupElementsForMode(i,Bx))}onSetupVR(){this.classList.remove(Wl),this.classList.remove(Gl),this.foreachHtmlElement(e=>this.setupElementsForMode(e,Fx))}onSetupDesktop(){this.classList.remove(Wl),this.classList.add(Gl);const e=this.getAROverlayContainer();e&&(e.classList.remove(Wl),e.classList.add(Gl)),this.foreachHtmlElement(i=>this.setupElementsForMode(i,Ux))}setupElementsForMode(e,i,n=null){var a,l;if(e===((l=(a=this._context)==null?void 0:a.renderer)==null?void 0:l.domElement)||e.id==="VRButton"||e.id==="ARButton")return;if(e.classList.contains(i))e.style.visibility="visible",e.style.display==="none"&&(e.style.display="block");else for(const c of YE)e.classList.contains(c)&&(e.style.visibility="hidden",e.style.display="none")}foreachHtmlElement(e){for(let i=0;i<this.children.length;i++){const n=this.children[i];n.style&&e(n)}}onBeforeBeginLoading(){const e=this.getAttribute("dracoDecoderPath");e&&(Ce&&console.log("using custom draco decoder path",e),J_(e));const i=this.getAttribute("dracoDecoderType");i&&(Ce&&console.log("using custom draco decoder type",i),eb(i));const n=this.getAttribute("ktx2DecoderPath");n&&(Ce&&console.log("using custom ktx2 decoder path",n),tb(n))}}typeof window<"u"&&!window.customElements.get(Zb)&&window.customElements.define(Zb,Ky);function ZE(o){if(o.startsWith("blob:"))return"blob";const t=o.split("/");let e=t[t.length-1];const i=e.indexOf("?");i>0&&(e=e.substring(0,i));const n=e.indexOf("=");n>0&&(e=e.substring(n));const s=e.split(".").pop(),l=s?["glb","gltf","usdz","usd","fbx","obj","mtl"].indexOf(s.toLowerCase()):-1;if(s&&l>=0&&(e=e.substring(0,e.length-s.length-1)),e=decodeURIComponent(e),e.length>3){let c="",h=!1;const u=["(",")","[","]","{","}",":",";",",",".","!","?"];for(let f=0;f<e.length;f++){let p=e[f];(p==="_"||p==="-")&&(p=" "),!(p===" "&&c.length<=0||u.includes(p)||(c.length===0&&(p=p.toUpperCase()),h&&p===" "))&&(h&&(p=p.toUpperCase()),h=!1,c+=p,p===" "&&(h=!0))}return j()&&e!==c&&console.debug('Generated display name: "'+e+'" → "'+c+'"'),c.trim()}return j()&&console.debug("Loading: use default name",e),e}function JE(o){Mg(t=>{var i;const e=o.getAttribute("loading-blur");if(e!==null&&e!=="0"&&t.domElement===o){const n=(i=t.lodsManager.manager)==null?void 0:i.awaitLoading({frames:5,signal:AbortSignal.timeout(1e4),maxPromisesPerObject:1}).catch(l=>{});let s="20px";e.endsWith("px")&&(s=e);const a=170;if(t.scene.background===null){const l=o,c=t.renderer.domElement,h=c.style.filter,u=c.style.overflow;c.style.filter+=`blur(${s})`,l.style.overflow="hidden",n==null||n.then(()=>{const f=c.animate([{filter:"blur(0px)"}],{duration:a,easing:"ease-in"});f.onfinish=()=>{c.style.filter=h,l.style.overflow=u}})}else{const l=document.createElement("div");t.domElement.prepend(l),l.style.cssText="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none",l.style.backdropFilter=`blur(${s})`,n==null||n.then(()=>{const c=l.animate([{backdropFilter:"blur(0px)",opacity:0}],{duration:a,easing:"ease-in"});c.onfinish=()=>{l.remove()}})}}},{once:!0})}const eT=Object.freeze(Object.defineProperty({__proto__:null,NeedleEngineWebComponent:Ky},Symbol.toStringTag,{value:"Module"}));function tT(){vn.registerWaitForInteraction(()=>{const o=d.AudioContext.getContext();o.addEventListener("statechange",()=>{setTimeout(()=>{const t=o.state;(t==="suspended"||t==="interrupted")&&o.resume().then(()=>{console.log("AudioContext resumed successfully")}).catch(e=>{console.log("Failed to resume AudioContext: "+e)})},500)})})}setTimeout(tT,1e3);const Qe=S("debugphysics"),Vp=S("debugcolliderplacement"),Wp=S("debugcollisions"),iT=S("showcolliders"),Gp=S("debugraycasts"),ti=Symbol("needle component"),zt=Symbol("physics body"),Jb=Symbol("rigidbody");globalThis.NEEDLE_USE_RAPIER=globalThis.NEEDLE_USE_RAPIER!==void 0?globalThis.NEEDLE_USE_RAPIER:!0;Qe&&console.log("Use Rapier",!0,globalThis.NEEDLE_USE_RAPIER);re.registerCallback(he.ContextCreationStart,o=>{Qe&&console.log("Register rapier physics backend"),o.context.physics.engine=new Mu(o.context)});const bs=class bs{constructor(t){r(this,"debugRenderColliders",!1);r(this,"debugRenderRaycasts",!1);r(this,"context");r(this,"_initializePromise");r(this,"_isInitialized",!1);r(this,"rapierRay");r(this,"raycastVectorsBuffer",new ki(()=>new d.Vector3,10));r(this,"rapierSphere",null);r(this,"rapierColliderArray",[]);r(this,"rapierIdentityRotation",{x:0,y:0,z:0,w:1});r(this,"rapierForwardVector",{x:0,y:0,z:1});r(this,"enabled",!1);r(this,"_tempPosition",new d.Vector3);r(this,"_tempQuaternion",new d.Quaternion);r(this,"_tempScale",new d.Vector3);r(this,"_tempMatrix",new d.Matrix4);r(this,"_isUpdatingPhysicsWorld",!1);r(this,"_world");r(this,"_hasCreatedWorld",!1);r(this,"eventQueue");r(this,"collisionHandler");r(this,"objects",[]);r(this,"bodies",[]);r(this,"_meshCache",new Map);r(this,"_gravity",{x:0,y:-9.81,z:0});r(this,"lines");r(this,"_tempCenterPos",new d.Vector3);r(this,"_tempCenterVec",new d.Vector3);r(this,"_tempCenterQuaternion",new d.Quaternion);this.context=t}removeBody(t){var i,n,s;if(!t)return;this.validate();const e=t[zt];if(t[zt]=null,e&&this.world){const a=this.objects.findIndex(l=>l===t);if(a>=0){const l=this.bodies[a];if(this.bodies.splice(a,1),this.objects.splice(a,1),l instanceof exports.MODULES.RAPIER_PHYSICS.MODULE.Collider){const c=l;(i=this.world)==null||i.removeCollider(c,!0);const h=c.parent();h&&h.numColliders()<=0&&(h[ti]||(n=this.world)==null||n.removeRigidBody(h))}else l instanceof exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBody&&(l.numColliders()<=0?(s=this.world)==null||s.removeRigidBody(l):j()&&(l.did_log_removing||setTimeout(()=>{l.numColliders()>0&&(l.did_log_removing=!0,console.warn("RapierPhysics: removing rigidbody with colliders from the physics world is not possible right now, please remove the colliders first"))},1)))}}}updateBody(t,e,i){if(this.validate(),!!this.enabled&&!(t.destroyed||!t.gameObject)&&!(!e&&!i))if(t.isCollider===!0)console.warn("TODO: implement updating collider position");else{const n=t,s=n[zt];s&&this.syncPhysicsBody(n.gameObject,s,e,i)}}updateProperties(t){if(this.validate(),t.isCollider){const e=t,i=e[zt];i&&(this.internalUpdateColliderProperties(e,i),e.sharedMaterial&&this.updatePhysicsMaterial(e))}else{const e=t,i=this.internal_getRigidbody(e);i&&this.internalUpdateRigidbodyProperties(e,i)}}addForce(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.addForce(e,i):console.warn("Rigidbody doesn't exist: can not apply force (does your object with the Rigidbody have a collider?)")}addImpulse(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.applyImpulse(e,i):console.warn("Rigidbody doesn't exist: can not apply impulse (does your object with the Rigidbody have a collider?)")}getLinearVelocity(t){this.validate();const e=this.internal_getRigidbody(t);return e?e.linvel():null}getAngularVelocity(t){this.validate();const e=this.internal_getRigidbody(t);return e?e.angvel():null}resetForces(t,e){this.validate();const i=this.internal_getRigidbody(t);i==null||i.resetForces(e)}resetTorques(t,e){this.validate();const i=this.internal_getRigidbody(t);i==null||i.resetTorques(e)}applyImpulse(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.applyImpulse(e,i):console.warn("Rigidbody doesn't exist: can not apply impulse (does your object with the Rigidbody have a collider?)")}wakeup(t){this.validate();const e=this.internal_getRigidbody(t);e?e.wakeUp():console.warn("Rigidbody doesn't exist: can not wake up (does your object with the Rigidbody have a collider?)")}isSleeping(t){this.validate();const e=this.internal_getRigidbody(t);return e==null?void 0:e.isSleeping()}setAngularVelocity(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.setAngvel(e,i):console.warn("Rigidbody doesn't exist: can not set angular velocity (does your object with the Rigidbody have a collider?)")}setLinearVelocity(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.setLinvel(e,i):console.warn("Rigidbody doesn't exist: can not set linear velocity (does your object with the Rigidbody have a collider?)")}get isInitialized(){return this._isInitialized}async initialize(){return this._initializePromise||(this._initializePromise=this.internalInitialization()),this._initializePromise}async internalInitialization(){return S("__nophysics")?(console.warn("Physics are disabled"),!1):(Qe&&console.log("Initialize rapier physics engine"),this._hasCreatedWorld?(console.error("Invalid call to create physics world: world is already created"),!0):(this._hasCreatedWorld=!0,exports.MODULES.RAPIER_PHYSICS.MAYBEMODULE==null&&(Qe&&console.trace("Loading rapier physics engine"),await(await exports.MODULES.RAPIER_PHYSICS.load()).init()),Qe&&console.log("Physics engine initialized, creating world..."),this._world=new exports.MODULES.RAPIER_PHYSICS.MODULE.World(this._gravity),this.rapierRay=new exports.MODULES.RAPIER_PHYSICS.MODULE.Ray({x:0,y:0,z:0},{x:0,y:0,z:1}),this.enabled=!0,this._isInitialized=!0,Qe&&console.log("Physics world created"),!0))}validate(){this._isInitialized||Qe&&(this._lastWarnTime=this._lastWarnTime??0,Date.now()-this._lastWarnTime>1e3&&(this._lastWarnTime=Date.now(),console.warn("Physics engine is not initialized")))}raycast(t,e,i){var c;if(!this._isInitialized)return console.log("Physics engine is not initialized"),null;let n=i==null?void 0:i.maxDistance,s=i==null?void 0:i.solid;n===void 0&&(n=1/0),s===void 0&&(s=!0);const a=this.getPhysicsRay(this.rapierRay,t,e);if(!a)return null;(this.debugRenderRaycasts||Gp)&&$.DrawRay(a.origin,a.dir,255,1);const l=(c=this.world)==null?void 0:c.castRay(a,n,s,i==null?void 0:i.queryFilterFlags,i==null?void 0:i.filterGroups,void 0,void 0,h=>{const u=h[ti];return i!=null&&i.filterPredicate?i.filterPredicate(u):(i==null?void 0:i.useIgnoreRaycastLayer)!==!1?!(u!=null&&u.gameObject.layers.isEnabled(2)):!0});if(l){const h=a.pointAt(l.timeOfImpact),u=this.raycastVectorsBuffer.get();return u.set(h.x,h.y,h.z),{point:u,collider:l.collider[ti]}}return null}raycastAndGetNormal(t,e,i){var c;if(!this._isInitialized)return null;let n=i==null?void 0:i.maxDistance,s=i==null?void 0:i.solid;n===void 0&&(n=1/0),s===void 0&&(s=!0);const a=this.getPhysicsRay(this.rapierRay,t,e);if(!a)return null;(this.debugRenderRaycasts||Gp)&&$.DrawRay(a.origin,a.dir,255,1);const l=(c=this.world)==null?void 0:c.castRayAndGetNormal(a,n,s,i==null?void 0:i.queryFilterFlags,i==null?void 0:i.filterGroups,void 0,void 0,h=>{const u=h[ti];return i!=null&&i.filterPredicate?i.filterPredicate(u):(i==null?void 0:i.useIgnoreRaycastLayer)!==!1?!(u!=null&&u.gameObject.layers.isEnabled(2)):!0});if(l){const h=a.pointAt(l.timeOfImpact),u=l.normal,f=this.raycastVectorsBuffer.get(),p=this.raycastVectorsBuffer.get();return f.set(h.x,h.y,h.z),p.set(u.x,u.y,u.z),{point:f,normal:p,collider:l.collider[ti]}}return null}getPhysicsRay(t,e,i){var l,c,h;const n=(l=this.context)==null?void 0:l.mainCamera;if(e===void 0){const u=(c=this.context)==null?void 0:c.input.getPointerPosition(0);if(u)e=u;else return null}if(e.z===void 0){if(!n)return console.error("Can not perform raycast from 2d point - no main camera found"),null;const u=this.raycastVectorsBuffer.get();u.x=e.x,u.y=e.y,u.z=0,(u.x>1||u.y>1||u.y<-1||u.x<-1)&&(Qe&&console.warn("Converting screenspace to raycast space",u),(h=this.context)==null||h.input.convertScreenspaceToRaycastSpace(u)),u.unproject(n),e=u}const s=e;t.origin.x=s.x,t.origin.y=s.y,t.origin.z=s.z;const a=this.raycastVectorsBuffer.get();if(i)a.set(i.x,i.y,i.z);else{if(!n)return console.error("Can not perform raycast - no camera found"),null;a.set(t.origin.x,t.origin.y,t.origin.z);const u=Q(n);a.sub(u)}return a.normalize(),t.dir.x=a.x,t.dir.y=a.y,t.dir.z=a.z,t}sphereOverlap(t,e){return this.rapierColliderArray.length=0,this._isInitialized?this.world?(this.rapierSphere??(this.rapierSphere=new exports.MODULES.RAPIER_PHYSICS.MODULE.Ball(e)),this.rapierSphere.radius=e,(this.debugRenderRaycasts||Gp)&&$.DrawWireSphere(t,e,3359999,1),this.world.intersectionsWithShape(t,this.rapierIdentityRotation,this.rapierSphere,i=>{const n=i[ti],s=new gw(n.gameObject,n);return this.rapierColliderArray.push(s),!0},void 0,void 0,void 0,void 0,i=>i.isSensor()?!1:i[ti].gameObject.layers.isEnabled(2)==!1),this.rapierColliderArray):this.rapierColliderArray:this.rapierColliderArray}get world(){return this._world}get isUpdating(){return this._isUpdatingPhysicsWorld}get gravity(){var t;return((t=this.world)==null?void 0:t.gravity)??this._gravity}set gravity(t){this.world?this.world.gravity=t:this._gravity=t}clearCaches(){var t,e,i,n;this._meshCache.clear(),(t=this.eventQueue)!=null&&t.raw&&((e=this.eventQueue)==null||e.free()),(i=this.world)!=null&&i.bodies&&((n=this.world)==null||n.free())}async addBoxCollider(t,e){if(this._isInitialized||await this.initialize(),!t.activeAndEnabled)return;if(!this.enabled){Qe&&console.warn("Physics are disabled");return}const i=t.gameObject,n=Ue(i,this._tempPosition).multiply(e);n.multiplyScalar(.5),n.x<0&&(n.x=Math.abs(n.x)),n.y<0&&(n.y=Math.abs(n.y)),n.z<0&&(n.z=Math.abs(n.z));const s=1e-7;n.x<s&&(n.x=s),n.y<s&&(n.y=s),n.z<s&&(n.z=s);const a=exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.cuboid(n.x,n.y,n.z);this.createCollider(t,a)}async addSphereCollider(t){if(this._isInitialized||await this.initialize(),!t.activeAndEnabled)return;if(!this.enabled){Qe&&console.warn("Physics are disabled");return}const e=exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.ball(.5);this.createCollider(t,e),this.updateProperties(t)}async addCapsuleCollider(t,e,i){if(this._isInitialized||await this.initialize(),!t.activeAndEnabled)return;if(!this.enabled){Qe&&console.warn("Physics are disabled");return}const n=t.gameObject,s=Ue(n,this._tempPosition);s.x=Math.abs(s.x),s.y=Math.abs(s.y);const a=i*s.x;e=Math.max(e,a*2);const l=z.clamp(e*.5*s.y-i*s.x,0,Number.MAX_SAFE_INTEGER),c=exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.capsule(l,a);this.createCollider(t,c)}async addMeshCollider(t,e,i,n){var f,p,g;let s=e.geometry;if(!s){Qe&&console.warn("Missing mesh geometry",e.name);return}(p=(f=s.index)==null?void 0:f.array)!=null&&p.length||(console.warn(`Your MeshCollider is missing vertices or indices in the assined mesh "${e.name}". Consider providing an indexed geometry.`),s=H.mergeVertices(s));let a=null;const l=s.getAttribute("position");if(l instanceof d.InterleavedBufferAttribute){const y=l.count;a=new Float32Array(y*3);for(let b=0;b<y;b++){const _=l.getX(b),v=l.getY(b),w=l.getZ(b);a[b*3]=_,a[b*3+1]=v,a[b*3+2]=w}}else a=l.array;if(await this.initialize(),!this.enabled){Qe&&console.warn("Physics are disabled");return}if(!t.activeAndEnabled)return;const c=(g=s.index)==null?void 0:g.array,h=t.gameObject.worldScale.clone();if(n&&h.multiply(n),Math.abs(h.x-1)>1e-4||Math.abs(h.y-1)>1e-4||Math.abs(h.z-1)>1e-4){const y=`${s.uuid}_${h.x}_${h.y}_${h.z}_${i}`;if(this._meshCache.has(y))Qe&&console.warn("Use cached mesh collider"),a=this._meshCache.get(y);else{(Qe||j())&&console.debug(`[Performance] Your MeshCollider "${t.name}" is scaled: consider applying the scale to the collider mesh instead (${h.x}, ${h.y}, ${h.z})`);const b=new Float32Array(a.length);for(let _=0;_<a.length;_+=3)b[_]=a[_]*h.x,b[_+1]=a[_+1]*h.y,b[_+2]=a[_+2]*h.z;a=b,this._meshCache.set(y,b)}}const u=i?exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.convexHull(a):exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.trimesh(a,c);u&&this.createCollider(t,u)}updatePhysicsMaterial(t){if(!t)return;const e=t.sharedMaterial,i=t[zt];if(i&&e){if(e.bounciness!==void 0&&i.setRestitution(e.bounciness),e.bounceCombine!==void 0)switch(e.bounceCombine){case ht.Average:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}if(e.dynamicFriction!==void 0&&i.setFriction(e.dynamicFriction),e.frictionCombine!==void 0)switch(e.frictionCombine){case ht.Average:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}}}getBody(t){return t?t[zt]:null}getComponent(t){return t?t[ti]:null}createCollider(t,e){var a;if(!this.world)throw new Error("Physics world not initialized");const i=this._tempMatrix;let n;t.attachedRigidbody?n=this.getRigidbody(t,this._tempMatrix):(Qe&&console.log("Create collider without rigidbody",t.name),i.makeRotationFromQuaternion(_e(t.gameObject)),i.setPosition(Q(t.gameObject))),i.decompose(this._tempPosition,this._tempQuaternion,this._tempScale),this.tryApplyCenter(t,this._tempPosition),e.setTranslation(this._tempPosition.x,this._tempPosition.y,this._tempPosition.z),e.setRotation(this._tempQuaternion),e.setSensor(t.isTrigger);const s=t.sharedMaterial;if(s){if(s.bounciness!==void 0&&e.setRestitution(s.bounciness),s.bounceCombine!==void 0)switch(s.bounceCombine){case ht.Average:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}if(s.dynamicFriction!==void 0&&e.setFriction(s.dynamicFriction),s.frictionCombine!==void 0)switch(s.frictionCombine){case ht.Average:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}}((a=t.attachedRigidbody)==null?void 0:a.autoMass)===!1&&(e.setDensity(1e-6),e.setMass(1e-6));try{const l=this.world.createCollider(e,n);return l[ti]=t,t[zt]=l,l.setActiveEvents(exports.MODULES.RAPIER_PHYSICS.MODULE.ActiveEvents.COLLISION_EVENTS),l.setActiveCollisionTypes(exports.MODULES.RAPIER_PHYSICS.MODULE.ActiveCollisionTypes.ALL),this.objects.push(t),this.bodies.push(l),this.updateColliderCollisionGroups(t),l}catch(l){return console.error('Error creating collider "'+t.name+`"
1572
+ `,s)}}setPublicKey(){ba&&ba.length>0&&this.setAttribute("public-key",ba)}setVersion(){_n.length>0&&this.setAttribute("version",_n)}getAROverlayContainer(){return this._overlay_ar.createOverlayContainer(this)}getVROverlayContainer(){for(let e=0;e<this.children.length;e++){const i=this.children[e];if(i.classList.contains("vr"))return i}return null}onEnterAR(e){var n;this.onSetupAR();const i=this.getAROverlayContainer();this._overlay_ar.onBegin(this._context,i,e),this.dispatchEvent(new CustomEvent("enter-ar",{detail:{session:e,context:this._context,htmlContainer:(n=this._overlay_ar)==null?void 0:n.ARContainer}}))}onExitAR(e){var i;this._overlay_ar.onEnd(this._context),this.onSetupDesktop(),this.dispatchEvent(new CustomEvent("exit-ar",{detail:{session:e,context:this._context,htmlContainer:(i=this._overlay_ar)==null?void 0:i.ARContainer}}))}onEnterVR(e){this.onSetupVR(),this.dispatchEvent(new CustomEvent("enter-vr",{detail:{session:e,context:this._context}}))}onExitVR(e){this.onSetupDesktop(),this.dispatchEvent(new CustomEvent("exit-vr",{detail:{session:e,context:this._context}}))}onSetupAR(){this.classList.add(Wl),this.classList.remove(Gl);const e=this.getAROverlayContainer();Ce&&console.warn("onSetupAR:",e),e&&(e.classList.add(Wl),e.classList.remove(Gl)),this.foreachHtmlElement(i=>this.setupElementsForMode(i,Bx))}onSetupVR(){this.classList.remove(Wl),this.classList.remove(Gl),this.foreachHtmlElement(e=>this.setupElementsForMode(e,Fx))}onSetupDesktop(){this.classList.remove(Wl),this.classList.add(Gl);const e=this.getAROverlayContainer();e&&(e.classList.remove(Wl),e.classList.add(Gl)),this.foreachHtmlElement(i=>this.setupElementsForMode(i,Ux))}setupElementsForMode(e,i,n=null){var a,l;if(e===((l=(a=this._context)==null?void 0:a.renderer)==null?void 0:l.domElement)||e.id==="VRButton"||e.id==="ARButton")return;if(e.classList.contains(i))e.style.visibility="visible",e.style.display==="none"&&(e.style.display="block");else for(const c of YE)e.classList.contains(c)&&(e.style.visibility="hidden",e.style.display="none")}foreachHtmlElement(e){for(let i=0;i<this.children.length;i++){const n=this.children[i];n.style&&e(n)}}onBeforeBeginLoading(){const e=this.getAttribute("dracoDecoderPath");e&&(Ce&&console.log("using custom draco decoder path",e),J_(e));const i=this.getAttribute("dracoDecoderType");i&&(Ce&&console.log("using custom draco decoder type",i),eb(i));const n=this.getAttribute("ktx2DecoderPath");n&&(Ce&&console.log("using custom ktx2 decoder path",n),tb(n))}}typeof window<"u"&&!window.customElements.get(Zb)&&window.customElements.define(Zb,Ky);function ZE(o){if(o.startsWith("blob:"))return"blob";const t=o.split("/");let e=t[t.length-1];const i=e.indexOf("?");i>0&&(e=e.substring(0,i));const n=e.indexOf("=");n>0&&(e=e.substring(n));const s=e.split(".").pop(),l=s?["glb","gltf","usdz","usd","fbx","obj","mtl"].indexOf(s.toLowerCase()):-1;if(s&&l>=0&&(e=e.substring(0,e.length-s.length-1)),e=decodeURIComponent(e),e.length>3){let c="",h=!1;const u=["(",")","[","]","{","}",":",";",",",".","!","?"];for(let f=0;f<e.length;f++){let p=e[f];(p==="_"||p==="-")&&(p=" "),!(p===" "&&c.length<=0||u.includes(p)||(c.length===0&&(p=p.toUpperCase()),h&&p===" "))&&(h&&(p=p.toUpperCase()),h=!1,c+=p,p===" "&&(h=!0))}return j()&&e!==c&&console.debug('Generated display name: "'+e+'" → "'+c+'"'),c.trim()}return j()&&console.debug("Loading: use default name",e),e}function JE(o){const t=o.getAttribute("loading-blur");t!==null&&t!=="0"&&Mg(e=>{var i;if(e.domElement===o){const n=(i=e.lodsManager.manager)==null?void 0:i.awaitLoading({signal:AbortSignal.timeout(1e4)}).catch(l=>{});let s="10px";t.endsWith("px")&&(s=t);const a=500;if(e.scene.background===null){const l=o,c=e.renderer.domElement,h=c.style.filter,u=c.style.overflow;c.style.filter+=`blur(${s})`,l.style.overflow="hidden",n==null||n.then(()=>{const f=c.animate([{filter:"blur(0px)"}],{duration:a,easing:"ease-in"});f.onfinish=()=>{c.style.filter=h,l.style.overflow=u}})}else{const l=document.createElement("div");e.domElement.prepend(l),l.style.cssText="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10;",l.style.backdropFilter=`blur(${s})`,n==null||n.then(()=>{const c=l.animate([{backdropFilter:"blur(0px)"}],{duration:a,easing:"ease-in"});c.onfinish=()=>{l.remove()}})}}},{once:!0})}const eT=Object.freeze(Object.defineProperty({__proto__:null,NeedleEngineWebComponent:Ky},Symbol.toStringTag,{value:"Module"}));function tT(){vn.registerWaitForInteraction(()=>{const o=d.AudioContext.getContext();o.addEventListener("statechange",()=>{setTimeout(()=>{const t=o.state;(t==="suspended"||t==="interrupted")&&o.resume().then(()=>{console.log("AudioContext resumed successfully")}).catch(e=>{console.log("Failed to resume AudioContext: "+e)})},500)})})}setTimeout(tT,1e3);const Qe=S("debugphysics"),Vp=S("debugcolliderplacement"),Wp=S("debugcollisions"),iT=S("showcolliders"),Gp=S("debugraycasts"),ti=Symbol("needle component"),zt=Symbol("physics body"),Jb=Symbol("rigidbody");globalThis.NEEDLE_USE_RAPIER=globalThis.NEEDLE_USE_RAPIER!==void 0?globalThis.NEEDLE_USE_RAPIER:!0;Qe&&console.log("Use Rapier",!0,globalThis.NEEDLE_USE_RAPIER);re.registerCallback(he.ContextCreationStart,o=>{Qe&&console.log("Register rapier physics backend"),o.context.physics.engine=new Mu(o.context)});const bs=class bs{constructor(t){r(this,"debugRenderColliders",!1);r(this,"debugRenderRaycasts",!1);r(this,"context");r(this,"_initializePromise");r(this,"_isInitialized",!1);r(this,"rapierRay");r(this,"raycastVectorsBuffer",new ki(()=>new d.Vector3,10));r(this,"rapierSphere",null);r(this,"rapierColliderArray",[]);r(this,"rapierIdentityRotation",{x:0,y:0,z:0,w:1});r(this,"rapierForwardVector",{x:0,y:0,z:1});r(this,"enabled",!1);r(this,"_tempPosition",new d.Vector3);r(this,"_tempQuaternion",new d.Quaternion);r(this,"_tempScale",new d.Vector3);r(this,"_tempMatrix",new d.Matrix4);r(this,"_isUpdatingPhysicsWorld",!1);r(this,"_world");r(this,"_hasCreatedWorld",!1);r(this,"eventQueue");r(this,"collisionHandler");r(this,"objects",[]);r(this,"bodies",[]);r(this,"_meshCache",new Map);r(this,"_gravity",{x:0,y:-9.81,z:0});r(this,"lines");r(this,"_tempCenterPos",new d.Vector3);r(this,"_tempCenterVec",new d.Vector3);r(this,"_tempCenterQuaternion",new d.Quaternion);this.context=t}removeBody(t){var i,n,s;if(!t)return;this.validate();const e=t[zt];if(t[zt]=null,e&&this.world){const a=this.objects.findIndex(l=>l===t);if(a>=0){const l=this.bodies[a];if(this.bodies.splice(a,1),this.objects.splice(a,1),l instanceof exports.MODULES.RAPIER_PHYSICS.MODULE.Collider){const c=l;(i=this.world)==null||i.removeCollider(c,!0);const h=c.parent();h&&h.numColliders()<=0&&(h[ti]||(n=this.world)==null||n.removeRigidBody(h))}else l instanceof exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBody&&(l.numColliders()<=0?(s=this.world)==null||s.removeRigidBody(l):j()&&(l.did_log_removing||setTimeout(()=>{l.numColliders()>0&&(l.did_log_removing=!0,console.warn("RapierPhysics: removing rigidbody with colliders from the physics world is not possible right now, please remove the colliders first"))},1)))}}}updateBody(t,e,i){if(this.validate(),!!this.enabled&&!(t.destroyed||!t.gameObject)&&!(!e&&!i))if(t.isCollider===!0)console.warn("TODO: implement updating collider position");else{const n=t,s=n[zt];s&&this.syncPhysicsBody(n.gameObject,s,e,i)}}updateProperties(t){if(this.validate(),t.isCollider){const e=t,i=e[zt];i&&(this.internalUpdateColliderProperties(e,i),e.sharedMaterial&&this.updatePhysicsMaterial(e))}else{const e=t,i=this.internal_getRigidbody(e);i&&this.internalUpdateRigidbodyProperties(e,i)}}addForce(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.addForce(e,i):console.warn("Rigidbody doesn't exist: can not apply force (does your object with the Rigidbody have a collider?)")}addImpulse(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.applyImpulse(e,i):console.warn("Rigidbody doesn't exist: can not apply impulse (does your object with the Rigidbody have a collider?)")}getLinearVelocity(t){this.validate();const e=this.internal_getRigidbody(t);return e?e.linvel():null}getAngularVelocity(t){this.validate();const e=this.internal_getRigidbody(t);return e?e.angvel():null}resetForces(t,e){this.validate();const i=this.internal_getRigidbody(t);i==null||i.resetForces(e)}resetTorques(t,e){this.validate();const i=this.internal_getRigidbody(t);i==null||i.resetTorques(e)}applyImpulse(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.applyImpulse(e,i):console.warn("Rigidbody doesn't exist: can not apply impulse (does your object with the Rigidbody have a collider?)")}wakeup(t){this.validate();const e=this.internal_getRigidbody(t);e?e.wakeUp():console.warn("Rigidbody doesn't exist: can not wake up (does your object with the Rigidbody have a collider?)")}isSleeping(t){this.validate();const e=this.internal_getRigidbody(t);return e==null?void 0:e.isSleeping()}setAngularVelocity(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.setAngvel(e,i):console.warn("Rigidbody doesn't exist: can not set angular velocity (does your object with the Rigidbody have a collider?)")}setLinearVelocity(t,e,i){this.validate();const n=this.internal_getRigidbody(t);n?n.setLinvel(e,i):console.warn("Rigidbody doesn't exist: can not set linear velocity (does your object with the Rigidbody have a collider?)")}get isInitialized(){return this._isInitialized}async initialize(){return this._initializePromise||(this._initializePromise=this.internalInitialization()),this._initializePromise}async internalInitialization(){return S("__nophysics")?(console.warn("Physics are disabled"),!1):(Qe&&console.log("Initialize rapier physics engine"),this._hasCreatedWorld?(console.error("Invalid call to create physics world: world is already created"),!0):(this._hasCreatedWorld=!0,exports.MODULES.RAPIER_PHYSICS.MAYBEMODULE==null&&(Qe&&console.trace("Loading rapier physics engine"),await(await exports.MODULES.RAPIER_PHYSICS.load()).init()),Qe&&console.log("Physics engine initialized, creating world..."),this._world=new exports.MODULES.RAPIER_PHYSICS.MODULE.World(this._gravity),this.rapierRay=new exports.MODULES.RAPIER_PHYSICS.MODULE.Ray({x:0,y:0,z:0},{x:0,y:0,z:1}),this.enabled=!0,this._isInitialized=!0,Qe&&console.log("Physics world created"),!0))}validate(){this._isInitialized||Qe&&(this._lastWarnTime=this._lastWarnTime??0,Date.now()-this._lastWarnTime>1e3&&(this._lastWarnTime=Date.now(),console.warn("Physics engine is not initialized")))}raycast(t,e,i){var c;if(!this._isInitialized)return console.log("Physics engine is not initialized"),null;let n=i==null?void 0:i.maxDistance,s=i==null?void 0:i.solid;n===void 0&&(n=1/0),s===void 0&&(s=!0);const a=this.getPhysicsRay(this.rapierRay,t,e);if(!a)return null;(this.debugRenderRaycasts||Gp)&&$.DrawRay(a.origin,a.dir,255,1);const l=(c=this.world)==null?void 0:c.castRay(a,n,s,i==null?void 0:i.queryFilterFlags,i==null?void 0:i.filterGroups,void 0,void 0,h=>{const u=h[ti];return i!=null&&i.filterPredicate?i.filterPredicate(u):(i==null?void 0:i.useIgnoreRaycastLayer)!==!1?!(u!=null&&u.gameObject.layers.isEnabled(2)):!0});if(l){const h=a.pointAt(l.timeOfImpact),u=this.raycastVectorsBuffer.get();return u.set(h.x,h.y,h.z),{point:u,collider:l.collider[ti]}}return null}raycastAndGetNormal(t,e,i){var c;if(!this._isInitialized)return null;let n=i==null?void 0:i.maxDistance,s=i==null?void 0:i.solid;n===void 0&&(n=1/0),s===void 0&&(s=!0);const a=this.getPhysicsRay(this.rapierRay,t,e);if(!a)return null;(this.debugRenderRaycasts||Gp)&&$.DrawRay(a.origin,a.dir,255,1);const l=(c=this.world)==null?void 0:c.castRayAndGetNormal(a,n,s,i==null?void 0:i.queryFilterFlags,i==null?void 0:i.filterGroups,void 0,void 0,h=>{const u=h[ti];return i!=null&&i.filterPredicate?i.filterPredicate(u):(i==null?void 0:i.useIgnoreRaycastLayer)!==!1?!(u!=null&&u.gameObject.layers.isEnabled(2)):!0});if(l){const h=a.pointAt(l.timeOfImpact),u=l.normal,f=this.raycastVectorsBuffer.get(),p=this.raycastVectorsBuffer.get();return f.set(h.x,h.y,h.z),p.set(u.x,u.y,u.z),{point:f,normal:p,collider:l.collider[ti]}}return null}getPhysicsRay(t,e,i){var l,c,h;const n=(l=this.context)==null?void 0:l.mainCamera;if(e===void 0){const u=(c=this.context)==null?void 0:c.input.getPointerPosition(0);if(u)e=u;else return null}if(e.z===void 0){if(!n)return console.error("Can not perform raycast from 2d point - no main camera found"),null;const u=this.raycastVectorsBuffer.get();u.x=e.x,u.y=e.y,u.z=0,(u.x>1||u.y>1||u.y<-1||u.x<-1)&&(Qe&&console.warn("Converting screenspace to raycast space",u),(h=this.context)==null||h.input.convertScreenspaceToRaycastSpace(u)),u.unproject(n),e=u}const s=e;t.origin.x=s.x,t.origin.y=s.y,t.origin.z=s.z;const a=this.raycastVectorsBuffer.get();if(i)a.set(i.x,i.y,i.z);else{if(!n)return console.error("Can not perform raycast - no camera found"),null;a.set(t.origin.x,t.origin.y,t.origin.z);const u=Q(n);a.sub(u)}return a.normalize(),t.dir.x=a.x,t.dir.y=a.y,t.dir.z=a.z,t}sphereOverlap(t,e){return this.rapierColliderArray.length=0,this._isInitialized?this.world?(this.rapierSphere??(this.rapierSphere=new exports.MODULES.RAPIER_PHYSICS.MODULE.Ball(e)),this.rapierSphere.radius=e,(this.debugRenderRaycasts||Gp)&&$.DrawWireSphere(t,e,3359999,1),this.world.intersectionsWithShape(t,this.rapierIdentityRotation,this.rapierSphere,i=>{const n=i[ti],s=new gw(n.gameObject,n);return this.rapierColliderArray.push(s),!0},void 0,void 0,void 0,void 0,i=>i.isSensor()?!1:i[ti].gameObject.layers.isEnabled(2)==!1),this.rapierColliderArray):this.rapierColliderArray:this.rapierColliderArray}get world(){return this._world}get isUpdating(){return this._isUpdatingPhysicsWorld}get gravity(){var t;return((t=this.world)==null?void 0:t.gravity)??this._gravity}set gravity(t){this.world?this.world.gravity=t:this._gravity=t}clearCaches(){var t,e,i,n;this._meshCache.clear(),(t=this.eventQueue)!=null&&t.raw&&((e=this.eventQueue)==null||e.free()),(i=this.world)!=null&&i.bodies&&((n=this.world)==null||n.free())}async addBoxCollider(t,e){if(this._isInitialized||await this.initialize(),!t.activeAndEnabled)return;if(!this.enabled){Qe&&console.warn("Physics are disabled");return}const i=t.gameObject,n=Ue(i,this._tempPosition).multiply(e);n.multiplyScalar(.5),n.x<0&&(n.x=Math.abs(n.x)),n.y<0&&(n.y=Math.abs(n.y)),n.z<0&&(n.z=Math.abs(n.z));const s=1e-7;n.x<s&&(n.x=s),n.y<s&&(n.y=s),n.z<s&&(n.z=s);const a=exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.cuboid(n.x,n.y,n.z);this.createCollider(t,a)}async addSphereCollider(t){if(this._isInitialized||await this.initialize(),!t.activeAndEnabled)return;if(!this.enabled){Qe&&console.warn("Physics are disabled");return}const e=exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.ball(.5);this.createCollider(t,e),this.updateProperties(t)}async addCapsuleCollider(t,e,i){if(this._isInitialized||await this.initialize(),!t.activeAndEnabled)return;if(!this.enabled){Qe&&console.warn("Physics are disabled");return}const n=t.gameObject,s=Ue(n,this._tempPosition);s.x=Math.abs(s.x),s.y=Math.abs(s.y);const a=i*s.x;e=Math.max(e,a*2);const l=z.clamp(e*.5*s.y-i*s.x,0,Number.MAX_SAFE_INTEGER),c=exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.capsule(l,a);this.createCollider(t,c)}async addMeshCollider(t,e,i,n){var f,p,g;let s=e.geometry;if(!s){Qe&&console.warn("Missing mesh geometry",e.name);return}(p=(f=s.index)==null?void 0:f.array)!=null&&p.length||(console.warn(`Your MeshCollider is missing vertices or indices in the assined mesh "${e.name}". Consider providing an indexed geometry.`),s=H.mergeVertices(s));let a=null;const l=s.getAttribute("position");if(l instanceof d.InterleavedBufferAttribute){const y=l.count;a=new Float32Array(y*3);for(let b=0;b<y;b++){const _=l.getX(b),v=l.getY(b),w=l.getZ(b);a[b*3]=_,a[b*3+1]=v,a[b*3+2]=w}}else a=l.array;if(await this.initialize(),!this.enabled){Qe&&console.warn("Physics are disabled");return}if(!t.activeAndEnabled)return;const c=(g=s.index)==null?void 0:g.array,h=t.gameObject.worldScale.clone();if(n&&h.multiply(n),Math.abs(h.x-1)>1e-4||Math.abs(h.y-1)>1e-4||Math.abs(h.z-1)>1e-4){const y=`${s.uuid}_${h.x}_${h.y}_${h.z}_${i}`;if(this._meshCache.has(y))Qe&&console.warn("Use cached mesh collider"),a=this._meshCache.get(y);else{(Qe||j())&&console.debug(`[Performance] Your MeshCollider "${t.name}" is scaled: consider applying the scale to the collider mesh instead (${h.x}, ${h.y}, ${h.z})`);const b=new Float32Array(a.length);for(let _=0;_<a.length;_+=3)b[_]=a[_]*h.x,b[_+1]=a[_+1]*h.y,b[_+2]=a[_+2]*h.z;a=b,this._meshCache.set(y,b)}}const u=i?exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.convexHull(a):exports.MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.trimesh(a,c);u&&this.createCollider(t,u)}updatePhysicsMaterial(t){if(!t)return;const e=t.sharedMaterial,i=t[zt];if(i&&e){if(e.bounciness!==void 0&&i.setRestitution(e.bounciness),e.bounceCombine!==void 0)switch(e.bounceCombine){case ht.Average:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:i.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}if(e.dynamicFriction!==void 0&&i.setFriction(e.dynamicFriction),e.frictionCombine!==void 0)switch(e.frictionCombine){case ht.Average:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:i.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}}}getBody(t){return t?t[zt]:null}getComponent(t){return t?t[ti]:null}createCollider(t,e){var a;if(!this.world)throw new Error("Physics world not initialized");const i=this._tempMatrix;let n;t.attachedRigidbody?n=this.getRigidbody(t,this._tempMatrix):(Qe&&console.log("Create collider without rigidbody",t.name),i.makeRotationFromQuaternion(_e(t.gameObject)),i.setPosition(Q(t.gameObject))),i.decompose(this._tempPosition,this._tempQuaternion,this._tempScale),this.tryApplyCenter(t,this._tempPosition),e.setTranslation(this._tempPosition.x,this._tempPosition.y,this._tempPosition.z),e.setRotation(this._tempQuaternion),e.setSensor(t.isTrigger);const s=t.sharedMaterial;if(s){if(s.bounciness!==void 0&&e.setRestitution(s.bounciness),s.bounceCombine!==void 0)switch(s.bounceCombine){case ht.Average:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:e.setRestitutionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}if(s.dynamicFriction!==void 0&&e.setFriction(s.dynamicFriction),s.frictionCombine!==void 0)switch(s.frictionCombine){case ht.Average:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case ht.Maximum:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case ht.Minimum:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case ht.Multiply:e.setFrictionCombineRule(exports.MODULES.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}}((a=t.attachedRigidbody)==null?void 0:a.autoMass)===!1&&(e.setDensity(1e-6),e.setMass(1e-6));try{const l=this.world.createCollider(e,n);return l[ti]=t,t[zt]=l,l.setActiveEvents(exports.MODULES.RAPIER_PHYSICS.MODULE.ActiveEvents.COLLISION_EVENTS),l.setActiveCollisionTypes(exports.MODULES.RAPIER_PHYSICS.MODULE.ActiveCollisionTypes.ALL),this.objects.push(t),this.bodies.push(l),this.updateColliderCollisionGroups(t),l}catch(l){return console.error('Error creating collider "'+t.name+`"
1573
1573
  Error:`,l),null}}updateColliderCollisionGroups(t){const e=t[zt],i=t.membership;let n=0;if(i==null)n=65535;else for(let l=0;l<i.length;l++){const c=i[l];c>31?console.error(`Rapier only supports 32 layers, layer ${c} is not supported`):n|=1<<Math.floor(c)}const s=t.filter;let a=0;if(s==null)a=65535;else for(let l=0;l<s.length;l++){const c=s[l];c>31?console.error(`Rapier only supports 32 layers, layer ${c} is not supported`):a|=1<<Math.floor(c)}e.setCollisionGroups(n<<16|a)}getRigidbody(t,e){if(!this.world)throw new Error("Physics world not initialized");let i=null;if(t.attachedRigidbody){const n=t.attachedRigidbody;if(i=n[zt],!i){const s=n.isKinematic&&!Vp;Qe&&console.log("Create rigidbody",s);const a=s?exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyDesc.kinematicPositionBased():exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyDesc.dynamic(),l=Q(t.attachedRigidbody.gameObject);a.setTranslation(l.x,l.y,l.z),a.setRotation(_e(t.attachedRigidbody.gameObject)),a.centerOfMass=new exports.MODULES.RAPIER_PHYSICS.MODULE.Vector3(n.centerOfMass.x,n.centerOfMass.y,n.centerOfMass.z),i=this.world.createRigidBody(a),this.bodies.push(i),this.objects.push(n)}i[ti]=n,n[zt]=i,this.internalUpdateRigidbodyProperties(n,i),this.getRigidbodyRelativeMatrix(t.gameObject,n.gameObject,e),t[Jb]=i}else{const n=exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyDesc.kinematicPositionBased(),s=Q(t.gameObject);n.setTranslation(s.x,s.y,s.z),n.setRotation(_e(t.gameObject)),i=this.world.createRigidBody(n),e.identity(),i[ti]=null}return i}internal_getRigidbody(t){return t.isCollider===!0?t[Jb]:t[zt]}internalUpdateColliderProperties(t,e){const i=e.shape;let n=!1;switch(i.type){case exports.MODULES.RAPIER_PHYSICS.MODULE.ShapeType.Ball:{const p=i,g=t,y=t.gameObject,b=Ue(y,this._tempPosition),_=Math.abs(g.radius*b.x);n=p.radius!==_,p.radius=_,n&&e.setShape(p);break}case exports.MODULES.RAPIER_PHYSICS.MODULE.ShapeType.Cuboid:const s=i,a=t,l=t.gameObject,c=Ue(l,this._tempPosition),h=Math.abs(a.size.x*.5*c.x),u=Math.abs(a.size.y*.5*c.y),f=Math.abs(a.size.z*.5*c.z);n=s.halfExtents.x!==h||s.halfExtents.y!==u||s.halfExtents.z!==f,s.halfExtents.x=h,s.halfExtents.y=u,s.halfExtents.z=f,n&&e.setShape(s);break}if(n){const s=t.attachedRigidbody;if(s!=null&&s.autoMass){const a=this.getBody(s);a==null||a.recomputeMassPropertiesFromColliders()}}this.updateColliderCollisionGroups(t),t.isTrigger!==e.isSensor()&&e.setSensor(t.isTrigger)}internalUpdateRigidbodyProperties(t,e){if(e.enableCcd(t.collisionDetectionMode!==Qu.Discrete),e.setLinearDamping(t.drag),e.setAngularDamping(t.angularDrag),e.setGravityScale(t.useGravity?t.gravityScale:0,!0),t.dominanceGroup<=127&&t.dominanceGroup>=-127?e.setDominanceGroup(Math.floor(t.dominanceGroup)):e.setDominanceGroup(0),t.autoMass){e.setAdditionalMass(0,!1);for(let i=0;i<e.numColliders();i++)e.collider(i).setDensity(1);e.recomputeMassPropertiesFromColliders()}else{e.setAdditionalMass(t.mass,!1);for(let i=0;i<e.numColliders();i++)e.collider(i).setDensity(1e-7);e.recomputeMassPropertiesFromColliders()}e.setEnabledRotations(!t.lockRotationX,!t.lockRotationY,!t.lockRotationZ,!1),e.setEnabledTranslations(!t.lockPositionX,!t.lockPositionY,!t.lockPositionZ,!1),t.isKinematic?e.setBodyType(exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicPositionBased,!1):e.setBodyType(exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyType.Dynamic,!1)}step(t){if(this.world&&this.enabled){if(this._isUpdatingPhysicsWorld=!0,this.eventQueue||(this.eventQueue=new exports.MODULES.RAPIER_PHYSICS.MODULE.EventQueue(!1)),t===void 0||t<=0){this._isUpdatingPhysicsWorld=!1;return}else t!==void 0&&(this.world.timestep=z.lerp(this.world.timestep,t,.8));try{this.world.step(this.eventQueue)}catch(e){console.warn("Error running physics step",e)}this._isUpdatingPhysicsWorld=!1}}postStep(){this.world&&this.enabled&&(this._isUpdatingPhysicsWorld=!0,this.syncObjects(),this._isUpdatingPhysicsWorld=!1,this.eventQueue&&!this.collisionHandler&&(this.collisionHandler=new nT(this.world,this.eventQueue)),this.collisionHandler&&(this.collisionHandler.handleCollisionEvents(),this.collisionHandler.update()),this.updateDebugRendering(this.world))}updateDebugRendering(t){var e,i,n,s;if(Qe||Vp||iT||this.debugRenderColliders===!0){if(!this.lines){const l=new d.LineBasicMaterial({color:7855479,fog:!1}),c=new d.BufferGeometry;this.lines=new d.LineSegments(c,l),this.lines.layers.disableAll(),this.lines.layers.enable(2)}this.lines.parent!==((e=this.context)==null?void 0:e.scene)&&((i=this.context)==null||i.scene.add(this.lines));const a=t.debugRender();this.lines.geometry.setAttribute("position",new d.BufferAttribute(a.vertices,3)),this.lines.geometry.setAttribute("color",new d.BufferAttribute(a.colors,4)),(this.context.time.frame%30===0||((n=this.lines.geometry.boundingSphere)==null?void 0:n.radius)===0)&&this.lines.geometry.computeBoundingSphere()}else this.lines&&((s=this.context)==null||s.scene.remove(this.lines))}syncObjects(){if(!Vp)for(let t=0;t<this.bodies.length;t++){const e=this.objects[t],i=this.bodies[t],n=e;if((n==null?void 0:n.isCollider)===!0&&!n.attachedRigidbody){const c=i.parent();c?this.syncPhysicsBody(e.gameObject,c,!0,!0):this.syncPhysicsBody(e.gameObject,i,!0,!0);continue}const s=i.translation(),a=i.rotation();if(Number.isNaN(s.x)||Number.isNaN(a.x)){!n.__COLLIDER_NAN&&j()&&(console.warn("Collider has NaN values",n.name,n.gameObject,i),n.__COLLIDER_NAN=!0);continue}const l=e.center;if(l&&l.isVector3){this._tempQuaternion.set(a.x,a.y,a.z,a.w);const c=this._tempPosition.copy(l).applyQuaternion(this._tempQuaternion),h=Ue(e.gameObject);c.multiply(h),s.x-=c.x,s.y-=c.y,s.z-=c.z}Pr(e.gameObject,s.x,s.y,s.z),Qm(e.gameObject,a.x,a.y,a.z,a.w)}}syncPhysicsBody(t,e,i,n){if(e instanceof exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBody){const s=Q(t,this._tempPosition),a=_e(t,this._tempQuaternion);switch(e.bodyType()){case exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyType.Fixed:case exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicPositionBased:case exports.MODULES.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicVelocityBased:i&&e.setNextKinematicTranslation(s),n&&e.setNextKinematicRotation(a);break;default:i&&e.setTranslation(s,!1),n&&e.setRotation(a,!1);break}}else if(e instanceof exports.MODULES.RAPIER_PHYSICS.MODULE.Collider){t.matrixWorldNeedsUpdate&&t.updateWorldMatrix(!0,!1),t.matrixWorld.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const s=this._tempPosition,a=this._tempQuaternion,l=e[ti];if(this.tryApplyCenter(l,s),i){const c=e.translation();(c.x!==s.x||c.y!==s.y||c.z!==s.z)&&e.setTranslation(s)}if(n){const c=e.rotation();(c.x!==a.x||c.y!==a.y||c.z!==a.z||c.w!==a.w)&&e.setRotation(a)}}}tryApplyCenter(t,e){const i=t.center;i&&t.gameObject&&(i.x!==0||i.y!==0||i.z!==0)&&(this._tempCenterPos.x=i.x,this._tempCenterPos.y=i.y,this._tempCenterPos.z=i.z,Ue(t.gameObject,this._tempCenterVec),this._tempCenterPos.multiply(this._tempCenterVec),t.attachedRigidbody?this._tempCenterPos.applyQuaternion(t.gameObject.quaternion):(_e(t.gameObject,this._tempCenterQuaternion),this._tempCenterPos.applyQuaternion(this._tempCenterQuaternion)),e.x+=this._tempCenterPos.x,e.y+=this._tempCenterPos.y,e.z+=this._tempCenterPos.z)}getRigidbodyRelativeMatrix(t,e,i,n){if(n===void 0&&(n=bs._matricesBuffer,n.length=0),t===e){const s=Ue(t,this._tempPosition);i.makeScale(s.x,s.y,s.z);for(let a=n.length-1;a>=0;a--)i.multiply(n[a]);return i}return n.push(t.matrix),t.parent&&this.getRigidbodyRelativeMatrix(t.parent,e,i,n),i}addFixedJoint(t,e){if(!this.world){console.error("Physics world not initialized");return}const i=t[zt],n=e[zt];this.calculateJointRelativeMatrices(t.gameObject,e.gameObject,this._tempMatrix),this._tempMatrix.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const s=exports.MODULES.RAPIER_PHYSICS.MODULE.JointData.fixed(bs.centerConnectionPos,bs.centerConnectionRot,this._tempPosition,this._tempQuaternion),a=this.world.createImpulseJoint(s,i,n,!0);Qe&&console.log("ADD FIXED JOINT",a)}addHingeJoint(t,e,i,n){if(!this.world){console.error("Physics world not initialized");return}const s=t[zt],a=e[zt];this.calculateJointRelativeMatrices(t.gameObject,e.gameObject,this._tempMatrix),this._tempMatrix.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const l=exports.MODULES.RAPIER_PHYSICS.MODULE.JointData.revolute(i,this._tempPosition,n),c=this.world.createImpulseJoint(l,s,a,!0);Qe&&console.log("ADD HINGE JOINT",c)}calculateJointRelativeMatrices(t,e,i){t.updateWorldMatrix(!0,!1),e.updateWorldMatrix(!0,!1);const n=t.matrixWorld,s=e.matrixWorld;n.elements[0]=1,n.elements[5]=1,n.elements[10]=1,s.elements[0]=1,s.elements[5]=1,s.elements[10]=1,i.copy(s).premultiply(n.invert()).invert()}};r(bs,"_didLoadPhysicsEngine",!1),r(bs,"_matricesBuffer",[]),r(bs,"centerConnectionPos",{x:0,y:0,z:0}),r(bs,"centerConnectionRot",{x:0,y:0,z:0,w:1});let Mu=bs;class nT{constructor(t,e){r(this,"world");r(this,"eventQueue");r(this,"activeCollisions",[]);r(this,"activeCollisionsStay",[]);r(this,"activeTriggers",[]);this.world=t,this.eventQueue=e}handleCollisionEvents(){this.eventQueue&&this.world&&this.eventQueue.drainCollisionEvents((t,e,i)=>{const n=this.world.getCollider(t),s=this.world.getCollider(e);if(!n||!s)return;const a=n[ti],l=s[ti];Wp&&console.log("EVT",a.name,l.name,i,n,s),a&&l&&(i?(this.onCollisionStarted(a,n,l,s),this.onCollisionStarted(l,s,a,n)):(this.onCollisionEnded(a,l),this.onCollisionEnded(l,a)))})}update(){this.onHandleCollisionStay()}onCollisionStarted(t,e,i,n){let s=null;if(t.isTrigger||i.isTrigger)Rr(t.gameObject,a=>{a.onTriggerEnter&&!a.destroyed&&a.onTriggerEnter(i),this.activeTriggers.push({collider:t,component:a,otherCollider:i})});else{const a=t.gameObject;this.world.contactPair(e,n,(l,c)=>{Rr(a,h=>{var f;if(h.destroyed)return;const u=h.onCollisionEnter||h.onCollisionStay||h.onCollisionExit;if(u||Wp){if(!s){const p=[],g=l.normal();i instanceof Io&&i.convex&&(g.x=-g.x,g.y=-g.y,g.z=-g.z);for(let y=0;y<l.numSolverContacts();y++){const b=l.solverContactPoint(y),_=l.contactImpulse(y);if(b){const v=l.contactDist(y),w=l.solverContactFriction(y),x=l.solverContactTangentVelocity(y),O=new pw(b,v,g,_,w,x);p.push(O),Wp&&$.DrawDirection(b,g,16711680,3,!0)}}s=new mw(a,i,p)}if(u){const p={collider:t,component:h,collision:s};this.activeCollisions.push(p),h.onCollisionStay&&this.activeCollisionsStay.push(p),(f=h.onCollisionEnter)==null||f.call(h,s)}}})})}}onHandleCollisionStay(){for(const t of this.activeCollisionsStay){const e=t.component;if(!e.destroyed&&e.activeAndEnabled&&e.onCollisionStay){if(t.collision.collider.destroyed)continue;const i=t.collision;e.onCollisionStay(i)}}for(const t of this.activeTriggers){const e=t.component;if(!e.destroyed&&e.activeAndEnabled&&e.onTriggerStay){const i=t.otherCollider;if(i.destroyed)continue;e.onTriggerStay(i)}}}onCollisionEnded(t,e){if(!(t.destroyed||e.destroyed)){for(let i=0;i<this.activeCollisions.length;i++){const n=this.activeCollisions[i],s=n.collider;if(s.destroyed||n.collision.collider.destroyed){this.activeCollisions.splice(i,1),i--;continue}if(s===t&&n.collision.collider===e){const a=n.component;if(this.activeCollisions.splice(i,1),i--,a.activeAndEnabled&&a.onCollisionExit){const l=n.collision;a.onCollisionExit(l)}}}for(let i=0;i<this.activeCollisionsStay.length;i++){const n=this.activeCollisionsStay[i],s=n.collider;if(s.destroyed||n.collision.collider.destroyed){this.activeCollisionsStay.splice(i,1),i--;continue}if(s===t&&n.collision.collider===e){const a=n.component;if(this.activeCollisionsStay.splice(i,1),i--,a.activeAndEnabled&&a.onCollisionExit){const l=n.collision;a.onCollisionExit(l)}}}for(let i=0;i<this.activeTriggers.length;i++){const n=this.activeTriggers[i],s=n.collider;if(s.destroyed||n.otherCollider.destroyed){this.activeTriggers.splice(i,1),i--;continue}if(s===t&&n.otherCollider===e){const a=n.component;if(this.activeTriggers.splice(i,1),i--,a.activeAndEnabled&&a.onTriggerExit){const l=n.otherCollider;a.onTriggerExit(l)}}}}}}class sT{static async createComparisonScene(t){const{files:e}=t,n=await Promise.all(e.map(_=>new te(_).loadAssetAsync())),s=new d.Scene;let a=0;for(const _ of n)if(_ instanceof d.Object3D){_.position.y=a,s.add(_);const v=li([_]);a+=v.getSize(new d.Vector3).y,a+=.1}const l=new d.PerspectiveCamera(20);s.add(l);const c=t.environment||"https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/studio_small_09_1k.exr";{let _=null;if(c.endsWith(".hdr")){const v=(await Promise.resolve().then(()=>require("./three-examples-X3OadjXB.umd.cjs")).then(w=>w.RGBELoader$1)).RGBELoader;_=new v}else if(c.endsWith(".exr")){const v=(await Promise.resolve().then(()=>require("./three-examples-X3OadjXB.umd.cjs")).then(w=>w.EXRLoader$1)).EXRLoader;_=new v}if(_){const v=await _.loadAsync(c).catch(w=>(console.error(w),null));v&&(v.mapping=d.EquirectangularReflectionMapping,v.needsUpdate=!0,s.background=v,s.environment=v,s.backgroundBlurriness=.75)}else console.warn("Unsupported environment map format",c)}const h=li(s.children),u=h.getCenter(new d.Vector3),f=h.getSize(new d.Vector3),g=Math.max(f.x,f.y,f.z)/(2*Math.tan(Math.PI*l.fov/360));l.position.set(u.x,u.y,g),l.lookAt(u);const y=new H.OrbitControls(l,t.domElement||document.body);y.target=u,y.update();const b=(t.domElement||document.body).getBoundingClientRect();return l.aspect=b.width/b.height,l.updateProjectionMatrix(),{scene:s,camera:l}}}let $m=0;function e0(o){o?$m++:$m--}function oT(){return $m>0}const rT={binary:!0,animations:!0};async function aT(o){if(!o.context)throw new Error("No context provided to exportAsGLTF");o.scene||(o.scene=o.context.scene);const t={...rT,...o},{context:e}=t,i=new H.GLTFExporter;i.register(l=>new Dw(l)),i.register(l=>new LM(l)),i.register(l=>new Rw(l)),Qg(i,t.context);const n={binary:t.binary,animations:cT(e,t.scene,[])},s=new lT;console.debug("Exporting GLTF",n),s.onBeforeExport(t),e0(!0);const a=await i.parseAsync(t.scene,n).catch(l=>(console.error(l),null));if(e0(!1),s.onAfterExport(t),!a)throw new Error("Failed to export GLTF");if(t.downloadAs!=null){let l=null;if(a instanceof ArrayBuffer?l=new Blob([a],{type:"application/octet-stream"}):console.error("Can not download GLTF as a blob",a),l){const c=URL.createObjectURL(l),h=document.createElement("a");h.href=c;let u=t.downloadAs;!u.endsWith(".glb")&&!u.endsWith(".gltf")&&(u+=t.binary?".glb":".gltf"),h.download=u,h.click()}}return a}const t0=Symbol("needle:weight");class lT{constructor(){r(this,"_undo",[])}onBeforeExport(t){t.context.animations.mixers.forEach(e=>{const i=Ha.tryGetActionsFromMixer(e);if(i)for(let n=0;n<i.length;n++){const s=i[n];s[t0]=s.weight,s.weight=0,this._undo.push(()=>{s.weight=s[t0]})}e.update(0)}),t.context.scene.traverse(e=>{if(!Pm(e)){const i=e.parent;i&&(e.removeFromParent(),this._undo.push(()=>i.add(e)))}})}onAfterExport(t){this._undo.forEach(e=>e()),this._undo.length=0}}function cT(o,t,e){o.animations.mixers.forEach(n=>{const s=Ha.tryGetActionsFromMixer(n);if(s)for(let a=0;a<s.length;a++){const c=s[a].getClip();e.push(c)}}),Array.isArray(t)||(t=[t]);for(const n of t)Ha.tryGetAnimationClipsFromObjectHierarchy(n,e);const i=new Set(e);return Array.from(i)}const i0="needle-button",Hp=j();var pr,mr,gr,Vt,ws,Ua,nl,zx,Nx,Kc;class Zy extends HTMLElement{constructor(){super();on(this,nl);on(this,pr);on(this,mr);on(this,gr);on(this,Vt);on(this,ws);on(this,Ua);on(this,Kc,e=>{Hp&&console.log("Needle Button clicked"),!e.defaultPrevented&&ce(this,Vt)&&ce(this,Vt).click()});this.removeEventListener("click",ce(this,Kc)),this.addEventListener("click",ce(this,Kc))}attributeChangedCallback(e,i,n){Ol(this,nl,zx).call(this)}}pr=new WeakMap,mr=new WeakMap,gr=new WeakMap,Vt=new WeakMap,ws=new WeakMap,Ua=new WeakMap,nl=new WeakSet,zx=function(){var i,n;if((i=ce(this,Vt))==null||i.remove(),this.getAttribute("ar")!=null)ce(this,ws)??rn(this,ws,new Po),rn(this,Vt,ce(this,ws).createARButton());else if(this.getAttribute("vr")!=null)ce(this,ws)??rn(this,ws,new Po),rn(this,Vt,ce(this,ws).createVRButton());else if(this.getAttribute("quicklook")!=null)ce(this,ws)??rn(this,ws,new Po),rn(this,Vt,ce(this,ws).createQuicklookButton());else{Hp?console.warn("No button type specified for <needle-button>. Use either ar, vr or quicklook attribute."):console.debug("No button type specified for <needle-button>. Use either ar, vr or quicklook attribute.");return}ce(this,pr)??rn(this,pr,this.attachShadow({mode:"open"})),ce(this,mr)??rn(this,mr,document.createElement("slot")),ce(this,gr)??rn(this,gr,document.createElement("style")),ce(this,gr).innerHTML=`
1574
1574
  button {
1575
1575
  all: initial;
@@ -1604,4 +1604,4 @@ Error:`,l),null}}updateColliderCollisionGroups(t){const e=t[zt],i=t.membership;l
1604
1604
  justify-content: center;
1605
1605
  gap: .5rem;
1606
1606
  }
1607
- `),ce(this,mr).innerHTML=ce(this,Vt).innerHTML,ce(this,mr).style.cssText="display: flex; align-items: center; justify-content: center;",ce(this,Vt).innerHTML=ce(this,mr).outerHTML,ce(this,pr).innerHTML=ce(this,Vt).outerHTML,ce(this,pr).prepend(ce(this,gr)),ru(_m,{element:ce(this,pr)}),(n=ce(this,Ua))==null||n.disconnect(),ce(this,Ua)??rn(this,Ua,new MutationObserver(()=>Ol(this,nl,Nx).call(this))),ce(this,Ua).observe(ce(this,Vt),{attributes:!0}),Hp&&console.log("Needle Button updated")},Nx=function(){ce(this,Vt)&&(ce(this,Vt).style.display==="none"?this.style.display="none":this.style.display==="none"&&(this.style.display=""))},Kc=new WeakMap,r(Zy,"observedAttributes",["ar","vr","quicklook"]);typeof window<"u"&&!window.customElements.get(i0)&&window.customElements.define(i0,Zy);const Hl=S("debugavatar");class Jy{constructor(t,e,i,n){r(this,"root");r(this,"head");r(this,"leftHand");r(this,"rigthHand");var s;this.root=t,this.head=e,this.leftHand=i,this.rigthHand=n,(s=this.root)==null||s.traverse(a=>a.layers.set(2))}get isValid(){return this.head!==null&&this.head!==void 0}}class $x{constructor(){r(this,"avatarRegistryUrl",null)}async getOrCreateNewAvatarInstance(t,e){if(!e)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof e=="string"){if(i=await this.loadAvatar(t,e),!i){const s=new xn;i=C.instantiate(za(e,t.scene),s)}}else i=e;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(Hl&&console.log("[Custom Avatar] valid config",e,Hl?n:""),n):(console.warn("[Custom Avatar] config isn't valid",e,Hl?n:""),null)}async loadAvatar(t,e){if(console.assert(e!=null&&typeof e=="string","Avatar id must not be null"),e.length<=0||!e)return null;if(Hl&&console.log("[Custom Avatar] "+e+", loading..."),e.endsWith(".glb")||(e+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+e);let s=null;if(n.ok){const l=await n.blob();l&&(s=await l.arrayBuffer())}if(!s)return null;const a=await bn().parseSync(t,s,null,0);return(a==null?void 0:a.scene)??null}const i=new H.GLTFLoader;return Og(i,t),new Promise((n,s)=>{const a=this.avatarRegistryUrl+"/"+e;i.load(a,async l=>{await bn().createBuiltinComponents(t,a,l,null,void 0),n(l.scene)},l=>{Hl&&console.log("[Custom Avatar] "+l.loaded/l.total*100+"% loaded of "+l.total/1024+"kB")},l=>{console.error("[Custom Avatar] Error when loading: "+l),n(null)})})}cacheModel(t,e){}findAvatar(t){const e=t;let i=e;i.children.length==1&&(i=t.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),a=this.findAvatarPart(i,["right","hand"]);if(!n){n=e;const c=new d.Vector3;new d.Box3().setFromObject(n).getSize(c);const h=Math.max(c.x,c.y,c.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+h+" meters! Should be < 0.3m"),h>.3&&n.scale.multiplyScalar(1/h*.3)}return new Jy(e,n,s,a)}findAvatarPart(t,e){const i=t.name.toLowerCase();let n=!0;for(const s of e){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return t;if(t.children)for(const s of t.children){const a=this.findAvatarPart(s,e);if(a)return a}return null}handleCustomAvatarErrors(t){if(!t.ok)throw Error(t.statusText);return t}}class Vx{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(t){}}class Wx{}const hT=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:fe,ActionCollection:Zw,ActionModel:xi,AlignmentConstraint:fh,Animation:Tt,AnimationCurve:Ah,AnimationExtension:af,AnimationTrackHandler:Ef,Animator:St,AnimatorController:Gi,Antialiasing:Dh,AudioExtension:Wr,AudioListener:Os,AudioSource:qi,AudioTrackHandler:tl,Avatar:Oo,AvatarBlink_Simple:zr,AvatarEyeLook_Rotation:jg,AvatarLoader:$x,AvatarMarker:At,AvatarModel:Jy,Avatar_Brain_LookAt:Uc,Avatar_MouthShapes:yh,Avatar_MustacheShake:Dg,Avatar_POI:As,AxesHelper:rl,BaseUIComponent:Qi,BasicIKConstraint:Fg,BehaviorExtension:fy,BehaviorModel:wt,BloomEffect:wf,BoxCollider:tf,BoxGizmo:Xr,BoxHelperComponent:is,Button:Ws,CallInfo:Ps,Camera:ri,CameraTargetReachedEvent:Fc,Canvas:Ja,CanvasGroup:ko,CapsuleCollider:Ls,ChangeMaterialOnClick:sy,ChangeTransformOnClick:Gr,CharacterController:Nr,CharacterControllerInput:js,ChromaticAberration:Ih,Collider:di,ColorAdjustments:$o,ColorBySpeedModule:_l,ColorOverLifetimeModule:_f,ContactShadows:_h,ControlTrackHandler:Tf,CustomBranding:qr,Deletable:$g,DeleteBox:Xa,DepthOfField:Pn,DeviceFlag:nf,DocumentExtension:Vx,DragControls:lr,DropListener:Bs,Duplicatable:Gg,EffectWrapper:Gc,EmissionModule:$s,EmphasizeOnClick:hl,EnvironmentScene:jf,EventList:ye,EventListEvent:Yu,EventSystem:Qt,EventTrigger:of,FieldWithDefault:Bw,FixedJoint:Oy,Fog:ml,GltfExport:ey,GltfExportBox:Zg,Gradient:Yr,Graphic:Oh,GraphicRaycaster:Ku,GridHelper:gl,GridLayoutGroup:by,GroundProjectedEnv:os,GroupActionModel:yo,HideOnStart:Ya,HingeJoint:Rh,HorizontalLayoutGroup:_y,Image:wl,InheritVelocityModule:Ty,InputField:Wy,InstanceHandle:Nc,InstancingHandler:Qa,Interactable:Ng,Keyframe:ai,LODGroup:Th,LODModel:yl,Light:pi,LimitVelocityOverLifetimeModule:lt,LogStats:zg,LookAt:Gy,LookAtConstraint:Ur,MainModule:It,MaskableGraphic:kh,MeshCollider:Io,MeshRenderer:vh,MinMaxCurve:q,MinMaxGradient:Kr,NeedleMenu:as,NestedGltf:mf,Networking:Ry,NoiseModule:be,ObjectRaycaster:Ei,OffsetConstraint:Qr,OpenURL:xl,OrbitControls:ge,Outline:pl,Padding:Hr,ParticleBurst:wu,ParticleSubEmitter:Ay,ParticleSystem:Wc,ParticleSystemRenderer:en,PhysicsExtension:py,PixelationEffect:jh,PlayAnimationOnClick:$c,PlayAudioOnClick:Mo,PlayableDirector:il,PlayerColor:el,PointerEventData:mh,PostProcessingHandler:jy,PreliminaryAction:dl,PreliminaryTrigger:Sh,RawImage:Df,Rect:nx,RectTransform:wn,ReflectionProbe:zc,RegisteredAnimationInfo:_o,RemoteSkybox:Sf,Renderer:Ti,RendererLightmap:_u,Rigidbody:ot,RotationBySpeedModule:Ji,RotationOverLifetimeModule:Cn,SceneSwitcher:Ge,ScreenCapture:Vo,ScreenSpaceAmbientOcclusion:Vs,ScreenSpaceAmbientOcclusionN8:Mn,SetActiveOnClick:oy,ShadowCatcher:zh,ShapeModule:Ey,SharpeningEffect:Fh,SignalAsset:Rf,SignalReceiver:Gh,SignalReceiverEvent:Wh,SignalTrackHandler:Hc,Size:ix,SizeBySpeedModule:mi,SizeOverLifetimeModule:Zr,SkinnedMeshRenderer:Kg,SmoothFollow:Pf,SpatialGrabRaycaster:Tr,SpatialHtml:Xh,SpatialTrigger:Mf,SpatialTriggerReceiver:Zn,SpectatorCamera:Of,SphereCollider:al,Sprite:Us,SpriteData:Fa,SpriteRenderer:ui,SpriteSheet:Za,SubEmitterSystem:xu,SyncedCamera:Fy,SyncedRoom:On,SyncedTransform:ts,TapGestureTrigger:ay,TeleportTarget:uf,TestRunner:Uy,TestSimulateUserData:zy,Text:Dt,TextBuilder:gy,TextExtension:pf,TextureSheetAnimationModule:jt,TiltShiftEffect:hs,ToneMappingEffect:Ro,TrailModule:je,TransformData:We,TransformGizmo:ia,TriggerBuilder:xt,TriggerModel:Co,UIRaycastUtils:Eg,UIRootComponent:Ph,USDZExporter:Kn,USDZText:cr,USDZUIExtension:wy,UsageMarker:bh,VariantAction:ny,VelocityOverLifetimeModule:ze,VerticalLayoutGroup:yy,VideoPlayer:rt,Vignette:ta,VisibilityAction:Ch,Voip:Do,Volume:vl,VolumeParameter:U,VolumeProfile:bf,WebARCameraBackground:Yh,WebARSessionRoot:ns,WebXR:ff,WebXRImageTracking:Xc,WebXRImageTrackingModel:Hs,WebXRPlaneTracking:qs,WebXRTrackedImage:qc,XRControllerFollow:Gs,XRControllerModel:ss,XRControllerMovement:Ai,XRFlag:$i,XRRig:Ff,XRState:Xt,__Ignore:Wx},Symbol.toStringTag,{value:"Module"})),Ou=S("debugmissingcamera");re.registerCallback(he.MissingCamera,o=>{var l,c,h;Ou&&console.warn("Creating missing camera");const t=o.context.scene,e=new d.PerspectiveCamera;e.name="Default Fallback Camera",t.add(e);const i=new ri;if(i.sourceId=((c=(l=o.files)==null?void 0:l[0])==null?void 0:c.src)??"unknown",i.fieldOfView=35,o.context.domElement.getAttribute("transparent")!=null)i.clearFlags=Cr.Uninitialized;else if((h=o.context.domElement.getAttribute("background-image"))!=null&&h.length||o.context.lightmaps.tryGetSkybox(i.sourceId))i.clearFlags=Cr.Skybox,o.context.domElement.getAttribute("background-blurriness")===null&&(o.context.scene.backgroundBlurriness=.2);else{if(i.clearFlags=Cr.SolidColor,!o.context.domElement.getAttribute("background-color")){let u="#efefef";typeof window!==void 0&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(u="#1f1f1f"),t.background=new d.Color(u)}if(!t.environment){const u=new d.PMREMGenerator$1(o.context.renderer),f=new jf("neutral");t.environment=u.fromScene(f,.025).texture}}const s=vr(e,i,!0);e.position.x=0,e.position.y=1,e.position.z=2;const a=o.context.domElement;return(a==null?void 0:a.cameraControls)!=!1&&Gx(o.context,s),s});re.registerCallback(he.ContextCreated,o=>{if(!o.context.mainCamera){Ou&&console.log("Will not auto-fit because a default camera exists");return}const t=o.context.domElement;if((t==null?void 0:t.cameraControls)==!0){const e=v0(o.context.mainCamera);if((e==null?void 0:e.isCameraController)==!0){Ou&&console.log("Will not auto-fit because a camera controller exists");return}Gx(o.context)}});function Gx(o,t){t=t??o.mainCameraComponent;const e=t==null?void 0:t.gameObject;if(Ou&&console.log("Creating default camera controls",t==null?void 0:t.name),e){const i=ah(e,ge);i.sourceId=(t==null?void 0:t.sourceId)??"unknown";const n=o.domElement.getAttribute("auto-rotate");if(i.autoRotate=n!=null&&n!="0"&&(n==null?void 0:n.toLowerCase())!="false",i.autoRotateSpeed=.5,i.autoFit=!0,i.autoRotate&&n){const s=parseFloat(n);isNaN(s)||(i.autoRotateSpeed=s)}}else console.warn("Missing camera object, can not add orbit controls")}re.registerCallback(he.ContextCreated,o=>{const t=o.context.domElement.getAttribute("autoplay");if(t!==void 0&&(t===""||t==="true"||t==="1")&&o.files)for(const e of o.files)C.foreachComponent(e.file.scene,n=>{if(n.enabled!==!1){if(n instanceof Tt&&n.playAutomatically||n instanceof St||n instanceof il&&n.playOnAwake===!0)return!0;if(n instanceof Tt)return n.playAutomatically=!0,!0;if(n instanceof il)return n.playOnAwake=!0,!0}},!0)!==!0&&Ha.assignAnimationsFromFile(e.file,{createAnimationComponent:(n,s)=>Oi(n,Tt)})});class dT extends ae.WorkerBase{constructor(){super(new Worker(new URL("/generateMeshBVH.worker-BaNp_Xtp.js",typeof document>"u"?require("url").pathToFileURL(__filename).href:Nf&&Nf.tagName.toUpperCase()==="SCRIPT"&&Nf.src||new URL("needle-engine.bundle-BECP5XKQ.umd.cjs",document.baseURI).href),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(t,e,i={}){return new Promise((n,s)=>{if(e.getAttribute("position").isInterleavedBufferAttribute||e.index&&e.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");t.onerror=h=>{s(new Error(`[GenerateMeshBVHWorker] ${h.message||"Unknown error. Please check the server console. If you're using vite try adding 'three-mesh-bvh' to 'optimizeDeps.exclude' in your vite.config.js"}`))},t.onmessage=h=>{const{data:u}=h;if(u.error)s(new Error(u.error)),t.onmessage=null;else if(u.serialized){const{serialized:f,position:p}=u,g=ae.MeshBVH.deserialize(f,e,{setIndex:!1}),y=Object.assign({setBoundingBox:!0},i);if(e.attributes.position.array=p,f.index)if(e.index)e.index.array=f.index;else{const b=new d.BufferAttribute(f.index,1,!1);e.setIndex(b)}y.setBoundingBox&&(e.boundingBox=g.getBoundingBox(new d.Box3)),i.onProgress&&i.onProgress(u.progress),n(g),t.onmessage=null}else i.onProgress&&i.onProgress(u.progress)};const a=e.index?e.index.array:null,l=e.attributes.position.array,c=[l];a&&c.push(a),t.postMessage({index:a,position:l,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...e.groups]}},c.map(h=>h.buffer).filter(h=>typeof SharedArrayBuffer>"u"||!(h instanceof SharedArrayBuffer)))})}}const uT=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:dT},Symbol.toStringTag,{value:"Module"}));exports.$physicsKey=nM;exports.ActionBuilder=fe;exports.ActionCollection=Zw;exports.ActionModel=xi;exports.Addressables=Bv;exports.AlignmentConstraint=fh;exports.AmbientMode=Ia;exports.Animation=Tt;exports.AnimationCurve=Ah;exports.AnimationExtension=af;exports.AnimationTrackHandler=Ef;exports.AnimationUtils=Ha;exports.Animator=St;exports.AnimatorConditionMode=oo;exports.AnimatorController=Gi;exports.AnimatorControllerParameterType=kg;exports.AnimatorStateInfo=Jl;exports.Antialiasing=Dh;exports.Application=vn;exports.AssetDatabase=ev;exports.AssetReference=te;exports.AudioExtension=Wr;exports.AudioListener=Os;exports.AudioSource=qi;exports.AudioTrackHandler=tl;exports.Avatar=Oo;exports.AvatarBlink_Simple=zr;exports.AvatarEyeLook_Rotation=jg;exports.AvatarLoader=$x;exports.AvatarMarker=At;exports.AvatarModel=Jy;exports.Avatar_Brain_LookAt=Uc;exports.Avatar_MouthShapes=yh;exports.Avatar_MustacheShake=Dg;exports.Avatar_POI=As;exports.Axes=xa;exports.AxesHelper=rl;exports.BUILD_TIME=tg;exports.BaseUIComponent=Qi;exports.BasicIKConstraint=Fg;exports.BehaviorExtension=fy;exports.BehaviorModel=wt;exports.BloomEffect=wf;exports.BoxCollider=tf;exports.BoxGizmo=Xr;exports.BoxHelperComponent=is;exports.Button=Ws;exports.ButtonsFactory=zn;exports.CallDirection=_w;exports.CallInfo=Ps;exports.Camera=ri;exports.CameraTargetReachedEvent=Fc;exports.Canvas=Ja;exports.CanvasGroup=ko;exports.CapsuleCollider=Ls;exports.ChangeMaterialOnClick=sy;exports.ChangeTransformOnClick=Gr;exports.CharacterController=Nr;exports.CharacterControllerInput=js;exports.ChromaticAberration=Ih;exports.CircularBuffer=ki;exports.ClearFlags=Cr;exports.ClipExtrapolation=An;exports.Collider=di;exports.Collision=mw;exports.CollisionDetectionMode=Qu;exports.ColorAdjustments=$o;exports.ColorBySpeedModule=_l;exports.ColorOverLifetimeModule=_f;exports.Component=uP;exports.Component$1=D;exports.ComponentLifecycleEvents=sh;exports.Components=hT;exports.ConnectionEvents=X0;exports.ContactPoint=pw;exports.ContactShadows=_h;exports.Context=X;exports.ContextArgs=K1;exports.ContextEvent=he;exports.ContextRegistry=re;exports.ControlTrackHandler=Tf;exports.CustomBranding=qr;exports.CustomShader=mu;exports.DefaultReflectionMode=ou;exports.Deletable=$g;exports.DeleteBox=Xa;exports.DepthOfField=Pn;exports.DeviceFlag=nf;exports.DocumentExtension=Vx;exports.DragControls=lr;exports.DragMode=Vg;exports.DropListener=Bs;exports.Duplicatable=Gg;exports.EffectWrapper=Gc;exports.EmissionModule=$s;exports.EmphasizeOnClick=hl;exports.EngineLoadingView=Pu;exports.EnvironmentScene=jf;exports.EventList=ye;exports.EventListEvent=Yu;exports.EventSystem=Qt;exports.EventTrigger=of;exports.FieldWithDefault=Bw;exports.FileReference=Ic;exports.FileReferenceSerializer=Uv;exports.FileSpawnModel=MM;exports.File_Event=Sw;exports.FixedJoint=Oy;exports.Fog=ml;exports.FrameEvent=we;exports.GENERATOR=Fu;exports.GameObject=C;exports.Gizmos=$;exports.GltfExport=ey;exports.GltfExportBox=Zg;exports.Gradient=Yr;exports.Graphic=Oh;exports.GraphicRaycaster=Ku;exports.Graphics=Mr;exports.GridHelper=gl;exports.GridLayoutGroup=by;exports.GroundProjectedEnv=os;exports.GroupActionModel=yo;exports.HideFlags=Zu;exports.HideOnStart=Ya;exports.HingeJoint=Rh;exports.HorizontalLayoutGroup=_y;exports.HostData=t1;exports.Image=wl;exports.ImageReference=Dc;exports.ImageReferenceSerializer=Fv;exports.InheritVelocityModule=Ty;exports.Input=$0;exports.InputEventQueue=oi;exports.InputEvents=Re;exports.InputField=Wy;exports.InstanceHandle=Nc;exports.InstancingHandler=Qa;exports.InstancingUtil=Wi;exports.InstantiateEvent=dv;exports.InstantiateIdProvider=vt;exports.InstantiateOptions=xn;exports.Interactable=Ng;exports.JoinedRoomResponse=MC;exports.KeyEventArgs=mC;exports.Keyframe=ai;exports.LODGroup=Th;exports.LODModel=yl;exports.LeftRoomResponse=OC;exports.Light=pi;exports.LightData=Wv;exports.LimitVelocityOverLifetimeModule=lt;exports.LoadingElementOptions=QE;exports.LogStats=zg;exports.LogType=Mi;exports.LookAt=Gy;exports.LookAtConstraint=Ur;exports.MainModule=It;exports.MarkerType=Ny;exports.MaskableGraphic=kh;exports.Mathf=z;exports.MeshCollider=Io;exports.MeshRenderer=vh;exports.MinMaxCurve=q;exports.MinMaxGradient=Kr;exports.NEKeyboardEvent=Xl;exports.NEPointerEvent=_s;exports.NeedleButtonElement=Zy;exports.NeedleEngineWebComponent=Ky;exports.NeedleMenu=as;exports.NeedlePatchesKey=Rd;exports.NeedleXRController=og;exports.NeedleXRSession=J;exports.NeedleXRSync=K0;exports.NeedleXRUtils=J0;exports.NestedGltf=mf;exports.NetworkConnection=Y0;exports.NetworkedStreamEvents=Nn;exports.NetworkedStreams=gh;exports.Networking=Ry;exports.NewInstanceModel=fv;exports.NoiseModule=be;exports.ObjectRaycaster=Ei;exports.ObjectUtils=Lo;exports.OffsetConstraint=Qr;exports.OneEuroFilter=Od;exports.OneEuroFilterXYZ=qm;exports.OpenURL=xl;exports.OrbitControls=ge;exports.Outline=pl;exports.OwnershipEvent=Q0;exports.OwnershipModel=cg;exports.PUBLIC_KEY=ba;exports.Padding=Hr;exports.ParticleBurst=wu;exports.ParticleSubEmitter=Ay;exports.ParticleSystem=Wc;exports.ParticleSystemBaseBehaviour=No;exports.ParticleSystemRenderer=en;exports.ParticleSystemShapeType=vu;exports.PeerHandle=ja;exports.PeerNetworking=q0;exports.Physics=Ec;exports.PhysicsExtension=py;exports.PhysicsMaterialCombine=ht;exports.PixelationEffect=jh;exports.PlayAnimationOnClick=$c;exports.PlayAudioOnClick=Mo;exports.PlayableDirector=il;exports.PlayerColor=el;exports.PlayerState=yn;exports.PlayerStateEvent=tx;exports.PlayerSync=dy;exports.PlayerView=Nv;exports.PlayerViewManager=$v;exports.PointerEventData=mh;exports.PointerType=Nu;exports.PostProcessingEffect=Ye;exports.PostProcessingEffectOrder=it;exports.PostProcessingHandler=jy;exports.PreliminaryAction=dl;exports.PreliminaryTrigger=Sh;exports.PrimitiveType=Or;exports.Progress=oe;exports.PromiseAllWithErrors=Gm;exports.PromiseErrorResult=Qp;exports.RGBAColor=ie;exports.RapierPhysics=Mu;exports.RawImage=Df;exports.RaycastOptions=es;exports.Rect=nx;exports.RectTransform=wn;exports.ReflectionProbe=zc;exports.RegisteredAnimationInfo=_o;exports.RemoteSkybox=Sf;exports.RenderTexture=xr;exports.RenderTextureSerializer=hw;exports.Renderer=Ti;exports.RendererData=Vv;exports.RendererLightmap=_u;exports.Rigidbody=ot;exports.RigidbodyConstraints=Ne;exports.RoomEvents=ee;exports.RotationBySpeedModule=Ji;exports.RotationOverLifetimeModule=Cn;exports.SceneLightSettings=fu;exports.SceneSwitcher=Ge;exports.ScreenCapture=Vo;exports.ScreenSpaceAmbientOcclusion=Vs;exports.ScreenSpaceAmbientOcclusionN8=Mn;exports.SendQueue=fn;exports.SerializationContext=vg;exports.SetActiveOnClick=oy;exports.ShadowCatcher=zh;exports.ShapeModule=Ey;exports.SharpeningEffect=Fh;exports.SignalAsset=Rf;exports.SignalReceiver=Gh;exports.SignalReceiverEvent=Wh;exports.SignalTrackHandler=Hc;exports.Size=ix;exports.SizeBySpeedModule=mi;exports.SizeOverLifetimeModule=Zr;exports.SkinnedMeshRenderer=Kg;exports.SmoothFollow=Pf;exports.SpatialGrabRaycaster=Tr;exports.SpatialHtml=Xh;exports.SpatialTrigger=Mf;exports.SpatialTriggerReceiver=Zn;exports.SpectatorCamera=Of;exports.SphereCollider=al;exports.SphereIntersection=ug;exports.SphereOverlapResult=gw;exports.Sprite=Us;exports.SpriteData=Fa;exports.SpriteRenderer=ui;exports.SpriteSheet=Za;exports.StateMachineBehaviour=_P;exports.StreamEndedEvent=Ag;exports.StreamReceivedEvent=yw;exports.SubEmitterSystem=xu;exports.SyncedCamera=Fy;exports.SyncedRoom=On;exports.SyncedTransform=ts;exports.TapGestureTrigger=ay;exports.TeleportTarget=uf;exports.TestRunner=Uy;exports.TestSceneUtils=sT;exports.TestSimulateUserData=zy;exports.Text=Dt;exports.TextBuilder=gy;exports.TextExtension=pf;exports.TextureSheetAnimationModule=jt;exports.TiltShiftEffect=hs;exports.Time=Gv;exports.ToneMappingEffect=Ro;exports.TrackHandler=Hh;exports.TrackType=_i;exports.TrailModule=je;exports.TransformData=We;exports.TransformGizmo=ia;exports.TriggerBuilder=xt;exports.TriggerModel=Co;exports.TypeStore=k;exports.UIRaycastUtils=Eg;exports.UIRootComponent=Ph;exports.USDDocument=ty;exports.USDObject=Et;exports.USDWriter=Vw;exports.USDZExporter=Kn;exports.USDZExporter$1=Ww;exports.USDZText=cr;exports.USDZUIExtension=wy;exports.UriSerializer=dw;exports.UsageMarker=bh;exports.UserJoinedOrLeftRoomModel=kC;exports.VERSION=_n;exports.VariantAction=ny;exports.VelocityOverLifetimeModule=ze;exports.VerticalLayoutGroup=yy;exports.VideoPlayer=rt;exports.ViewDevice=wo;exports.Vignette=ta;exports.VisibilityAction=Ch;exports.Voip=Do;exports.Volume=vl;exports.VolumeParameter=U;exports.VolumeProfile=bf;exports.WaitForFrames=E1;exports.WaitForPromise=zv;exports.WaitForSeconds=Sg;exports.Watch=Es;exports.WebARCameraBackground=Yh;exports.WebARSessionRoot=ns;exports.WebXR=ff;exports.WebXRButtonFactory=Po;exports.WebXRImageTracking=Xc;exports.WebXRImageTrackingModel=Hs;exports.WebXRPlaneTracking=qs;exports.WebXRTrackedImage=qc;exports.XRControllerFollow=Gs;exports.XRControllerModel=ss;exports.XRControllerMovement=Ai;exports.XRFlag=$i;exports.XRRig=Ff;exports.XRState=Xt;exports.XRStateFlag=Bn;exports.__Ignore=Wx;exports.__internalNotifyObjectDestroyed=ov;exports.activeInHierarchyFieldName=Ts;exports.addAttributeChangeCallback=d0;exports.addComponent=Oi;exports.addCustomExtensionPlugin=XM;exports.addNewComponent=vr;exports.addPatch=Uu;exports.apply=Wu;exports.applyHMRChanges=dP;exports.applyPrototypeExtensions=Pv;exports.beginListenDestroy=uv;exports.beginListenInstantiate=mv;exports.binaryIdentifierCasts=rg;exports.build_scene_functions=Y1;exports.builtinComponentKeyName=er;exports.calculateProgress01=Yy;exports.clearMessages=RS;exports.colorSerializer=IP;exports.compareAssociation=bv;exports.componentSerializer=Bd;exports.copyTexture=O0;exports.createMotion=rw;exports.debugNet=Jt;exports.debugOwner=Ql;exports.decompressGpuTexture=Xw;exports.deepClone=Jc;exports.delay=Jn;exports.delayForFrames=eh;exports.deserializeObject=nu;exports.destroy=Ri;exports.destroyComponentInstance=kv;exports.determineMimeTypeFromExtension=Cw;exports.disposeObjectResources=Se;exports.disposeStream=$n;exports.editorGuidKeyName=cc;exports.enableSpatialConsole=_r;exports.euler=BP;exports.eventListSerializer=NP;exports.exportAsGLTF=aT;exports.findByGuid=xg;exports.findObjectOfType=hh;exports.findObjectsOfType=Ev;exports.findResourceUsers=pg;exports.fitObjectIntoVolume=R0;exports.foreachComponent=Rr;exports.foreachComponentEnumerator=Hu;exports.forward=WS;exports.generateQRCode=f0;exports.generateSeed=pv;exports.getBoundingBox=li;exports.getCameraController=v0;exports.getComponent=jr;exports.getComponentInChildren=ch;exports.getComponentInParent=Lc;exports.getComponents=lh;exports.getComponentsInChildren=sl;exports.getComponentsInParent=Vu;exports.getFormattedDate=Uw;exports.getIconElement=bt;exports.getIconTexture=ym;exports.getLoader=bn;exports.getOrAddComponent=ah;exports.getParam=S;exports.getParentHierarchyPath=qS;exports.getPath=lS;exports.getPeerOptions=xC;exports.getPeerjsInstance=H0;exports.getResourceUserCount=HC;exports.getTempColor=S0;exports.getTempQuaternion=un;exports.getTempVector=V;exports.getUrlParams=Zc;exports.getVisibleInCustomShadowRendering=k0;exports.getWorldDirection=C0;exports.getWorldEuler=Ym;exports.getWorldPosition=Q;exports.getWorldQuaternion=_e;exports.getWorldRotation=Bu;exports.getWorldScale=Ue;exports.hasCommercialLicense=Yn;exports.hasIndieLicense=uh;exports.hasPointerEventComponent=cu;exports.hasProLicense=Qn;exports.hideDebugConsole=L0;exports.imageToCanvas=Qw;exports.instantiate=Er;exports.invokeLoadedImportPluginHooks=Lw;exports.invokeXRSessionEnd=N0;exports.invokeXRSessionStart=z0;exports.isActiveInHierarchy=Tv;exports.isActiveSelf=ol;exports.isAndroidDevice=pS;exports.isAnimationAction=M0;exports.isComponent=fw;exports.isDebugMode=sS;exports.isDesktop=hS;exports.isDestroyed=kr;exports.isDevEnvironment=j;exports.isDisposed=WC;exports.isExporting=oT;exports.isGLTFModel=uw;exports.isHostedOnGlitch=s0;exports.isHotReloadEnabled=wm;exports.isHotReloading=cP;exports.isIPad=uS;exports.isIconElement=Xv;exports.isLocalNetwork=Yt;exports.isMacOS=gS;exports.isMobileDevice=dS;exports.isMozillaXR=mS;exports.isQuest=bS;exports.isResourceTrackingEnabled=iv;exports.isSafari=_S;exports.isUsingInstancing=Gu;exports.isiOS=yS;exports.isiPad=fS;exports.loadAsset=VE;exports.loadSync=Qy;exports.logHierarchy=Xd;exports.lookAtInverse=jS;exports.lookAtObject=th;exports.lookAtScreenPoint=BS;exports.makeId=rS;exports.makeIdFromRandomWords=l0;exports.makeNameSafe=Xi;exports.markAsInstancedRendered=Av;exports.microphonePermissionsGranted=vS;exports.nameof=nS;exports.nameofFactory=r0;exports.objectSerializer=cw;exports.offXRSessionEnd=pC;exports.offXRSessionStart=fC;exports.onAfterRender=aP;exports.onBeforeRender=rP;exports.onClear=sP;exports.onDestroy=oP;exports.onInitialized=Jv;exports.onStart=Mg;exports.onUpdate=ew;exports.onXRSessionEnd=sg;exports.onXRSessionStart=zu;exports.parseSync=Ix;exports.placeOnSurface=E0;exports.postprocessFBXMaterials=Jm;exports.prefix=RP;exports.pushState=a0;exports.randomNumber=aS;exports.registerBinaryType=ag;exports.registerComponent=qu;exports.registerComponentExtension=Xg;exports.registerCustomEffectType=tn;exports.registerExportExtensions=Qg;exports.registerExtensions=yu;exports.registerHotReloadType=iw;exports.registerLoader=ig;exports.registerPrefabProvider=yv;exports.registerPrototypeExtensions=Mv;exports.registerType=r1;exports.relativePathPrefix=h0;exports.removeAttributeChangeCallback=u0;exports.removeComponent=wg;exports.removeCustomImportExtensionType=QM;exports.removePatch=dC;exports.resolveUrl=Eo;exports.sanitizeString=c0;exports.saveImage=Tx;exports.screenshot=ME;exports.screenshot2=qy;exports.sendDestroyed=gg;exports.serializable=m;exports.serializeObject=wv;exports.serializeable=Br;exports.setActive=uc;exports.setAllowBalloonMessages=y0;exports.setAllowOverlayMessages=PS;exports.setAutoFitEnabled=Hd;exports.setCameraController=Zp;exports.setDestroyed=Dv;exports.setDevEnvironment=tC;exports.setDisposable=fg;exports.setDontDestroy=pa;exports.setOrAddParamsToUrl=Xp;exports.setParam=oS;exports.setParamWithoutReload=Oc;exports.setPeerOptions=SC;exports.setResourceTrackingEnabled=VC;exports.setState=Vm;exports.setVisibleInCustomShadowRendering=Zm;exports.setWorldEuler=Km;exports.setWorldPosition=st;exports.setWorldPositionXYZ=Pr;exports.setWorldQuaternion=Hi;exports.setWorldQuaternionXYZW=Qm;exports.setWorldRotation=P0;exports.setWorldRotationXYZ=ih;exports.setWorldScale=Na;exports.showBalloonError=nh;exports.showBalloonMessage=Ee;exports.showBalloonWarning=me;exports.showDebugConsole=eg;exports.slerp=IS;exports.syncDestroy=oh;exports.syncField=hy;exports.syncInstantiate=yg;exports.textureToCanvas=XS;exports.tryCastBinary=W0;exports.tryDetermineMimetypeFromBinary=Mw;exports.tryDetermineMimetypeFromURL=Pw;exports.tryFindObject=za;exports.tryGetGuid=G0;exports.unregisterHotReloadType=nw;exports.unwatchWrite=Wm;exports.useForAutoFit=w0;exports.validate=Ct;exports.watchWrite=ju;
1607
+ `),ce(this,mr).innerHTML=ce(this,Vt).innerHTML,ce(this,mr).style.cssText="display: flex; align-items: center; justify-content: center;",ce(this,Vt).innerHTML=ce(this,mr).outerHTML,ce(this,pr).innerHTML=ce(this,Vt).outerHTML,ce(this,pr).prepend(ce(this,gr)),ru(_m,{element:ce(this,pr)}),(n=ce(this,Ua))==null||n.disconnect(),ce(this,Ua)??rn(this,Ua,new MutationObserver(()=>Ol(this,nl,Nx).call(this))),ce(this,Ua).observe(ce(this,Vt),{attributes:!0}),Hp&&console.log("Needle Button updated")},Nx=function(){ce(this,Vt)&&(ce(this,Vt).style.display==="none"?this.style.display="none":this.style.display==="none"&&(this.style.display=""))},Kc=new WeakMap,r(Zy,"observedAttributes",["ar","vr","quicklook"]);typeof window<"u"&&!window.customElements.get(i0)&&window.customElements.define(i0,Zy);const Hl=S("debugavatar");class Jy{constructor(t,e,i,n){r(this,"root");r(this,"head");r(this,"leftHand");r(this,"rigthHand");var s;this.root=t,this.head=e,this.leftHand=i,this.rigthHand=n,(s=this.root)==null||s.traverse(a=>a.layers.set(2))}get isValid(){return this.head!==null&&this.head!==void 0}}class $x{constructor(){r(this,"avatarRegistryUrl",null)}async getOrCreateNewAvatarInstance(t,e){if(!e)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof e=="string"){if(i=await this.loadAvatar(t,e),!i){const s=new xn;i=C.instantiate(za(e,t.scene),s)}}else i=e;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(Hl&&console.log("[Custom Avatar] valid config",e,Hl?n:""),n):(console.warn("[Custom Avatar] config isn't valid",e,Hl?n:""),null)}async loadAvatar(t,e){if(console.assert(e!=null&&typeof e=="string","Avatar id must not be null"),e.length<=0||!e)return null;if(Hl&&console.log("[Custom Avatar] "+e+", loading..."),e.endsWith(".glb")||(e+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+e);let s=null;if(n.ok){const l=await n.blob();l&&(s=await l.arrayBuffer())}if(!s)return null;const a=await bn().parseSync(t,s,null,0);return(a==null?void 0:a.scene)??null}const i=new H.GLTFLoader;return Og(i,t),new Promise((n,s)=>{const a=this.avatarRegistryUrl+"/"+e;i.load(a,async l=>{await bn().createBuiltinComponents(t,a,l,null,void 0),n(l.scene)},l=>{Hl&&console.log("[Custom Avatar] "+l.loaded/l.total*100+"% loaded of "+l.total/1024+"kB")},l=>{console.error("[Custom Avatar] Error when loading: "+l),n(null)})})}cacheModel(t,e){}findAvatar(t){const e=t;let i=e;i.children.length==1&&(i=t.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),a=this.findAvatarPart(i,["right","hand"]);if(!n){n=e;const c=new d.Vector3;new d.Box3().setFromObject(n).getSize(c);const h=Math.max(c.x,c.y,c.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+h+" meters! Should be < 0.3m"),h>.3&&n.scale.multiplyScalar(1/h*.3)}return new Jy(e,n,s,a)}findAvatarPart(t,e){const i=t.name.toLowerCase();let n=!0;for(const s of e){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return t;if(t.children)for(const s of t.children){const a=this.findAvatarPart(s,e);if(a)return a}return null}handleCustomAvatarErrors(t){if(!t.ok)throw Error(t.statusText);return t}}class Vx{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(t){}}class Wx{}const hT=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:fe,ActionCollection:Zw,ActionModel:xi,AlignmentConstraint:fh,Animation:Tt,AnimationCurve:Ah,AnimationExtension:af,AnimationTrackHandler:Ef,Animator:St,AnimatorController:Gi,Antialiasing:Dh,AudioExtension:Wr,AudioListener:Os,AudioSource:qi,AudioTrackHandler:tl,Avatar:Oo,AvatarBlink_Simple:zr,AvatarEyeLook_Rotation:jg,AvatarLoader:$x,AvatarMarker:At,AvatarModel:Jy,Avatar_Brain_LookAt:Uc,Avatar_MouthShapes:yh,Avatar_MustacheShake:Dg,Avatar_POI:As,AxesHelper:rl,BaseUIComponent:Qi,BasicIKConstraint:Fg,BehaviorExtension:fy,BehaviorModel:wt,BloomEffect:wf,BoxCollider:tf,BoxGizmo:Xr,BoxHelperComponent:is,Button:Ws,CallInfo:Ps,Camera:ri,CameraTargetReachedEvent:Fc,Canvas:Ja,CanvasGroup:ko,CapsuleCollider:Ls,ChangeMaterialOnClick:sy,ChangeTransformOnClick:Gr,CharacterController:Nr,CharacterControllerInput:js,ChromaticAberration:Ih,Collider:di,ColorAdjustments:$o,ColorBySpeedModule:_l,ColorOverLifetimeModule:_f,ContactShadows:_h,ControlTrackHandler:Tf,CustomBranding:qr,Deletable:$g,DeleteBox:Xa,DepthOfField:Pn,DeviceFlag:nf,DocumentExtension:Vx,DragControls:lr,DropListener:Bs,Duplicatable:Gg,EffectWrapper:Gc,EmissionModule:$s,EmphasizeOnClick:hl,EnvironmentScene:jf,EventList:ye,EventListEvent:Yu,EventSystem:Qt,EventTrigger:of,FieldWithDefault:Bw,FixedJoint:Oy,Fog:ml,GltfExport:ey,GltfExportBox:Zg,Gradient:Yr,Graphic:Oh,GraphicRaycaster:Ku,GridHelper:gl,GridLayoutGroup:by,GroundProjectedEnv:os,GroupActionModel:yo,HideOnStart:Ya,HingeJoint:Rh,HorizontalLayoutGroup:_y,Image:wl,InheritVelocityModule:Ty,InputField:Wy,InstanceHandle:Nc,InstancingHandler:Qa,Interactable:Ng,Keyframe:ai,LODGroup:Th,LODModel:yl,Light:pi,LimitVelocityOverLifetimeModule:lt,LogStats:zg,LookAt:Gy,LookAtConstraint:Ur,MainModule:It,MaskableGraphic:kh,MeshCollider:Io,MeshRenderer:vh,MinMaxCurve:q,MinMaxGradient:Kr,NeedleMenu:as,NestedGltf:mf,Networking:Ry,NoiseModule:be,ObjectRaycaster:Ei,OffsetConstraint:Qr,OpenURL:xl,OrbitControls:ge,Outline:pl,Padding:Hr,ParticleBurst:wu,ParticleSubEmitter:Ay,ParticleSystem:Wc,ParticleSystemRenderer:en,PhysicsExtension:py,PixelationEffect:jh,PlayAnimationOnClick:$c,PlayAudioOnClick:Mo,PlayableDirector:il,PlayerColor:el,PointerEventData:mh,PostProcessingHandler:jy,PreliminaryAction:dl,PreliminaryTrigger:Sh,RawImage:Df,Rect:nx,RectTransform:wn,ReflectionProbe:zc,RegisteredAnimationInfo:_o,RemoteSkybox:Sf,Renderer:Ti,RendererLightmap:_u,Rigidbody:ot,RotationBySpeedModule:Ji,RotationOverLifetimeModule:Cn,SceneSwitcher:Ge,ScreenCapture:Vo,ScreenSpaceAmbientOcclusion:Vs,ScreenSpaceAmbientOcclusionN8:Mn,SetActiveOnClick:oy,ShadowCatcher:zh,ShapeModule:Ey,SharpeningEffect:Fh,SignalAsset:Rf,SignalReceiver:Gh,SignalReceiverEvent:Wh,SignalTrackHandler:Hc,Size:ix,SizeBySpeedModule:mi,SizeOverLifetimeModule:Zr,SkinnedMeshRenderer:Kg,SmoothFollow:Pf,SpatialGrabRaycaster:Tr,SpatialHtml:Xh,SpatialTrigger:Mf,SpatialTriggerReceiver:Zn,SpectatorCamera:Of,SphereCollider:al,Sprite:Us,SpriteData:Fa,SpriteRenderer:ui,SpriteSheet:Za,SubEmitterSystem:xu,SyncedCamera:Fy,SyncedRoom:On,SyncedTransform:ts,TapGestureTrigger:ay,TeleportTarget:uf,TestRunner:Uy,TestSimulateUserData:zy,Text:Dt,TextBuilder:gy,TextExtension:pf,TextureSheetAnimationModule:jt,TiltShiftEffect:hs,ToneMappingEffect:Ro,TrailModule:je,TransformData:We,TransformGizmo:ia,TriggerBuilder:xt,TriggerModel:Co,UIRaycastUtils:Eg,UIRootComponent:Ph,USDZExporter:Kn,USDZText:cr,USDZUIExtension:wy,UsageMarker:bh,VariantAction:ny,VelocityOverLifetimeModule:ze,VerticalLayoutGroup:yy,VideoPlayer:rt,Vignette:ta,VisibilityAction:Ch,Voip:Do,Volume:vl,VolumeParameter:U,VolumeProfile:bf,WebARCameraBackground:Yh,WebARSessionRoot:ns,WebXR:ff,WebXRImageTracking:Xc,WebXRImageTrackingModel:Hs,WebXRPlaneTracking:qs,WebXRTrackedImage:qc,XRControllerFollow:Gs,XRControllerModel:ss,XRControllerMovement:Ai,XRFlag:$i,XRRig:Ff,XRState:Xt,__Ignore:Wx},Symbol.toStringTag,{value:"Module"})),Ou=S("debugmissingcamera");re.registerCallback(he.MissingCamera,o=>{var l,c,h;Ou&&console.warn("Creating missing camera");const t=o.context.scene,e=new d.PerspectiveCamera;e.name="Default Fallback Camera",t.add(e);const i=new ri;if(i.sourceId=((c=(l=o.files)==null?void 0:l[0])==null?void 0:c.src)??"unknown",i.fieldOfView=35,o.context.domElement.getAttribute("transparent")!=null)i.clearFlags=Cr.Uninitialized;else if((h=o.context.domElement.getAttribute("background-image"))!=null&&h.length||o.context.lightmaps.tryGetSkybox(i.sourceId))i.clearFlags=Cr.Skybox,o.context.domElement.getAttribute("background-blurriness")===null&&(o.context.scene.backgroundBlurriness=.2);else{if(i.clearFlags=Cr.SolidColor,!o.context.domElement.getAttribute("background-color")){let u="#efefef";typeof window!==void 0&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(u="#1f1f1f"),t.background=new d.Color(u)}if(!t.environment){const u=new d.PMREMGenerator$1(o.context.renderer),f=new jf("neutral");t.environment=u.fromScene(f,.025).texture}}const s=vr(e,i,!0);e.position.x=0,e.position.y=1,e.position.z=2;const a=o.context.domElement;return(a==null?void 0:a.cameraControls)!=!1&&Gx(o.context,s),s});re.registerCallback(he.ContextCreated,o=>{if(!o.context.mainCamera){Ou&&console.log("Will not auto-fit because a default camera exists");return}const t=o.context.domElement;if((t==null?void 0:t.cameraControls)==!0){const e=v0(o.context.mainCamera);if((e==null?void 0:e.isCameraController)==!0){Ou&&console.log("Will not auto-fit because a camera controller exists");return}Gx(o.context)}});function Gx(o,t){t=t??o.mainCameraComponent;const e=t==null?void 0:t.gameObject;if(Ou&&console.log("Creating default camera controls",t==null?void 0:t.name),e){const i=ah(e,ge);i.sourceId=(t==null?void 0:t.sourceId)??"unknown";const n=o.domElement.getAttribute("auto-rotate");if(i.autoRotate=n!=null&&n!="0"&&(n==null?void 0:n.toLowerCase())!="false",i.autoRotateSpeed=.5,i.autoFit=!0,i.autoRotate&&n){const s=parseFloat(n);isNaN(s)||(i.autoRotateSpeed=s)}}else console.warn("Missing camera object, can not add orbit controls")}re.registerCallback(he.ContextCreated,o=>{const t=o.context.domElement.getAttribute("autoplay");if(t!==void 0&&(t===""||t==="true"||t==="1")&&o.files)for(const e of o.files)C.foreachComponent(e.file.scene,n=>{if(n.enabled!==!1){if(n instanceof Tt&&n.playAutomatically||n instanceof St||n instanceof il&&n.playOnAwake===!0)return!0;if(n instanceof Tt)return n.playAutomatically=!0,!0;if(n instanceof il)return n.playOnAwake=!0,!0}},!0)!==!0&&Ha.assignAnimationsFromFile(e.file,{createAnimationComponent:(n,s)=>Oi(n,Tt)})});class dT extends ae.WorkerBase{constructor(){super(new Worker(new URL("/generateMeshBVH.worker-BaNp_Xtp.js",typeof document>"u"?require("url").pathToFileURL(__filename).href:Nf&&Nf.tagName.toUpperCase()==="SCRIPT"&&Nf.src||new URL("needle-engine.bundle-Dcn5L5IY.umd.cjs",document.baseURI).href),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(t,e,i={}){return new Promise((n,s)=>{if(e.getAttribute("position").isInterleavedBufferAttribute||e.index&&e.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");t.onerror=h=>{s(new Error(`[GenerateMeshBVHWorker] ${h.message||"Unknown error. Please check the server console. If you're using vite try adding 'three-mesh-bvh' to 'optimizeDeps.exclude' in your vite.config.js"}`))},t.onmessage=h=>{const{data:u}=h;if(u.error)s(new Error(u.error)),t.onmessage=null;else if(u.serialized){const{serialized:f,position:p}=u,g=ae.MeshBVH.deserialize(f,e,{setIndex:!1}),y=Object.assign({setBoundingBox:!0},i);if(e.attributes.position.array=p,f.index)if(e.index)e.index.array=f.index;else{const b=new d.BufferAttribute(f.index,1,!1);e.setIndex(b)}y.setBoundingBox&&(e.boundingBox=g.getBoundingBox(new d.Box3)),i.onProgress&&i.onProgress(u.progress),n(g),t.onmessage=null}else i.onProgress&&i.onProgress(u.progress)};const a=e.index?e.index.array:null,l=e.attributes.position.array,c=[l];a&&c.push(a),t.postMessage({index:a,position:l,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...e.groups]}},c.map(h=>h.buffer).filter(h=>typeof SharedArrayBuffer>"u"||!(h instanceof SharedArrayBuffer)))})}}const uT=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:dT},Symbol.toStringTag,{value:"Module"}));exports.$physicsKey=nM;exports.ActionBuilder=fe;exports.ActionCollection=Zw;exports.ActionModel=xi;exports.Addressables=Bv;exports.AlignmentConstraint=fh;exports.AmbientMode=Ia;exports.Animation=Tt;exports.AnimationCurve=Ah;exports.AnimationExtension=af;exports.AnimationTrackHandler=Ef;exports.AnimationUtils=Ha;exports.Animator=St;exports.AnimatorConditionMode=oo;exports.AnimatorController=Gi;exports.AnimatorControllerParameterType=kg;exports.AnimatorStateInfo=Jl;exports.Antialiasing=Dh;exports.Application=vn;exports.AssetDatabase=ev;exports.AssetReference=te;exports.AudioExtension=Wr;exports.AudioListener=Os;exports.AudioSource=qi;exports.AudioTrackHandler=tl;exports.Avatar=Oo;exports.AvatarBlink_Simple=zr;exports.AvatarEyeLook_Rotation=jg;exports.AvatarLoader=$x;exports.AvatarMarker=At;exports.AvatarModel=Jy;exports.Avatar_Brain_LookAt=Uc;exports.Avatar_MouthShapes=yh;exports.Avatar_MustacheShake=Dg;exports.Avatar_POI=As;exports.Axes=xa;exports.AxesHelper=rl;exports.BUILD_TIME=tg;exports.BaseUIComponent=Qi;exports.BasicIKConstraint=Fg;exports.BehaviorExtension=fy;exports.BehaviorModel=wt;exports.BloomEffect=wf;exports.BoxCollider=tf;exports.BoxGizmo=Xr;exports.BoxHelperComponent=is;exports.Button=Ws;exports.ButtonsFactory=zn;exports.CallDirection=_w;exports.CallInfo=Ps;exports.Camera=ri;exports.CameraTargetReachedEvent=Fc;exports.Canvas=Ja;exports.CanvasGroup=ko;exports.CapsuleCollider=Ls;exports.ChangeMaterialOnClick=sy;exports.ChangeTransformOnClick=Gr;exports.CharacterController=Nr;exports.CharacterControllerInput=js;exports.ChromaticAberration=Ih;exports.CircularBuffer=ki;exports.ClearFlags=Cr;exports.ClipExtrapolation=An;exports.Collider=di;exports.Collision=mw;exports.CollisionDetectionMode=Qu;exports.ColorAdjustments=$o;exports.ColorBySpeedModule=_l;exports.ColorOverLifetimeModule=_f;exports.Component=uP;exports.Component$1=D;exports.ComponentLifecycleEvents=sh;exports.Components=hT;exports.ConnectionEvents=X0;exports.ContactPoint=pw;exports.ContactShadows=_h;exports.Context=X;exports.ContextArgs=K1;exports.ContextEvent=he;exports.ContextRegistry=re;exports.ControlTrackHandler=Tf;exports.CustomBranding=qr;exports.CustomShader=mu;exports.DefaultReflectionMode=ou;exports.Deletable=$g;exports.DeleteBox=Xa;exports.DepthOfField=Pn;exports.DeviceFlag=nf;exports.DocumentExtension=Vx;exports.DragControls=lr;exports.DragMode=Vg;exports.DropListener=Bs;exports.Duplicatable=Gg;exports.EffectWrapper=Gc;exports.EmissionModule=$s;exports.EmphasizeOnClick=hl;exports.EngineLoadingView=Pu;exports.EnvironmentScene=jf;exports.EventList=ye;exports.EventListEvent=Yu;exports.EventSystem=Qt;exports.EventTrigger=of;exports.FieldWithDefault=Bw;exports.FileReference=Ic;exports.FileReferenceSerializer=Uv;exports.FileSpawnModel=MM;exports.File_Event=Sw;exports.FixedJoint=Oy;exports.Fog=ml;exports.FrameEvent=we;exports.GENERATOR=Fu;exports.GameObject=C;exports.Gizmos=$;exports.GltfExport=ey;exports.GltfExportBox=Zg;exports.Gradient=Yr;exports.Graphic=Oh;exports.GraphicRaycaster=Ku;exports.Graphics=Mr;exports.GridHelper=gl;exports.GridLayoutGroup=by;exports.GroundProjectedEnv=os;exports.GroupActionModel=yo;exports.HideFlags=Zu;exports.HideOnStart=Ya;exports.HingeJoint=Rh;exports.HorizontalLayoutGroup=_y;exports.HostData=t1;exports.Image=wl;exports.ImageReference=Dc;exports.ImageReferenceSerializer=Fv;exports.InheritVelocityModule=Ty;exports.Input=$0;exports.InputEventQueue=oi;exports.InputEvents=Re;exports.InputField=Wy;exports.InstanceHandle=Nc;exports.InstancingHandler=Qa;exports.InstancingUtil=Wi;exports.InstantiateEvent=dv;exports.InstantiateIdProvider=vt;exports.InstantiateOptions=xn;exports.Interactable=Ng;exports.JoinedRoomResponse=MC;exports.KeyEventArgs=mC;exports.Keyframe=ai;exports.LODGroup=Th;exports.LODModel=yl;exports.LeftRoomResponse=OC;exports.Light=pi;exports.LightData=Wv;exports.LimitVelocityOverLifetimeModule=lt;exports.LoadingElementOptions=QE;exports.LogStats=zg;exports.LogType=Mi;exports.LookAt=Gy;exports.LookAtConstraint=Ur;exports.MainModule=It;exports.MarkerType=Ny;exports.MaskableGraphic=kh;exports.Mathf=z;exports.MeshCollider=Io;exports.MeshRenderer=vh;exports.MinMaxCurve=q;exports.MinMaxGradient=Kr;exports.NEKeyboardEvent=Xl;exports.NEPointerEvent=_s;exports.NeedleButtonElement=Zy;exports.NeedleEngineWebComponent=Ky;exports.NeedleMenu=as;exports.NeedlePatchesKey=Rd;exports.NeedleXRController=og;exports.NeedleXRSession=J;exports.NeedleXRSync=K0;exports.NeedleXRUtils=J0;exports.NestedGltf=mf;exports.NetworkConnection=Y0;exports.NetworkedStreamEvents=Nn;exports.NetworkedStreams=gh;exports.Networking=Ry;exports.NewInstanceModel=fv;exports.NoiseModule=be;exports.ObjectRaycaster=Ei;exports.ObjectUtils=Lo;exports.OffsetConstraint=Qr;exports.OneEuroFilter=Od;exports.OneEuroFilterXYZ=qm;exports.OpenURL=xl;exports.OrbitControls=ge;exports.Outline=pl;exports.OwnershipEvent=Q0;exports.OwnershipModel=cg;exports.PUBLIC_KEY=ba;exports.Padding=Hr;exports.ParticleBurst=wu;exports.ParticleSubEmitter=Ay;exports.ParticleSystem=Wc;exports.ParticleSystemBaseBehaviour=No;exports.ParticleSystemRenderer=en;exports.ParticleSystemShapeType=vu;exports.PeerHandle=ja;exports.PeerNetworking=q0;exports.Physics=Ec;exports.PhysicsExtension=py;exports.PhysicsMaterialCombine=ht;exports.PixelationEffect=jh;exports.PlayAnimationOnClick=$c;exports.PlayAudioOnClick=Mo;exports.PlayableDirector=il;exports.PlayerColor=el;exports.PlayerState=yn;exports.PlayerStateEvent=tx;exports.PlayerSync=dy;exports.PlayerView=Nv;exports.PlayerViewManager=$v;exports.PointerEventData=mh;exports.PointerType=Nu;exports.PostProcessingEffect=Ye;exports.PostProcessingEffectOrder=it;exports.PostProcessingHandler=jy;exports.PreliminaryAction=dl;exports.PreliminaryTrigger=Sh;exports.PrimitiveType=Or;exports.Progress=oe;exports.PromiseAllWithErrors=Gm;exports.PromiseErrorResult=Qp;exports.RGBAColor=ie;exports.RapierPhysics=Mu;exports.RawImage=Df;exports.RaycastOptions=es;exports.Rect=nx;exports.RectTransform=wn;exports.ReflectionProbe=zc;exports.RegisteredAnimationInfo=_o;exports.RemoteSkybox=Sf;exports.RenderTexture=xr;exports.RenderTextureSerializer=hw;exports.Renderer=Ti;exports.RendererData=Vv;exports.RendererLightmap=_u;exports.Rigidbody=ot;exports.RigidbodyConstraints=Ne;exports.RoomEvents=ee;exports.RotationBySpeedModule=Ji;exports.RotationOverLifetimeModule=Cn;exports.SceneLightSettings=fu;exports.SceneSwitcher=Ge;exports.ScreenCapture=Vo;exports.ScreenSpaceAmbientOcclusion=Vs;exports.ScreenSpaceAmbientOcclusionN8=Mn;exports.SendQueue=fn;exports.SerializationContext=vg;exports.SetActiveOnClick=oy;exports.ShadowCatcher=zh;exports.ShapeModule=Ey;exports.SharpeningEffect=Fh;exports.SignalAsset=Rf;exports.SignalReceiver=Gh;exports.SignalReceiverEvent=Wh;exports.SignalTrackHandler=Hc;exports.Size=ix;exports.SizeBySpeedModule=mi;exports.SizeOverLifetimeModule=Zr;exports.SkinnedMeshRenderer=Kg;exports.SmoothFollow=Pf;exports.SpatialGrabRaycaster=Tr;exports.SpatialHtml=Xh;exports.SpatialTrigger=Mf;exports.SpatialTriggerReceiver=Zn;exports.SpectatorCamera=Of;exports.SphereCollider=al;exports.SphereIntersection=ug;exports.SphereOverlapResult=gw;exports.Sprite=Us;exports.SpriteData=Fa;exports.SpriteRenderer=ui;exports.SpriteSheet=Za;exports.StateMachineBehaviour=_P;exports.StreamEndedEvent=Ag;exports.StreamReceivedEvent=yw;exports.SubEmitterSystem=xu;exports.SyncedCamera=Fy;exports.SyncedRoom=On;exports.SyncedTransform=ts;exports.TapGestureTrigger=ay;exports.TeleportTarget=uf;exports.TestRunner=Uy;exports.TestSceneUtils=sT;exports.TestSimulateUserData=zy;exports.Text=Dt;exports.TextBuilder=gy;exports.TextExtension=pf;exports.TextureSheetAnimationModule=jt;exports.TiltShiftEffect=hs;exports.Time=Gv;exports.ToneMappingEffect=Ro;exports.TrackHandler=Hh;exports.TrackType=_i;exports.TrailModule=je;exports.TransformData=We;exports.TransformGizmo=ia;exports.TriggerBuilder=xt;exports.TriggerModel=Co;exports.TypeStore=k;exports.UIRaycastUtils=Eg;exports.UIRootComponent=Ph;exports.USDDocument=ty;exports.USDObject=Et;exports.USDWriter=Vw;exports.USDZExporter=Kn;exports.USDZExporter$1=Ww;exports.USDZText=cr;exports.USDZUIExtension=wy;exports.UriSerializer=dw;exports.UsageMarker=bh;exports.UserJoinedOrLeftRoomModel=kC;exports.VERSION=_n;exports.VariantAction=ny;exports.VelocityOverLifetimeModule=ze;exports.VerticalLayoutGroup=yy;exports.VideoPlayer=rt;exports.ViewDevice=wo;exports.Vignette=ta;exports.VisibilityAction=Ch;exports.Voip=Do;exports.Volume=vl;exports.VolumeParameter=U;exports.VolumeProfile=bf;exports.WaitForFrames=E1;exports.WaitForPromise=zv;exports.WaitForSeconds=Sg;exports.Watch=Es;exports.WebARCameraBackground=Yh;exports.WebARSessionRoot=ns;exports.WebXR=ff;exports.WebXRButtonFactory=Po;exports.WebXRImageTracking=Xc;exports.WebXRImageTrackingModel=Hs;exports.WebXRPlaneTracking=qs;exports.WebXRTrackedImage=qc;exports.XRControllerFollow=Gs;exports.XRControllerModel=ss;exports.XRControllerMovement=Ai;exports.XRFlag=$i;exports.XRRig=Ff;exports.XRState=Xt;exports.XRStateFlag=Bn;exports.__Ignore=Wx;exports.__internalNotifyObjectDestroyed=ov;exports.activeInHierarchyFieldName=Ts;exports.addAttributeChangeCallback=d0;exports.addComponent=Oi;exports.addCustomExtensionPlugin=XM;exports.addNewComponent=vr;exports.addPatch=Uu;exports.apply=Wu;exports.applyHMRChanges=dP;exports.applyPrototypeExtensions=Pv;exports.beginListenDestroy=uv;exports.beginListenInstantiate=mv;exports.binaryIdentifierCasts=rg;exports.build_scene_functions=Y1;exports.builtinComponentKeyName=er;exports.calculateProgress01=Yy;exports.clearMessages=RS;exports.colorSerializer=IP;exports.compareAssociation=bv;exports.componentSerializer=Bd;exports.copyTexture=O0;exports.createMotion=rw;exports.debugNet=Jt;exports.debugOwner=Ql;exports.decompressGpuTexture=Xw;exports.deepClone=Jc;exports.delay=Jn;exports.delayForFrames=eh;exports.deserializeObject=nu;exports.destroy=Ri;exports.destroyComponentInstance=kv;exports.determineMimeTypeFromExtension=Cw;exports.disposeObjectResources=Se;exports.disposeStream=$n;exports.editorGuidKeyName=cc;exports.enableSpatialConsole=_r;exports.euler=BP;exports.eventListSerializer=NP;exports.exportAsGLTF=aT;exports.findByGuid=xg;exports.findObjectOfType=hh;exports.findObjectsOfType=Ev;exports.findResourceUsers=pg;exports.fitObjectIntoVolume=R0;exports.foreachComponent=Rr;exports.foreachComponentEnumerator=Hu;exports.forward=WS;exports.generateQRCode=f0;exports.generateSeed=pv;exports.getBoundingBox=li;exports.getCameraController=v0;exports.getComponent=jr;exports.getComponentInChildren=ch;exports.getComponentInParent=Lc;exports.getComponents=lh;exports.getComponentsInChildren=sl;exports.getComponentsInParent=Vu;exports.getFormattedDate=Uw;exports.getIconElement=bt;exports.getIconTexture=ym;exports.getLoader=bn;exports.getOrAddComponent=ah;exports.getParam=S;exports.getParentHierarchyPath=qS;exports.getPath=lS;exports.getPeerOptions=xC;exports.getPeerjsInstance=H0;exports.getResourceUserCount=HC;exports.getTempColor=S0;exports.getTempQuaternion=un;exports.getTempVector=V;exports.getUrlParams=Zc;exports.getVisibleInCustomShadowRendering=k0;exports.getWorldDirection=C0;exports.getWorldEuler=Ym;exports.getWorldPosition=Q;exports.getWorldQuaternion=_e;exports.getWorldRotation=Bu;exports.getWorldScale=Ue;exports.hasCommercialLicense=Yn;exports.hasIndieLicense=uh;exports.hasPointerEventComponent=cu;exports.hasProLicense=Qn;exports.hideDebugConsole=L0;exports.imageToCanvas=Qw;exports.instantiate=Er;exports.invokeLoadedImportPluginHooks=Lw;exports.invokeXRSessionEnd=N0;exports.invokeXRSessionStart=z0;exports.isActiveInHierarchy=Tv;exports.isActiveSelf=ol;exports.isAndroidDevice=pS;exports.isAnimationAction=M0;exports.isComponent=fw;exports.isDebugMode=sS;exports.isDesktop=hS;exports.isDestroyed=kr;exports.isDevEnvironment=j;exports.isDisposed=WC;exports.isExporting=oT;exports.isGLTFModel=uw;exports.isHostedOnGlitch=s0;exports.isHotReloadEnabled=wm;exports.isHotReloading=cP;exports.isIPad=uS;exports.isIconElement=Xv;exports.isLocalNetwork=Yt;exports.isMacOS=gS;exports.isMobileDevice=dS;exports.isMozillaXR=mS;exports.isQuest=bS;exports.isResourceTrackingEnabled=iv;exports.isSafari=_S;exports.isUsingInstancing=Gu;exports.isiOS=yS;exports.isiPad=fS;exports.loadAsset=VE;exports.loadSync=Qy;exports.logHierarchy=Xd;exports.lookAtInverse=jS;exports.lookAtObject=th;exports.lookAtScreenPoint=BS;exports.makeId=rS;exports.makeIdFromRandomWords=l0;exports.makeNameSafe=Xi;exports.markAsInstancedRendered=Av;exports.microphonePermissionsGranted=vS;exports.nameof=nS;exports.nameofFactory=r0;exports.objectSerializer=cw;exports.offXRSessionEnd=pC;exports.offXRSessionStart=fC;exports.onAfterRender=aP;exports.onBeforeRender=rP;exports.onClear=sP;exports.onDestroy=oP;exports.onInitialized=Jv;exports.onStart=Mg;exports.onUpdate=ew;exports.onXRSessionEnd=sg;exports.onXRSessionStart=zu;exports.parseSync=Ix;exports.placeOnSurface=E0;exports.postprocessFBXMaterials=Jm;exports.prefix=RP;exports.pushState=a0;exports.randomNumber=aS;exports.registerBinaryType=ag;exports.registerComponent=qu;exports.registerComponentExtension=Xg;exports.registerCustomEffectType=tn;exports.registerExportExtensions=Qg;exports.registerExtensions=yu;exports.registerHotReloadType=iw;exports.registerLoader=ig;exports.registerPrefabProvider=yv;exports.registerPrototypeExtensions=Mv;exports.registerType=r1;exports.relativePathPrefix=h0;exports.removeAttributeChangeCallback=u0;exports.removeComponent=wg;exports.removeCustomImportExtensionType=QM;exports.removePatch=dC;exports.resolveUrl=Eo;exports.sanitizeString=c0;exports.saveImage=Tx;exports.screenshot=ME;exports.screenshot2=qy;exports.sendDestroyed=gg;exports.serializable=m;exports.serializeObject=wv;exports.serializeable=Br;exports.setActive=uc;exports.setAllowBalloonMessages=y0;exports.setAllowOverlayMessages=PS;exports.setAutoFitEnabled=Hd;exports.setCameraController=Zp;exports.setDestroyed=Dv;exports.setDevEnvironment=tC;exports.setDisposable=fg;exports.setDontDestroy=pa;exports.setOrAddParamsToUrl=Xp;exports.setParam=oS;exports.setParamWithoutReload=Oc;exports.setPeerOptions=SC;exports.setResourceTrackingEnabled=VC;exports.setState=Vm;exports.setVisibleInCustomShadowRendering=Zm;exports.setWorldEuler=Km;exports.setWorldPosition=st;exports.setWorldPositionXYZ=Pr;exports.setWorldQuaternion=Hi;exports.setWorldQuaternionXYZW=Qm;exports.setWorldRotation=P0;exports.setWorldRotationXYZ=ih;exports.setWorldScale=Na;exports.showBalloonError=nh;exports.showBalloonMessage=Ee;exports.showBalloonWarning=me;exports.showDebugConsole=eg;exports.slerp=IS;exports.syncDestroy=oh;exports.syncField=hy;exports.syncInstantiate=yg;exports.textureToCanvas=XS;exports.tryCastBinary=W0;exports.tryDetermineMimetypeFromBinary=Mw;exports.tryDetermineMimetypeFromURL=Pw;exports.tryFindObject=za;exports.tryGetGuid=G0;exports.unregisterHotReloadType=nw;exports.unwatchWrite=Wm;exports.useForAutoFit=w0;exports.validate=Ct;exports.watchWrite=ju;