(()=>{var no=Object.create,Fn=Object.defineProperty;var io=Object.getOwnPropertyDescriptor;var ro=Object.getOwnPropertyNames;var oo=Object.getPrototypeOf,so=Object.prototype.hasOwnProperty;var ao=i=>Fn(i,"__esModule",{value:!0});var co=(i,t)=>()=>(i&&(t=i(i=0)),t),H=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ho=(i,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ro(t))!so.call(i,n)&&n!=="default"&&Fn(i,n,{get:()=>t[n],enumerable:!(e=io(t,n))||e.enumerable});return i},ue=i=>ho(ao(Fn(i!=null?no(oo(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var Fi=H(De=>{m();"use strict";De.byteLength=lo;De.toByteArray=yo;De.fromByteArray=vo;var Tt=[],mt=[],po=typeof Uint8Array!="undefined"?Uint8Array:Array,Bn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var de=0,uo=Bn.length;de<uo;++de)Tt[de]=Bn[de],mt[Bn.charCodeAt(de)]=de;mt["-".charCodeAt(0)]=62;mt["_".charCodeAt(0)]=63;function Pi(i){var t=i.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=i.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function lo(i){var t=Pi(i),e=t[0],n=t[1];return(e+n)*3/4-n}function fo(i,t,e){return(t+e)*3/4-e}function yo(i){var t,e=Pi(i),n=e[0],r=e[1],o=new po(fo(i,n,r)),s=0,a=r>0?n-4:n,h;for(h=0;h<a;h+=4)t=mt[i.charCodeAt(h)]<<18|mt[i.charCodeAt(h+1)]<<12|mt[i.charCodeAt(h+2)]<<6|mt[i.charCodeAt(h+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return r===2&&(t=mt[i.charCodeAt(h)]<<2|mt[i.charCodeAt(h+1)]>>4,o[s++]=t&255),r===1&&(t=mt[i.charCodeAt(h)]<<10|mt[i.charCodeAt(h+1)]<<4|mt[i.charCodeAt(h+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function mo(i){return Tt[i>>18&63]+Tt[i>>12&63]+Tt[i>>6&63]+Tt[i&63]}function go(i,t,e){for(var n,r=[],o=t;o<e;o+=3)n=(i[o]<<16&16711680)+(i[o+1]<<8&65280)+(i[o+2]&255),r.push(mo(n));return r.join("")}function vo(i){for(var t,e=i.length,n=e%3,r=[],o=16383,s=0,a=e-n;s<a;s+=o)r.push(go(i,s,s+o>a?a:s+o));return n===1?(t=i[e-1],r.push(Tt[t>>2]+Tt[t<<4&63]+"==")):n===2&&(t=(i[e-2]<<8)+i[e-1],r.push(Tt[t>>10]+Tt[t>>4&63]+Tt[t<<2&63]+"=")),r.join("")}});var Bi=H(Nn=>{m();Nn.read=function(i,t,e,n,r){var o,s,a=r*8-n-1,h=(1<<a)-1,p=h>>1,u=-7,d=e?r-1:0,b=e?-1:1,x=i[t+d];for(d+=b,o=x&(1<<-u)-1,x>>=-u,u+=a;u>0;o=o*256+i[t+d],d+=b,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=s*256+i[t+d],d+=b,u-=8);if(o===0)o=1-p;else{if(o===h)return s?NaN:(x?-1:1)*Infinity;s=s+Math.pow(2,n),o=o-p}return(x?-1:1)*s*Math.pow(2,o-n)};Nn.write=function(i,t,e,n,r,o){var s,a,h,p=o*8-r-1,u=(1<<p)-1,d=u>>1,b=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,E=n?1:-1,S=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===Infinity?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-s))<1&&(s--,h*=2),s+d>=1?t+=b/h:t+=b*Math.pow(2,1-d),t*h>=2&&(s++,h/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*h-1)*Math.pow(2,r),s=s+d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),s=0));r>=8;i[e+x]=a&255,x+=E,a/=256,r-=8);for(s=s<<r|a,p+=r;p>0;i[e+x]=s&255,x+=E,s/=256,p-=8);i[e+x-E]|=S*128}});var Ki=H(me=>{m();"use strict";var Un=Fi(),le=Bi(),Ni=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;me.Buffer=f;me.SlowBuffer=Ro;me.INSPECT_MAX_BYTES=50;var Le=2147483647;me.kMaxLength=Le;f.TYPED_ARRAY_SUPPORT=xo();!f.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function xo(){try{let i=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(i,t),i.foo()===42}catch(i){return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.buffer}});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.byteOffset}});function Ft(i){if(i>Le)throw new RangeError('The value "'+i+'" is invalid for option "size"');let t=new Uint8Array(i);return Object.setPrototypeOf(t,f.prototype),t}function f(i,t,e){if(typeof i=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Dn(i)}return Ui(i,t,e)}f.poolSize=8192;function Ui(i,t,e){if(typeof i=="string")return bo(i,t);if(ArrayBuffer.isView(i))return Eo(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(Rt(i,ArrayBuffer)||i&&Rt(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Rt(i,SharedArrayBuffer)||i&&Rt(i.buffer,SharedArrayBuffer)))return jn(i,t,e);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=i.valueOf&&i.valueOf();if(n!=null&&n!==i)return f.from(n,t,e);let r=To(i);if(r)return r;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return f.from(i[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i)}f.from=function(i,t,e){return Ui(i,t,e)};Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f,Uint8Array);function Di(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function wo(i,t,e){return Di(i),i<=0?Ft(i):t!==void 0?typeof e=="string"?Ft(i).fill(t,e):Ft(i).fill(t):Ft(i)}f.alloc=function(i,t,e){return wo(i,t,e)};function Dn(i){return Di(i),Ft(i<0?0:Hn(i)|0)}f.allocUnsafe=function(i){return Dn(i)};f.allocUnsafeSlow=function(i){return Dn(i)};function bo(i,t){if((typeof t!="string"||t==="")&&(t="utf8"),!f.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=Li(i,t)|0,n=Ft(e),r=n.write(i,t);return r!==e&&(n=n.slice(0,r)),n}function Ln(i){let t=i.length<0?0:Hn(i.length)|0,e=Ft(t);for(let n=0;n<t;n+=1)e[n]=i[n]&255;return e}function Eo(i){if(Rt(i,Uint8Array)){let t=new Uint8Array(i);return jn(t.buffer,t.byteOffset,t.byteLength)}return Ln(i)}function jn(i,t,e){if(t<0||i.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(i):e===void 0?n=new Uint8Array(i,t):n=new Uint8Array(i,t,e),Object.setPrototypeOf(n,f.prototype),n}function To(i){if(f.isBuffer(i)){let t=Hn(i.length)|0,e=Ft(t);return e.length===0||i.copy(e,0,0,t),e}if(i.length!==void 0)return typeof i.length!="number"||kn(i.length)?Ft(0):Ln(i);if(i.type==="Buffer"&&Array.isArray(i.data))return Ln(i.data)}function Hn(i){if(i>=Le)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Le.toString(16)+" bytes");return i|0}function Ro(i){return+i!=i&&(i=0),f.alloc(+i)}f.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==f.prototype};f.compare=function(t,e){if(Rt(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),Rt(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let o=0,s=Math.min(n,r);o<s;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0};f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return f.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let r=f.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){let s=t[n];if(Rt(s,Uint8Array))o+s.length>r.length?(f.isBuffer(s)||(s=f.from(s)),s.copy(r,o)):Uint8Array.prototype.set.call(r,s,o);else if(f.isBuffer(s))s.copy(r,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return r};function Li(i,t){if(f.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||Rt(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let e=i.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Gn(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ji(i).length;default:if(r)return n?-1:Gn(i).length;t=(""+t).toLowerCase(),r=!0}}f.byteLength=Li;function Ao(i,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(i||(i="utf8");;)switch(i){case"hex":return Bo(this,t,e);case"utf8":case"utf-8":return qi(this,t,e);case"ascii":return Po(this,t,e);case"latin1":case"binary":return Fo(this,t,e);case"base64":return Mo(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return No(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),n=!0}}f.prototype._isBuffer=!0;function ne(i,t,e){let n=i[t];i[t]=i[e],i[e]=n}f.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)ne(this,e,e+1);return this};f.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)ne(this,e,e+3),ne(this,e+1,e+2);return this};f.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)ne(this,e,e+7),ne(this,e+1,e+6),ne(this,e+2,e+5),ne(this,e+3,e+4);return this};f.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?qi(this,0,t):Ao.apply(this,arguments)};f.prototype.toLocaleString=f.prototype.toString;f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:f.compare(this,t)===0};f.prototype.inspect=function(){let t="",e=me.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};Ni&&(f.prototype[Ni]=f.prototype.inspect);f.prototype.compare=function(t,e,n,r,o){if(Rt(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),r===void 0&&(r=0),o===void 0&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,o>>>=0,this===t)return 0;let s=o-r,a=n-e,h=Math.min(s,a),p=this.slice(r,o),u=t.slice(e,n);for(let d=0;d<h;++d)if(p[d]!==u[d]){s=p[d],a=u[d];break}return s<a?-1:a<s?1:0};function ji(i,t,e,n,r){if(i.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,kn(e)&&(e=r?0:i.length-1),e<0&&(e=i.length+e),e>=i.length){if(r)return-1;e=i.length-1}else if(e<0)if(r)e=0;else return-1;if(typeof t=="string"&&(t=f.from(t,n)),f.isBuffer(t))return t.length===0?-1:Hi(i,t,e,n,r);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?r?Uint8Array.prototype.indexOf.call(i,t,e):Uint8Array.prototype.lastIndexOf.call(i,t,e):Hi(i,[t],e,n,r);throw new TypeError("val must be string, number or Buffer")}function Hi(i,t,e,n,r){let o=1,s=i.length,a=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(i.length<2||t.length<2)return-1;o=2,s/=2,a/=2,e/=2}function h(u,d){return o===1?u[d]:u.readUInt16BE(d*o)}let p;if(r){let u=-1;for(p=e;p<s;p++)if(h(i,p)===h(t,u===-1?0:p-u)){if(u===-1&&(u=p),p-u+1===a)return u*o}else u!==-1&&(p-=p-u),u=-1}else for(e+a>s&&(e=s-a),p=e;p>=0;p--){let u=!0;for(let d=0;d<a;d++)if(h(i,p+d)!==h(t,d)){u=!1;break}if(u)return p}return-1}f.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};f.prototype.indexOf=function(t,e,n){return ji(this,t,e,n,!0)};f.prototype.lastIndexOf=function(t,e,n){return ji(this,t,e,n,!1)};function _o(i,t,e,n){e=Number(e)||0;let r=i.length-e;n?(n=Number(n),n>r&&(n=r)):n=r;let o=t.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let a=parseInt(t.substr(s*2,2),16);if(kn(a))return s;i[e+s]=a}return s}function Oo(i,t,e,n){return je(Gn(t,i.length-e),i,e,n)}function Io(i,t,e,n){return je(jo(t),i,e,n)}function Co(i,t,e,n){return je(Ji(t),i,e,n)}function zo(i,t,e,n){return je(Ho(t,i.length-e),i,e,n)}f.prototype.write=function(t,e,n,r){if(e===void 0)r="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")r=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,r===void 0&&(r="utf8")):(r=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-e;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let s=!1;for(;;)switch(r){case"hex":return _o(this,t,e,n);case"utf8":case"utf-8":return Oo(this,t,e,n);case"ascii":case"latin1":case"binary":return Io(this,t,e,n);case"base64":return Co(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zo(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Mo(i,t,e){return t===0&&e===i.length?Un.fromByteArray(i):Un.fromByteArray(i.slice(t,e))}function qi(i,t,e){e=Math.min(i.length,e);let n=[],r=t;for(;r<e;){let o=i[r],s=null,a=o>239?4:o>223?3:o>191?2:1;if(r+a<=e){let h,p,u,d;switch(a){case 1:o<128&&(s=o);break;case 2:h=i[r+1],(h&192)==128&&(d=(o&31)<<6|h&63,d>127&&(s=d));break;case 3:h=i[r+1],p=i[r+2],(h&192)==128&&(p&192)==128&&(d=(o&15)<<12|(h&63)<<6|p&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:h=i[r+1],p=i[r+2],u=i[r+3],(h&192)==128&&(p&192)==128&&(u&192)==128&&(d=(o&15)<<18|(h&63)<<12|(p&63)<<6|u&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),r+=a}return So(n)}var Gi=4096;function So(i){let t=i.length;if(t<=Gi)return String.fromCharCode.apply(String,i);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,i.slice(n,n+=Gi));return e}function Po(i,t,e){let n="";e=Math.min(i.length,e);for(let r=t;r<e;++r)n+=String.fromCharCode(i[r]&127);return n}function Fo(i,t,e){let n="";e=Math.min(i.length,e);for(let r=t;r<e;++r)n+=String.fromCharCode(i[r]);return n}function Bo(i,t,e){let n=i.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let r="";for(let o=t;o<e;++o)r+=qo[i[o]];return r}function No(i,t,e){let n=i.slice(t,e),r="";for(let o=0;o<n.length-1;o+=2)r+=String.fromCharCode(n[o]+n[o+1]*256);return r}f.prototype.slice=function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let r=this.subarray(t,e);return Object.setPrototypeOf(r,f.prototype),r};function J(i,t,e){if(i%1!=0||i<0)throw new RangeError("offset is not uint");if(i+t>e)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||J(t,e,this.length);let r=this[t],o=1,s=0;for(;++s<e&&(o*=256);)r+=this[t+s]*o;return r};f.prototype.readUintBE=f.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||J(t,e,this.length);let r=this[t+--e],o=1;for(;e>0&&(o*=256);)r+=this[t+--e]*o;return r};f.prototype.readUint8=f.prototype.readUInt8=function(t,e){return t=t>>>0,e||J(t,1,this.length),this[t]};f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||J(t,2,this.length),this[t]|this[t+1]<<8};f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||J(t,2,this.length),this[t]<<8|this[t+1]};f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||J(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||J(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};f.prototype.readBigUInt64LE=Lt(function(t){t=t>>>0,ye(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ce(t,this.length-8);let r=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))});f.prototype.readBigUInt64BE=Lt(function(t){t=t>>>0,ye(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ce(t,this.length-8);let r=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(o)});f.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||J(t,e,this.length);let r=this[t],o=1,s=0;for(;++s<e&&(o*=256);)r+=this[t+s]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*e)),r};f.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||J(t,e,this.length);let r=e,o=1,s=this[t+--r];for(;r>0&&(o*=256);)s+=this[t+--r]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};f.prototype.readInt8=function(t,e){return t=t>>>0,e||J(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};f.prototype.readInt16LE=function(t,e){t=t>>>0,e||J(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};f.prototype.readInt16BE=function(t,e){t=t>>>0,e||J(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};f.prototype.readInt32LE=function(t,e){return t=t>>>0,e||J(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};f.prototype.readInt32BE=function(t,e){return t=t>>>0,e||J(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};f.prototype.readBigInt64LE=Lt(function(t){t=t>>>0,ye(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ce(t,this.length-8);let r=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});f.prototype.readBigInt64BE=Lt(function(t){t=t>>>0,ye(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ce(t,this.length-8);let r=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});f.prototype.readFloatLE=function(t,e){return t=t>>>0,e||J(t,4,this.length),le.read(this,t,!0,23,4)};f.prototype.readFloatBE=function(t,e){return t=t>>>0,e||J(t,4,this.length),le.read(this,t,!1,23,4)};f.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||J(t,8,this.length),le.read(this,t,!0,52,8)};f.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||J(t,8,this.length),le.read(this,t,!1,52,8)};function ot(i,t,e,n,r,o){if(!f.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<o)throw new RangeError('"value" argument is out of bounds');if(e+n>i.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e=e>>>0,n=n>>>0,!r){let a=Math.pow(2,8*n)-1;ot(this,t,e,n,a,0)}let o=1,s=0;for(this[e]=t&255;++s<n&&(o*=256);)this[e+s]=t/o&255;return e+n};f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e=e>>>0,n=n>>>0,!r){let a=Math.pow(2,8*n)-1;ot(this,t,e,n,a,0)}let o=n-1,s=1;for(this[e+o]=t&255;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+n};f.prototype.writeUint8=f.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,1,255,0),this[e]=t&255,e+1};f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function ki(i,t,e,n,r){$i(t,n,r,i,e,7);let o=Number(t&BigInt(4294967295));i[e++]=o,o=o>>8,i[e++]=o,o=o>>8,i[e++]=o,o=o>>8,i[e++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return i[e++]=s,s=s>>8,i[e++]=s,s=s>>8,i[e++]=s,s=s>>8,i[e++]=s,e}function Wi(i,t,e,n,r){$i(t,n,r,i,e,7);let o=Number(t&BigInt(4294967295));i[e+7]=o,o=o>>8,i[e+6]=o,o=o>>8,i[e+5]=o,o=o>>8,i[e+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return i[e+3]=s,s=s>>8,i[e+2]=s,s=s>>8,i[e+1]=s,s=s>>8,i[e]=s,e+8}f.prototype.writeBigUInt64LE=Lt(function(t,e=0){return ki(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeBigUInt64BE=Lt(function(t,e=0){return Wi(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e=e>>>0,!r){let h=Math.pow(2,8*n-1);ot(this,t,e,n,h-1,-h)}let o=0,s=1,a=0;for(this[e]=t&255;++o<n&&(s*=256);)t<0&&a===0&&this[e+o-1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n};f.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e=e>>>0,!r){let h=Math.pow(2,8*n-1);ot(this,t,e,n,h-1,-h)}let o=n-1,s=1,a=0;for(this[e+o]=t&255;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n};f.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};f.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};f.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};f.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};f.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||ot(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};f.prototype.writeBigInt64LE=Lt(function(t,e=0){return ki(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});f.prototype.writeBigInt64BE=Lt(function(t,e=0){return Wi(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Yi(i,t,e,n,r,o){if(e+n>i.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Xi(i,t,e,n,r){return t=+t,e=e>>>0,r||Yi(i,t,e,4,34028234663852886e22,-34028234663852886e22),le.write(i,t,e,n,23,4),e+4}f.prototype.writeFloatLE=function(t,e,n){return Xi(this,t,e,!0,n)};f.prototype.writeFloatBE=function(t,e,n){return Xi(this,t,e,!1,n)};function Vi(i,t,e,n,r){return t=+t,e=e>>>0,r||Yi(i,t,e,8,17976931348623157e292,-17976931348623157e292),le.write(i,t,e,n,52,8),e+8}f.prototype.writeDoubleLE=function(t,e,n){return Vi(this,t,e,!0,n)};f.prototype.writeDoubleBE=function(t,e,n){return Vi(this,t,e,!1,n)};f.prototype.copy=function(t,e,n,r){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&r!==0&&(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);let o=r-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),o};f.prototype.fill=function(t,e,n,r){if(typeof t=="string"){if(typeof e=="string"?(r=e,e=0,n=this.length):typeof n=="string"&&(r=n,n=this.length),r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!f.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(t.length===1){let s=t.charCodeAt(0);(r==="utf8"&&s<128||r==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let o;if(typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{let s=f.isBuffer(t)?t:f.from(t,r),a=s.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var fe={};function qn(i,t,e){fe[i]=class extends e{constructor(){super();Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(r){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:r,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}qn("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);qn("ERR_INVALID_ARG_TYPE",function(i,t){return`The "${i}" argument must be of type number. Received type ${typeof t}`},TypeError);qn("ERR_OUT_OF_RANGE",function(i,t,e){let n=`The value of "${i}" is out of range.`,r=e;return Number.isInteger(e)&&Math.abs(e)>2**32?r=Zi(String(e)):typeof e=="bigint"&&(r=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(r=Zi(r)),r+="n"),n+=` It must be ${t}. Received ${r}`,n},RangeError);function Zi(i){let t="",e=i.length,n=i[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${i.slice(e-3,e)}${t}`;return`${i.slice(0,e)}${t}`}function Uo(i,t,e){ye(t,"offset"),(i[t]===void 0||i[t+e]===void 0)&&Ce(t,i.length-(e+1))}function $i(i,t,e,n,r,o){if(i>e||i<t){let s=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${t}${s} and <= ${e}${s}`,new fe.ERR_OUT_OF_RANGE("value",a,i)}Uo(n,r,o)}function ye(i,t){if(typeof i!="number")throw new fe.ERR_INVALID_ARG_TYPE(t,"number",i)}function Ce(i,t,e){throw Math.floor(i)!==i?(ye(i,e),new fe.ERR_OUT_OF_RANGE(e||"offset","an integer",i)):t<0?new fe.ERR_BUFFER_OUT_OF_BOUNDS:new fe.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,i)}var Do=/[^+/0-9A-Za-z-_]/g;function Lo(i){if(i=i.split("=")[0],i=i.trim().replace(Do,""),i.length<2)return"";for(;i.length%4!=0;)i=i+"=";return i}function Gn(i,t){t=t||Infinity;let e,n=i.length,r=null,o=[];for(let s=0;s<n;++s){if(e=i.charCodeAt(s),e>55295&&e<57344){if(!r){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}r=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),r=e;continue}e=(r-55296<<10|e-56320)+65536}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function jo(i){let t=[];for(let e=0;e<i.length;++e)t.push(i.charCodeAt(e)&255);return t}function Ho(i,t){let e,n,r,o=[];for(let s=0;s<i.length&&!((t-=2)<0);++s)e=i.charCodeAt(s),n=e>>8,r=e%256,o.push(r),o.push(n);return o}function Ji(i){return Un.toByteArray(Lo(i))}function je(i,t,e,n){let r;for(r=0;r<n&&!(r+e>=t.length||r>=i.length);++r)t[r+e]=i[r];return r}function Rt(i,t){return i instanceof t||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===t.name}function kn(i){return i!==i}var qo=function(){let i="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let r=0;r<16;++r)t[n+r]=i[e]+i[r]}return t}();function Lt(i){return typeof BigInt=="undefined"?Go:i}function Go(){throw new Error("BigInt not supported")}});var m=co(()=>{globalThis.global=globalThis;globalThis.Buffer=Ki().Buffer;globalThis.process={browser:!0,env:{},nextTick(i,...t){queueMicrotask(()=>i(...t))}}});var wt=H(K=>{m();"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.RAD2DEG=K.DEG2RAD=K.Epsilon=K.ToLinearSpace=K.ToGammaSpace=K.Space=K.Orientation=void 0;var us;(function(i){i[i.CW=0]="CW",i[i.CCW=1]="CCW"})(us=K.Orientation||(K.Orientation={}));var ds;(function(i){i[i.LOCAL=0]="LOCAL",i[i.WORLD=1]="WORLD",i[i.BONE=2]="BONE"})(ds=K.Space||(K.Space={}));K.ToGammaSpace=1/2.2;K.ToLinearSpace=2.2;K.Epsilon=1e-6;K.DEG2RAD=Math.PI/180;K.RAD2DEG=360/(Math.PI*2)});var hr=H(Ke=>{m();"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.buildArray=void 0;function ls(i,t){let e=[];for(let n=0;n<i;++n)e.push(t());return e}Ke.buildArray=ls});var Nt=H(Qe=>{m();"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.Scalar=void 0;var rt=class{static WithinEpsilon(t,e,n=1401298e-51){let r=t-e;return-n<=r&&r<=n}static ToHex(t){let e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()}static Sign(t){let e=+t;return e===0||isNaN(e)?e:e>0?1:-1}static Clamp(t,e=0,n=1){return Math.min(n,Math.max(e,t))}static Log2(t){return Math.log(t)*Math.LOG2E}static Repeat(t,e){return t-Math.floor(t/e)*e}static Normalize(t,e,n){return(t-e)/(n-e)}static Denormalize(t,e,n){return t*(n-e)+e}static DeltaAngle(t,e){let n=rt.Repeat(e-t,360);return n>180&&(n-=360),n}static PingPong(t,e){let n=rt.Repeat(t,e*2);return e-Math.abs(n-e)}static SmoothStep(t,e,n){let r=rt.Clamp(n);return r=-2*r*r*r+3*r*r,e*r+t*(1-r)}static MoveTowards(t,e,n){let r=0;return Math.abs(e-t)<=n?r=e:r=t+rt.Sign(e-t)*n,r}static MoveTowardsAngle(t,e,n){let r=rt.DeltaAngle(t,e),o=0;return-n<r&&r<n?o=e:o=rt.MoveTowards(t,t+r,n),o}static Lerp(t,e,n){return t+(e-t)*n}static LerpAngle(t,e,n){let r=rt.Repeat(e-t,360);return r>180&&(r-=360),t+r*rt.Clamp(n)}static InverseLerp(t,e,n){let r=0;return t!==e?r=rt.Clamp((n-t)/(e-t)):r=0,r}static Hermite(t,e,n,r,o){let s=o*o,a=o*s,h=2*a-3*s+1,p=-2*a+3*s,u=a-2*s+o,d=a-s;return t*h+n*p+e*u+r*d}static RandomRange(t,e){return t===e?t:Math.random()*(e-t)+t}static RangeToPercent(t,e,n){return(t-e)/(n-e)}static PercentToRange(t,e,n){return(n-e)*t+e}static NormalizeRadians(t){return t-rt.TwoPi*Math.floor((t+Math.PI)/rt.TwoPi)}};Qe.Scalar=rt;rt.TwoPi=Math.PI*2});var ei=H(en=>{m();"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.Vector4=void 0;var fs=wt(),tn=Nt(),ys=_t(),F=class{constructor(t,e,n,r){this.x=t,this.y=e,this.z=n,this.w=r}static Add(t,e){return new F(t.x,t.y,t.z,t.w).addInPlace(e)}static FromArray(t,e=0){return new F(t[e],t[e+1],t[e+2],t[e+3])}static FromArrayToRef(t,e,n){n.x=t[e],n.y=t[e+1],n.z=t[e+2],n.w=t[e+3]}static FromFloatArrayToRef(t,e,n){F.FromArrayToRef(t,e,n)}static FromFloatsToRef(t,e,n,r,o){o.x=t,o.y=e,o.z=n,o.w=r}static Zero(){return new F(0,0,0,0)}static One(){return new F(1,1,1,1)}static Normalize(t){let e=F.Zero();return F.NormalizeToRef(t,e),e}static NormalizeToRef(t,e){e.copyFrom(t),e.normalize()}static Minimize(t,e){let n=new F(t.x,t.y,t.z,t.w);return n.minimizeInPlace(e),n}static Maximize(t,e){let n=new F(t.x,t.y,t.z,t.w);return n.maximizeInPlace(e),n}static Distance(t,e){return Math.sqrt(F.DistanceSquared(t,e))}static DistanceSquared(t,e){let n=t.x-e.x,r=t.y-e.y,o=t.z-e.z,s=t.w-e.w;return n*n+r*r+o*o+s*s}static Center(t,e){let n=F.Add(t,e);return n.scaleInPlace(.5),n}static TransformNormal(t,e){let n=F.Zero();return F.TransformNormalToRef(t,e,n),n}static TransformNormalToRef(t,e,n){let r=e.m,o=t.x*r[0]+t.y*r[4]+t.z*r[8],s=t.x*r[1]+t.y*r[5]+t.z*r[9],a=t.x*r[2]+t.y*r[6]+t.z*r[10];n.x=o,n.y=s,n.z=a,n.w=t.w}static TransformNormalFromFloatsToRef(t,e,n,r,o,s){let a=o.m;s.x=t*a[0]+e*a[4]+n*a[8],s.y=t*a[1]+e*a[5]+n*a[9],s.z=t*a[2]+e*a[6]+n*a[10],s.w=r}toString(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"}getClassName(){return"Vector4"}getHashCode(){let t=this.x||0;return t=t*397^(this.y||0),t=t*397^(this.z||0),t=t*397^(this.w||0),t}asArray(){let t=new Array;return this.toArray(t,0),t}toArray(t,e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,this}addInPlace(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}add(t){return new F(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)}addToRef(t,e){return e.x=this.x+t.x,e.y=this.y+t.y,e.z=this.z+t.z,e.w=this.w+t.w,this}subtractInPlace(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subtract(t){return new F(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)}subtractToRef(t,e){return e.x=this.x-t.x,e.y=this.y-t.y,e.z=this.z-t.z,e.w=this.w-t.w,this}subtractFromFloats(t,e,n,r){return new F(this.x-t,this.y-e,this.z-n,this.w-r)}subtractFromFloatsToRef(t,e,n,r,o){return o.x=this.x-t,o.y=this.y-e,o.z=this.z-n,o.w=this.w-r,this}negate(){return new F(-this.x,-this.y,-this.z,-this.w)}scaleInPlace(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}scale(t){return new F(this.x*t,this.y*t,this.z*t,this.w*t)}scaleToRef(t,e){return e.x=this.x*t,e.y=this.y*t,e.z=this.z*t,e.w=this.w*t,this}scaleAndAddToRef(t,e){return e.x+=this.x*t,e.y+=this.y*t,e.z+=this.z*t,e.w+=this.w*t,this}equals(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w}equalsWithEpsilon(t,e=fs.Epsilon){return t&&tn.Scalar.WithinEpsilon(this.x,t.x,e)&&tn.Scalar.WithinEpsilon(this.y,t.y,e)&&tn.Scalar.WithinEpsilon(this.z,t.z,e)&&tn.Scalar.WithinEpsilon(this.w,t.w,e)}equalsToFloats(t,e,n,r){return this.x===t&&this.y===e&&this.z===n&&this.w===r}multiplyInPlace(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiply(t){return new F(this.x*t.x,this.y*t.y,this.z*t.z,this.w*t.w)}multiplyToRef(t,e){return e.x=this.x*t.x,e.y=this.y*t.y,e.z=this.z*t.z,e.w=this.w*t.w,this}multiplyByFloats(t,e,n,r){return new F(this.x*t,this.y*e,this.z*n,this.w*r)}divide(t){return new F(this.x/t.x,this.y/t.y,this.z/t.z,this.w/t.w)}divideToRef(t,e){return e.x=this.x/t.x,e.y=this.y/t.y,e.z=this.z/t.z,e.w=this.w/t.w,this}divideInPlace(t){return this.divideToRef(t,this)}minimizeInPlace(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),t.z<this.z&&(this.z=t.z),t.w<this.w&&(this.w=t.w),this}maximizeInPlace(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),t.w>this.w&&(this.w=t.w),this}floor(){return new F(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))}fract(){return new F(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}normalize(){let t=this.length();return t===0?this:this.scaleInPlace(1/t)}toVector3(){return new ys.Vector3(this.x,this.y,this.z)}clone(){return new F(this.x,this.y,this.z,this.w)}copyFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}copyFromFloats(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}set(t,e,n,r){return this.copyFromFloats(t,e,n,r)}setAll(t){return this.x=this.y=this.z=this.w=t,this}};en.Vector4=F});var Pe=H(nn=>{m();"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.Matrix=void 0;var ht=_t(),ni=Fe(),D=xe(),ms=ei(),w=class{constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this._m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this._updateIdentityStatus(!1)}get m(){return this._m}static get IdentityReadOnly(){return w._identityReadOnly}static FromArray(t,e=0){let n=new w;return w.FromArrayToRef(t,e,n),n}static FromArrayToRef(t,e,n){for(let r=0;r<16;r++)n._m[r]=t[r+e];n._markAsUpdated()}static FromFloatArrayToRefScaled(t,e,n,r){for(let o=0;o<16;o++)r._m[o]=t[o+e]*n;r._markAsUpdated()}static FromValuesToRef(t,e,n,r,o,s,a,h,p,u,d,b,x,E,S,I,L){let R=L._m;R[0]=t,R[1]=e,R[2]=n,R[3]=r,R[4]=o,R[5]=s,R[6]=a,R[7]=h,R[8]=p,R[9]=u,R[10]=d,R[11]=b,R[12]=x,R[13]=E,R[14]=S,R[15]=I,L._markAsUpdated()}static FromValues(t,e,n,r,o,s,a,h,p,u,d,b,x,E,S,I){let L=new w,R=L._m;return R[0]=t,R[1]=e,R[2]=n,R[3]=r,R[4]=o,R[5]=s,R[6]=a,R[7]=h,R[8]=p,R[9]=u,R[10]=d,R[11]=b,R[12]=x,R[13]=E,R[14]=S,R[15]=I,L._markAsUpdated(),L}static Compose(t,e,n){let r=new w;return w.ComposeToRef(t,e,n,r),r}static ComposeToRef(t,e,n,r){w.ScalingToRef(t.x,t.y,t.z,D.MathTmp.Matrix[1]),e.toRotationMatrix(D.MathTmp.Matrix[0]),D.MathTmp.Matrix[1].multiplyToRef(D.MathTmp.Matrix[0],r),r.setTranslation(n)}static Identity(){let t=w.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t}static IdentityToRef(t){w.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0)}static Zero(){let t=w.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t}static RotationX(t){let e=new w;return w.RotationXToRef(t,e),e}static Invert(t){let e=new w;return t.invertToRef(e),e}static RotationXToRef(t,e){let n=Math.sin(t),r=Math.cos(t);w.FromValuesToRef(1,0,0,0,0,r,n,0,0,-n,r,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&n===0)}static RotationY(t){let e=new w;return w.RotationYToRef(t,e),e}static RotationYToRef(t,e){let n=Math.sin(t),r=Math.cos(t);w.FromValuesToRef(r,0,-n,0,0,1,0,0,n,0,r,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&n===0)}static RotationZ(t){let e=new w;return w.RotationZToRef(t,e),e}static RotationZToRef(t,e){let n=Math.sin(t),r=Math.cos(t);w.FromValuesToRef(r,n,0,0,-n,r,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(r===1&&n===0)}static RotationAxis(t,e){let n=new w;return w.RotationAxisToRef(t,e,n),n}static RotationAxisToRef(t,e,n){let r=Math.sin(-e),o=Math.cos(-e),s=1-o;t.normalize();let a=n._m;a[0]=t.x*t.x*s+o,a[1]=t.x*t.y*s-t.z*r,a[2]=t.x*t.z*s+t.y*r,a[3]=0,a[4]=t.y*t.x*s+t.z*r,a[5]=t.y*t.y*s+o,a[6]=t.y*t.z*s-t.x*r,a[7]=0,a[8]=t.z*t.x*s-t.y*r,a[9]=t.z*t.y*s+t.x*r,a[10]=t.z*t.z*s+o,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,n._markAsUpdated()}static RotationYawPitchRoll(t,e,n){let r=new w;return w.RotationYawPitchRollToRef(t,e,n,r),r}static RotationYawPitchRollToRef(t,e,n,r){ni.Quaternion.RotationYawPitchRollToRef(t,e,n,D.MathTmp.Quaternion[0]),D.MathTmp.Quaternion[0].toRotationMatrix(r)}static Scaling(t,e,n){let r=new w;return w.ScalingToRef(t,e,n,r),r}static ScalingToRef(t,e,n,r){w.FromValuesToRef(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1,r),r._updateIdentityStatus(t===1&&e===1&&n===1)}static Translation(t,e,n){let r=new w;return w.TranslationToRef(t,e,n,r),r}static TranslationToRef(t,e,n,r){w.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,e,n,1,r),r._updateIdentityStatus(t===0&&e===0&&n===0)}static Lerp(t,e,n){let r=new w;return w.LerpToRef(t,e,n,r),r}static LerpToRef(t,e,n,r){for(let o=0;o<16;o++)r._m[o]=t._m[o]*(1-n)+e._m[o]*n;r._markAsUpdated()}static DecomposeLerp(t,e,n){let r=new w;return w.DecomposeLerpToRef(t,e,n,r),r}static DecomposeLerpToRef(t,e,n,r){let o=D.MathTmp.Vector3[0],s=D.MathTmp.Quaternion[0],a=D.MathTmp.Vector3[1];t.decompose(o,s,a);let h=D.MathTmp.Vector3[2],p=D.MathTmp.Quaternion[1],u=D.MathTmp.Vector3[3];e.decompose(h,p,u);let d=D.MathTmp.Vector3[4];ht.Vector3.LerpToRef(o,h,n,d);let b=D.MathTmp.Quaternion[2];ni.Quaternion.SlerpToRef(s,p,n,b);let x=D.MathTmp.Vector3[5];ht.Vector3.LerpToRef(a,u,n,x),w.ComposeToRef(d,b,x,r)}static LookAtLH(t,e,n){let r=new w;return w.LookAtLHToRef(t,e,n,r),r}static LookAtLHToRef(t,e,n,r){let o=D.MathTmp.Vector3[0],s=D.MathTmp.Vector3[1],a=D.MathTmp.Vector3[2];e.subtractToRef(t,a),a.normalize(),ht.Vector3.CrossToRef(n,a,o);let h=o.lengthSquared();h===0?o.x=1:o.normalizeFromLength(Math.sqrt(h)),ht.Vector3.CrossToRef(a,o,s),s.normalize();let p=-ht.Vector3.Dot(o,t),u=-ht.Vector3.Dot(s,t),d=-ht.Vector3.Dot(a,t);w.FromValuesToRef(o.x,s.x,a.x,0,o.y,s.y,a.y,0,o.z,s.z,a.z,0,p,u,d,1,r)}static LookAtRH(t,e,n){let r=new w;return w.LookAtRHToRef(t,e,n,r),r}static LookAtRHToRef(t,e,n,r){let o=D.MathTmp.Vector3[0],s=D.MathTmp.Vector3[1],a=D.MathTmp.Vector3[2];t.subtractToRef(e,a),a.normalize(),ht.Vector3.CrossToRef(n,a,o);let h=o.lengthSquared();h===0?o.x=1:o.normalizeFromLength(Math.sqrt(h)),ht.Vector3.CrossToRef(a,o,s),s.normalize();let p=-ht.Vector3.Dot(o,t),u=-ht.Vector3.Dot(s,t),d=-ht.Vector3.Dot(a,t);w.FromValuesToRef(o.x,s.x,a.x,0,o.y,s.y,a.y,0,o.z,s.z,a.z,0,p,u,d,1,r)}static OrthoLH(t,e,n,r){let o=new w;return w.OrthoLHToRef(t,e,n,r,o),o}static OrthoLHToRef(t,e,n,r,o){let s=n,a=r,h=2/t,p=2/e,u=2/(a-s),d=-(a+s)/(a-s);w.FromValuesToRef(h,0,0,0,0,p,0,0,0,0,u,0,0,0,d,1,o),o._updateIdentityStatus(h===1&&p===1&&u===1&&d===0)}static OrthoOffCenterLH(t,e,n,r,o,s){let a=new w;return w.OrthoOffCenterLHToRef(t,e,n,r,o,s,a),a}static OrthoOffCenterLHToRef(t,e,n,r,o,s,a){let h=o,p=s,u=2/(e-t),d=2/(r-n),b=2/(p-h),x=-(p+h)/(p-h),E=(t+e)/(t-e),S=(r+n)/(n-r);w.FromValuesToRef(u,0,0,0,0,d,0,0,0,0,b,0,E,S,x,1,a),a._markAsUpdated()}static OrthoOffCenterRH(t,e,n,r,o,s){let a=new w;return w.OrthoOffCenterRHToRef(t,e,n,r,o,s,a),a}static OrthoOffCenterRHToRef(t,e,n,r,o,s,a){w.OrthoOffCenterLHToRef(t,e,n,r,o,s,a),a._m[10]*=-1}static PerspectiveLH(t,e,n,r){let o=new w,s=n,a=r,h=2*s/t,p=2*s/e,u=(a+s)/(a-s),d=-2*a*s/(a-s);return w.FromValuesToRef(h,0,0,0,0,p,0,0,0,0,u,1,0,0,d,0,o),o._updateIdentityStatus(!1),o}static PerspectiveFovLH(t,e,n,r){let o=new w;return w.PerspectiveFovLHToRef(t,e,n,r,o),o}static PerspectiveFovLHToRef(t,e,n,r,o,s=!0){let a=n,h=r,p=1/Math.tan(t*.5),u=s?p/e:p,d=s?p:p*e,b=(h+a)/(h-a),x=-2*h*a/(h-a);w.FromValuesToRef(u,0,0,0,0,d,0,0,0,0,b,1,0,0,x,0,o),o._updateIdentityStatus(!1)}static PerspectiveFovRH(t,e,n,r){let o=new w;return w.PerspectiveFovRHToRef(t,e,n,r,o),o}static PerspectiveFovRHToRef(t,e,n,r,o,s=!0){let a=n,h=r,p=1/Math.tan(t*.5),u=s?p/e:p,d=s?p:p*e,b=-(h+a)/(h-a),x=-2*h*a/(h-a);w.FromValuesToRef(u,0,0,0,0,d,0,0,0,0,b,-1,0,0,x,0,o),o._updateIdentityStatus(!1)}static PerspectiveFovWebVRToRef(t,e,n,r,o=!1){let s=o?-1:1,a=Math.tan(t.upDegrees*Math.PI/180),h=Math.tan(t.downDegrees*Math.PI/180),p=Math.tan(t.leftDegrees*Math.PI/180),u=Math.tan(t.rightDegrees*Math.PI/180),d=2/(p+u),b=2/(a+h),x=r._m;x[0]=d,x[1]=x[2]=x[3]=x[4]=0,x[5]=b,x[6]=x[7]=0,x[8]=(p-u)*d*.5,x[9]=-((a-h)*b*.5),x[10]=-n/(e-n),x[11]=1*s,x[12]=x[13]=x[15]=0,x[14]=-(2*n*e)/(n-e),r._markAsUpdated()}static GetAsMatrix2x2(t){return[t._m[0],t._m[1],t._m[4],t._m[5]]}static GetAsMatrix3x3(t){return[t._m[0],t._m[1],t._m[2],t._m[4],t._m[5],t._m[6],t._m[8],t._m[9],t._m[10]]}static Transpose(t){let e=new w;return w.TransposeToRef(t,e),e}static TransposeToRef(t,e){let n=e._m,r=t._m;n[0]=r[0],n[1]=r[4],n[2]=r[8],n[3]=r[12],n[4]=r[1],n[5]=r[5],n[6]=r[9],n[7]=r[13],n[8]=r[2],n[9]=r[6],n[10]=r[10],n[11]=r[14],n[12]=r[3],n[13]=r[7],n[14]=r[11],n[15]=r[15],e._updateIdentityStatus(t._isIdentity,t._isIdentityDirty)}static Reflection(t){let e=new w;return w.ReflectionToRef(t,e),e}static ReflectionToRef(t,e){t.normalize();let n=t.normal.x,r=t.normal.y,o=t.normal.z,s=-2*n,a=-2*r,h=-2*o;w.FromValuesToRef(s*n+1,a*n,h*n,0,s*r,a*r+1,h*r,0,s*o,a*o,h*o+1,0,s*t.d,a*t.d,h*t.d,1,e)}static FromXYZAxesToRef(t,e,n,r){w.FromValuesToRef(t.x,t.y,t.z,0,e.x,e.y,e.z,0,n.x,n.y,n.z,0,0,0,0,1,r)}static FromQuaternionToRef(t,e){let n=t.x*t.x,r=t.y*t.y,o=t.z*t.z,s=t.x*t.y,a=t.z*t.w,h=t.z*t.x,p=t.y*t.w,u=t.y*t.z,d=t.x*t.w;e._m[0]=1-2*(r+o),e._m[1]=2*(s+a),e._m[2]=2*(h-p),e._m[3]=0,e._m[4]=2*(s-a),e._m[5]=1-2*(o+n),e._m[6]=2*(u+d),e._m[7]=0,e._m[8]=2*(h+p),e._m[9]=2*(u-d),e._m[10]=1-2*(r+n),e._m[11]=0,e._m[12]=0,e._m[13]=0,e._m[14]=0,e._m[15]=1,e._markAsUpdated()}_markAsUpdated(){this.updateFlag=w._updateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;let t=this._m;this._isIdentity=t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[7]===0&&t[8]===0&&t[9]===0&&t[10]===1&&t[11]===0&&t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,this._m[0]!==1||this._m[5]!==1||this._m[15]!==1?this._isIdentity3x2=!1:this._m[1]!==0||this._m[2]!==0||this._m[3]!==0||this._m[4]!==0||this._m[6]!==0||this._m[7]!==0||this._m[8]!==0||this._m[9]!==0||this._m[10]!==0||this._m[11]!==0||this._m[12]!==0||this._m[13]!==0||this._m[14]!==0?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(this._isIdentity===!0)return 1;let t=this._m,e=t[0],n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],h=t[6],p=t[7],u=t[8],d=t[9],b=t[10],x=t[11],E=t[12],S=t[13],I=t[14],L=t[15],R=b*L-I*x,j=d*L-S*x,X=d*I-S*b,lt=u*L-E*x,ft=u*I-b*E,yt=u*S-E*d,xt=+(a*R-h*j+p*X),Mt=-(s*R-h*lt+p*ft),St=+(s*j-a*lt+p*yt),Pt=-(s*X-a*ft+h*yt);return e*xt+n*Mt+r*St+o*Pt}toArray(){return this._m}asArray(){return this._m}invert(){return this.invertToRef(this),this}reset(){return w.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this}add(t){let e=new w;return this.addToRef(t,e),e}addToRef(t,e){for(let n=0;n<16;n++)e._m[n]=this._m[n]+t._m[n];return e._markAsUpdated(),this}addToSelf(t){for(let e=0;e<16;e++)this._m[e]+=t._m[e];return this._markAsUpdated(),this}invertToRef(t){if(this._isIdentity===!0)return w.IdentityToRef(t),this;let e=this._m,n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],h=e[5],p=e[6],u=e[7],d=e[8],b=e[9],x=e[10],E=e[11],S=e[12],I=e[13],L=e[14],R=e[15],j=x*R-L*E,X=b*R-I*E,lt=b*L-I*x,ft=d*R-S*E,yt=d*L-x*S,xt=d*I-S*b,Mt=+(h*j-p*X+u*lt),St=-(a*j-p*ft+u*yt),Pt=+(a*X-h*ft+u*xt),Xt=-(a*lt-h*yt+p*xt),Vt=n*Mt+r*St+o*Pt+s*Xt;if(Vt===0)return t.copyFrom(this),this;let W=1/Vt,Zt=p*R-L*u,$t=h*R-I*u,Jt=h*L-I*p,Kt=a*R-S*u,Qt=a*L-S*p,te=a*I-S*h,ee=p*E-x*u,Ii=h*E-b*u,Ci=h*x-b*p,zi=a*E-d*u,Mi=a*x-d*p,Si=a*b-d*h,kr=-(r*j-o*X+s*lt),Wr=+(n*j-o*ft+s*yt),Yr=-(n*X-r*ft+s*xt),Xr=+(n*lt-r*yt+o*xt),Vr=+(r*Zt-o*$t+s*Jt),Zr=-(n*Zt-o*Kt+s*Qt),$r=+(n*$t-r*Kt+s*te),Jr=-(n*Jt-r*Qt+o*te),Kr=-(r*ee-o*Ii+s*Ci),Qr=+(n*ee-o*zi+s*Mi),to=-(n*Ii-r*zi+s*Si),eo=+(n*Ci-r*Mi+o*Si);return w.FromValuesToRef(Mt*W,kr*W,Vr*W,Kr*W,St*W,Wr*W,Zr*W,Qr*W,Pt*W,Yr*W,$r*W,to*W,Xt*W,Xr*W,Jr*W,eo*W,t),this}addAtIndex(t,e){return this._m[t]+=e,this._markAsUpdated(),this}multiplyAtIndex(t,e){return this._m[t]*=e,this._markAsUpdated(),this}setTranslationFromFloats(t,e,n){return this._m[12]=t,this._m[13]=e,this._m[14]=n,this._markAsUpdated(),this}setTranslation(t){return this.setTranslationFromFloats(t.x,t.y,t.z)}getTranslation(){return new ht.Vector3(this._m[12],this._m[13],this._m[14])}getTranslationToRef(t){return t.x=this._m[12],t.y=this._m[13],t.z=this._m[14],this}removeRotationAndScaling(){let t=this.m;return w.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(t[12]===0&&t[13]===0&&t[14]===0&&t[15]===1),this}multiply(t){let e=new w;return this.multiplyToRef(t,e),e}copyFrom(t){t.copyToArray(this._m);let e=t;return this._updateIdentityStatus(e._isIdentity,e._isIdentityDirty,e._isIdentity3x2,e._isIdentity3x2Dirty),this}copyToArray(t,e=0){for(let n=0;n<16;n++)t[e+n]=this._m[n];return this}multiplyToRef(t,e){return this._isIdentity?(e.copyFrom(t),this):t._isIdentity?(e.copyFrom(this),this):(this.multiplyToArray(t,e._m,0),e._markAsUpdated(),this)}multiplyToArray(t,e,n){let r=this._m,o=t.m,s=r[0],a=r[1],h=r[2],p=r[3],u=r[4],d=r[5],b=r[6],x=r[7],E=r[8],S=r[9],I=r[10],L=r[11],R=r[12],j=r[13],X=r[14],lt=r[15],ft=o[0],yt=o[1],xt=o[2],Mt=o[3],St=o[4],Pt=o[5],Xt=o[6],Vt=o[7],W=o[8],Zt=o[9],$t=o[10],Jt=o[11],Kt=o[12],Qt=o[13],te=o[14],ee=o[15];return e[n]=s*ft+a*St+h*W+p*Kt,e[n+1]=s*yt+a*Pt+h*Zt+p*Qt,e[n+2]=s*xt+a*Xt+h*$t+p*te,e[n+3]=s*Mt+a*Vt+h*Jt+p*ee,e[n+4]=u*ft+d*St+b*W+x*Kt,e[n+5]=u*yt+d*Pt+b*Zt+x*Qt,e[n+6]=u*xt+d*Xt+b*$t+x*te,e[n+7]=u*Mt+d*Vt+b*Jt+x*ee,e[n+8]=E*ft+S*St+I*W+L*Kt,e[n+9]=E*yt+S*Pt+I*Zt+L*Qt,e[n+10]=E*xt+S*Xt+I*$t+L*te,e[n+11]=E*Mt+S*Vt+I*Jt+L*ee,e[n+12]=R*ft+j*St+X*W+lt*Kt,e[n+13]=R*yt+j*Pt+X*Zt+lt*Qt,e[n+14]=R*xt+j*Xt+X*$t+lt*te,e[n+15]=R*Mt+j*Vt+X*Jt+lt*ee,this}equals(t){let e=t;if(!e)return!1;if((this._isIdentity||e._isIdentity)&&!this._isIdentityDirty&&!e._isIdentityDirty)return this._isIdentity&&e._isIdentity;let n=this.m,r=e.m;return n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]&&n[4]===r[4]&&n[5]===r[5]&&n[6]===r[6]&&n[7]===r[7]&&n[8]===r[8]&&n[9]===r[9]&&n[10]===r[10]&&n[11]===r[11]&&n[12]===r[12]&&n[13]===r[13]&&n[14]===r[14]&&n[15]===r[15]}clone(){let t=new w;return t.copyFrom(this),t}getClassName(){return"Matrix"}getHashCode(){let t=this._m[0]||0;for(let e=1;e<16;e++)t=t*397^(this._m[e]||0);return t}decompose(t,e,n){if(this._isIdentity)return n&&n.setAll(0),t&&t.setAll(1),e&&e.copyFromFloats(0,0,0,1),!0;let r=this._m;n&&n.copyFromFloats(r[12],r[13],r[14]);let o=t||D.MathTmp.Vector3[0];if(o.x=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),o.y=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),o.z=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),this.determinant()<=0&&(o.y*=-1),o.x===0||o.y===0||o.z===0)return e&&e.copyFromFloats(0,0,0,1),!1;if(e){let s=1/o.x,a=1/o.y,h=1/o.z;w.FromValuesToRef(r[0]*s,r[1]*s,r[2]*s,0,r[4]*a,r[5]*a,r[6]*a,0,r[8]*h,r[9]*h,r[10]*h,0,0,0,0,1,D.MathTmp.Matrix[0]),ni.Quaternion.FromRotationMatrixToRef(D.MathTmp.Matrix[0],e)}return!0}getRow(t){if(t<0||t>3)return null;let e=t*4;return new ms.Vector4(this._m[e+0],this._m[e+1],this._m[e+2],this._m[e+3])}setRow(t,e){return this.setRowFromFloats(t,e.x,e.y,e.z,e.w)}transpose(){return w.Transpose(this)}transposeToRef(t){return w.TransposeToRef(this,t),this}setRowFromFloats(t,e,n,r,o){if(t<0||t>3)return this;let s=t*4;return this._m[s+0]=e,this._m[s+1]=n,this._m[s+2]=r,this._m[s+3]=o,this._markAsUpdated(),this}scale(t){let e=new w;return this.scaleToRef(t,e),e}scaleToRef(t,e){for(let n=0;n<16;n++)e._m[n]=this._m[n]*t;return e._markAsUpdated(),this}scaleAndAddToRef(t,e){for(let n=0;n<16;n++)e._m[n]+=this._m[n]*t;return e._markAsUpdated(),this}toNormalMatrix(t){let e=D.MathTmp.Matrix[0];this.invertToRef(e),e.transposeToRef(t);let n=t._m;w.FromValuesToRef(n[0],n[1],n[2],0,n[4],n[5],n[6],0,n[8],n[9],n[10],0,0,0,0,1,t)}getRotationMatrix(){let t=new w;return this.getRotationMatrixToRef(t),t}getRotationMatrixToRef(t){let e=D.MathTmp.Vector3[0];if(!this.decompose(e))return w.IdentityToRef(t),this;let n=this._m,r=1/e.x,o=1/e.y,s=1/e.z;return w.FromValuesToRef(n[0]*r,n[1]*r,n[2]*r,0,n[4]*o,n[5]*o,n[6]*o,0,n[8]*s,n[9]*s,n[10]*s,0,0,0,0,1,t),this}toggleModelMatrixHandInPlace(){let t=this._m;t[2]*=-1,t[6]*=-1,t[8]*=-1,t[9]*=-1,t[14]*=-1,this._markAsUpdated()}toggleProjectionMatrixHandInPlace(){let t=this._m;t[8]*=-1,t[9]*=-1,t[10]*=-1,t[11]*=-1,this._markAsUpdated()}_updateIdentityStatus(t,e=!1,n=!1,r=!0){this.updateFlag=w._updateFlagSeed++,this._isIdentity=t,this._isIdentity3x2=t||n,this._isIdentityDirty=this._isIdentity?!1:e,this._isIdentity3x2Dirty=this._isIdentity3x2?!1:r}};nn.Matrix=w;w._updateFlagSeed=0;w._identityReadOnly=w.Identity()});var Fe=H(on=>{m();"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.Quaternion=void 0;var pr=Pe(),se=_t(),rn=xe(),et=wt(),ii=Nt(),O=class{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}static FromRotationMatrix(t){let e=new O;return O.FromRotationMatrixToRef(t,e),e}static FromRotationMatrixToRef(t,e){let n=t.m,r=n[0],o=n[4],s=n[8],a=n[1],h=n[5],p=n[9],u=n[2],d=n[6],b=n[10],x=r+h+b,E;x>0?(E=.5/Math.sqrt(x+1),e.w=.25/E,e.x=(d-p)*E,e.y=(s-u)*E,e.z=(a-o)*E):r>h&&r>b?(E=2*Math.sqrt(1+r-h-b),e.w=(d-p)/E,e.x=.25*E,e.y=(o+a)/E,e.z=(s+u)/E):h>b?(E=2*Math.sqrt(1+h-r-b),e.w=(s-u)/E,e.x=(o+a)/E,e.y=.25*E,e.z=(p+d)/E):(E=2*Math.sqrt(1+b-r-h),e.w=(a-o)/E,e.x=(s+u)/E,e.y=(p+d)/E,e.z=.25*E)}static Dot(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w}static AreClose(t,e){return O.Dot(t,e)>=0}static Zero(){return new O(0,0,0,0)}static Inverse(t){return new O(-t.x,-t.y,-t.z,t.w)}static IsIdentity(t){return t&&t.x===0&&t.y===0&&t.z===0&&t.w===1}static RotationAxis(t,e){let n=e*et.DEG2RAD;return O.RotationAxisToRef(t,n,new O)}static RotationAxisToRef(t,e,n){let r=e*et.DEG2RAD,o=Math.sin(r/2);return t.normalize(),n.w=Math.cos(r/2),n.x=t.x*o,n.y=t.y*o,n.z=t.z*o,n}static FromArray(t,e=0){return new O(t[e],t[e+1],t[e+2],t[e+3])}static FromEulerAnglesRef(t,e,n,r){return O.RotationYawPitchRollToRef(e*et.DEG2RAD,t*et.DEG2RAD,n*et.DEG2RAD,r)}static RotationYawPitchRoll(t,e,n){let r=new O;return O.RotationYawPitchRollToRef(t,e,n,r),r}static RotationYawPitchRollToRef(t,e,n,r){let o=e*.5,s=t*.5,a=n*.5,h=Math.cos(o),p=Math.cos(s),u=Math.cos(a),d=Math.sin(o),b=Math.sin(s),x=Math.sin(a);r.x=p*d*u+b*h*x,r.y=b*h*u-p*d*x,r.z=p*h*x-b*d*u,r.w=p*h*u+b*d*x}static RotationAlphaBetaGamma(t,e,n){let r=new O;return O.RotationAlphaBetaGammaToRef(t,e,n,r),r}static RotationAlphaBetaGammaToRef(t,e,n,r){let o=(n+t)*.5,s=(n-t)*.5,a=e*.5;r.x=Math.cos(s)*Math.sin(a),r.y=Math.sin(s)*Math.sin(a),r.z=Math.sin(o)*Math.cos(a),r.w=Math.cos(o)*Math.cos(a)}static RotationQuaternionFromAxis(t,e,n){let r=new O(0,0,0,0);return O.RotationQuaternionFromAxisToRef(t,e,n,r),r}static RotationQuaternionFromAxisToRef(t,e,n,r){let o=rn.MathTmp.Matrix[0];pr.Matrix.FromXYZAxesToRef(t.normalize(),e.normalize(),n.normalize(),o),O.FromRotationMatrixToRef(o,r)}static Slerp(t,e,n){let r=O.Identity;return O.SlerpToRef(t,e,n,r),r}static SlerpToRef(t,e,n,r){let o,s,a=t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w,h=!1;if(a<0&&(h=!0,a=-a),a>.999999)s=1-n,o=h?-n:n;else{let p=Math.acos(a),u=1/Math.sin(p);s=Math.sin((1-n)*p)*u,o=h?-Math.sin(n*p)*u:Math.sin(n*p)*u}r.x=s*t.x+o*e.x,r.y=s*t.y+o*e.y,r.z=s*t.z+o*e.z,r.w=s*t.w+o*e.w}static Hermite(t,e,n,r,o){let s=o*o,a=o*s,h=2*a-3*s+1,p=-2*a+3*s,u=a-2*s+o,d=a-s,b=t.x*h+n.x*p+e.x*u+r.x*d,x=t.y*h+n.y*p+e.y*u+r.y*d,E=t.z*h+n.z*p+e.z*u+r.z*d,S=t.w*h+n.w*p+e.w*u+r.w*d;return new O(b,x,E,S)}static get Identity(){return new O(0,0,0,1)}static Angle(t,e){let n=O.Dot(t,e);return Math.acos(Math.min(Math.abs(n),1))*2*et.RAD2DEG}static Euler(t,e,n){return O.RotationYawPitchRoll(e*et.DEG2RAD,t*et.DEG2RAD,n*et.DEG2RAD)}static LookRotation(t,e=rn.MathTmp.staticUp){let n=se.Vector3.Normalize(t),r=se.Vector3.Normalize(se.Vector3.Cross(e,n)),o=se.Vector3.Cross(n,r),s=r.x,a=r.y,h=r.z,p=o.x,u=o.y,d=o.z,b=n.x,x=n.y,E=n.z,S=s+u+E,I=new O;if(S>0){let j=Math.sqrt(S+1);return I.w=j*.5,j=.5/j,I.x=(d-x)*j,I.y=(b-h)*j,I.z=(a-p)*j,I}if(s>=u&&s>=E){let j=Math.sqrt(1+s-u-E),X=.5/j;return I.x=.5*j,I.y=(a+p)*X,I.z=(h+b)*X,I.w=(d-x)*X,I}if(u>E){let j=Math.sqrt(1+u-s-E),X=.5/j;return I.x=(p+a)*X,I.y=.5*j,I.z=(x+d)*X,I.w=(b-h)*X,I}let L=Math.sqrt(1+E-s-u),R=.5/L;return I.x=(b+h)*R,I.y=(x+d)*R,I.z=.5*L,I.w=(a-p)*R,I}static RotateTowards(t,e,n){let r=O.Angle(t,e);if(r===0)return e;let o=Math.min(1,n/r);return O.Slerp(t,e,o)}static FromToRotation(t,e,n=rn.MathTmp.staticUp){let r=t.normalize(),o=e.normalize(),s=se.Vector3.Cross(r,o),a=Math.sqrt(r.lengthSquared()*o.lengthSquared())+se.Vector3.Dot(r,o);return s.lengthSquared()<1e-4?Math.abs(a)<1e-4?new O(n.x,n.y,n.z,0).normalized:O.Identity:new O(s.x,s.y,s.z,a).normalized}get normalized(){return this.normalize()}setFromToRotation(t,e,n=rn.MathTmp.staticUp){let r=O.FromToRotation(t,e,n);this.x=r.x,this.y=r.y,this.z=r.z,this.w=r.w}set eulerAngles(t){this.setEuler(t.x,t.y,t.z)}get eulerAngles(){let t=new se.Vector3,e=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w,n=this.x*this.w-this.y*this.z;return n>.4995*e?(t.x=Math.PI/2,t.y=2*Math.atan2(this.y,this.x),t.z=0):n<-.4995*e?(t.x=-Math.PI/2,t.y=-2*Math.atan2(this.y,this.x),t.z=0):(t.x=Math.asin(2*(this.w*this.x-this.y*this.z)),t.y=Math.atan2(2*this.w*this.y+2*this.z*this.x,1-2*(this.x*this.x+this.y*this.y)),t.z=Math.atan2(2*this.w*this.z+2*this.x*this.y,1-2*(this.z*this.z+this.x*this.x))),t.x*=et.RAD2DEG,t.y*=et.RAD2DEG,t.z*=et.RAD2DEG,t.x=ii.Scalar.Repeat(t.x,360),t.y=ii.Scalar.Repeat(t.y,360),t.z=ii.Scalar.Repeat(t.z,360),t}toString(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`}get length(){return Math.sqrt(this.lengthSquared)}get lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}getClassName(){return"Quaternion"}getHashCode(){let t=this.x||0;return t=t*397^(this.y||0),t=t*397^(this.z||0),t=t*397^(this.w||0),t}asArray(){return[this.x,this.y,this.z,this.w]}equals(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w}clone(){return new O(this.x,this.y,this.z,this.w)}copyFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}copyFromFloats(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}set(t,e,n,r){return this.copyFromFloats(t,e,n,r)}setEuler(t,e,n){return O.RotationYawPitchRollToRef(e*et.DEG2RAD,t*et.DEG2RAD,n*et.DEG2RAD,this),this}add(t){return new O(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)}addInPlace(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}subtract(t){return new O(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)}scale(t){return new O(this.x*t,this.y*t,this.z*t,this.w*t)}scaleToRef(t,e){return e.x=this.x*t,e.y=this.y*t,e.z=this.z*t,e.w=this.w*t,this}scaleInPlace(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}scaleAndAddToRef(t,e){return e.x+=this.x*t,e.y+=this.y*t,e.z+=this.z*t,e.w+=this.w*t,this}multiply(t){let e=new O(0,0,0,1);return this.multiplyToRef(t,e),e}multiplyToRef(t,e){let n=this.x*t.w+this.y*t.z-this.z*t.y+this.w*t.x,r=-this.x*t.z+this.y*t.w+this.z*t.x+this.w*t.y,o=this.x*t.y-this.y*t.x+this.z*t.w+this.w*t.z,s=-this.x*t.x-this.y*t.y-this.z*t.z+this.w*t.w;return e.copyFromFloats(n,r,o,s),this}multiplyInPlace(t){return this.multiplyToRef(t,this),this}conjugateToRef(t){return t.copyFromFloats(-this.x,-this.y,-this.z,this.w),this}conjugateInPlace(){return this.x*=-1,this.y*=-1,this.z*=-1,this}conjugate(){return new O(-this.x,-this.y,-this.z,this.w)}normalize(){let t=1/this.length;return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}angleAxis(t,e){if(e.lengthSquared()===0)return O.Identity;let n=O.Identity,r=t*et.DEG2RAD;r*=.5;let o=e.normalize();return o=e.scaleInPlace(Math.sin(r)),n.x=o.x,n.y=o.y,n.z=o.z,n.w=Math.cos(r),n.normalize()}toRotationMatrix(t){return pr.Matrix.FromQuaternionToRef(this,t),this}fromRotationMatrix(t){return O.FromRotationMatrixToRef(t,this),this}};on.Quaternion=O});var _t=H(an=>{m();"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.Vector3=void 0;var sn=xe(),gs=wt(),ur=Fe(),ri=Nt(),A=class{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}get isNonUniform(){let t=Math.abs(this.x),e=Math.abs(this.y);if(t!==e)return!0;let n=Math.abs(this.z);return t!==n||e!==n}static Add(t,e){return new A(t.x,t.y,t.z).addInPlace(e)}static GetClipFactor(t,e,n,r){let o=A.Dot(t,n)-r,s=A.Dot(e,n)-r;return o/(o-s)}static GetAngleBetweenVectors(t,e,n){let r=t.normalizeToRef(sn.MathTmp.Vector3[1]),o=e.normalizeToRef(sn.MathTmp.Vector3[2]),s=A.Dot(r,o),a=sn.MathTmp.Vector3[3];return A.CrossToRef(r,o,a),A.Dot(a,n)>0?Math.acos(s):-Math.acos(s)}static FromArray(t,e=0){return new A(t[e],t[e+1],t[e+2])}static FromFloatArray(t,e){return A.FromArray(t,e)}static FromArrayToRef(t,e,n){n.x=t[e],n.y=t[e+1],n.z=t[e+2]}static FromFloatArrayToRef(t,e,n){return A.FromArrayToRef(t,e,n)}static FromFloatsToRef(t,e,n,r){r.copyFromFloats(t,e,n)}static Zero(){return new A(0,0,0)}static One(){return new A(1,1,1)}static Up(){return new A(0,1,0)}static Down(){return new A(0,-1,0)}static Forward(){return new A(0,0,1)}static Backward(){return new A(0,0,-1)}static Right(){return new A(1,0,0)}static Left(){return new A(-1,0,0)}static TransformCoordinates(t,e){let n=A.Zero();return A.TransformCoordinatesToRef(t,e,n),n}static TransformCoordinatesToRef(t,e,n){return A.TransformCoordinatesFromFloatsToRef(t.x,t.y,t.z,e,n)}static TransformCoordinatesFromFloatsToRef(t,e,n,r,o){let s=r.m,a=t*s[0]+e*s[4]+n*s[8]+s[12],h=t*s[1]+e*s[5]+n*s[9]+s[13],p=t*s[2]+e*s[6]+n*s[10]+s[14],u=1/(t*s[3]+e*s[7]+n*s[11]+s[15]);o.x=a*u,o.y=h*u,o.z=p*u}static TransformNormal(t,e){let n=A.Zero();return A.TransformNormalToRef(t,e,n),n}static TransformNormalToRef(t,e,n){this.TransformNormalFromFloatsToRef(t.x,t.y,t.z,e,n)}static TransformNormalFromFloatsToRef(t,e,n,r,o){let s=r.m;o.x=t*s[0]+e*s[4]+n*s[8],o.y=t*s[1]+e*s[5]+n*s[9],o.z=t*s[2]+e*s[6]+n*s[10]}static CatmullRom(t,e,n,r,o){let s=o*o,a=o*s,h=.5*(2*e.x+(-t.x+n.x)*o+(2*t.x-5*e.x+4*n.x-r.x)*s+(-t.x+3*e.x-3*n.x+r.x)*a),p=.5*(2*e.y+(-t.y+n.y)*o+(2*t.y-5*e.y+4*n.y-r.y)*s+(-t.y+3*e.y-3*n.y+r.y)*a),u=.5*(2*e.z+(-t.z+n.z)*o+(2*t.z-5*e.z+4*n.z-r.z)*s+(-t.z+3*e.z-3*n.z+r.z)*a);return new A(h,p,u)}static Clamp(t,e,n){let r=new A;return A.ClampToRef(t,e,n,r),r}static ClampToRef(t,e,n,r){let o=t.x;o=o>n.x?n.x:o,o=o<e.x?e.x:o;let s=t.y;s=s>n.y?n.y:s,s=s<e.y?e.y:s;let a=t.z;a=a>n.z?n.z:a,a=a<e.z?e.z:a,r.copyFromFloats(o,s,a)}static Hermite(t,e,n,r,o){let s=o*o,a=o*s,h=2*a-3*s+1,p=-2*a+3*s,u=a-2*s+o,d=a-s,b=t.x*h+n.x*p+e.x*u+r.x*d,x=t.y*h+n.y*p+e.y*u+r.y*d,E=t.z*h+n.z*p+e.z*u+r.z*d;return new A(b,x,E)}static Lerp(t,e,n){let r=new A(0,0,0);return A.LerpToRef(t,e,n,r),r}static LerpToRef(t,e,n,r){r.x=t.x+(e.x-t.x)*n,r.y=t.y+(e.y-t.y)*n,r.z=t.z+(e.z-t.z)*n}static Dot(t,e){return t.x*e.x+t.y*e.y+t.z*e.z}static Cross(t,e){let n=A.Zero();return A.CrossToRef(t,e,n),n}static CrossToRef(t,e,n){let r=t.y*e.z-t.z*e.y,o=t.z*e.x-t.x*e.z,s=t.x*e.y-t.y*e.x;n.copyFromFloats(r,o,s)}static Normalize(t){let e=A.Zero();return A.NormalizeToRef(t,e),e}static NormalizeToRef(t,e){t.normalizeToRef(e)}static Minimize(t,e){let n=new A(t.x,t.y,t.z);return n.minimizeInPlace(e),n}static Maximize(t,e){let n=new A(t.x,t.y,t.z);return n.maximizeInPlace(e),n}static Distance(t,e){return Math.sqrt(A.DistanceSquared(t,e))}static DistanceSquared(t,e){let n=t.x-e.x,r=t.y-e.y,o=t.z-e.z;return n*n+r*r+o*o}static Center(t,e){let n=A.Add(t,e);return n.scaleInPlace(.5),n}static RotationFromAxis(t,e,n){let r=A.Zero();return A.RotationFromAxisToRef(t,e,n,r),r}static RotationFromAxisToRef(t,e,n,r){let o=sn.MathTmp.Quaternion[0];ur.Quaternion.RotationQuaternionFromAxisToRef(t,e,n,o),r.copyFrom(o.eulerAngles)}toString(){return`(${this.x}, ${this.y}, ${this.z})`}getClassName(){return"Vector3"}getHashCode(){let t=this.x||0;return t=t*397^(this.y||0),t=t*397^(this.z||0),t}asArray(){let t=[];return this.toArray(t,0),t}toArray(t,e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,this}toQuaternion(){return ur.Quaternion.Identity.setEuler(this.y,this.x,this.z)}addInPlace(t){return this.addInPlaceFromFloats(t.x,t.y,t.z)}addInPlaceFromFloats(t,e,n){return this.x+=t,this.y+=e,this.z+=n,this}add(t){return new A(this.x+t.x,this.y+t.y,this.z+t.z)}addToRef(t,e){return e.copyFromFloats(this.x+t.x,this.y+t.y,this.z+t.z)}subtractInPlace(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subtract(t){return new A(this.x-t.x,this.y-t.y,this.z-t.z)}subtractToRef(t,e){return this.subtractFromFloatsToRef(t.x,t.y,t.z,e)}subtractFromFloats(t,e,n){return new A(this.x-t,this.y-e,this.z-n)}subtractFromFloatsToRef(t,e,n,r){return r.copyFromFloats(this.x-t,this.y-e,this.z-n)}applyMatrix4(t){this.applyMatrix4ToRef(t,this)}applyMatrix4ToRef(t,e){let{x:n,y:r,z:o}=this,{m:s}=t,a=1/(s[3]*n+s[7]*r+s[11]*o+s[15]);return e.x=(s[0]*n+s[4]*r+s[8]*o+s[12])*a,e.y=(s[1]*n+s[5]*r+s[9]*o+s[13])*a,e.z=(s[2]*n+s[6]*r+s[10]*o+s[14])*a,e}rotate(t){return this.rotateToRef(t,this)}rotateToRef(t,e){let{x:n,y:r,z:o}=this,{x:s,y:a,z:h,w:p}=t,u=p*n+a*o-h*r,d=p*r+h*n-s*o,b=p*o+s*r-a*n,x=-s*n-a*r-h*o;return e.x=u*p+x*-s+d*-h-b*-a,e.y=d*p+x*-a+b*-s-u*-h,e.z=b*p+x*-h+u*-a-d*-s,e}negate(){return new A(-this.x,-this.y,-this.z)}scaleInPlace(t){return this.x*=t,this.y*=t,this.z*=t,this}scale(t){return new A(this.x*t,this.y*t,this.z*t)}scaleToRef(t,e){return e.copyFromFloats(this.x*t,this.y*t,this.z*t)}scaleAndAddToRef(t,e){return e.addInPlaceFromFloats(this.x*t,this.y*t,this.z*t)}equals(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z}equalsWithEpsilon(t,e=gs.Epsilon){return t&&ri.Scalar.WithinEpsilon(this.x,t.x,e)&&ri.Scalar.WithinEpsilon(this.y,t.y,e)&&ri.Scalar.WithinEpsilon(this.z,t.z,e)}equalsToFloats(t,e,n){return this.x===t&&this.y===e&&this.z===n}multiplyInPlace(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiply(t){return this.multiplyByFloats(t.x,t.y,t.z)}multiplyToRef(t,e){return e.copyFromFloats(this.x*t.x,this.y*t.y,this.z*t.z)}multiplyByFloats(t,e,n){return new A(this.x*t,this.y*e,this.z*n)}divide(t){return new A(this.x/t.x,this.y/t.y,this.z/t.z)}divideToRef(t,e){return e.copyFromFloats(this.x/t.x,this.y/t.y,this.z/t.z)}divideInPlace(t){return this.divideToRef(t,this)}minimizeInPlace(t){return this.minimizeInPlaceFromFloats(t.x,t.y,t.z)}maximizeInPlace(t){return this.maximizeInPlaceFromFloats(t.x,t.y,t.z)}minimizeInPlaceFromFloats(t,e,n){return t<this.x&&(this.x=t),e<this.y&&(this.y=e),n<this.z&&(this.z=n),this}maximizeInPlaceFromFloats(t,e,n){return t>this.x&&(this.x=t),e>this.y&&(this.y=e),n>this.z&&(this.z=n),this}floor(){return new A(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))}fract(){return new A(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z))}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(t){return t===0||t===1?this:this.scaleInPlace(1/t)}normalizeToNew(){let t=new A(0,0,0);return this.normalizeToRef(t),t}normalizeToRef(t){let e=this.length();return e===0||e===1?t.copyFromFloats(this.x,this.y,this.z):this.scaleToRef(1/e,t)}clone(){return new A(this.x,this.y,this.z)}copyFrom(t){return this.copyFromFloats(t.x,t.y,t.z)}copyFromFloats(t,e,n){return this.x=t,this.y=e,this.z=n,this}set(t,e,n){return this.copyFromFloats(t,e,n)}setAll(t){return this.x=this.y=this.z=t,this}};an.Vector3=A});var xe=H(cn=>{m();"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.MathTmp=void 0;var oi=hr(),dr=_t(),vs=Fe(),lr=Pe();cn.MathTmp={Vector3:(0,oi.buildArray)(6,dr.Vector3.Zero),Matrix:(0,oi.buildArray)(2,lr.Matrix.Identity),Quaternion:(0,oi.buildArray)(3,vs.Quaternion.Zero),staticUp:dr.Vector3.Up(),tmpMatrix:lr.Matrix.Zero()}});var si=H(hn=>{m();"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.Angle=void 0;var we=class{constructor(t){this._radians=t,this._radians<0&&(this._radians+=2*Math.PI)}static BetweenTwoPoints(t,e){let n=e.subtract(t),r=Math.atan2(n.y,n.x);return new we(r)}static FromRadians(t){return new we(t)}static FromDegrees(t){return new we(t*Math.PI/180)}degrees(){return this._radians*180/Math.PI}radians(){return this._radians}};hn.Angle=we});var un=H(pn=>{m();"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.Vector2=void 0;var xs=wt(),fr=Nt(),z=class{constructor(t=0,e=0){this.x=t,this.y=e}static Zero(){return new z(0,0)}static One(){return new z(1,1)}static Add(t,e){return new z(t.x,t.y).addInPlace(e)}static FromArray(t,e=0){return new z(t[e],t[e+1])}static FromArrayToRef(t,e,n){n.x=t[e],n.y=t[e+1]}static CatmullRom(t,e,n,r,o){let s=o*o,a=o*s,h=.5*(2*e.x+(-t.x+n.x)*o+(2*t.x-5*e.x+4*n.x-r.x)*s+(-t.x+3*e.x-3*n.x+r.x)*a),p=.5*(2*e.y+(-t.y+n.y)*o+(2*t.y-5*e.y+4*n.y-r.y)*s+(-t.y+3*e.y-3*n.y+r.y)*a);return new z(h,p)}static Clamp(t,e,n){let r=t.x;r=r>n.x?n.x:r,r=r<e.x?e.x:r;let o=t.y;return o=o>n.y?n.y:o,o=o<e.y?e.y:o,new z(r,o)}static Hermite(t,e,n,r,o){let s=o*o,a=o*s,h=2*a-3*s+1,p=-2*a+3*s,u=a-2*s+o,d=a-s,b=t.x*h+n.x*p+e.x*u+r.x*d,x=t.y*h+n.y*p+e.y*u+r.y*d;return new z(b,x)}static Lerp(t,e,n){let r=t.x+(e.x-t.x)*n,o=t.y+(e.y-t.y)*n;return new z(r,o)}static Dot(t,e){return t.x*e.x+t.y*e.y}static Normalize(t){let e=new z(t.x,t.y);return e.normalize(),e}static Minimize(t,e){let n=t.x<e.x?t.x:e.x,r=t.y<e.y?t.y:e.y;return new z(n,r)}static Maximize(t,e){let n=t.x>e.x?t.x:e.x,r=t.y>e.y?t.y:e.y;return new z(n,r)}static Transform(t,e){let n=z.Zero();return z.TransformToRef(t,e,n),n}static TransformToRef(t,e,n){let r=e.m,o=t.x*r[0]+t.y*r[4]+r[12],s=t.x*r[1]+t.y*r[5]+r[13];n.x=o,n.y=s}static PointInTriangle(t,e,n,r){let o=1/2*(-n.y*r.x+e.y*(-n.x+r.x)+e.x*(n.y-r.y)+n.x*r.y),s=o<0?-1:1,a=(e.y*r.x-e.x*r.y+(r.y-e.y)*t.x+(e.x-r.x)*t.y)*s,h=(e.x*n.y-e.y*n.x+(e.y-n.y)*t.x+(n.x-e.x)*t.y)*s;return a>0&&h>0&&a+h<2*o*s}static Distance(t,e){return Math.sqrt(z.DistanceSquared(t,e))}static DistanceSquared(t,e){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r}static Center(t,e){let n=z.Add(t,e);return n.scaleInPlace(.5),n}static DistanceOfPointFromSegment(t,e,n){let r=z.DistanceSquared(e,n);if(r===0)return z.Distance(t,e);let o=n.subtract(e),s=Math.max(0,Math.min(1,z.Dot(t.subtract(e),o)/r)),a=e.add(o.multiplyByFloats(s,s));return z.Distance(t,a)}toString(){return"{X: "+this.x+" Y:"+this.y+"}"}getClassName(){return"Vector2"}getHashCode(){let t=this.x||0;return t=t*397^(this.y||0),t}toArray(t,e=0){return t[e]=this.x,t[e+1]=this.y,this}asArray(){let t=new Array;return this.toArray(t,0),t}copyFrom(t){return this.x=t.x,this.y=t.y,this}copyFromFloats(t,e){return this.x=t,this.y=e,this}set(t,e){return this.copyFromFloats(t,e)}add(t){return new z(this.x+t.x,this.y+t.y)}addToRef(t,e){return e.x=this.x+t.x,e.y=this.y+t.y,this}addInPlace(t){return this.x+=t.x,this.y+=t.y,this}addVector3(t){return new z(this.x+t.x,this.y+t.y)}subtract(t){return new z(this.x-t.x,this.y-t.y)}subtractToRef(t,e){return e.x=this.x-t.x,e.y=this.y-t.y,this}subtractInPlace(t){return this.x-=t.x,this.y-=t.y,this}multiplyInPlace(t){return this.x*=t.x,this.y*=t.y,this}multiply(t){return new z(this.x*t.x,this.y*t.y)}multiplyToRef(t,e){return e.x=this.x*t.x,e.y=this.y*t.y,this}multiplyByFloats(t,e){return new z(this.x*t,this.y*e)}divide(t){return new z(this.x/t.x,this.y/t.y)}divideToRef(t,e){return e.x=this.x/t.x,e.y=this.y/t.y,this}divideInPlace(t){return this.divideToRef(t,this)}negate(){return new z(-this.x,-this.y)}scaleInPlace(t){return this.x*=t,this.y*=t,this}scale(t){let e=new z(0,0);return this.scaleToRef(t,e),e}scaleToRef(t,e){return e.x=this.x*t,e.y=this.y*t,this}scaleAndAddToRef(t,e){return e.x+=this.x*t,e.y+=this.y*t,this}equals(t){return t&&this.x===t.x&&this.y===t.y}equalsWithEpsilon(t,e=xs.Epsilon){return t&&fr.Scalar.WithinEpsilon(this.x,t.x,e)&&fr.Scalar.WithinEpsilon(this.y,t.y,e)}floor(){return new z(Math.floor(this.x),Math.floor(this.y))}fract(){return new z(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let t=this.length();if(t===0)return this;let e=1/t;return this.x*=e,this.y*=e,this}clone(){return new z(this.x,this.y)}};pn.Vector2=z});var ci=H(ln=>{m();"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.Arc2=void 0;var dn=si(),ws=un(),ai=wt(),yr=class{constructor(t,e,n){this.startPoint=t,this.midPoint=e,this.endPoint=n;let r=Math.pow(e.x,2)+Math.pow(e.y,2),o=(Math.pow(t.x,2)+Math.pow(t.y,2)-r)/2,s=(r-Math.pow(n.x,2)-Math.pow(n.y,2))/2,a=(t.x-e.x)*(e.y-n.y)-(e.x-n.x)*(t.y-e.y);this.centerPoint=new ws.Vector2((o*(e.y-n.y)-s*(t.y-e.y))/a,((t.x-e.x)*s-(e.x-n.x)*o)/a),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=dn.Angle.BetweenTwoPoints(this.centerPoint,this.startPoint);let h=this.startAngle.degrees(),p=dn.Angle.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),u=dn.Angle.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();p-h>180&&(p-=360),p-h<-180&&(p+=360),u-p>180&&(u-=360),u-p<-180&&(u+=360),this.orientation=p-h<0?ai.Orientation.CW:ai.Orientation.CCW,this.angle=dn.Angle.FromDegrees(this.orientation===ai.Orientation.CW?h-u:u-h)}};ln.Arc2=yr});var mr=H(fn=>{m();"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.Axis=void 0;var hi=_t(),Be=class{};fn.Axis=Be;Be.X=new hi.Vector3(1,0,0);Be.Y=new hi.Vector3(0,1,0);Be.Z=new hi.Vector3(0,0,1)});var vr=H(yn=>{m();"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.BezierCurve=void 0;var gr=class{static Interpolate(t,e,n,r,o){let s=1-3*r+3*e,a=3*r-6*e,h=3*e,p=t;for(let u=0;u<5;u++){let d=p*p,b=d*p,x=s*b+a*d+h*p,E=1/(3*s*d+2*a*p+h);p-=(x-t)*E,p=Math.min(1,Math.max(0,p))}return 3*Math.pow(1-p,2)*p*n+3*(1-p)*Math.pow(p,2)*o+Math.pow(p,3)}};yn.BezierCurve=gr});var pi=H(mn=>{m();"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.Color4=void 0;var qt=Nt(),be=wt(),P=class{constructor(t=0,e=0,n=0,r=1){this.r=t,this.g=e,this.b=n,this.a=r}static FromHexString(t){if(t.substring(0,1)!=="#"||t.length!==9)return new P(0,0,0,0);let e=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=parseInt(t.substring(7,9),16);return P.FromInts(e,n,r,o)}static Lerp(t,e,n){let r=new P(0,0,0,0);return P.LerpToRef(t,e,n,r),r}static LerpToRef(t,e,n,r){r.r=t.r+(e.r-t.r)*n,r.g=t.g+(e.g-t.g)*n,r.b=t.b+(e.b-t.b)*n,r.a=t.a+(e.a-t.a)*n}static Red(){return new P(1,0,0,1)}static Green(){return new P(0,1,0,1)}static Blue(){return new P(0,0,1,1)}static Black(){return new P(0,0,0,1)}static White(){return new P(1,1,1,1)}static Purple(){return new P(.5,0,.5,1)}static Magenta(){return new P(1,0,1,1)}static Yellow(){return new P(1,1,0,1)}static Gray(){return new P(.5,.5,.5,1)}static Teal(){return new P(0,1,1,1)}static Clear(){return new P(0,0,0,0)}static FromColor3(t,e=1){return new P(t.r,t.g,t.b,e)}static FromArray(t,e=0){return new P(t[e],t[e+1],t[e+2],t[e+3])}static FromInts(t,e,n,r){return new P(t/255,e/255,n/255,r/255)}static CheckColors4(t,e){if(t.length===e*3){let n=[];for(let r=0;r<t.length;r+=3){let o=r/3*4;n[o]=t[r],n[o+1]=t[r+1],n[o+2]=t[r+2],n[o+3]=1}return n}return t}addInPlace(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a,this}asArray(){let t=new Array;return this.toArray(t,0),t}toArray(t,e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,this}add(t){return new P(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)}subtract(t){return new P(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)}subtractToRef(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,e.a=this.a-t.a,this}scale(t){return new P(this.r*t,this.g*t,this.b*t,this.a*t)}scaleToRef(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,e.a=this.a*t,this}scaleAndAddToRef(t,e){return e.r+=this.r*t,e.g+=this.g*t,e.b+=this.b*t,e.a+=this.a*t,this}clampToRef(t=0,e=1,n){return n.r=qt.Scalar.Clamp(this.r,t,e),n.g=qt.Scalar.Clamp(this.g,t,e),n.b=qt.Scalar.Clamp(this.b,t,e),n.a=qt.Scalar.Clamp(this.a,t,e),this}multiply(t){return new P(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)}multiplyToRef(t,e){return e.r=this.r*t.r,e.g=this.g*t.g,e.b=this.b*t.b,e.a=this.a*t.a,e}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"}getClassName(){return"Color4"}getHashCode(){let t=this.r||0;return t=t*397^(this.g||0),t=t*397^(this.b||0),t=t*397^(this.a||0),t}clone(){return new P(this.r,this.g,this.b,this.a)}copyFrom(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}copyFromFloats(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this}set(t,e,n,r){return this.copyFromFloats(t,e,n,r)}toHexString(){let t=this.r*255|0,e=this.g*255|0,n=this.b*255|0,r=this.a*255|0;return"#"+qt.Scalar.ToHex(t)+qt.Scalar.ToHex(e)+qt.Scalar.ToHex(n)+qt.Scalar.ToHex(r)}toLinearSpace(){let t=new P;return this.toLinearSpaceToRef(t),t}toLinearSpaceToRef(t){return t.r=Math.pow(this.r,be.ToLinearSpace),t.g=Math.pow(this.g,be.ToLinearSpace),t.b=Math.pow(this.b,be.ToLinearSpace),t.a=this.a,this}toGammaSpace(){let t=new P;return this.toGammaSpaceToRef(t),t}toGammaSpaceToRef(t){return t.r=Math.pow(this.r,be.ToGammaSpace),t.g=Math.pow(this.g,be.ToGammaSpace),t.b=Math.pow(this.b,be.ToGammaSpace),t.a=this.a,this}};mn.Color4=P});var xr=H(gn=>{m();"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.Color3=void 0;var Ee=wt(),bs=pi(),Te=Nt(),B=class{constructor(t=0,e=0,n=0){this.r=t,this.g=e,this.b=n}static FromHexString(t){if(t.substring(0,1)!=="#"||t.length!==7)return new B(0,0,0);let e=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return B.FromInts(e,n,r)}static FromArray(t,e=0){return new B(t[e],t[e+1],t[e+2])}static FromInts(t,e,n){return new B(t/255,e/255,n/255)}static Lerp(t,e,n){let r=new B(0,0,0);return B.LerpToRef(t,e,n,r),r}static LerpToRef(t,e,n,r){r.r=t.r+(e.r-t.r)*n,r.g=t.g+(e.g-t.g)*n,r.b=t.b+(e.b-t.b)*n}static Red(){return new B(1,0,0)}static Green(){return new B(0,1,0)}static Blue(){return new B(0,0,1)}static Black(){return new B(0,0,0)}static White(){return new B(1,1,1)}static Purple(){return new B(.5,0,.5)}static Magenta(){return new B(1,0,1)}static Yellow(){return new B(1,1,0)}static Gray(){return new B(.5,.5,.5)}static Teal(){return new B(0,1,1)}static Random(){return new B(Math.random(),Math.random(),Math.random())}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"}getClassName(){return"Color3"}getHashCode(){let t=this.r||0;return t=t*397^(this.g||0),t=t*397^(this.b||0),t}toArray(t,e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,this}toColor4(t=1){return new bs.Color4(this.r,this.g,this.b,t)}asArray(){let t=new Array;return this.toArray(t,0),t}toLuminance(){return this.r*.3+this.g*.59+this.b*.11}multiply(t){return new B(this.r*t.r,this.g*t.g,this.b*t.b)}multiplyToRef(t,e){return e.r=this.r*t.r,e.g=this.g*t.g,e.b=this.b*t.b,this}equals(t){return t&&this.r===t.r&&this.g===t.g&&this.b===t.b}equalsFloats(t,e,n){return this.r===t&&this.g===e&&this.b===n}scale(t){return new B(this.r*t,this.g*t,this.b*t)}scaleToRef(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,this}scaleAndAddToRef(t,e){return e.r+=this.r*t,e.g+=this.g*t,e.b+=this.b*t,this}clampToRef(t=0,e=1,n){return n.r=Te.Scalar.Clamp(this.r,t,e),n.g=Te.Scalar.Clamp(this.g,t,e),n.b=Te.Scalar.Clamp(this.b,t,e),this}add(t){return new B(this.r+t.r,this.g+t.g,this.b+t.b)}addToRef(t,e){return e.r=this.r+t.r,e.g=this.g+t.g,e.b=this.b+t.b,this}subtract(t){return new B(this.r-t.r,this.g-t.g,this.b-t.b)}subtractToRef(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,this}clone(){return new B(this.r,this.g,this.b)}copyFrom(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyFromFloats(t,e,n){return this.r=t,this.g=e,this.b=n,this}set(t,e,n){return this.copyFromFloats(t,e,n)}toHexString(){let t=this.r*255|0,e=this.g*255|0,n=this.b*255|0;return"#"+Te.Scalar.ToHex(t)+Te.Scalar.ToHex(e)+Te.Scalar.ToHex(n)}toLinearSpace(){let t=new B;return this.toLinearSpaceToRef(t),t}toLinearSpaceToRef(t){return t.r=Math.pow(this.r,Ee.ToLinearSpace),t.g=Math.pow(this.g,Ee.ToLinearSpace),t.b=Math.pow(this.b,Ee.ToLinearSpace),this}toGammaSpace(){let t=new B;return this.toGammaSpaceToRef(t),t}toGammaSpaceToRef(t){return t.r=Math.pow(this.r,Ee.ToGammaSpace),t.g=Math.pow(this.g,Ee.ToGammaSpace),t.b=Math.pow(this.b,Ee.ToGammaSpace),this}toJSON(){return{r:this.r,g:this.g,b:this.b}}};gn.Color3=B});var wr=H(vn=>{m();"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.Curve3=void 0;var Re=_t(),Gt=class{constructor(t){this._length=0,this._points=t,this._length=this._computeLength(t)}static CreateQuadraticBezier(t,e,n,r){r=r>2?r:3;let o=new Array,s=(a,h,p,u)=>(1-a)*(1-a)*h+2*a*(1-a)*p+a*a*u;for(let a=0;a<=r;a++)o.push(new Re.Vector3(s(a/r,t.x,e.x,n.x),s(a/r,t.y,e.y,n.y),s(a/r,t.z,e.z,n.z)));return new Gt(o)}static CreateCubicBezier(t,e,n,r,o){o=o>3?o:4;let s=new Array,a=(h,p,u,d,b)=>(1-h)*(1-h)*(1-h)*p+3*h*(1-h)*(1-h)*u+3*h*h*(1-h)*d+h*h*h*b;for(let h=0;h<=o;h++)s.push(new Re.Vector3(a(h/o,t.x,e.x,n.x,r.x),a(h/o,t.y,e.y,n.y,r.y),a(h/o,t.z,e.z,n.z,r.z)));return new Gt(s)}static CreateHermiteSpline(t,e,n,r,o){let s=new Array,a=1/o;for(let h=0;h<=o;h++)s.push(Re.Vector3.Hermite(t,e,n,r,h*a));return new Gt(s)}static CreateCatmullRomSpline(t,e,n){let r=new Array,o=1/e,s=0;if(n){let a=t.length;for(let h=0;h<a;h++){s=0;for(let p=0;p<e;p++)r.push(Re.Vector3.CatmullRom(t[h%a],t[(h+1)%a],t[(h+2)%a],t[(h+3)%a],s)),s+=o}r.push(r[0])}else{let a=new Array;a.push(t[0].clone()),Array.prototype.push.apply(a,t),a.push(t[t.length-1].clone());let h=0;for(h=0;h<a.length-3;h++){s=0;for(let p=0;p<e;p++)r.push(Re.Vector3.CatmullRom(a[h],a[h+1],a[h+2],a[h+3],s)),s+=o}h--,r.push(Re.Vector3.CatmullRom(a[h],a[h+1],a[h+2],a[h+3],s))}return new Gt(r)}getPoints(){return this._points}length(){return this._length}continue(t){let e=this._points[this._points.length-1],n=this._points.slice(),r=t.getPoints();for(let s=1;s<r.length;s++)n.push(r[s].subtract(r[0]).add(e));return new Gt(n)}_computeLength(t){let e=0;for(let n=1;n<t.length;n++)e+=t[n].subtract(t[n-1]).length();return e}};vn.Curve3=Gt});var ui=H(wn=>{m();"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.Plane=void 0;var xn=_t(),Es=Pe(),Ts=xe(),kt=class{constructor(t,e,n,r){this.normal=new xn.Vector3(t,e,n),this.d=r}static FromArray(t){return new kt(t[0],t[1],t[2],t[3])}static FromPoints(t,e,n){let r=new kt(0,0,0,0);return r.copyFromPoints(t,e,n),r}static FromPositionAndNormal(t,e){let n=new kt(0,0,0,0);return e.normalize(),n.normal=e,n.d=-(e.x*t.x+e.y*t.y+e.z*t.z),n}static SignedDistanceToPlaneFromPositionAndNormal(t,e,n){let r=-(e.x*t.x+e.y*t.y+e.z*t.z);return xn.Vector3.Dot(n,e)+r}asArray(){return[this.normal.x,this.normal.y,this.normal.z,this.d]}clone(){return new kt(this.normal.x,this.normal.y,this.normal.z,this.d)}getClassName(){return"Plane"}getHashCode(){let t=this.normal.getHashCode();return t=t*397^(this.d||0),t}normalize(){let t=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),e=0;return t!==0&&(e=1/t),this.normal.x*=e,this.normal.y*=e,this.normal.z*=e,this.d*=e,this}transform(t){let e=Ts.MathTmp.Matrix[0];Es.Matrix.TransposeToRef(t,e);let n=e.m,r=this.normal.x,o=this.normal.y,s=this.normal.z,a=this.d,h=r*n[0]+o*n[1]+s*n[2]+a*n[3],p=r*n[4]+o*n[5]+s*n[6]+a*n[7],u=r*n[8]+o*n[9]+s*n[10]+a*n[11],d=r*n[12]+o*n[13]+s*n[14]+a*n[15];return new kt(h,p,u,d)}dotCoordinate(t){return this.normal.x*t.x+this.normal.y*t.y+this.normal.z*t.z+this.d}copyFromPoints(t,e,n){let r=e.x-t.x,o=e.y-t.y,s=e.z-t.z,a=n.x-t.x,h=n.y-t.y,p=n.z-t.z,u=o*p-s*h,d=s*a-r*p,b=r*h-o*a,x=Math.sqrt(u*u+d*d+b*b),E;return x!==0?E=1/x:E=0,this.normal.x=u*E,this.normal.y=d*E,this.normal.z=b*E,this.d=-(this.normal.x*t.x+this.normal.y*t.y+this.normal.z*t.z),this}isFrontFacingTo(t,e){return xn.Vector3.Dot(this.normal,t)<=e}signedDistanceTo(t){return xn.Vector3.Dot(t,this.normal)+this.d}};wn.Plane=kt});var br=H(bn=>{m();"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.Frustum=void 0;var Rs=ui(),Ot=class{static GetPlanes(t){let e=[];for(let n=0;n<6;n++)e.push(new Rs.Plane(0,0,0,0));return Ot.GetPlanesToRef(t,e),e}static GetNearPlaneToRef(t,e){let n=t.m;e.normal.x=n[3]+n[2],e.normal.y=n[7]+n[6],e.normal.z=n[11]+n[10],e.d=n[15]+n[14],e.normalize()}static GetFarPlaneToRef(t,e){let n=t.m;e.normal.x=n[3]-n[2],e.normal.y=n[7]-n[6],e.normal.z=n[11]-n[10],e.d=n[15]-n[14],e.normalize()}static GetLeftPlaneToRef(t,e){let n=t.m;e.normal.x=n[3]+n[0],e.normal.y=n[7]+n[4],e.normal.z=n[11]+n[8],e.d=n[15]+n[12],e.normalize()}static GetRightPlaneToRef(t,e){let n=t.m;e.normal.x=n[3]-n[0],e.normal.y=n[7]-n[4],e.normal.z=n[11]-n[8],e.d=n[15]-n[12],e.normalize()}static GetTopPlaneToRef(t,e){let n=t.m;e.normal.x=n[3]-n[1],e.normal.y=n[7]-n[5],e.normal.z=n[11]-n[9],e.d=n[15]-n[13],e.normalize()}static GetBottomPlaneToRef(t,e){let n=t.m;e.normal.x=n[3]+n[1],e.normal.y=n[7]+n[5],e.normal.z=n[11]+n[9],e.d=n[15]+n[13],e.normalize()}static GetPlanesToRef(t,e){Ot.GetNearPlaneToRef(t,e[0]),Ot.GetFarPlaneToRef(t,e[1]),Ot.GetLeftPlaneToRef(t,e[2]),Ot.GetRightPlaneToRef(t,e[3]),Ot.GetTopPlaneToRef(t,e[4]),Ot.GetBottomPlaneToRef(t,e[5])}};bn.Frustum=Ot});var Er=H(Tn=>{m();"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.Path2=void 0;var ae=un(),As=ci(),_s=wt(),En=class{constructor(t,e){this.closed=!1,this._points=new Array,this._length=0,this._points.push(new ae.Vector2(t,e))}static StartingAt(t,e){return new En(t,e)}addLineTo(t,e){if(this.closed)return this;let n=new ae.Vector2(t,e),r=this._points[this._points.length-1];return this._points.push(n),this._length+=n.subtract(r).length(),this}addArcTo(t,e,n,r,o=36){if(this.closed)return this;let s=this._points[this._points.length-1],a=new ae.Vector2(t,e),h=new ae.Vector2(n,r),p=new As.Arc2(s,a,h),u=p.angle.radians()/o;p.orientation===_s.Orientation.CW&&(u*=-1);let d=p.startAngle.radians()+u;for(let b=0;b<o;b++){let x=Math.cos(d)*p.radius+p.centerPoint.x,E=Math.sin(d)*p.radius+p.centerPoint.y;this.addLineTo(x,E),d+=u}return this}close(){return this.closed=!0,this}length(){let t=this._length;if(!this.closed){let e=this._points[this._points.length-1];t+=this._points[0].subtract(e).length()}return t}getPoints(){return this._points}getPointAtLengthPosition(t){if(t<0||t>1)return ae.Vector2.Zero();let e=t*this.length(),n=0;for(let r=0;r<this._points.length;r++){let o=(r+1)%this._points.length,s=this._points[r],h=this._points[o].subtract(s),p=h.length()+n;if(e>=n&&e<=p){let u=h.normalize(),d=e-n;return new ae.Vector2(s.x+u.x*d,s.y+u.y*d)}n=p}return ae.Vector2.Zero()}};Tn.Path2=En});var Rr=H(Rn=>{m();"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.Path3D=void 0;var It=_t(),di=wt(),li=Nt(),Tr=class{constructor(t,e=null,n){this.path=t,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array;for(let r=0;r<t.length;r++)this._curve[r]=t[r].clone();this._raw=n||!1,this._compute(e)}getCurve(){return this._curve}getTangents(){return this._tangents}getNormals(){return this._normals}getBinormals(){return this._binormals}getDistances(){return this._distances}update(t,e=null){for(let n=0;n<t.length;n++)this._curve[n].x=t[n].x,this._curve[n].y=t[n].y,this._curve[n].z=t[n].z;return this._compute(e),this}_compute(t){let e=this._curve.length;this._tangents[0]=this._getFirstNonNullVector(0),this._raw||this._tangents[0].normalize(),this._tangents[e-1]=this._curve[e-1].subtract(this._curve[e-2]),this._raw||this._tangents[e-1].normalize();let n=this._tangents[0],r=this._normalVector(this._curve[0],n,t);this._normals[0]=r,this._raw||this._normals[0].normalize(),this._binormals[0]=It.Vector3.Cross(n,this._normals[0]),this._raw||this._binormals[0].normalize(),this._distances[0]=0;let o,s,a,h;for(let p=1;p<e;p++)o=this._getLastNonNullVector(p),p<e-1&&(s=this._getFirstNonNullVector(p),this._tangents[p]=o.add(s),this._tangents[p].normalize()),this._distances[p]=this._distances[p-1]+o.length(),a=this._tangents[p],h=this._binormals[p-1],this._normals[p]=It.Vector3.Cross(h,a),this._raw||this._normals[p].normalize(),this._binormals[p]=It.Vector3.Cross(a,this._normals[p]),this._raw||this._binormals[p].normalize()}_getFirstNonNullVector(t){let e=1,n=this._curve[t+e].subtract(this._curve[t]);for(;n.length()===0&&t+e+1<this._curve.length;)e++,n=this._curve[t+e].subtract(this._curve[t]);return n}_getLastNonNullVector(t){let e=1,n=this._curve[t].subtract(this._curve[t-e]);for(;n.length()===0&&t>e+1;)e++,n=this._curve[t].subtract(this._curve[t-e]);return n}_normalVector(t,e,n){let r,o=e.length();if(o===0&&(o=1),n==null){let s;li.Scalar.WithinEpsilon(Math.abs(e.y)/o,1,di.Epsilon)?li.Scalar.WithinEpsilon(Math.abs(e.x)/o,1,di.Epsilon)?li.Scalar.WithinEpsilon(Math.abs(e.z)/o,1,di.Epsilon)?s=It.Vector3.Zero():s=new It.Vector3(0,0,1):s=new It.Vector3(1,0,0):s=new It.Vector3(0,-1,0),r=It.Vector3.Cross(e,s)}else r=It.Vector3.Cross(e,n),It.Vector3.CrossToRef(r,e,r);return r.normalize(),r}};Rn.Path3D=Tr});var Ar=H(An=>{m();"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.Size=void 0;var Ut=class{constructor(t,e){this.width=t,this.height=e}get surface(){return this.width*this.height}static Zero(){return new Ut(0,0)}static Lerp(t,e,n){let r=t.width+(e.width-t.width)*n,o=t.height+(e.height-t.height)*n;return new Ut(r,o)}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){let t=this.width||0;return t=t*397^(this.height||0),t}copyFrom(t){this.width=t.width,this.height=t.height}copyFromFloats(t,e){return this.width=t,this.height=e,this}set(t,e){return this.copyFromFloats(t,e)}multiplyByFloats(t,e){return new Ut(this.width*t,this.height*e)}clone(){return new Ut(this.width,this.height)}equals(t){return t?this.width===t.width&&this.height===t.height:!1}add(t){return new Ut(this.width+t.width,this.height+t.height)}subtract(t){return new Ut(this.width-t.width,this.height-t.height)}};An.Size=Ut});var Wt=H(N=>{m();"use strict";var Os=N&&N.__createBinding||(Object.create?function(i,t,e,n){n===void 0&&(n=e),Object.defineProperty(i,n,{enumerable:!0,get:function(){return t[e]}})}:function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]}),Y=N&&N.__exportStar||function(i,t){for(var e in i)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&Os(t,i,e)};Object.defineProperty(N,"__esModule",{value:!0});Y(wt(),N);Y(xe(),N);Y(si(),N);Y(ci(),N);Y(mr(),N);Y(vr(),N);Y(xr(),N);Y(pi(),N);Y(wr(),N);Y(br(),N);Y(Pe(),N);Y(Er(),N);Y(Rr(),N);Y(ui(),N);Y(Fe(),N);Y(Nt(),N);Y(Ar(),N);Y(un(),N);Y(_t(),N);Y(ei(),N);Y(Wt(),N)});m();m();m();var Xs=function(){function i(){}return i.AVATAR={getEntityRepresentation:function(t){return t.avatarEntity}},i.FIRST_PERSON_CAMERA={getEntityRepresentation:function(t){return t.firstPersonCameraEntity}},i}();m();m();m();m();var Qi=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,o=[],s;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)o.push(r.value)}catch(a){s={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return o},tr=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,o;n<r;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return i.concat(o||Array.prototype.slice.call(t))},er=0;function Q(){for(var i=[],t=0;t<arguments.length;t++)i[t]=arguments[t];typeof dcl!="undefined"?dcl.log.apply(dcl,tr([],Qi(i),!1)):console.log.apply(console,tr(["DEBUG:"],Qi(i),!1))}function jt(i,t){typeof dcl!="undefined"?dcl.error(i,t):console.error("ERROR:",i,t)}function At(i){if(er++,i.length===0)throw new Error("newId(type: string): type cannot be empty");return i+er.toString(36)}function Wn(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var t=Math.random()*16|0,e=i==="x"?t:t&3|8;return e.toString(16)})}var He="__event_name__",nr=[];function Yn(i){if(!(He in i)||typeof i[He]!="string")throw new Error("The EventConstructor is not registered");return i[He]}var qe=function(){function i(){this.listeners={}}return i.prototype.addListener=function(t,e,n){if(!t||typeof t!="function")throw new Error("Invalid EventConstructor");var r=Yn(t),o=this.listeners[r];o||(o=this.listeners[r]=[]);for(var s=0;s<o.length;s++){var a=o[s];if(a.listener===e)throw new Error("The provided listener is already registered")}return o.push({listener:e,fn:n}),this},i.prototype.removeListener=function(t,e){if(!e||typeof e!="function")throw new Error("Invalid EventConstructor");var n=Yn(e),r=this.listeners[n];if(!r)return!1;for(var o=0;o<r.length;o++){var s=r[o];if(s.listener===t)return r.splice(o,1),!0}return!1},i.prototype.fireEvent=function(t){var e=Yn(t.constructor),n=this.listeners[e];if(n)for(var r=0;r<n.length;r++)try{var o=n[r];o.fn.call(o.listener,t)}catch(s){jt(s)}return this},i}();function gt(){var i=At("EV");if(nr.indexOf(i)!==-1)throw new Error("The event name "+i+" is already taken");return nr.push(i),function(t){return t[He]=i,t}}var Xn=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Vn=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},Bt=function(){function i(t,e,n){this.entity=t,this.componentName=e,this.component=n}return i=Xn([gt(),Vn("design:paramtypes",[Object,String,Object])],i),i}();var Ht=function(){function i(t,e,n){this.entity=t,this.componentName=e,this.classId=n}return i=Xn([gt(),Vn("design:paramtypes",[Object,String,Object])],i),i}();var Ge=function(){function i(t,e){this.entity=t,this.parent=e}return i=Xn([gt(),Vn("design:paramtypes",[Object,Object])],i),i}();m();m();var ge;(function(i){i[i.PERCENT=0]="PERCENT",i[i.PIXELS=1]="PIXELS"})(ge||(ge={}));var ir=function(){function i(t){if(this.type=ge.PIXELS,typeof t=="string"){var e=t;e.indexOf("px")>-1?this.type=ge.PIXELS:e.indexOf("%")>-1&&(this.type=ge.PERCENT),this.value=parseFloat(e)}else this.value=t}return i.prototype.toString=function(){var t=this.value.toString();return this.type===ge.PERCENT?t+="%":t+="px",t},i}();var ke=function(){return ke=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},ke.apply(this,arguments)},Zn=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},$n=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},rr=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,o=[],s;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)o.push(r.value)}catch(a){s={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return o},or=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,o;n<r;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return i.concat(o||Array.prototype.slice.call(t))},ie="__name__symbol_",ve="__classId__symbol_",We="__component__id_",Ye=function(){function i(t,e,n){this.componentId=t,this.componentName=e,this.classId=n}return i=Zn([gt(),$n("design:paramtypes",[String,String,Number])],i),i}();var Xe=function(){function i(t){this.componentId=t}return i=Zn([gt(),$n("design:paramtypes",[String])],i),i}();var ze=function(){function i(t,e){this.componentId=t,this.component=e}return i=Zn([gt(),$n("design:paramtypes",[String,Object])],i),i}();function C(i,t){return function(e){if(e.isComponent)throw new TypeError("You cannot extend a component. Trying to extend "+e.originalClassName+" with: "+i);var n=e,r=function(){var s=Array.prototype.slice.call(arguments),a=new(n.bind.apply(n,or([void 0],rr(s),!1)));return Object.defineProperty(a,ie,{enumerable:!1,writable:!1,configurable:!1,value:i}),t!==void 0&&Object.defineProperty(a,ve,{enumerable:!1,writable:!1,configurable:!1,value:t}),a};return t!==void 0&&(r[ve]=t),r[ie]=i,r.isComponent=!0,r.originalClassName=i,r.prototype=e.prototype,r.prototype.constructor=e,r}}function _(i,t){return function(e){if(e.isComponent)throw new TypeError("You cannot extend a component. Trying to extend "+e.originalClassName+" with: "+i);if(typeof t!="number"||isNaN(t))throw new Error("classId: "+t+" is an invalid integer");var n=e,r=function(){if(!_.engine)throw new Error("You need to set a DisposableComponent.engine before creating disposable components");var s=Array.prototype.slice.call(arguments),a=new(n.bind.apply(n,or([void 0],rr(s),!1))),h=At("C");return Object.defineProperty(a,ie,{enumerable:!1,writable:!1,configurable:!1,value:i}),Object.defineProperty(a,We,{enumerable:!1,writable:!1,configurable:!1,value:h}),t!==void 0&&Object.defineProperty(a,ve,{enumerable:!1,writable:!1,configurable:!1,value:t}),_.engine&&_.engine.registerComponent(a),a};return t!==void 0&&(r[ve]=t),r[ie]=i,r.isComponent=!0,r.isDisposableComponent=!0,r.originalClassName=i,r.prototype=e.prototype,r.prototype.constructor=e,r}}(function(i){i.engine=null})(_||(_={}));function st(i){if(!i)throw new TypeError(i+" is not a component.");if(i[ie])return i[ie];throw new TypeError(i+" is not a registered component.")}function re(i){if(!i)throw new TypeError(i+" is not a component.");if(i[ve])return i[ve];if(!i[ie])throw new TypeError(i+" is not a registered component.");return null}function at(i){if(!i)throw new TypeError(i+" is not a component.");if(i[We])return i[We];throw new TypeError(i+" is not a registered disposable component.")}var c=function(){function i(){this.dirty=!1,this.data={},this.subscriptions=[]}return i.component=function(t,e){if(delete t[e]){var n=e+"_"+Math.random();t[n]=void 0,Object.defineProperty(t,n,ke(ke({},Object.getOwnPropertyDescriptor(t,n)),{enumerable:!1})),Object.defineProperty(t,e.toString(),{get:function(){return this[n]},set:function(r){var o=this[n];if(r?this.data[e]=at(r):this.data[e]=null,this[n]=r,r!==o){this.dirty=!0;for(var s=0;s<this.subscriptions.length;s++)this.subscriptions[s](e,r,o)}},enumerable:!0})}},i.field=function(t,e){delete t[e]&&Object.defineProperty(t,e.toString(),{get:function(){return this.data[e]},set:function(n){var r=this.data[e];if(this.data[e]=n,n!==r){this.dirty=!0;for(var o=0;o<this.subscriptions.length;o++)this.subscriptions[o](e,n,r)}},enumerable:!0})},i.uiValue=function(t,e){delete t[e]&&Object.defineProperty(t,e.toString(),{get:function(){return this.data[e].toString()},set:function(n){var r=this.data[e],o=new ir(n);if(this.data[e]=o,o!==r){this.dirty=!0;for(var s=0;s<this.subscriptions.length;s++)this.subscriptions[s](e,o,r)}},enumerable:!0})},i.readonly=function(t,e){delete t[e]&&Object.defineProperty(t,e.toString(),{get:function(){if(!(e in this.data))throw new Error("The field "+e+" is uninitialized");return this.data[e]},set:function(n){if(e in this.data)throw new Error("The field "+e+" is readonly");this.data[e]=n,this.dirty=!0},enumerable:!0,configurable:!1})},i.prototype.onChange=function(t){return this.subscriptions.push(t),this},i.prototype.toJSON=function(){return this.data},i}();function Ve(i){return We in i}m();var Jn=function(){function i(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.entities=[],this.active=!1,this._requiresNames=[],!t)throw new Error("ComponentGroup: Could not load the requires list");if(!(t instanceof Array))throw new Error("ComponentGroup: requires list is not an Array");Object.defineProperty(this,"requires",{get:function(){return t.slice()}}),Object.defineProperty(this,"requiresNames",{get:function(){return this._requiresNames.slice()}});for(var n=function(s){var a=t[s],h=null;if(!a)throw new Error("ComponentGroup: the required component at location "+s+" is invalid");try{h=st(a)}catch(p){throw new Error("ComponentGroup: the required component at location "+s+" is not registered as a @Component. Remember to provide the class of the component, not the name")}if(r._requiresNames.some(function(p){return p===h}))throw new Error("ComponentGroup: the required component list has a repeated name "+h);r._requiresNames.push(h)},r=this,o=0;o<t.length;o++)n(o)}return i.prototype.hasEntity=function(t){return t.isAddedToEngine()?this.entities.indexOf(t)!==-1:!1},i.prototype.addEntity=function(t){if(!t.isAddedToEngine())throw new TypeError("ComponentGroup: Cannot add a entity that is not added to the engine");this.entities.indexOf(t)===-1&&this.entities.push(t)},i.prototype.removeEntity=function(t){var e=this.entities.indexOf(t);e!==-1&&this.entities.splice(e,1)},i.prototype.componentRemoved=function(t,e){this._requiresNames.indexOf(e)!==-1&&this.removeEntity(t)},i.prototype.meetsRequirements=function(t){for(var e=0;e<this._requiresNames.length;e++){var n=this._requiresNames[e];if(!(n in t.components))return!1}return!0},i}();m();var oe=function(){function i(t){this.name=t,this.children={},this.eventManager=null,this.alive=!1,this.uuid=At("E"),this.components={},this.engine=null,this._parent=null}return i.prototype.addComponentOrReplace=function(t){if(typeof t=="function")throw new Error("You passed a function or class as a component, an instance of component is expected");if(typeof t!="object")throw new Error("You passed a "+typeof t+", an instance of component is expected");var e=st(t);if(this.components[e]){if(this.components[e]===t)return t;this.removeComponent(this.components[e],!1)}return this.addComponent(t)},i.prototype.hasComponent=function(t){var e=typeof t;if(e!=="string"&&e!=="object"&&e!=="function")throw new Error("Entity#has(component): component is not a class, name or instance");if(t===null)return!1;var n=e==="string"?t:st(t),r=this.components[n];return r?e==="object"?r===t:e==="function"?r instanceof t:!0:!1},i.prototype.getComponent=function(t){var e=typeof t;if(e!=="string"&&e!=="function")throw new Error("Entity#get(component): component is not a class or name");var n=e==="string"?t:st(t),r=this.components[n];if(!r)throw new Error('Can not get component "'+n+'" from entity "'+this.identifier+'"');if(e==="function"){if(r instanceof t)return r;throw new Error('Can not get component "'+n+'" from entity "'+this.identifier+'" (by instance)')}return r},i.prototype.getComponentOrNull=function(t){var e=typeof t;if(e!=="string"&&e!=="function")throw new Error("Entity#getOrNull(component): component is not a class or name");var n=e==="string"?t:st(t),r=this.components[n];return r?e==="function"?r instanceof t?r:null:r:null},i.prototype.getComponentOrCreate=function(t){if(typeof t!="function")throw new Error("Entity#getOrCreate(component): component is not a class");var e=this.getComponentOrNull(t);return e||(e=new t,st(e),this.addComponentOrReplace(e)),e},i.prototype.addComponent=function(t){if(typeof t!="object")throw new Error("Entity#add(component): You passed a function or class as a component, an instance of component is expected");var e=st(t),n=re(t);if(this.components[e])throw new Error('A component of type "'+e+'" is already present in entity "'+this.identifier+'"');this.components[e]=t,this.eventManager&&this.eventManager.fireEvent(new Ht(this,e,n));var r=t;return typeof r.addedToEntity=="function"&&r.addedToEntity(this),t},i.prototype.removeComponent=function(t,e){e===void 0&&(e=!0);var n=typeof t;if(n!=="string"&&n!=="function"&&n!=="object")throw new Error("Entity#remove(component): component is not a class, class or name");var r=n==="string"?t:st(t),o=this.components[r];if(!o){Q('Entity Warning: Trying to remove inexisting component "'+r+'" from entity "'+this.identifier+'"');return}if(n==="function")if(o instanceof t){delete this.components[r],o&&(e&&this.eventManager&&this.eventManager.fireEvent(new Bt(this,r,o)),typeof o.removedFromEntity=="function"&&o.removedFromEntity(this));return}else{Q('Entity Warning: Trying to remove wrong (by constructor) component "'+r+'" from entity "'+this.identifier+'"');return}delete this.components[r],o&&(e&&this.eventManager&&this.eventManager.fireEvent(new Bt(this,r,o)),typeof o.removedFromEntity=="function"&&o.removedFromEntity(this))},i.prototype.isAddedToEngine=function(){return!!(this.engine&&(this.uuid in this.engine.entities||this.engine.rootEntity===this))},i.prototype.setParent=function(t){var e;if(t&&"getEntityRepresentation"in t){if(!this.engine)throw new Error("In order to set an attachable as parent, you first need to add the entity to the engine.");e=t.getEntityRepresentation(this.engine)}else e=!t&&this.engine?this.engine.rootEntity:t;var n=this.getParent();if(e===this)throw new Error('Failed to set parent for entity "'+this.identifier+`": An entity can't set itself as a its own parent`);if(e===n)return this;var r=this.getCircularAncestor(e);if(r)throw new Error('Failed to set parent for entity "'+this.identifier+'": Circular parent references are not allowed (See entity "'+r+'")');return n&&delete n.children[this.uuid],e!==null&&e.uuid!=="0"&&(!e.isAddedToEngine()&&this.isAddedToEngine()&&this.engine.removeEntity(this),e.isAddedToEngine()&&!this.isAddedToEngine()&&e.engine.addEntity(this)),this._parent=e||null,this.registerAsChild(),this.eventManager&&this.engine&&this.eventManager.fireEvent(new Ge(this,e)),this},i.prototype.getParent=function(){return this._parent},Object.defineProperty(i.prototype,"identifier",{get:function(){return this.name||this.uuid},enumerable:!1,configurable:!0}),i.prototype.getCircularAncestor=function(t){for(var e=this.engine?this.engine.rootEntity:null,n=t;n&&n!==e;){var r=n.getParent();if(r===this)return n.uuid;n=r}return null},i.prototype.registerAsChild=function(){var t=this.getParent();this.uuid&&t&&(t.children[this.uuid]=this)},i}();var ko=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,o=[],s;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)o.push(r.value)}catch(a){s={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return o},Wo=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,o;n<r;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return i.concat(o||Array.prototype.slice.call(t))},sr=function(){function i(t){this.eventManager=new qe,this.systems=[],this.entityLists={},this.addedSystems=[],this._entities={},this._disposableComponents={},this._componentGroups={},this.simpleSystems=[],this.eventManager.addListener(Ht,this,this.componentAddedHandler),this.eventManager.addListener(Bt,this,this.componentRemovedHandler),this.rootEntity=t,this.firstPersonCameraEntity=new oe,this.firstPersonCameraEntity.uuid="FirstPersonCameraEntityReference",this.addEntity(this.firstPersonCameraEntity),this.avatarEntity=new oe,this.avatarEntity.uuid="AvatarEntityReference",this.addEntity(this.avatarEntity)}return Object.defineProperty(i.prototype,"entities",{get:function(){return this._entities},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"disposableComponents",{get:function(){return this._disposableComponents},enumerable:!1,configurable:!0}),i.prototype.addEntity=function(t){var e=t.getParent();if(t.isAddedToEngine())return t;t.eventManager=this.eventManager,t.engine=this,this._entities[t.uuid]=t,this.checkRequirementsAndAdd(t),e?!e.isAddedToEngine()&&e!==this.rootEntity&&Q("Engine: warning, added an entity with a parent not present in the engine. Parent id: "+e.uuid):t.setParent(this.rootEntity),t.alive=!0;for(var n in t.children){var r=t.children[n];r&&(r.isAddedToEngine()||this.addEntity(r))}return t},i.prototype.removeEntity=function(t){var e=t.uuid;if(t.isAddedToEngine()){for(var n in t.components){var r=this._componentGroups[n];if(r)for(var o in r)r[o].removeEntity(t);delete this.entityLists[n][e]}for(var s=0;s<this.simpleSystems.length;s++){var a=this.simpleSystems[s];a.onRemoveEntity&&a.onRemoveEntity(t)}for(var s in t.children){var h=t.children[s];h&&this.removeEntity(h)}return t.alive=!1,t.eventManager=null,delete this._entities[e],!0}else{Q("Engine: Trying to remove non existent entity from engine."),t.isAddedToEngine()?Q("Engine: Entity id: "+e):Q('Engine: Entity "'+t.uuid+'" has not been added to any engine yet.'),Q("Engine: Entity's components:");for(var n in t.components)Q(n);return!1}},i.prototype.addSystem=function(t,e){if(e===void 0&&(e=0),this.addedSystems.indexOf(t)!==-1)return Q("Engine: Trying to add a system that is already added. Aborting"),t;if(this.systems.length>0)for(var n=0;n<this.systems.length;n++){var r=this.systems[n],o=n===this.systems.length-1;if(r.priority>e){this.addedSystems.push(t),this.systems.splice(n,0,{system:t,priority:e});break}else if(o){this.addedSystems.push(t),this.systems.splice(n+1,0,{system:t,priority:e});break}}else this.addedSystems.push(t),this.systems.splice(1,0,{system:t,priority:e});return this.registerSystem(t),t},i.prototype.removeSystem=function(t){var e=this.addedSystems.indexOf(t);if(e!==-1){t.active=!1,t.deactivate&&t.deactivate(),this.addedSystems.splice(e,1);for(var n=0;n<this.systems.length;n++){var r=this.systems[n].system;r===t&&this.systems.splice(n,1)}return!0}return!1},i.prototype.update=function(t){for(var e in this.systems){var n=this.systems[e].system;if(n.active&&n.update)try{n.update(t)}catch(r){jt(r)}}return this},i.prototype.getEntitiesWithComponent=function(t){var e=typeof t=="string"?t:st(t);return e in this.entityLists?this.entityLists[e]:this.entityLists[e]={}},i.prototype.registerComponent=function(t){var e=at(t),n=st(t),r=re(t);this._disposableComponents[e]=t,r!==null&&(this.eventManager.fireEvent(new Ye(e,n,r)),this.eventManager.fireEvent(new ze(e,t)))},i.prototype.disposeComponent=function(t){var e=at(t);return delete this._disposableComponents[e]?(this.eventManager.fireEvent(new Xe(e)),t.onDispose&&t.onDispose(),!0):!1},i.prototype.updateComponent=function(t){this.eventManager.fireEvent(new ze(at(t),t))},i.prototype.getComponentGroup=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=void 0;if(t.length>0){var r=this._componentGroups[st(t[0])];if(r)for(var o=t.slice(),s=0;s<r.length;s++){var a=r[s];if(o.length===a.requires.length){for(var h=0;h<o.length&&a.requires.indexOf(o[h])!==-1;h++)h===o.length-1&&(n=a);if(n)break}}}if(n)return n;n=new(Jn.bind.apply(Jn,Wo([void 0],ko(t),!1))),n.active=!0;for(var p=n.requiresNames,s=0;s<p.length;s++){var u=p[s],r=this._componentGroups[u];r||(this._componentGroups[u]=r=[]),r.indexOf(n)===-1&&r.push(n)}for(var d in this._entities)this.checkRequirements(this._entities[d],n);return n},i.prototype.removeComponentGroup=function(t){if(t.active){t.active=!1;for(var e=t.requiresNames,n=0;n<e.length;n++){var r=e[n],o=this._componentGroups[r];if(o){var s=o.indexOf(t);s!==-1&&o.splice(s,1)}}return!0}return!1},i.prototype.registerSystem=function(t){t.active=!0,t.activate&&t.activate(this),this.simpleSystems.push(t)},i.prototype.checkRequirementsAndAdd=function(t){if(!!t.isAddedToEngine()){for(var e in t.components){e in this.entityLists||(this.entityLists[e]={}),this.entityLists[e][t.uuid]=t;var n=this._componentGroups[e];if(n)for(var r in n)this.checkRequirements(t,n[r])}for(var o=0;o<this.simpleSystems.length;o++){var s=this.simpleSystems[o];s.onAddEntity&&s.onAddEntity(t)}}},i.prototype.checkRequirements=function(t,e){e.meetsRequirements(t)?e.hasEntity(t)||e.addEntity(t):e.hasEntity(t)&&e.removeEntity(t)},i.prototype.componentAddedHandler=function(t){var e,n=t.entity,r=t.componentName;if(!!n.isAddedToEngine()){this.entityLists[r]?this.entityLists[r][n.uuid]=n:this.entityLists[r]=(e={},e[n.uuid]=n,e);var o=this._componentGroups[r];if(o)for(var s in o)this.checkRequirements(n,o[s])}},i.prototype.componentRemovedHandler=function(t){var e=t.entity,n=t.componentName;if(!!e.isAddedToEngine()){delete this.entityLists[n][e.uuid];var r=this._componentGroups[n];if(r)for(var o in r)this.checkRequirements(e,r[o])}},i}();m();var Yo=Promise.resolve().then.bind(Promise.resolve());function Ze(i){var t=Yo(i);return t.isComplete=!1,t.then(function(e){t.isComplete=!0,t.result=e,t.didFail=!1}).catch(function(e){t.isComplete=!0,t.error=e,t.didFail=!0,jt("executeTask: FAILED "+e.toString(),e)}),t}m();var Xo=function(i,t,e,n){function r(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function a(u){try{p(n.next(u))}catch(d){s(d)}}function h(u){try{p(n.throw(u))}catch(d){s(d)}}function p(u){u.done?o(u.value):r(u.value).then(a,h)}p((n=n.apply(i,t||[])).next())})},Vo=function(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(p){return function(u){return h([p,u])}}function h(p){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,r&&(o=p[0]&2?r.return:p[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,p[1])).done)return o;switch(r=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return e.label++,{value:p[1],done:!1};case 5:e.label++,r=p[1],p=[0];continue;case 7:p=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){e=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){e.label=p[1];break}if(p[0]===6&&e.label<o[1]){e.label=o[1],o=p;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(p);break}o[2]&&e.ops.pop(),e.trys.pop();continue}p=t.call(i,e)}catch(u){p=[6,u],r=0}finally{n=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Kn=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Zo=function(){function i(t,e,n,r){e===void 0&&(e=!1),this.initalize(t,e,n,r)}return i.prototype.initalize=function(t,e,n,r){return e===void 0&&(e=!1),this.mask=t,this.skipNextObservers=e,this.target=n,this.currentTarget=r,this},i}();var $o=function(){function i(t,e,n){n===void 0&&(n=null),this.callback=t,this.mask=e,this.scope=n,this.unregisterOnNextCall=!1,this._willBeUnregistered=!1}return i}();var ba=function(){function i(){this._observers=null,this._observables=null}return i.Watch=function(t,e,n,r){var o,s;n===void 0&&(n=-1),r===void 0&&(r=null);var a=new i;a._observers=new Array,a._observables=t;try{for(var h=Kn(t),p=h.next();!p.done;p=h.next()){var u=p.value,d=u.add(e,n,!1,r);d&&a._observers.push(d)}}catch(b){o={error:b}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}return a},i.prototype.dispose=function(){if(this._observers&&this._observables)for(var t=0;t<this._observers.length;t++)this._observables[t].remove(this._observers[t]);this._observers=null,this._observables=null},i}();var tt=function(){function i(t){this._observers=new Array,this._onObserverAdded=null,this._eventState=new Zo(0),t&&(this._onObserverAdded=t)}return i.prototype.add=function(t,e,n,r,o){if(e===void 0&&(e=-1),n===void 0&&(n=!1),r===void 0&&(r=null),o===void 0&&(o=!1),!t)return null;var s=new $o(t,e,r);return s.unregisterOnNextCall=o,n?this._observers.unshift(s):this._observers.push(s),this._onObserverAdded&&this._onObserverAdded(s),s},i.prototype.addOnce=function(t){return this.add(t,void 0,void 0,void 0,!0)},i.prototype.remove=function(t){if(!t)return!1;var e=this._observers.indexOf(t);return e!==-1?(this._deferUnregister(t),!0):!1},i.prototype.removeCallback=function(t,e){for(var n=0;n<this._observers.length;n++)if(this._observers[n].callback===t&&(!e||e===this._observers[n].scope))return this._deferUnregister(this._observers[n]),!0;return!1},i.prototype.notifyObservers=function(t,e,n,r){var o,s;if(e===void 0&&(e=-1),!this._observers.length)return!0;var a=this._eventState;a.mask=e,a.target=n,a.currentTarget=r,a.skipNextObservers=!1,a.lastReturnValue=t;try{for(var h=Kn(this._observers),p=h.next();!p.done;p=h.next()){var u=p.value;if(!u._willBeUnregistered&&(u.mask&e&&(u.scope?a.lastReturnValue=u.callback.apply(u.scope,[t,a]):a.lastReturnValue=u.callback(t,a),u.unregisterOnNextCall&&this._deferUnregister(u)),a.skipNextObservers))return!1}}catch(d){o={error:d}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}return!0},i.prototype.notifyObserversWithPromise=function(t,e,n,r){var o=this;e===void 0&&(e=-1);var s=Promise.resolve(t);if(!this._observers.length)return s;var a=this._eventState;return a.mask=e,a.target=n,a.currentTarget=r,a.skipNextObservers=!1,this._observers.forEach(function(h){a.skipNextObservers||h._willBeUnregistered||h.mask&e&&(h.scope?s=s.then(function(p){return a.lastReturnValue=p,h.callback.apply(h.scope,[t,a])}):s=s.then(function(p){return a.lastReturnValue=p,h.callback(t,a)}),h.unregisterOnNextCall&&o._deferUnregister(h))}),s.then(function(){return t})},i.prototype.notifyObserver=function(t,e,n){n===void 0&&(n=-1);var r=this._eventState;r.mask=n,r.skipNextObservers=!1,t.callback(e,r)},i.prototype.hasObservers=function(){return this._observers.length>0},i.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},i.prototype.clone=function(){var t=new i;return t._observers=this._observers.slice(0),t},i.prototype.hasSpecificMask=function(t){var e,n;t===void 0&&(t=-1);try{for(var r=Kn(this._observers),o=r.next();!o.done;o=r.next()){var s=o.value;if(s.mask&t||s.mask===t)return!0}}catch(a){e={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!1},i.prototype._deferUnregister=function(t){var e=this;t.unregisterOnNextCall=!1,t._willBeUnregistered=!0,Ze(function(){return Xo(e,void 0,void 0,function(){return Vo(this,function(n){return[2,this._remove(t)]})})})},i.prototype._remove=function(t){if(!t)return!1;var e=this._observers.indexOf(t);return e!==-1?(this._observers.splice(e,1),!0):!1},i}();m();m();var Qn=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ti=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},$e=function(){function i(t,e){this.uuid=t,this.payload=e}return i=Qn([gt(),ti("design:paramtypes",[String,Object])],i),i}();var Me=function(){function i(t){this.payload=t}return i=Qn([gt(),ti("design:paramtypes",[Object])],i),i}();var Je=function(){function i(t){this.payload=t}return i=Qn([gt(),ti("design:paramtypes",[Object])],i),i}();var Se;function ct(i){return function(){Se&&Se.subscribe(i)}}var Jo=new tt(ct("cameraModeChanged")),Ko=new tt(ct("idleStateChanged")),Qo=new tt(ct("onEnterScene"));var ts=new tt(ct("onLeaveScene"));var es=new tt(ct("sceneStart")),ns=new tt(ct("playerExpression")),is=new tt(ct("onPointerLock")),rs=new tt(ct("videoEvent")),os=new tt(ct("profileChanged")),ss=new tt(ct("playerConnected")),as=new tt(ct("playerDisconnected")),cs=new tt(ct("onRealmChanged")),hs=new tt(ct("playerClicked"));function ar(i){Se=i,Se&&Se.onEvent(function(t){switch(t.type){case"onEnterScene":{Qo.notifyObservers(t.data);return}case"onLeaveScene":{ts.notifyObservers(t.data);return}case"cameraModeChanged":{Jo.notifyObservers(t.data);return}case"idleStateChanged":{Ko.notifyObservers(t.data);return}case"sceneStart":{es.notifyObservers(t.data);return}case"playerExpression":{ns.notifyObservers(t.data);return}case"videoEvent":{var e=t.data,n=_.engine.disposableComponents[e.componentId];n&&n.update(e),rs.notifyObservers(e);return}case"profileChanged":{os.notifyObservers(t.data);return}case"onPointerLock":{is.notifyObservers(t.data);return}case"playerConnected":{ss.notifyObservers(t.data);return}case"playerDisconnected":{as.notifyObservers(t.data);return}case"onRealmChanged":{cs.notifyObservers(t.data);return}case"playerClicked":{hs.notifyObservers(t.data);return}}})}m();var ps="0",cr=function(){function i(t){this.dcl=t,this.cachedComponents={}}return i.prototype.activate=function(t){var e=this;this.engine=t,t.eventManager.addListener(Ht,this,this.componentAdded),t.eventManager.addListener(Bt,this,this.componentRemoved),t.eventManager.addListener(Ye,this,this.disposableComponentCreated),t.eventManager.addListener(Xe,this,this.disposableComponentRemoved),t.eventManager.addListener(ze,this,this.disposableComponentUpdated),t.eventManager.addListener(Ge,this,this.parentChanged);var n=t.rootEntity.uuid;this.dcl.addEntity(n),this.dcl.onUpdate(function(r){t.update(r),e.presentEntities()}),this.dcl.onEvent(function(r){var o=r.data;switch(r.type){case"uuidEvent":t.eventManager.fireEvent(new $e(o.uuid,o.payload));break;case"raycastResponse":o.queryType==="HitFirst"?t.eventManager.fireEvent(new Me(o)):o.queryType==="HitAll"&&t.eventManager.fireEvent(new Me(o));break;case"actionButtonEvent":t.eventManager.fireEvent(new Je(o.payload));break}})},i.prototype.onAddEntity=function(t){if(t&&t.isAddedToEngine()){var e=t.uuid,n=t.getParent();this.dcl.addEntity(e),n&&this.dcl.setParent(e,n.uuid),this.cachedComponents[e]={};for(var r in t.components){var o=t.components[r],s=re(o);if(s!==null)if(Ve(o))this.dcl.attachEntityComponent(t.uuid,r,at(o));else{var a=JSON.stringify(o);this.dcl.updateEntityComponent(e,r,s,a),this.cachedComponents[e][r]=a}}}},i.prototype.onRemoveEntity=function(t){if(t.isAddedToEngine()){var e=t.uuid;this.dcl.removeEntity(e),delete this.cachedComponents[e]}},i.prototype.presentEntities=function(){for(var t in this.engine.entities){var e=this.engine.entities[t];for(var n in e.components){var r=e.components[n],o=re(r);if(o!==null&&!Ve(r)){var s=this.getJsonIfDirty(e.uuid,n,r);s&&(this.dcl.updateEntityComponent(e.uuid,n,o,s),this.clearDirty(e.uuid,n,r,s))}}}for(var a in this.engine.disposableComponents){var r=this.engine.disposableComponents[a];r instanceof c&&r.dirty&&(this.dcl.componentUpdated(a,JSON.stringify(r)),r.dirty=!1)}},i.prototype.componentAdded=function(t){if(t.entity.isAddedToEngine()){var e=t.entity.components[t.componentName];if(Ve(e))this.dcl.attachEntityComponent(t.entity.uuid,t.componentName,at(e));else if(t.classId!==null){var n=JSON.stringify(e);this.dcl.updateEntityComponent(t.entity.uuid,t.componentName,t.classId,n),this.cachedComponents[t.entity.uuid][t.componentName]=n}}},i.prototype.componentRemoved=function(t){t.entity.isAddedToEngine()&&(this.dcl.removeEntityComponent(t.entity.uuid,t.componentName),delete this.cachedComponents[t.entity.uuid][t.componentName])},i.prototype.disposableComponentCreated=function(t){this.dcl.componentCreated(t.componentId,t.componentName,t.classId)},i.prototype.disposableComponentRemoved=function(t){this.dcl.componentDisposed(t.componentId)},i.prototype.disposableComponentUpdated=function(t){this.dcl.componentUpdated(t.componentId,JSON.stringify(t.component))},i.prototype.parentChanged=function(t){this.dcl.setParent(t.entity.uuid,t.parent?t.parent.uuid:ps)},i.prototype.getJsonIfDirty=function(t,e,n){var r=JSON.stringify(n);return r!==this.cachedComponents[t][e]&&r},i.prototype.clearDirty=function(t,e,n,r){this.cachedComponents[t][e]=r},i}();m();m();var q=ue(Wt());m();var Is=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),fi=function(){return fi=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},fi.apply(this,arguments)},ce=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},he=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},Ne={looping:!0,speed:1,weight:1,layer:0},_r=function(i){Is(t,i);function t(e,n){n===void 0&&(n=Ne);var r=i.call(this)||this;return r.isAnimationClip=!0,r.looping=Ne.looping,r.weight=Ne.weight,r.playing=!1,r.shouldReset=!1,r.speed=Ne.speed,r.name=At("AnimClip"),r.layer=Ne.layer,r.clip=e,r.setParams(fi({},n)),r}return t.prototype.setParams=function(e){return this.looping=e.looping!==void 0?e.looping:this.looping,this.speed=e.speed||this.speed,this.weight=e.weight||this.weight,this.layer=e.layer||this.layer,this},t.prototype.toJSON=function(){var e=JSON.parse(JSON.stringify(i.prototype.toJSON.call(this)));return this.shouldReset&&(this.shouldReset=!1),e},t.prototype.play=function(e){var n;e===void 0&&(e=!1),(n=this.owner)===null||n===void 0||n.play(this,e)},t.prototype.pause=function(){var e;(e=this.owner)===null||e===void 0||e.pause(this)},t.prototype.reset=function(){this.shouldReset=!0},t.prototype.stop=function(){var e;(e=this.owner)===null||e===void 0||e.stop(this)},ce([c.readonly,he("design:type",String)],t.prototype,"clip",void 0),ce([c.field,he("design:type",Boolean)],t.prototype,"looping",void 0),ce([c.field,he("design:type",Number)],t.prototype,"weight",void 0),ce([c.field,he("design:type",Boolean)],t.prototype,"playing",void 0),ce([c.field,he("design:type",Boolean)],t.prototype,"shouldReset",void 0),ce([c.field,he("design:type",Number)],t.prototype,"speed",void 0),ce([c.readonly,he("design:type",String)],t.prototype,"name",void 0),t}(c);m();var Ae=ue(Wt());m();var _n;(function(i){i[i.DOWN=0]="DOWN",i[i.UP=1]="UP"})(_n||(_n={}));var On;(function(i){i[i.FirstPerson=0]="FirstPerson",i[i.ThirdPerson=1]="ThirdPerson",i[i.BuildingToolGodMode=2]="BuildingToolGodMode"})(On||(On={}));var Or;(function(i){i.OWNER="owner",i.OPERATOR="operator"})(Or||(Or={}));var Ir=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ct=function(){return Ct=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ct.apply(this,arguments)},Cr=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},$;(function(i){i.POINTER="POINTER",i.PRIMARY="PRIMARY",i.SECONDARY="SECONDARY",i.ANY="ANY",i.FORWARD="FORWARD",i.BACKWARD="BACKWARD",i.RIGHT="RIGHT",i.LEFT="LEFT",i.JUMP="JUMP",i.WALK="WALK",i.ACTION_3="ACTION_3",i.ACTION_4="ACTION_4",i.ACTION_5="ACTION_5",i.ACTION_6="ACTION_6"})($||($={}));var zr=function(){function i(t){if(this.callback=t,!t||!("apply"in t)||!("call"in t))throw new Error("Callback is not a function");yi.ensureInstance()}return i}();var Cs=function(i){Ir(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t=Cr([C("pointerDown")],t),t}(zr);var zs=function(i){Ir(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t=Cr([C("pointerUp")],t),t}(zr);var Ms=function(){function i(t,e){this.fn=t,this.useRaycast=e}return i}();var yi=function(){function i(){this.buttonIdMapping=[$.POINTER,$.PRIMARY,$.SECONDARY,$.ANY,$.FORWARD,$.BACKWARD,$.RIGHT,$.LEFT,$.JUMP,$.WALK,$.ACTION_3,$.ACTION_4,$.ACTION_5,$.ACTION_6],this.subscriptions=this.buttonIdMapping.reduce(function(t,e){var n;return Ct(Ct({},t),(n={},n[e]={BUTTON_DOWN:[],BUTTON_UP:[]},n))},{}),this.internalState=this.buttonIdMapping.reduce(function(t,e){var n;return Ct(Ct({},t),(n={},n[e]={BUTTON_DOWN:!1},n))},{})}return Object.defineProperty(i,"instance",{get:function(){return i.ensureInstance(),i._instance},enumerable:!1,configurable:!0}),i.ensureInstance=function(){i._instance||(i._instance=new i)},i.prototype.isButtonPressed=function(t){return this.internalState[t]},i.prototype.subscribe=function(t,e,n,r){var o=this;return this.subscriptions[e][t].push(new Ms(r,n)),function(){o.unsubscribe(t,e,r)}},i.prototype.unsubscribe=function(t,e,n){var r=this.getSubscriptionId(t,e,n);return r>-1?this.subscriptions[e][t].splice(r,1):!1},i.prototype.handlePointerEvent=function(t){var e=this.getPointerById(t.buttonId);if(!!e){var n=Ct(Ct({},t),{button:e,direction:new Ae.Vector3().copyFrom(t.direction),origin:new Ae.Vector3().copyFrom(t.origin),hit:void 0}),r=t.hit?Ct(Ct({},t.hit),{hitPoint:new Ae.Vector3().copyFrom(t.hit.hitPoint),normal:new Ae.Vector3().copyFrom(t.hit.normal),worldNormal:new Ae.Vector3().copyFrom(t.hit.worldNormal)}):void 0;if(t.type===_n.DOWN){this.internalState[e].BUTTON_DOWN=!0;for(var o=0;o<this.subscriptions[e].BUTTON_DOWN.length;o++){var s=this.subscriptions[e].BUTTON_DOWN[o];s.useRaycast?n.hit=r:n.hit=void 0,s.fn(n)}if(r&&r.entityId&&_.engine){var a=_.engine.entities[r.entityId],h=a&&a.getComponentOrNull(Cs);h&&(n.hit=r,h.callback(n))}}else{this.internalState[e].BUTTON_DOWN=!1;for(var o=0;o<this.subscriptions[e].BUTTON_UP.length;o++){var s=this.subscriptions[e].BUTTON_UP[o];s.useRaycast?n.hit=r:n.hit=void 0,s.fn(n)}if(r&&r.entityId&&_.engine){var a=_.engine.entities[r.entityId],h=a&&a.getComponentOrNull(zs);h&&(n.hit=r,h.callback(n))}}}},i.prototype.getSubscriptionId=function(t,e,n){for(var r=0;r<this.subscriptions[e][t].length;r++)if(this.subscriptions[e][t][r].fn===n)return r;return-1},i.prototype.getPointerById=function(t){if(t<0||t>=this.buttonIdMapping.length)return null;var e=this.buttonIdMapping[t];return e===$.ANY?null:e},i}();var M=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),In=function(){return In=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},In.apply(this,arguments)},l=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},y=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},T;(function(i){i[i.TRANSFORM=1]="TRANSFORM",i[i.UUID_CALLBACK=8]="UUID_CALLBACK",i[i.BOX_SHAPE=16]="BOX_SHAPE",i[i.SPHERE_SHAPE=17]="SPHERE_SHAPE",i[i.PLANE_SHAPE=18]="PLANE_SHAPE",i[i.CONE_SHAPE=19]="CONE_SHAPE",i[i.CYLINDER_SHAPE=20]="CYLINDER_SHAPE",i[i.TEXT_SHAPE=21]="TEXT_SHAPE",i[i.NFT_SHAPE=22]="NFT_SHAPE",i[i.UI_WORLD_SPACE_SHAPE=23]="UI_WORLD_SPACE_SHAPE",i[i.UI_SCREEN_SPACE_SHAPE=24]="UI_SCREEN_SPACE_SHAPE",i[i.UI_CONTAINER_RECT=25]="UI_CONTAINER_RECT",i[i.UI_CONTAINER_STACK=26]="UI_CONTAINER_STACK",i[i.UI_TEXT_SHAPE=27]="UI_TEXT_SHAPE",i[i.UI_INPUT_TEXT_SHAPE=28]="UI_INPUT_TEXT_SHAPE",i[i.UI_IMAGE_SHAPE=29]="UI_IMAGE_SHAPE",i[i.UI_SLIDER_SHAPE=30]="UI_SLIDER_SHAPE",i[i.CIRCLE_SHAPE=31]="CIRCLE_SHAPE",i[i.BILLBOARD=32]="BILLBOARD",i[i.ANIMATION=33]="ANIMATION",i[i.FONT=34]="FONT",i[i.UI_FULLSCREEN_SHAPE=40]="UI_FULLSCREEN_SHAPE",i[i.UI_BUTTON_SHAPE=41]="UI_BUTTON_SHAPE",i[i.GLTF_SHAPE=54]="GLTF_SHAPE",i[i.OBJ_SHAPE=55]="OBJ_SHAPE",i[i.AVATAR_SHAPE=56]="AVATAR_SHAPE",i[i.BASIC_MATERIAL=64]="BASIC_MATERIAL",i[i.PBR_MATERIAL=65]="PBR_MATERIAL",i[i.HIGHLIGHT_ENTITY=66]="HIGHLIGHT_ENTITY",i[i.SOUND=67]="SOUND",i[i.TEXTURE=68]="TEXTURE",i[i.VIDEO_CLIP=70]="VIDEO_CLIP",i[i.VIDEO_TEXTURE=71]="VIDEO_TEXTURE",i[i.AVATAR_TEXTURE=72]="AVATAR_TEXTURE",i[i.AUDIO_CLIP=200]="AUDIO_CLIP",i[i.AUDIO_SOURCE=201]="AUDIO_SOURCE",i[i.AUDIO_STREAM=202]="AUDIO_STREAM",i[i.GIZMOS=203]="GIZMOS",i[i.SMART_ITEM=204]="SMART_ITEM",i[i.AVATAR_MODIFIER_AREA=205]="AVATAR_MODIFIER_AREA",i[i.AVATAR_ATTACH=206]="AVATAR_ATTACH",i[i.CAMERA_MODE_AREA=207]="CAMERA_MODE_AREA",i[i.NAME=300]="NAME",i[i.LOCKED_ON_EDIT=301]="LOCKED_ON_EDIT",i[i.VISIBLE_ON_EDIT=302]="VISIBLE_ON_EDIT"})(T||(T={}));var Mr;(function(i){i.HIDE_AVATARS="HIDE_AVATARS",i.DISABLE_PASSPORTS="DISABLE_PASSPORTS"})(Mr||(Mr={}));var lc=function(i){M(t,i);function t(e){var n=i.call(this)||this;return n.area=e.area,n.modifiers=e.modifiers,n.excludeIds=e.excludeIds,n}return l([c.field,y("design:type",Object)],t.prototype,"area",void 0),l([c.field,y("design:type",Array)],t.prototype,"modifiers",void 0),l([c.field,y("design:type",Array)],t.prototype,"excludeIds",void 0),t=l([C("engine.avatarModifierArea",T.AVATAR_MODIFIER_AREA),y("design:paramtypes",[Object])],t),t}(c);var Sr=function(i){M(t,i);function t(e){e===void 0&&(e={});var n=i.call(this)||this;return n.position=e.position||q.Vector3.Zero(),n.rotation=e.rotation||q.Quaternion.Identity,n.scale=e.scale||new q.Vector3(1,1,1),n}return Object.defineProperty(t.prototype,"eulerAngles",{get:function(){return this.rotation.eulerAngles},enumerable:!1,configurable:!0}),t.prototype.lookAt=function(e,n){n===void 0&&(n=q.MathTmp.staticUp);var r=new q.Matrix;return q.Matrix.LookAtLHToRef(this.position,e,n,r),r.invert(),q.Quaternion.FromRotationMatrixToRef(r,this.rotation),this},t.prototype.rotate=function(e,n){return this.rotation.multiplyInPlace(this.rotation.angleAxis(n,e)),this},t.prototype.translate=function(e){return this.position.addInPlace(e),this},l([c.field,y("design:type",q.Vector3)],t.prototype,"position",void 0),l([c.field,y("design:type",q.Quaternion)],t.prototype,"rotation",void 0),l([c.field,y("design:type",q.Vector3)],t.prototype,"scale",void 0),t=l([C("engine.transform",T.TRANSFORM),y("design:paramtypes",[Object])],t),t}(c);var mi;(function(i){i[i.Position=0]="Position",i[i.NameTag=1]="NameTag",i[i.LeftHand=2]="LeftHand",i[i.RightHand=3]="RightHand"})(mi||(mi={}));var fc=function(i){M(t,i);function t(e){e===void 0&&(e={});var n=i.call(this)||this;return n.avatarId=e.avatarId||"",n.anchorPointId=e.anchorPointId||mi.Position,n}return l([c.field,y("design:type",String)],t.prototype,"avatarId",void 0),l([c.field,y("design:type",Number)],t.prototype,"anchorPointId",void 0),l([c.field,y("design:type",String)],t.prototype,"avatarSceneId",void 0),t=l([C("engine.transform",T.AVATAR_ATTACH),y("design:paramtypes",[Object])],t),t}(c);var yc=function(i){M(t,i);function t(e,n,r){e===void 0&&(e=!0),n===void 0&&(n=!0),r===void 0&&(r=!0);var o=i.call(this)||this;return o.x=!0,o.y=!0,o.z=!0,o.x=e,o.y=n,o.z=r,o}return l([c.field,y("design:type",Boolean)],t.prototype,"x",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"y",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"z",void 0),t=l([C("engine.billboard",T.BILLBOARD),y("design:paramtypes",[Boolean,Boolean,Boolean])],t),t}(c);var pt=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.withCollisions=!0,e.isPointerBlocker=!0,e.visible=!0,e}return l([c.field,y("design:type",Boolean)],t.prototype,"withCollisions",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"isPointerBlocker",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"visible",void 0),t}(c);var mc=function(i){M(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return l([c.field,y("design:type",Array)],t.prototype,"uvs",void 0),t=l([_("engine.shape",T.BOX_SHAPE)],t),t}(pt);var gc=function(i){M(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t=l([_("engine.shape",T.SPHERE_SHAPE)],t),t}(pt);var vc=function(i){M(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return l([c.field,y("design:type",Number)],t.prototype,"segments",void 0),l([c.field,y("design:type",Number)],t.prototype,"arc",void 0),t=l([_("engine.shape",T.CIRCLE_SHAPE)],t),t}(pt);var xc=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.width=1,e.height=1,e}return l([c.field,y("design:type",Number)],t.prototype,"width",void 0),l([c.field,y("design:type",Number)],t.prototype,"height",void 0),l([c.field,y("design:type",Array)],t.prototype,"uvs",void 0),t=l([_("engine.shape",T.PLANE_SHAPE)],t),t}(pt);var wc=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.radiusTop=0,e.radiusBottom=1,e.segmentsHeight=1,e.segmentsRadial=36,e.openEnded=!1,e.radius=null,e.arc=360,e}return l([c.field,y("design:type",Number)],t.prototype,"radiusTop",void 0),l([c.field,y("design:type",Number)],t.prototype,"radiusBottom",void 0),l([c.field,y("design:type",Number)],t.prototype,"segmentsHeight",void 0),l([c.field,y("design:type",Number)],t.prototype,"segmentsRadial",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"openEnded",void 0),l([c.field,y("design:type",Object)],t.prototype,"radius",void 0),l([c.field,y("design:type",Number)],t.prototype,"arc",void 0),t=l([_("engine.shape",T.CONE_SHAPE)],t),t}(pt);var bc=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.radiusTop=1,e.radiusBottom=1,e.segmentsHeight=1,e.segmentsRadial=36,e.openEnded=!1,e.radius=null,e.arc=360,e}return l([c.field,y("design:type",Number)],t.prototype,"radiusTop",void 0),l([c.field,y("design:type",Number)],t.prototype,"radiusBottom",void 0),l([c.field,y("design:type",Number)],t.prototype,"segmentsHeight",void 0),l([c.field,y("design:type",Number)],t.prototype,"segmentsRadial",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"openEnded",void 0),l([c.field,y("design:type",Object)],t.prototype,"radius",void 0),l([c.field,y("design:type",Number)],t.prototype,"arc",void 0),t=l([_("engine.shape",T.CYLINDER_SHAPE)],t),t}(pt);var Ec=function(i){M(t,i);function t(e){var n=i.call(this)||this;return n.src=e,n}return l([pt.readonly,y("design:type",String)],t.prototype,"src",void 0),t=l([_("engine.shape",T.GLTF_SHAPE),y("design:paramtypes",[String])],t),t}(pt);var gi;(function(i){i[i.Classic=0]="Classic",i[i.Baroque_Ornament=1]="Baroque_Ornament",i[i.Diamond_Ornament=2]="Diamond_Ornament",i[i.Minimal_Wide=3]="Minimal_Wide",i[i.Minimal_Grey=4]="Minimal_Grey",i[i.Blocky=5]="Blocky",i[i.Gold_Edges=6]="Gold_Edges",i[i.Gold_Carved=7]="Gold_Carved",i[i.Gold_Wide=8]="Gold_Wide",i[i.Gold_Rounded=9]="Gold_Rounded",i[i.Metal_Medium=10]="Metal_Medium",i[i.Metal_Wide=11]="Metal_Wide",i[i.Metal_Slim=12]="Metal_Slim",i[i.Metal_Rounded=13]="Metal_Rounded",i[i.Pins=14]="Pins",i[i.Minimal_Black=15]="Minimal_Black",i[i.Minimal_White=16]="Minimal_White",i[i.Tape=17]="Tape",i[i.Wood_Slim=18]="Wood_Slim",i[i.Wood_Wide=19]="Wood_Wide",i[i.Wood_Twigs=20]="Wood_Twigs",i[i.Canvas=21]="Canvas",i[i.None=22]="None"})(gi||(gi={}));var Tc=function(i){M(t,i);function t(e,n){n===void 0&&(n={});var r=i.call(this)||this;r.src=e;var o=new q.Color3(.6404918,.611472,.8584906),s=gi.Classic;return"r"in n?o=n:n!==null&&(n.color&&(o=n.color),n.style&&(s=n.style)),r.color=o,r.style=s,r}return l([pt.readonly,y("design:type",String)],t.prototype,"src",void 0),l([pt.readonly,y("design:type",Number)],t.prototype,"style",void 0),l([c.field,y("design:type",q.Color3)],t.prototype,"color",void 0),t=l([_("engine.shape",T.NFT_SHAPE),y("design:paramtypes",[String,Object])],t),t}(pt);var Rc=function(i){M(t,i);function t(e,n){var r=i.call(this)||this,o=new RegExp("data:[a-z-]+/[a-z-]+;base64");if((e.length>2048||o.test(e))&&Q("\u26A0\uFE0F\u{1F6A8} Base64 textures will be deprecated in version 7 of decentraland-ecs"),r.src=e,n)for(var s in n){var a=r;a[s]=n[s]}return r}return l([c.readonly,y("design:type",String)],t.prototype,"src",void 0),l([c.readonly,y("design:type",Number)],t.prototype,"samplingMode",void 0),l([c.readonly,y("design:type",Number)],t.prototype,"wrap",void 0),l([c.readonly,y("design:type",Boolean)],t.prototype,"hasAlpha",void 0),t=l([_("engine.texture",T.TEXTURE),y("design:paramtypes",[String,Object])],t),t}(c);var Ac=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.states=[],e}return t.prototype.addClip=function(e){var n=this;return this.states.push(e),e.onChange(function(){n.dirty=!0}),e.owner=this,this},t.prototype.getClip=function(e){for(var n=0;n<this.states.length;n++){var r=this.states[n];if(r.clip===e)return r}var o=new _r(e);return this.addClip(o),o},t.prototype.stop=function(e){if(e)e.playing=!1,e.shouldReset=!0;else for(var n=0;n<this.states.length;n++){var r=this.states[n];this.stop(r)}},t.prototype.play=function(e,n){n===void 0&&(n=!1);for(var r=0;r<this.states.length;r++){var o=this.states[r];o.layer===e.layer&&e!==o&&this.pause(o)}n&&(e.shouldReset=!0),e.playing=!0,e.dirty=!0,e.data.nonce=Math.random()},t.prototype.pause=function(e){if(e)e.playing=!1;else for(var n=0;n<this.states.length;n++){var r=this.states[n];this.pause(r)}},l([c.readonly,y("design:type",Array)],t.prototype,"states",void 0),t=l([C("engine.animator",T.ANIMATION)],t),t}(pt);var _c=function(i){M(t,i);function t(e){var n=i.call(this)||this;return n.src=e,n}return l([c.readonly,y("design:type",String)],t.prototype,"src",void 0),t=l([_("engine.shape",T.OBJ_SHAPE),y("design:paramtypes",[String])],t),t}(pt);var Cn=function(i){M(t,i);function t(e){e===void 0&&(e="");var n=i.call(this)||this;return n.src=e,n}return l([c.readonly,y("design:type",String)],t.prototype,"src",void 0),t=l([_("engine.font",T.FONT),y("design:paramtypes",[String])],t),t}(c);var Pr;(function(i){i.SanFrancisco="builtin:SF-UI-Text-Regular SDF",i.SanFrancisco_Heavy="builtin:SF-UI-Text-Heavy SDF",i.SanFrancisco_Semibold="builtin:SF-UI-Text-Semibold SDF",i.LiberationSans="builtin:LiberationSans SDF",i.SansSerif="SansSerif",i.SansSerif_Heavy="SansSerif_Heavy",i.SansSerif_Bold="SansSerif_Bold",i.SansSerif_SemiBold="SansSerif_SemiBold"})(Pr||(Pr={}));var Oc=function(i){M(t,i);function t(e){var n=i.call(this)||this;return n.outlineWidth=0,n.outlineColor=new q.Color3(1,1,1),n.color=new q.Color3(1,1,1),n.fontSize=10,n.opacity=1,n.value="",n.lineSpacing="0px",n.lineCount=0,n.textWrapping=!1,n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowColor=new q.Color3(1,1,1),n.hTextAlign="center",n.vTextAlign="center",n.width=1,n.height=1,n.paddingTop=0,n.paddingRight=0,n.paddingBottom=0,n.paddingLeft=0,n.billboard=!1,n.visible=!0,e&&(n.value=e),n}return l([c.field,y("design:type",Number)],t.prototype,"outlineWidth",void 0),l([c.field,y("design:type",q.Color3)],t.prototype,"outlineColor",void 0),l([c.field,y("design:type",q.Color3)],t.prototype,"color",void 0),l([c.field,y("design:type",Number)],t.prototype,"fontSize",void 0),l([c.component,y("design:type",Cn)],t.prototype,"font",void 0),l([c.field,y("design:type",Number)],t.prototype,"opacity",void 0),l([c.field,y("design:type",String)],t.prototype,"value",void 0),l([c.field,y("design:type",String)],t.prototype,"lineSpacing",void 0),l([c.field,y("design:type",Number)],t.prototype,"lineCount",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"textWrapping",void 0),l([c.field,y("design:type",Number)],t.prototype,"shadowBlur",void 0),l([c.field,y("design:type",Number)],t.prototype,"shadowOffsetX",void 0),l([c.field,y("design:type",Number)],t.prototype,"shadowOffsetY",void 0),l([c.field,y("design:type",q.Color3)],t.prototype,"shadowColor",void 0),l([c.field,y("design:type",String)],t.prototype,"hTextAlign",void 0),l([c.field,y("design:type",String)],t.prototype,"vTextAlign",void 0),l([c.field,y("design:type",Number)],t.prototype,"width",void 0),l([c.field,y("design:type",Number)],t.prototype,"height",void 0),l([c.field,y("design:type",Number)],t.prototype,"paddingTop",void 0),l([c.field,y("design:type",Number)],t.prototype,"paddingRight",void 0),l([c.field,y("design:type",Number)],t.prototype,"paddingBottom",void 0),l([c.field,y("design:type",Number)],t.prototype,"paddingLeft",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"billboard",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"visible",void 0),t=l([C("engine.text",T.TEXT_SHAPE),y("design:paramtypes",[String])],t),t}(c);var vi;(function(i){i[i.OPAQUE=0]="OPAQUE",i[i.ALPHA_TEST=1]="ALPHA_TEST",i[i.ALPHA_BLEND=2]="ALPHA_BLEND",i[i.ALPHA_TEST_AND_BLEND=3]="ALPHA_TEST_AND_BLEND",i[i.AUTO=4]="AUTO"})(vi||(vi={}));var Ic=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.alphaTest=.5,e.castShadows=!0,e.transparencyMode=vi.AUTO,e}return l([c.field,y("design:type",Number)],t.prototype,"alphaTest",void 0),l([c.field,y("design:type",Object)],t.prototype,"albedoColor",void 0),l([c.field,y("design:type",q.Color3)],t.prototype,"emissiveColor",void 0),l([c.field,y("design:type",Number)],t.prototype,"metallic",void 0),l([c.field,y("design:type",Number)],t.prototype,"roughness",void 0),l([c.field,y("design:type",q.Color3)],t.prototype,"reflectivityColor",void 0),l([c.field,y("design:type",Number)],t.prototype,"directIntensity",void 0),l([c.field,y("design:type",Number)],t.prototype,"microSurface",void 0),l([c.field,y("design:type",Number)],t.prototype,"emissiveIntensity",void 0),l([c.field,y("design:type",Number)],t.prototype,"specularIntensity",void 0),l([c.component,y("design:type",Object)],t.prototype,"albedoTexture",void 0),l([c.component,y("design:type",Object)],t.prototype,"alphaTexture",void 0),l([c.component,y("design:type",Object)],t.prototype,"emissiveTexture",void 0),l([c.component,y("design:type",Object)],t.prototype,"bumpTexture",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"castShadows",void 0),l([c.field,y("design:type",Number)],t.prototype,"transparencyMode",void 0),t=l([_("engine.material",T.PBR_MATERIAL)],t),t}(c);var Cc=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.alphaTest=.5,e.castShadows=!0,e}return l([c.component,y("design:type",Object)],t.prototype,"texture",void 0),l([c.field,y("design:type",Number)],t.prototype,"alphaTest",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"castShadows",void 0),t=l([_("engine.material",T.BASIC_MATERIAL)],t),t}(c);var k=function(i){M(t,i);function t(e){var n=i.call(this)||this;if(n.uuid=At("UUID"),!e||!("apply"in e)||!("call"in e))throw new Error("Callback is not a function");return n.callback=e,n}return t.uuidEvent=function(e,n){if(delete e[n]){var r=n+"_"+Math.random();e[r]=void 0,Object.defineProperty(e,r,In(In({},Object.getOwnPropertyDescriptor(e,r)),{enumerable:!1})),Object.defineProperty(e,n.toString(),{get:function(){return this[r]},set:function(o){var s=this[r];if(o)if(o instanceof t)this.data[n]=o.uuid;else throw new Error("value is not an OnUUIDEvent");else this.data[n]=null;if(this[r]=o,o!==s){this.dirty=!0;for(var a=0;a<this.subscriptions.length;a++)this.subscriptions[a](n,o,s)}},enumerable:!0})}},t.prototype.toJSON=function(){return{uuid:this.uuid,type:this.type}},l([c.field,y("design:type",Function)],t.prototype,"callback",void 0),t}(c);var _e=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.button=$.ANY,e.hoverText="Interact",e.distance=10,e.showFeedback=!0,e}return t.prototype.toJSON=function(){return{uuid:this.uuid,type:this.type,button:this.button,hoverText:this.hoverText,distance:this.distance,showFeedback:this.showFeedback}},l([c.field,y("design:type",String)],t.prototype,"button",void 0),l([c.field,y("design:type",String)],t.prototype,"hoverText",void 0),l([c.field,y("design:type",Number)],t.prototype,"distance",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"showFeedback",void 0),t}(k);var zc=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.type="onPointerLock",e}return l([c.readonly,y("design:type",String)],t.prototype,"type",void 0),t=l([C("engine.onPointerLock",T.UUID_CALLBACK)],t),t}(k);var Mc=function(i){M(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.type="onAnimationEnd",e}return l([c.readonly,y("design:type",String)],t.prototype,"type",void 0),t=l([C("engine.onAnimationEnd",T.UUID_CALLBACK)],t),t}(k);var Sc=function(i){M(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t=l([C("engine.smartItem",T.SMART_ITEM)],t),t}(c);var Fr=function(i){M(t,i);function t(e){var n=i.call(this)||this;return n.url=e,n}return l([c.readonly,y("design:type",String)],t.prototype,"url",void 0),t=l([_("engine.VideoClip",T.VIDEO_CLIP),y("design:paramtypes",[String])],t),t}(c);var zn;(function(i){i[i.NONE=0]="NONE",i[i.ERROR=1]="ERROR",i[i.LOADING=2]="LOADING",i[i.READY=3]="READY",i[i.PLAYING=4]="PLAYING",i[i.BUFFERING=5]="BUFFERING"})(zn||(zn={}));var Pc=function(i){M(t,i);function t(e,n){var r=i.call(this)||this;if(r.volume=1,r.playbackRate=1,r.loop=!1,r.seek=-1,r._position=-1,r._videoLength=-1,r._status=zn.NONE,r.playing=!1,!(e instanceof Fr))throw new Error("Trying to create VideoTexture(VideoClip) with an invalid VideoClip");if(r.videoClipId=at(e),n)for(var o in n){var s=r;s[o]=n[o]}return r}return t.prototype.play=function(){this.playing=!0},t.prototype.pause=function(){this.playing=!1},t.prototype.reset=function(){this.seekTime(0),this.pause()},t.prototype.seekTime=function(e){this.seek=e,this.dirty=!0,this.data.nonce=Math.random()},t.prototype.toJSON=function(){if(this.seek>=0){var e=JSON.parse(JSON.stringify(i.prototype.toJSON.call(this)));return this.seek=-1,e}return i.prototype.toJSON.call(this)},t.prototype.update=function(e){e.videoClipId===this.videoClipId&&(this._status=e.videoStatus||zn.NONE,this._videoLength=e.totalVideoLength,this._position=e.currentOffset)},Object.defineProperty(t.prototype,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoLength",{get:function(){return this._videoLength},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),l([c.readonly,y("design:type",String)],t.prototype,"videoClipId",void 0),l([c.readonly,y("design:type",Number)],t.prototype,"samplingMode",void 0),l([c.readonly,y("design:type",Number)],t.prototype,"wrap",void 0),l([c.field,y("design:type",Number)],t.prototype,"volume",void 0),l([c.field,y("design:type",Number)],t.prototype,"playbackRate",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"loop",void 0),l([c.field,y("design:type",Number)],t.prototype,"seek",void 0),l([c.field,y("design:type",Boolean)],t.prototype,"playing",void 0),t=l([_("engine.VideoTexture",T.VIDEO_TEXTURE),y("design:paramtypes",[Fr,Object])],t),t}(c);var Fc=function(i){M(t,i);function t(e){var n=i.call(this)||this;return n.area=e.area,n.cameraMode=e.cameraMode,n}return l([c.field,y("design:type",Object)],t.prototype,"area",void 0),l([c.field,y("design:type",Number)],t.prototype,"cameraMode",void 0),t=l([C("engine.cameraModeArea",T.CAMERA_MODE_AREA),y("design:paramtypes",[Object])],t),t}(c);var Bc=function(i){M(t,i);function t(e,n){var r=i.call(this)||this;if(r.userId=e,n)for(var o in n){var s=r;s[o]=n[o]}return r}return l([c.readonly,y("design:type",String)],t.prototype,"userId",void 0),l([c.readonly,y("design:type",Number)],t.prototype,"samplingMode",void 0),l([c.readonly,y("design:type",Number)],t.prototype,"wrap",void 0),l([c.readonly,y("design:type",Boolean)],t.prototype,"hasAlpha",void 0),t=l([_("engine.texture",T.AVATAR_TEXTURE),y("design:paramtypes",[String,Object])],t),t}(c);m();var Ue=ue(Wt());m();var Oe=ue(Wt());var xi=function(){function i(){var t=this;this.position=new Oe.Vector3,this.rotation=new Oe.Quaternion,this.feetPosition=new Oe.Vector3,this.worldPosition=new Oe.Vector3,this.lastEventPosition={x:0,y:0,z:0},this.lastEventWorldPosition={x:0,y:0,z:0},this.lastEventRotation={x:0,y:0,z:0,w:1},this._playerHeight=1.6,this._cameraMode=On.ThirdPerson,typeof dcl!="undefined"&&(dcl.subscribe("positionChanged"),dcl.subscribe("rotationChanged"),dcl.subscribe("cameraModeChanged"),dcl.onEvent(function(e){switch(e.type){case"positionChanged":t.positionChanged(e.data);break;case"rotationChanged":t.rotationChanged(e.data);break;case"cameraModeChanged":t.cameraModeChanged(e.data);break}})),Object.defineProperty(this.position,"x",{get:function(){return t.lastEventPosition.x}}),Object.defineProperty(this.position,"y",{get:function(){return t.lastEventPosition.y}}),Object.defineProperty(this.position,"z",{get:function(){return t.lastEventPosition.z}}),Object.defineProperty(this.worldPosition,"x",{get:function(){return t.lastEventWorldPosition.x}}),Object.defineProperty(this.worldPosition,"y",{get:function(){return t.lastEventWorldPosition.y}}),Object.defineProperty(this.worldPosition,"z",{get:function(){return t.lastEventWorldPosition.z}}),Object.defineProperty(this.feetPosition,"x",{get:function(){return t.lastEventPosition.x}}),Object.defineProperty(this.feetPosition,"y",{get:function(){return t.lastEventPosition.y-t.playerHeight}}),Object.defineProperty(this.feetPosition,"z",{get:function(){return t.lastEventPosition.z}}),Object.defineProperty(this.rotation,"x",{get:function(){return t.lastEventRotation.x}}),Object.defineProperty(this.rotation,"y",{get:function(){return t.lastEventRotation.y}}),Object.defineProperty(this.rotation,"z",{get:function(){return t.lastEventRotation.z}}),Object.defineProperty(this.rotation,"w",{get:function(){return t.lastEventRotation.w}})}return Object.defineProperty(i,"instance",{get:function(){return i._instance||(i._instance=new i),i._instance},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"playerHeight",{get:function(){return this._playerHeight},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cameraMode",{get:function(){return this._cameraMode},enumerable:!1,configurable:!0}),i.prototype.positionChanged=function(t){this.lastEventPosition=t.position,this.lastEventWorldPosition=t.cameraPosition,this._playerHeight=t.playerHeight},i.prototype.rotationChanged=function(t){this.lastEventRotation=t.quaternion},i.prototype.cameraModeChanged=function(t){this._cameraMode=t.cameraMode},i}();var Mn;(function(i){i.HitFirst="rqhf",i.HitAll="rqha"})(Mn||(Mn={}));var wi=function(){function i(){this.queries={}}return Object.defineProperty(i,"instance",{get:function(){return i.ensureInstance(),i._instance},enumerable:!1,configurable:!0}),i.ensureInstance=function(){i._instance||(i._instance=new i)},i.prototype.getRayFromCamera=function(t){var e=xi.instance.rotation,n=Ue.Matrix.Identity();e.toRotationMatrix(n);var r=Ue.Vector3.TransformCoordinates(Ue.Vector3.Forward(),n),o={origin:xi.instance.position,direction:r,distance:t};return o},i.prototype.getRayFromPositions=function(t,e){var n=e.subtract(t),r=n.length(),o={origin:t,direction:n.normalize(),distance:r};return o},i.prototype.hitFirst=function(t,e,n){var r=typeof n=="number"?Mn.HitFirst+n:Wn();this.queries[r]=e,typeof dcl!="undefined"&&dcl.query("raycast",{queryId:r,queryType:"HitFirst",ray:t})},i.prototype.hitAll=function(t,e,n){var r=typeof n=="number"?Mn.HitAll+n:Wn();this.queries[r]=e,typeof dcl!="undefined"&&dcl.query("raycast",{queryId:r,queryType:"HitAll",ray:t})},i.prototype.hitFirstAvatar=function(t,e){Q("not implemented yet")},i.prototype.hitAllAvatars=function(t,e){Q("not implemented yet")},i.prototype.handleRaycastHitFirstResponse=function(t){this.queries[t.payload.queryId](t.payload.payload),delete this.queries[t.payload.queryId]},i.prototype.handleRaycastHitAllResponse=function(t){this.queries[t.payload.queryId](t.payload.payload),delete this.queries[t.payload.queryId]},i}();var Ss=function(){function i(){}return i.prototype.activate=function(t){t.eventManager.addListener(Me,this,function(e){e.payload.queryType==="HitFirst"?wi.instance.handleRaycastHitFirstResponse(e):e.payload.queryType==="HitAll"&&wi.instance.handleRaycastHitAllResponse(e)}),typeof dcl!="undefined"&&dcl.subscribe("raycastResponse")},i.prototype.deactivate=function(){typeof dcl!="undefined"&&dcl.unsubscribe("raycastResponse")},i}();var Ps=function(){function i(){}return i.prototype.activate=function(t){t.eventManager.addListener(Je,this,function(e){yi.instance.handlePointerEvent(e.payload)}),typeof dcl!="undefined"&&(dcl.subscribe("pointerUp"),dcl.subscribe("pointerDown"),dcl.subscribe("actionButtonEvent"))},i.prototype.deactivate=function(){typeof dcl!="undefined"&&(dcl.unsubscribe("pointerUp"),dcl.unsubscribe("pointerDown"),dcl.unsubscribe("actionButtonEvent"))},i}();var Fs=function(){function i(){this.handlerMap={}}return i.prototype.activate=function(t){t.eventManager.addListener($e,this,this.handleEvent),t.eventManager.addListener(Ht,this,this.componentAdded),t.eventManager.addListener(Bt,this,this.componentRemoved),typeof dcl!="undefined"&&dcl.subscribe("uuidEvent")},i.prototype.deactivate=function(){typeof dcl!="undefined"&&dcl.unsubscribe("uuidEvent")},i.prototype.onAddEntity=function(t){for(var e in t.components){var n=t.components[e];n instanceof k&&(this.handlerMap[n.uuid]=n)}},i.prototype.onRemoveEntity=function(t){for(var e in t.components){var n=t.components[e];n instanceof k&&delete this.handlerMap[n.uuid]}},i.prototype.componentAdded=function(t){if(t.entity.isAddedToEngine()){var e=t.entity.components[t.componentName];e instanceof k&&(this.handlerMap[e.uuid]=e)}},i.prototype.componentRemoved=function(t){t.entity.isAddedToEngine()&&t.component instanceof k&&delete this.handlerMap[t.component.uuid]},i.prototype.handleEvent=function(t){if(t.uuid in this.handlerMap){var e=this.handlerMap[t.uuid];e&&e.callback&&"call"in e.callback&&e.callback(t.payload)}},i}();var Br=new Ss,Nr=new Ps,ut=new Fs;m();var G=ue(Wt());m();var bi=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),nt=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},it=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},Ur=function(i){bi(t,i);function t(e){var n=i.call(this)||this;return n.loop=!1,n.volume=1,n.url=e,n}return nt([c.readonly,it("design:type",String)],t.prototype,"url",void 0),nt([c.field,it("design:type",Boolean)],t.prototype,"loop",void 0),nt([c.field,it("design:type",String)],t.prototype,"loadingCompleteEventId",void 0),nt([c.field,it("design:type",Number)],t.prototype,"volume",void 0),t=nt([_("engine.AudioClip",T.AUDIO_CLIP),it("design:paramtypes",[String])],t),t}(c);var Jc=function(i){bi(t,i);function t(e){var n=i.call(this)||this;if(n.audioClip=e,n.loop=!1,n.volume=1,n.playing=!1,n.pitch=1,n.playedAtTimestamp=Date.now(),!(e instanceof Ur))throw new Error("Trying to create AudioSource(AudioClip) with an invalid AudioClip");return n.audioClipId=at(e),n}return t.prototype.playOnce=function(){return this.playing=!0,this.dirty=!0,this.playedAtTimestamp=Date.now(),this.data.nonce=Math.random(),this},nt([c.readonly,it("design:type",String)],t.prototype,"audioClipId",void 0),nt([c.field,it("design:type",Boolean)],t.prototype,"loop",void 0),nt([c.field,it("design:type",Number)],t.prototype,"volume",void 0),nt([c.field,it("design:type",Boolean)],t.prototype,"playing",void 0),nt([c.field,it("design:type",Number)],t.prototype,"pitch",void 0),nt([c.field,it("design:type",Number)],t.prototype,"playedAtTimestamp",void 0),t=nt([C("engine.AudioSource",T.AUDIO_SOURCE),it("design:paramtypes",[Ur])],t),t}(c);var Kc=function(i){bi(t,i);function t(e){var n=i.call(this)||this;return n.playing=!1,n.volume=1,n.url=e,n.playing=!0,n}return nt([c.readonly,it("design:type",String)],t.prototype,"url",void 0),nt([c.field,it("design:type",Boolean)],t.prototype,"playing",void 0),nt([c.field,it("design:type",Number)],t.prototype,"volume",void 0),t=nt([C("engine.AudioStream",T.AUDIO_STREAM),it("design:paramtypes",[String])],t),t}(c);m();var Dr=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Dt=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},pe=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},Lr;(function(i){i.MOVE="MOVE",i.ROTATE="ROTATE",i.SCALE="SCALE",i.NONE="NONE"})(Lr||(Lr={}));var nh=function(i){Dr(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.type="gizmoEvent",e}return Dt([c.readonly,pe("design:type",String)],t.prototype,"type",void 0),t=Dt([C("engine.gizmoEvent",T.UUID_CALLBACK)],t),t}(k);var ih=function(i){Dr(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.position=!0,e.rotation=!0,e.scale=!0,e.cycle=!0,e.localReference=!1,e}return Dt([c.field,pe("design:type",Boolean)],t.prototype,"position",void 0),Dt([c.field,pe("design:type",Boolean)],t.prototype,"rotation",void 0),Dt([c.field,pe("design:type",Boolean)],t.prototype,"scale",void 0),Dt([c.field,pe("design:type",Boolean)],t.prototype,"cycle",void 0),Dt([c.field,pe("design:type",String)],t.prototype,"selectedGizmo",void 0),Dt([c.field,pe("design:type",Boolean)],t.prototype,"localReference",void 0),t=Dt([C("engine.gizmos",T.GIZMOS)],t),t}(c);m();var U=ue(Wt());m();var zt=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),V=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Z=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},ch=function(i){zt(t,i);function t(e){var n=i.call(this,e)||this;return n.type="onFocus",ut.handlerMap[n.uuid]=n,n}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.onFocus",T.UUID_CALLBACK),Z("design:paramtypes",[Function])],t),t}(k);var hh=function(i){zt(t,i);function t(e){var n=i.call(this,e)||this;return n.type="onTextSubmit",ut.handlerMap[n.uuid]=n,n}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.onTextSubmit",T.UUID_CALLBACK),Z("design:paramtypes",[Function])],t),t}(k);var ph=function(i){zt(t,i);function t(e){var n=i.call(this,e)||this;return n.type="onBlur",ut.handlerMap[n.uuid]=n,n}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.onBlur",T.UUID_CALLBACK),Z("design:paramtypes",[Function])],t),t}(k);var uh=function(i){zt(t,i);function t(e){var n=i.call(this,e)||this;return n.type="onEnter",ut.handlerMap[n.uuid]=n,n}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.onEnter",T.UUID_CALLBACK),Z("design:paramtypes",[Function])],t),t}(k);var Ei=function(i){zt(t,i);function t(e){var n=i.call(this,e)||this;return n.type="onChange",ut.handlerMap[n.uuid]=n,n}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.onChange",T.UUID_CALLBACK),Z("design:paramtypes",[Function])],t),t}(k);var dh=function(i){zt(t,i);function t(e,n){var r=i.call(this,e)||this;return r.type="onClick",ut.handlerMap[r.uuid]=r,n&&(r.showFeedback=n.showFeedback!==!1,n.button&&(r.button=n.button),n.hoverText&&(r.hoverText=n.hoverText),n.distance&&(r.distance=n.distance)),r}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.onClick",T.UUID_CALLBACK),Z("design:paramtypes",[Function,Object])],t),t}(_e);var lh=function(i){zt(t,i);function t(e,n){var r=i.call(this,e)||this;return r.type="pointerDown",ut.handlerMap[r.uuid]=r,n&&(r.showFeedback=n.showFeedback!==!1,n.button&&(r.button=n.button),n.hoverText&&(r.hoverText=n.hoverText),n.distance&&(r.distance=n.distance)),r}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.pointerDown",T.UUID_CALLBACK),Z("design:paramtypes",[Function,Object])],t),t}(_e);var fh=function(i){zt(t,i);function t(e,n){var r=i.call(this,e)||this;return r.type="pointerUp",ut.handlerMap[r.uuid]=r,n&&(r.showFeedback=n.showFeedback!==!1,n.button&&(r.button=n.button),n.hoverText&&(r.hoverText=n.hoverText),n.distance&&(r.distance=n.distance)),r}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.pointerUp",T.UUID_CALLBACK),Z("design:paramtypes",[Function,Object])],t),t}(_e);var yh=function(i){zt(t,i);function t(e,n){var r=i.call(this,e)||this;return r.type="pointerHoverEnter",ut.handlerMap[r.uuid]=r,n&&n.distance&&(r.distance=n.distance),r}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.pointerHoverEnter",T.UUID_CALLBACK),Z("design:paramtypes",[Function,Object])],t),t}(_e);var mh=function(i){zt(t,i);function t(e){var n=i.call(this,e)||this;return n.type="pointerHoverExit",ut.handlerMap[n.uuid]=n,n.distance=160,n}return V([c.readonly,Z("design:type",String)],t.prototype,"type",void 0),t=V([C("engine.pointerHoverExit",T.UUID_CALLBACK),Z("design:paramtypes",[Function])],t),t}(_e);var bt=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),g=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},v=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},Et=function(i){bt(t,i);function t(e){var n=i.call(this)||this;return n.name=null,n.visible=!0,n.opacity=1,n.hAlign="center",n.vAlign="center",n.width="100px",n.height="50px",n.positionX="0px",n.positionY="0px",n.isPointerBlocker=!0,e&&(n._parent=e,n.data.parentComponent=at(e)),n}return Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentComponent",{get:function(){return this.data.parentComponent},enumerable:!1,configurable:!0}),g([c.field,v("design:type",Object)],t.prototype,"name",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"visible",void 0),g([c.field,v("design:type",Number)],t.prototype,"opacity",void 0),g([c.field,v("design:type",String)],t.prototype,"hAlign",void 0),g([c.field,v("design:type",String)],t.prototype,"vAlign",void 0),g([c.uiValue,v("design:type",Object)],t.prototype,"width",void 0),g([c.uiValue,v("design:type",Object)],t.prototype,"height",void 0),g([c.uiValue,v("design:type",Object)],t.prototype,"positionX",void 0),g([c.uiValue,v("design:type",Object)],t.prototype,"positionY",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"isPointerBlocker",void 0),t}(c);var bh=function(i){bt(t,i);function t(){return i.call(this,null)||this}return t=g([_("engine.shape",T.UI_FULLSCREEN_SHAPE),v("design:paramtypes",[])],t),t}(Et);var Eh=function(i){bt(t,i);function t(){return i.call(this,null)||this}return t=g([_("engine.shape",T.UI_WORLD_SPACE_SHAPE),v("design:paramtypes",[])],t),t}(Et);var Th=function(i){bt(t,i);function t(){return i.call(this,null)||this}return t=g([_("engine.shape",T.UI_SCREEN_SPACE_SHAPE),v("design:paramtypes",[])],t),t}(Et);var Rh=function(i){bt(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.thickness=0,e.color=U.Color4.Clear(),e.alignmentUsesSize=!0,e}return g([c.field,v("design:type",Number)],t.prototype,"thickness",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"color",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"alignmentUsesSize",void 0),t=g([_("engine.shape",T.UI_CONTAINER_RECT)],t),t}(Et);var Ti;(function(i){i[i.VERTICAL=0]="VERTICAL",i[i.HORIZONTAL=1]="HORIZONTAL"})(Ti||(Ti={}));var Ah=function(i){bt(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.adaptWidth=!0,e.adaptHeight=!0,e.color=U.Color4.Clear(),e.stackOrientation=Ti.VERTICAL,e.spacing=0,e}return g([c.field,v("design:type",Boolean)],t.prototype,"adaptWidth",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"adaptHeight",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"color",void 0),g([c.field,v("design:type",Number)],t.prototype,"stackOrientation",void 0),g([c.field,v("design:type",Number)],t.prototype,"spacing",void 0),t=g([_("engine.shape",T.UI_CONTAINER_STACK)],t),t}(Et);var _h=function(i){bt(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.fontSize=10,e.fontWeight="normal",e.thickness=0,e.cornerRadius=0,e.color=U.Color4.White(),e.background=U.Color4.White(),e.paddingTop=0,e.paddingRight=0,e.paddingBottom=0,e.paddingLeft=0,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor=U.Color4.Black(),e.text="button",e}return g([c.field,v("design:type",Number)],t.prototype,"fontSize",void 0),g([c.field,v("design:type",String)],t.prototype,"fontWeight",void 0),g([c.field,v("design:type",Number)],t.prototype,"thickness",void 0),g([c.field,v("design:type",Number)],t.prototype,"cornerRadius",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"color",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"background",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingTop",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingRight",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingBottom",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingLeft",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowBlur",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowOffsetX",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowOffsetY",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"shadowColor",void 0),g([c.field,v("design:type",String)],t.prototype,"text",void 0),t=g([_("engine.shape",T.UI_BUTTON_SHAPE)],t),t}(Et);var Oh=function(i){bt(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.outlineWidth=0,e.outlineColor=U.Color4.White(),e.color=U.Color4.White(),e.fontSize=10,e.fontAutoSize=!1,e.value="",e.lineSpacing=0,e.lineCount=0,e.adaptWidth=!1,e.adaptHeight=!1,e.textWrapping=!1,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowColor=U.Color4.Black(),e.hTextAlign="left",e.vTextAlign="bottom",e.paddingTop=0,e.paddingRight=0,e.paddingBottom=0,e.paddingLeft=0,e}return g([c.field,v("design:type",Number)],t.prototype,"outlineWidth",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"outlineColor",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"color",void 0),g([c.field,v("design:type",Number)],t.prototype,"fontSize",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"fontAutoSize",void 0),g([c.component,v("design:type",Cn)],t.prototype,"font",void 0),g([c.field,v("design:type",String)],t.prototype,"value",void 0),g([c.field,v("design:type",Number)],t.prototype,"lineSpacing",void 0),g([c.field,v("design:type",Number)],t.prototype,"lineCount",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"adaptWidth",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"adaptHeight",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"textWrapping",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowBlur",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowOffsetX",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowOffsetY",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"shadowColor",void 0),g([c.field,v("design:type",String)],t.prototype,"hTextAlign",void 0),g([c.field,v("design:type",String)],t.prototype,"vTextAlign",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingTop",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingRight",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingBottom",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingLeft",void 0),t=g([_("engine.shape",T.UI_TEXT_SHAPE)],t),t}(Et);var Ih=function(i){bt(t,i);function t(e){var n=i.call(this,e)||this;return n.outlineWidth=0,n.outlineColor=U.Color4.Black(),n.color=U.Color4.Clear(),n.fontSize=10,n.value="",n.placeholder="",n.margin=10,n.hTextAlign="left",n.vTextAlign="bottom",n.focusedBackground=U.Color4.Black(),n.textWrapping=!1,n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowColor=U.Color4.White(),n.paddingTop=0,n.paddingRight=0,n.paddingBottom=0,n.paddingLeft=0,n.onTextSubmit=null,n.onChanged=null,n.onFocus=null,n.onBlur=null,n.onTextChanged=new Ei(function(r){var o=r.value,s=o.value,a=o.isSubmit,h=n.dirty;if(n.value=s,n.dirty=h,a&&n.onTextSubmit){var p={text:s};n.onTextSubmit.callback(p)}else if(!a&&n.onChanged){var u={value:s,pointerId:r.pointerId};n.onChanged.callback(u)}}),n}return g([c.field,v("design:type",Number)],t.prototype,"outlineWidth",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"outlineColor",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"color",void 0),g([c.field,v("design:type",Number)],t.prototype,"fontSize",void 0),g([c.component,v("design:type",Cn)],t.prototype,"font",void 0),g([c.field,v("design:type",String)],t.prototype,"value",void 0),g([c.field,v("design:type",String)],t.prototype,"placeholder",void 0),g([c.field,v("design:type",Number)],t.prototype,"margin",void 0),g([c.field,v("design:type",String)],t.prototype,"hTextAlign",void 0),g([c.field,v("design:type",String)],t.prototype,"vTextAlign",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"focusedBackground",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"textWrapping",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowBlur",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowOffsetX",void 0),g([c.field,v("design:type",Number)],t.prototype,"shadowOffsetY",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"shadowColor",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingTop",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingRight",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingBottom",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingLeft",void 0),g([k.uuidEvent,v("design:type",Ei)],t.prototype,"onTextChanged",void 0),g([k.uuidEvent,v("design:type",Object)],t.prototype,"onFocus",void 0),g([k.uuidEvent,v("design:type",Object)],t.prototype,"onBlur",void 0),t=g([_("engine.shape",T.UI_INPUT_TEXT_SHAPE),v("design:paramtypes",[Object])],t),t}(Et);var Ch=function(i){bt(t,i);function t(e,n){var r=i.call(this,e)||this;return r.sourceLeft=0,r.sourceTop=0,r.sourceWidth=1,r.sourceHeight=1,r.paddingTop=0,r.paddingRight=0,r.paddingBottom=0,r.paddingLeft=0,r.sizeInPixels=!0,r.onClick=null,r.source=n,r}return g([c.field,v("design:type",Number)],t.prototype,"sourceLeft",void 0),g([c.field,v("design:type",Number)],t.prototype,"sourceTop",void 0),g([c.field,v("design:type",Number)],t.prototype,"sourceWidth",void 0),g([c.field,v("design:type",Number)],t.prototype,"sourceHeight",void 0),g([c.component,v("design:type",Object)],t.prototype,"source",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingTop",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingRight",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingBottom",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingLeft",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"sizeInPixels",void 0),g([k.uuidEvent,v("design:type",Object)],t.prototype,"onClick",void 0),t=g([_("engine.shape",T.UI_IMAGE_SHAPE),v("design:paramtypes",[Et,Object])],t),t}(Et);var zh=function(i){bt(t,i);function t(){var e=i!==null&&i.apply(this,arguments)||this;return e.valueX=0,e.valueY=0,e.backgroundColor=U.Color4.Clear(),e.isHorizontal=!1,e.isVertical=!1,e.paddingTop=0,e.paddingRight=0,e.paddingBottom=0,e.paddingLeft=0,e.onChanged=null,e}return g([c.field,v("design:type",Number)],t.prototype,"valueX",void 0),g([c.field,v("design:type",Number)],t.prototype,"valueY",void 0),g([c.field,v("design:type",U.Color4)],t.prototype,"backgroundColor",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"isHorizontal",void 0),g([c.field,v("design:type",Boolean)],t.prototype,"isVertical",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingTop",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingRight",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingBottom",void 0),g([c.field,v("design:type",Number)],t.prototype,"paddingLeft",void 0),g([k.uuidEvent,v("design:type",Object)],t.prototype,"onChanged",void 0),t=g([_("engine.shape",T.UI_SLIDER_SHAPE)],t),t}(Et);m();var Bs=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),dt=function(i,t,e,n){var r=arguments.length,o=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,n);else for(var a=i.length-1;a>=0;a--)(s=i[a])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},vt=function(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)},jr=function(i){Bs(t,i);function t(){var n=i!==null&&i.apply(this,arguments)||this;return n.useDummyModel=!1,n.talking=!1,n}e=t,t.Dummy=function(){var n=new e;return n.useDummyModel=!0,n};var e;return dt([c.field,vt("design:type",String)],t.prototype,"id",void 0),dt([c.field,vt("design:type",String)],t.prototype,"name",void 0),dt([c.field,vt("design:type",String)],t.prototype,"expressionTriggerId",void 0),dt([c.field,vt("design:type",Number)],t.prototype,"expressionTriggerTimestamp",void 0),dt([c.field,vt("design:type",String)],t.prototype,"bodyShape",void 0),dt([c.field,vt("design:type",Array)],t.prototype,"wearables",void 0),dt([c.field,vt("design:type",Array)],t.prototype,"emotes",void 0),dt([c.field,vt("design:type",Object)],t.prototype,"skinColor",void 0),dt([c.field,vt("design:type",Object)],t.prototype,"hairColor",void 0),dt([c.field,vt("design:type",Object)],t.prototype,"eyeColor",void 0),dt([c.field,vt("design:type",Boolean)],t.prototype,"useDummyModel",void 0),dt([c.field,vt("design:type",Boolean)],t.prototype,"talking",void 0),t=e=dt([C("engine.avatarShape",T.AVATAR_SHAPE)],t),t}(c);m();var Ri=null,Sn=null,Ai=null;function _i(){return Ai||(Ai=new tt),Ai}function Ns(){if(!Sn){Sn=dcl.loadModule("@decentraland/CommunicationsController",{}),Sn.then(function(t){Ri=t});var i=_i();dcl.subscribe("comms"),dcl.onEvent(function(t){t.type==="comms"&&i.notifyObservers(t.data)})}return Sn}var Uh=function(){function i(){var t=this;this.messageQueue=[],this.connected=!1,this.flushing=!1,Ns().then(function(){t.connected=!0,t.flush()})}return i.prototype.on=function(t,e){return _i().add(function(n){try{var r=JSON.parse(n.message);r.message===t&&e(r.payload,n.sender)}catch(o){dcl.error("Error parsing comms message "+(o.message||""),o)}})},i.prototype.sendRaw=function(t){this.messageQueue.push(t),this.connected&&this.flush()},i.prototype.emit=function(t,e){var n=JSON.stringify({message:t,payload:e});this.sendRaw(n),_i().notifyObservers({message:n,sender:"self"})},i.prototype.flush=function(){var t=this;if(this.messageQueue.length!==0&&!!this.connected&&!!Ri&&!this.flushing){var e=this.messageQueue.shift();this.flushing=!0,dcl.callRpc(Ri.rpcHandle,"send",[e]).then(function(n){t.flushing=!1,t.flush()},function(n){t.flushing=!1,jt("Error flushing MessageBus",n)})}},i}();var Hr=new oe("scene");Hr.uuid="0";var Yt=new sr(Hr);_.engine=Yt;typeof dcl!="undefined"&&(Yt.addSystem(new cr(dcl),Infinity),ar(dcl));Yt.addSystem(ut);Yt.addSystem(Nr);Yt.addSystem(Br);m();m();function qr(i){return{all:i=i||new Map,on:function(t,e){var n=i.get(t);n?n.push(e):i.set(t,[e])},off:function(t,e){var n=i.get(t);n&&(e?n.splice(n.indexOf(e)>>>0,1):i.set(t,[]))},emit:function(t,e){var n=i.get(t);n&&n.slice().map(function(r){r(e)}),(n=i.get("*"))&&n.slice().map(function(r){r(t,e)})}}}var Oi=qr(),Ie=new Map,Gr=class extends oe{constructor(t,e=new jr){super();this.userId=t;this.visible=!0;this.avatarShape=e,this.avatarShape.useDummyModel=!0,this.addComponentOrReplace(this.avatarShape),this.eventManager=new qe,this.eventManager.fireEvent,this.transform=this.getComponentOrCreate(Sr)}loadProfile(t){if(t&&t.name&&t.avatar?.bodyShape){let{avatar:e}=t,n=this.avatarShape;n.id=this.userId,n.name=t.name,this.avatarShape.useDummyModel=!1,n.bodyShape=e.bodyShape,n.wearables=e.wearables,n.emotes=t.avatar.emotes,n.skinColor=e.skinColor,n.hairColor=e.hairColor,n.eyeColor=e.eyeColor,n.expressionTriggerId||(n.expressionTriggerId="Idle",n.expressionTriggerTimestamp=0)}else this.avatarShape.useDummyModel=!0;this.updateVisibility()}setVisible(t){this.visible!==t&&(this.visible=t),this.updateVisibility()}setTalking(t){this.avatarShape.talking=t}setUserData(t){t.position&&this.setPose(t.position),t.expression&&this.setExpression(t.expression.expressionType,t.expression.expressionTimestamp)}setExpression(t,e){let n=this.avatarShape;n.expressionTriggerId=t,n.expressionTriggerTimestamp=e}setPose(t){this.transform.position.set(t.positionX,t.positionY,t.positionZ),this.transform.rotation.set(t.rotationX,t.rotationY,t.rotationZ,t.rotationW)}remove(){this.isAddedToEngine()&&Yt.removeEntity(this)}updateVisibility(){!this.visible&&this.isAddedToEngine()?this.remove():this.visible&&!this.isAddedToEngine()&&Yt.addEntity(this)}};function Pn(i){let t=Ie.get(i);return t||(t=new Gr(i),Ie.set(i,t),t)}function Us({userId:i,data:t,profile:e}){let n=Pn(i);n.setUserData(t),n.loadProfile(e),n.setVisible(t.visible??!0)}function Ds({userId:i,expressionId:t,timestamp:e}){Pn(i).setExpression(t,e)}function Ls({userId:i,visible:t}){Pn(i).setVisible(t)}function js({userId:i,talking:t}){Pn(i).setTalking(t)}function Hs({userId:i}){let t=Ie.get(i);t&&(t.remove(),Ie.delete(i))}Oi.on("message",i=>{i.type==="USER_DATA"?Us(i):i.type==="USER_VISIBLE"?Ls(i):i.type==="USER_EXPRESSION"?Ds(i):i.type==="USER_REMOVED"?Hs(i):i.type==="USER_TALKING"&&js(i)});Ze(async()=>{let[i,t]=await Promise.all([dcl.loadModule("@decentraland/Identity",{}),dcl.loadModule("@decentraland/SocialController",{})]);dcl.onUpdate(async e=>{let n=await dcl.callRpc(t.rpcHandle,"pullAvatarEvents",[]),r="";for(let{payload:o}of n.events)if(o!==r)try{r=o;let s=JSON.parse(o);Ie.get(s.userId)?.visible===!1&&s.visible===!1||Oi.emit("message",s)}catch(s){console.error(s)}})});})();
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
//# sourceMappingURL=decentraland-ui.scene.js.txt.map
