@dcl/sdk 7.0.0-2536021667.commit-17c845c → 7.0.0-2536579928.commit-004d2e1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ecs7/index.d.ts +168 -3
- package/dist/ecs7/index.js +699 -56
- package/dist/ecs7/index.min.js +1 -1
- package/dist/ecs7/index.min.js.map +1 -1
- package/dist/ecs7/proto-definitions/BoxShape.proto +2 -1
- package/dist/ecs7/proto-definitions/CylinderShape.proto +2 -1
- package/dist/ecs7/proto-definitions/NFTShape.proto +1 -0
- package/dist/ecs7/proto-definitions/PlaneShape.proto +3 -1
- package/dist/ecs7/proto-definitions/SphereShape.proto +1 -1
- package/dist/ecs7/proto-definitions/TextShape.proto +7 -5
- package/dist/ecs7/proto-definitions/UiTransform.proto +159 -0
- package/package.json +6 -6
- package/types/@decentraland/Identity/index.d.ts +2 -0
- package/types/@decentraland/Players/index.d.ts +2 -0
- package/types/ecs7/index.d.ts +168 -3
- package/types/tsconfig.ecs7.json +12 -2
package/dist/ecs7/index.min.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(function(exports){"use strict";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},dist$1={},Quaternion={},Vector3={},hasRequiredVector3;function requireVector3(){return hasRequiredVector3||(hasRequiredVector3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Vector3=void 0,function(e){function t(e=0,t=0,r=0){return{x:e,y:t,z:r}}function r(e,t){t.x=e.x,t.y=e.y,t.z=e.z}function n(e){return Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z)}function i(e,t,r){r.x=e.x*t,r.y=e.y*t,r.z=e.z*t}function o(e,r){const n=t(0,0,0);return s(e,r,n),n}function s(e,t,n){0!==t&&1!==t?i(e,1/t,n):r(e,n)}function a(e,t,r,n){n.x=e.x+(t.x-e.x)*r,n.y=e.y+(t.y-e.y)*r,n.z=e.z+(t.z-e.z)*r}e.create=t,e.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}},e.subtract=function(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}},e.subtractToRef=function(e,t,r){r.x=e.x-t.x,r.y=e.y-t.y,r.z=e.z-t.z},e.opposite=function(e){return{x:-e.x,y:-e.y,z:-e.z}},e.copy=r,e.clone=function(e){return Object.assign({},e)},e.length=n,e.lengthSquared=function(e){return e.x*e.x+e.y*e.y+e.z*e.z},e.scaleToRef=i,e.scale=function(e,r){return t(e.x*r,e.y*r,e.z*r)},e.normalizeFromLength=o,e.normalizeFromLengthToRef=s,e.normalize=function(e){return o(e,n(e))},e.normalizeToRef=function(e,t){s(e,n(e),t)},e.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},e.rotate=function(e,t){const{x:r,y:n,z:i}=e,{x:o,y:s,z:a,w:u}=t,f=u*r+s*i-a*n,l=u*n+a*r-o*i,c=u*i+o*n-s*r,h=-o*r-s*n-a*i;return{x:f*u+h*-o+l*-a-c*-s,y:l*u+h*-s+c*-o-f*-a,z:c*u+h*-a+f*-s-l*-o}},e.lerp=function(e,r,n){const i=t(0,0,0);return a(e,r,n,i),i},e.lerpToRef=a,e.cross=function(t,r){const n=e.Zero();return e.crossToRef(t,r,n),n},e.crossToRef=function(e,t,r){r.x=e.y*t.z-e.z*t.y,r.y=e.z*t.x-e.x*t.z,r.z=e.x*t.y-e.y*t.x},e.Zero=function(){return t(0,0,0)},e.One=function(){return t(1,1,1)},e.Up=function(){return t(0,1,0)},e.Down=function(){return t(0,-1,0)},e.Forward=function(){return t(0,0,1)},e.Backward=function(){return t(0,0,-1)},e.Right=function(){return t(1,0,0)},e.Left=function(){return t(-1,0,0)}}(e.Vector3||(e.Vector3={}))}(Vector3)),Vector3}var Scalar={},hasRequiredScalar;function requireScalar(){if(hasRequiredScalar)return Scalar;hasRequiredScalar=1,Object.defineProperty(Scalar,"__esModule",{value:!0}),Scalar.Scalar=void 0;const e=2*Math.PI;function t(e){const t=+e;return 0===t||isNaN(t)?t:t>0?1:-1}function r(e,t=0,r=1){return Math.min(r,Math.max(t,e))}function n(e,t){return e-Math.floor(e/t)*t}function i(e,t){let r=n(t-e,360);return r>180&&(r-=360),r}function o(e,r,n){let i=0;return i=Math.abs(r-e)<=n?r:e+t(r-e)*n,i}return Scalar.Scalar={withinEpsilon:function(e,t,r=1401298e-51){const n=e-t;return-r<=n&&n<=r},toHex:function(e){const t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},sign:t,clamp:r,log2:function(e){return Math.log(e)*Math.LOG2E},repeat:n,normalize:function(e,t,r){return(e-t)/(r-t)},denormalize:function(e,t,r){return e*(r-t)+t},deltaAngle:i,pingPong:function(e,t){const r=n(e,2*t);return t-Math.abs(r-t)},smoothStep:function(e,t,n){let i=r(n);return i=-2*i*i*i+3*i*i,t*i+e*(1-i)},moveTowards:o,moveTowardsAngle:function(e,t,r){const n=i(e,t);let s=0;return s=-r<n&&n<r?t:o(e,e+n,r),s},lerp:function(e,t,r){return e+(t-e)*r},lerpAngle:function(e,t,i){let o=n(t-e,360);return o>180&&(o-=360),e+o*r(i)},inverseLerp:function(e,t,n){let i=0;return i=e!==t?r((n-e)/(t-e)):0,i},hermite:function(e,t,r,n,i){const o=i*i,s=i*o;return e*(2*s-3*o+1)+r*(-2*s+3*o)+t*(s-2*o+i)+n*(s-o)},randomRange:function(e,t){return e===t?e:Math.random()*(t-e)+e},rangeToPercent:function(e,t,r){return(e-t)/(r-t)},percentToRange:function(e,t,r){return(r-t)*e+t},normalizeRadians:function(t){return t-e*Math.floor((t+Math.PI)/e)},TwoPi:e},Scalar}var types$1={},hasRequiredTypes$1,hasRequiredQuaternion,hasRequiredDist$1;function requireTypes$1(){return hasRequiredTypes$1||(hasRequiredTypes$1=1,function(e){var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.RAD2DEG=e.DEG2RAD=e.Epsilon=e.ToLinearSpace=e.ToGammaSpace=e.Space=e.Orientation=void 0,(t=e.Orientation||(e.Orientation={}))[t.CW=0]="CW",t[t.CCW=1]="CCW",(r=e.Space||(e.Space={}))[r.LOCAL=0]="LOCAL",r[r.WORLD=1]="WORLD",r[r.BONE=2]="BONE",e.ToGammaSpace=1/2.2,e.ToLinearSpace=2.2,e.Epsilon=1e-6,e.DEG2RAD=Math.PI/180,e.RAD2DEG=360/(2*Math.PI)}(types$1)),types$1}function requireQuaternion(){return hasRequiredQuaternion||(hasRequiredQuaternion=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Quaternion=void 0;const t=requireVector3(),r=requireScalar(),n=requireTypes$1();!function(e){function i(e=0,t=0,r=0,n=1){return{x:e,y:t,z:r,w:n}}function o(e,t,r){const n=.5*t,o=.5*e,s=.5*r,a=Math.cos(n),u=Math.cos(o),f=Math.cos(s),l=Math.sin(n),c=Math.sin(o),h=Math.sin(s);return i(u*l*f+c*a*h,c*a*f-u*l*h,u*a*h-c*l*f,u*a*f+c*l*h)}function s(e){return Math.sqrt(a(e))}function a(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w}function u(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}function f(e,t){const r=u(e,t);return 2*Math.acos(Math.min(Math.abs(r),1))*n.RAD2DEG}function l(e){const t=1/s(e);return i(e.x*t,e.y*t,e.z*t,e.w*t)}function c(){return i(0,0,0,1)}function h(t,r,n){const i=e.Identity();return e.slerpToRef(t,r,n,i),i}function p(e,t,r){r.x=e.x*t.w+e.y*t.z-e.z*t.y+e.w*t.x,r.y=-e.x*t.z+e.y*t.w+e.z*t.x+e.w*t.y,r.z=e.x*t.y-e.y*t.x+e.z*t.w+e.w*t.z,r.w=-e.x*t.x-e.y*t.y-e.z*t.z+e.w*t.w}e.create=i,e.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z,w:e.w+t.w}},e.rotationYawPitchRoll=o,e.euler=function(e,t,r){return o(t*n.DEG2RAD,e*n.DEG2RAD,r*n.DEG2RAD)},e.length=s,e.lengthSquared=a,e.dot=u,e.angle=f,e.rotateTowards=function(e,t,r){const n=f(e,t);return 0===n?t:h(e,t,Math.min(1,r/n))},e.lookRotation=function(e,r={x:0,y:1,z:0}){const n=t.Vector3.normalize(e),o=t.Vector3.normalize(t.Vector3.cross(r,n)),s=t.Vector3.cross(n,o),a=o.x,u=o.y,f=o.z,l=s.x,c=s.y,h=s.z,p=n.x,d=n.y,y=n.z,m=a+c+y,E=i();if(m>0){let e=Math.sqrt(m+1);return E.w=.5*e,e=.5/e,E.x=(h-d)*e,E.y=(p-f)*e,E.z=(u-l)*e,E}if(a>=c&&a>=y){const e=Math.sqrt(1+a-c-y),t=.5/e;return E.x=.5*e,E.y=(u+l)*t,E.z=(f+p)*t,E.w=(h-d)*t,E}if(c>y){const e=Math.sqrt(1+c-a-y),t=.5/e;return E.x=(l+u)*t,E.y=.5*e,E.z=(d+h)*t,E.w=(p-f)*t,E}const g=Math.sqrt(1+y-a-c),b=.5/g;return E.x=(p+f)*b,E.y=(d+h)*b,E.z=.5*g,E.w=(u-l)*b,E},e.normalize=l,e.fromToRotation=function(e,r,n=t.Vector3.Up()){const o=t.Vector3.normalize(e),s=t.Vector3.normalize(r),a=t.Vector3.cross(o,s),u=Math.sqrt(t.Vector3.lengthSquared(o)*t.Vector3.lengthSquared(s))+t.Vector3.dot(o,s);return t.Vector3.lengthSquared(a)<1e-4?Math.abs(u)<1e-4?l(i(n.x,n.y,n.z,0)):c():l(i(a.x,a.y,a.z,u))},e.Identity=c,e.eulerAngles=function(e){const i=t.Vector3.create(),o=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,s=e.x*e.w-e.y*e.z;return s>.4995*o?(i.x=Math.PI/2,i.y=2*Math.atan2(e.y,e.x),i.z=0):s<-.4995*o?(i.x=-Math.PI/2,i.y=-2*Math.atan2(e.y,e.x),i.z=0):(i.x=Math.asin(2*(e.w*e.x-e.y*e.z)),i.y=Math.atan2(2*e.w*e.y+2*e.z*e.x,1-2*(e.x*e.x+e.y*e.y)),i.z=Math.atan2(2*e.w*e.z+2*e.x*e.y,1-2*(e.z*e.z+e.x*e.x))),i.x*=n.RAD2DEG,i.y*=n.RAD2DEG,i.z*=n.RAD2DEG,i.x=r.Scalar.repeat(i.x,360),i.y=r.Scalar.repeat(i.y,360),i.z=r.Scalar.repeat(i.z,360),i},e.rotationYawPitchRollToRef=function(e,t,r,n){const i=.5*t,o=.5*e,s=.5*r,a=Math.cos(i),u=Math.cos(o),f=Math.cos(s),l=Math.sin(i),c=Math.sin(o),h=Math.sin(s);n.x=u*l*f+c*a*h,n.y=c*a*f-u*l*h,n.z=u*a*h-c*l*f,n.w=u*a*f+c*l*h},e.fromRotationMatrixToRef=function(e,t){const r=e._m,n=r[0],i=r[4],o=r[8],s=r[1],a=r[5],u=r[9],f=r[2],l=r[6],c=r[10],h=n+a+c;let p;h>0?(p=.5/Math.sqrt(h+1),t.w=.25/p,t.x=(l-u)*p,t.y=(o-f)*p,t.z=(s-i)*p):n>a&&n>c?(p=2*Math.sqrt(1+n-a-c),t.w=(l-u)/p,t.x=.25*p,t.y=(i+s)/p,t.z=(o+f)/p):a>c?(p=2*Math.sqrt(1+a-n-c),t.w=(o-f)/p,t.x=(i+s)/p,t.y=.25*p,t.z=(u+l)/p):(p=2*Math.sqrt(1+c-n-a),t.w=(s-i)/p,t.x=(o+f)/p,t.y=(u+l)/p,t.z=.25*p)},e.slerp=h,e.slerpToRef=function(e,t,r,n){let i,o,s=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,a=!1;if(s<0&&(a=!0,s=-s),s>.999999)o=1-r,i=a?-r:r;else{const e=Math.acos(s),t=1/Math.sin(e);o=Math.sin((1-r)*e)*t,i=a?-Math.sin(r*e)*t:Math.sin(r*e)*t}n.x=o*e.x+i*t.x,n.y=o*e.y+i*t.y,n.z=o*e.z+i*t.z,n.w=o*e.w+i*t.w},e.multiply=function(e,t){const r=i(0,0,0,1);return p(e,t,r),r},e.multiplyToRef=p,e.angleAxis=function(r,i){if(0===t.Vector3.lengthSquared(i))return e.Identity();const o=c();let s=r*n.DEG2RAD;s*=.5;const a=t.Vector3.normalize(i);return t.Vector3.scaleToRef(a,Math.sin(s),a),o.x=a.x,o.y=a.y,o.z=a.z,o.w=Math.cos(s),l(o)},e.Zero=function(){return i(0,0,0,0)}}(e.Quaternion||(e.Quaternion={}))}(Quaternion)),Quaternion}function requireDist$1(){return hasRequiredDist$1||(hasRequiredDist$1=1,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(requireQuaternion(),e),r(requireVector3(),e),r(requireTypes$1(),e),r(requireDist$1(),e)}(dist$1)),dist$1}var distExports$1=requireDist$1(),minimal$1={exports:{}},indexMinimal={},minimal={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;return hasRequiredAspromise=1,aspromise=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,o=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,s){r[n]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(e){o&&(o=!1,s(e))}}))}}var base64={},hasRequiredBase64,eventemitter,hasRequiredEventemitter,float,hasRequiredFloat,inquire_1,hasRequiredInquire;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),i=0;i<64;)n[r[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;t.encode=function(e,t,n){for(var i,o=null,s=[],a=0,u=0;t<n;){var f=e[t++];switch(u){case 0:s[a++]=r[f>>2],i=(3&f)<<4,u=1;break;case 1:s[a++]=r[i|f>>4],i=(15&f)<<2,u=2;break;case 2:s[a++]=r[i|f>>6],s[a++]=r[63&f],u=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return u&&(s[a++]=r[i],s[a++]=61,1===u&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var o="invalid encoding";t.decode=function(e,t,r){for(var i,s=r,a=0,u=0;u<e.length;){var f=e.charCodeAt(u++);if(61===f&&a>1)break;if(void 0===(f=n[f]))throw Error(o);switch(a){case 0:i=f,a=1;break;case 1:t[r++]=i<<2|(48&f)>>4,i=f,a=2;break;case 2:t[r++]=(15&i)<<4|(60&f)>>2,i=f,a=3;break;case 3:t[r++]=(3&i)<<6|f,a=0}}if(1===a)throw Error(o);return r-s},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(base64)),base64}function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;function e(){this._listeners={}}return hasRequiredEventemitter=1,eventemitter=e,e.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},e.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},e.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this},eventemitter}function requireFloat(){if(hasRequiredFloat)return float;function e(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function o(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,s=8388607&n;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=o.bind(null,t),e.writeFloatBE=o.bind(null,r),e.readFloatLE=s.bind(null,n),e.readFloatBE=s.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function o(e,t,r,n,i,o){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+r);else{var u=Math.floor(Math.log(n)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(a=n*Math.pow(2,-u))>>>0,i,o+t),e((s<<31|u+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}}function s(e,t,r,n,i){var o=e(n,i+t),s=e(n,i+r),a=2*(s>>31)+1,u=s>>>20&2047,f=4294967296*(1048575&s)+o;return 2047===u?f?NaN:a*(1/0):0===u?5e-324*a*f:a*Math.pow(2,u-1075)*(f+4503599627370496)}e.writeDoubleLE=o.bind(null,t,0,4),e.writeDoubleBE=o.bind(null,r,4,0),e.readDoubleLE=s.bind(null,n,0,4),e.readDoubleBE=s.bind(null,i,4,0)}(),e}function t(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function r(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}return hasRequiredFloat=1,float=e(e)}function requireInquire(){if(hasRequiredInquire)return inquire_1;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}return hasRequiredInquire=1,inquire_1=inquire,inquire_1}var utf8={},hasRequiredUtf8,pool_1,hasRequiredPool,longbits,hasRequiredLongbits,hasRequiredMinimal$1,writer,hasRequiredWriter,writer_buffer,hasRequiredWriter_buffer,reader,hasRequiredReader,reader_buffer,hasRequiredReader_buffer;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(e){var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,o=[],s=0;t<r;)(n=e[t++])<128?o[s++]=n:n>191&&n<224?o[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(n>>10),o[s++]=56320+(1023&n)):o[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},t.write=function(e,t,r){for(var n,i,o=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}}(utf8)),utf8}function requirePool(){if(hasRequiredPool)return pool_1;return hasRequiredPool=1,pool_1=function(e,t,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(r){if(r<1||r>i)return e(r);s+r>n&&(o=e(n),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}}function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var e=requireMinimal$1();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var r=t.zero=new t(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return r;var n=e<0;n&&(e=-e);var i=e>>>0,o=(e-i)/4294967296>>>0;return n&&(o=~o>>>0,i=~i>>>0,++i>4294967295&&(i=0,++o>4294967295&&(o=0))),new t(i,o)},t.from=function(n){if("number"==typeof n)return t.fromNumber(n);if(e.isString(n)){if(!e.Long)return t.fromNumber(parseInt(n,10));n=e.Long.fromString(n)}return n.low||n.high?new t(n.low>>>0,n.high>>>0):r},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var i=String.prototype.charCodeAt;return t.fromHash=function(e){return e===n?r:new t((i.call(e,0)|i.call(e,1)<<8|i.call(e,2)<<16|i.call(e,3)<<24)>>>0,(i.call(e,4)|i.call(e,5)<<8|i.call(e,6)<<16|i.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10},longbits}function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,function(e){var t=e;function r(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function n(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}t.asPromise=requireAspromise(),t.base64=requireBase64(),t.EventEmitter=requireEventemitter(),t.float=requireFloat(),t.inquire=requireInquire(),t.utf8=requireUtf8(),t.pool=requirePool(),t.LongBits=requireLongbits(),t.isNode=Boolean(void 0!==commonjsGlobal&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=r,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},t.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):t._Buffer_from=t._Buffer_allocUnsafe=null}}(minimal)),minimal}function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=u;var e,t=requireMinimal$1(),r=t.LongBits,n=t.base64,i=t.utf8;function o(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function s(){}function a(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new o(s,0,0),this.tail=this.head,this.states=null}var f=function(){return t.Buffer?function(){return(u.create=function(){return new e})()}:function(){return new u}};function l(e,t,r){t[r]=255&e}function c(e,t){this.len=e,this.next=void 0,this.val=t}function h(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function p(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}u.create=f(),u.alloc=function(e){return new t.Array(e)},t.Array!==Array&&(u.alloc=t.pool(u.alloc,t.Array.prototype.subarray)),u.prototype._push=function(e,t,r){return this.tail=this.tail.next=new o(e,t,r),this.len+=t,this},c.prototype=Object.create(o.prototype),c.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new c((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(h,10,r.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=r.from(e);return this._push(h,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=r.from(e).zzEncode();return this._push(h,t.length(),t)},u.prototype.bool=function(e){return this._push(l,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(p,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=r.from(e);return this._push(p,4,t.lo)._push(p,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(t.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(t.float.writeDoubleLE,8,e)};var d=t.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};return u.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(l,1,0);if(t.isString(e)){var i=u.alloc(r=n.length(e));n.decode(e,i,0),e=i}return this.uint32(r)._push(d,r,e)},u.prototype.string=function(e){var t=i.length(e);return t?this.uint32(t)._push(i.write,t,e):this._push(l,1,0)},u.prototype.fork=function(){return this.states=new a(this),this.head=this.tail=new o(s,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(s,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},u._configure=function(t){e=t,u.create=f(),e._configure()},writer}function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=r;var e=requireWriter();(r.prototype=Object.create(e.prototype)).constructor=r;var t=requireMinimal$1();function r(){e.call(this)}function n(e,r,n){e.length<40?t.utf8.write(e,r,n):r.utf8Write?r.utf8Write(e,n):r.write(e,n)}return r._configure=function(){r.alloc=t._Buffer_allocUnsafe,r.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&"set"===t.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},r.prototype.bytes=function(e){t.isString(e)&&(e=t._Buffer_from(e,"base64"));var n=e.length>>>0;return this.uint32(n),n&&this._push(r.writeBytesBuffer,n,e),this},r.prototype.string=function(e){var r=t.Buffer.byteLength(e);return this.uint32(r),r&&this._push(n,r,e),this},r._configure(),writer_buffer}function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=o;var e,t=requireMinimal$1(),r=t.LongBits,n=t.utf8;function i(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function o(e){this.buf=e,this.pos=0,this.len=e.length}var s,a="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new o(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new o(e);throw Error("illegal buffer")},u=function(){return t.Buffer?function(r){return(o.create=function(r){return t.Buffer.isBuffer(r)?new e(r):a(r)})(r)}:a};function f(){var e=new r(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw i(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw i(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function l(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function c(){if(this.pos+8>this.len)throw i(this,8);return new r(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}return o.create=u(),o.prototype._slice=t.Array.prototype.subarray||t.Array.prototype.slice,o.prototype.uint32=(s=4294967295,function(){if(s=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return s;if(s=(s|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return s;if(s=(s|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return s;if(s=(s|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return s;if(s=(s|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return s;if((this.pos+=5)>this.len)throw this.pos=this.len,i(this,10);return s}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},o.prototype.bool=function(){return 0!==this.uint32()},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw i(this,4);return l(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw i(this,4);return 0|l(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw i(this,4);var e=t.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},o.prototype.double=function(){if(this.pos+8>this.len)throw i(this,4);var e=t.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},o.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw i(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},o.prototype.string=function(){var e=this.bytes();return n.read(e,0,e.length)},o.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw i(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw i(this)}while(128&this.buf[this.pos++]);return this},o.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},o._configure=function(r){e=r,o.create=u(),e._configure();var n=t.Long?"toLong":"toNumber";t.merge(o.prototype,{int64:function(){return f.call(this)[n](!1)},uint64:function(){return f.call(this)[n](!0)},sint64:function(){return f.call(this).zzDecode()[n](!1)},fixed64:function(){return c.call(this)[n](!0)},sfixed64:function(){return c.call(this)[n](!1)}})},reader}function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=r;var e=requireReader();(r.prototype=Object.create(e.prototype)).constructor=r;var t=requireMinimal$1();function r(t){e.call(this,t)}return r._configure=function(){t.Buffer&&(r.prototype._slice=t.Buffer.prototype.slice)},r.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},r._configure(),reader_buffer}var rpc={},service,hasRequiredService,hasRequiredRpc,roots,hasRequiredRoots,hasRequiredIndexMinimal,hasRequiredMinimal;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=t;var e=requireMinimal$1();function t(t,r,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(n)}return(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return e.asPromise(t,a,r,n,i,o);if(a.rpcImpl)try{return a.rpcImpl(r,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,t){if(e)return a.emit("error",e,r),s(e);if(null!==t){if(!(t instanceof i))try{t=i[a.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return a.emit("error",e,r),s(e)}return a.emit("data",t,r),s(null,t)}a.end(!0)}))}catch(e){return a.emit("error",e,r),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(e){e.Service=requireService()}(rpc)),rpc}function requireRoots(){return hasRequiredRoots?roots:(hasRequiredRoots=1,roots={})}function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(e){var t=e;function r(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=requireWriter(),t.BufferWriter=requireWriter_buffer(),t.Reader=requireReader(),t.BufferReader=requireReader_buffer(),t.util=requireMinimal$1(),t.rpc=requireRpc(),t.roots=requireRoots(),t.configure=r,r()}(indexMinimal)),indexMinimal}function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal$1.exports=requireIndexMinimal()),minimal$1.exports}var minimalExports=requireMinimal();function createBasePBAudioSource(){return{playing:!1,volume:0,loop:!1,pitch:0,playedAtTimestamp:0,audioClipUrl:""}}const PBAudioSource={encode:(e,t=minimalExports.Writer.create())=>(!0===e.playing&&t.uint32(8).bool(e.playing),0!==e.volume&&t.uint32(21).float(e.volume),!0===e.loop&&t.uint32(24).bool(e.loop),0!==e.pitch&&t.uint32(37).float(e.pitch),0!==e.playedAtTimestamp&&t.uint32(40).int32(e.playedAtTimestamp),""!==e.audioClipUrl&&t.uint32(50).string(e.audioClipUrl),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAudioSource();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.playing=r.bool();break;case 2:i.volume=r.float();break;case 3:i.loop=r.bool();break;case 4:i.pitch=r.float();break;case 5:i.playedAtTimestamp=r.int32();break;case 6:i.audioClipUrl=r.string();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$8=1020,AudioSource={serialize(e,t){const r=PBAudioSource.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBAudioSource.decode(t,t.length)}};function createBasePBAudioStream(){return{playing:!1,volume:0,url:""}}const PBAudioStream={encode:(e,t=minimalExports.Writer.create())=>(!0===e.playing&&t.uint32(8).bool(e.playing),0!==e.volume&&t.uint32(21).float(e.volume),""!==e.url&&t.uint32(26).string(e.url),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBAudioStream();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.playing=r.bool();break;case 2:i.volume=r.float();break;case 3:i.url=r.string();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$7=1021,AudioStream={serialize(e,t){const r=PBAudioStream.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBAudioStream.decode(t,t.length)}};function createBasePBBoxShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBBoxShape={encode(e,t=minimalExports.Writer.create()){!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t.uint32(34).fork();for(const r of e.uvs)t.float(r);return t.ldelim(),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBBoxShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:if(2==(7&e)){const e=r.uint32()+r.pos;for(;r.pos<e;)i.uvs.push(r.float())}else i.uvs.push(r.float());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$6=1013,BoxShape={serialize(e,t){const r=PBBoxShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBBoxShape.decode(t,t.length)}};function createBasePBCylinderShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,radiusTop:0,radiusBottom:0}}const PBCylinderShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),0!==e.radiusTop&&t.uint32(37).float(e.radiusTop),0!==e.radiusBottom&&t.uint32(45).float(e.radiusBottom),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBCylinderShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.radiusTop=r.float();break;case 5:i.radiusBottom=r.float();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$5=1016,CylinderShape={serialize(e,t){const r=PBCylinderShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBCylinderShape.decode(t,t.length)}};function createBaseColor3(){return{r:0,g:0,b:0}}const Color3={encode:(e,t=minimalExports.Writer.create())=>(0!==e.r&&t.uint32(13).float(e.r),0!==e.g&&t.uint32(21).float(e.g),0!==e.b&&t.uint32(29).float(e.b),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBaseColor3();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.r=r.float();break;case 2:i.g=r.float();break;case 3:i.b=r.float();break;default:r.skipType(7&e)}}return i}};function createBasePBNFTShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,src:"",assetId:"",style:0,color:void 0}}const PBNFTShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),""!==e.src&&t.uint32(34).string(e.src),""!==e.assetId&&t.uint32(42).string(e.assetId),0!==e.style&&t.uint32(48).int32(e.style),void 0!==e.color&&Color3.encode(e.color,t.uint32(58).fork()).ldelim(),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBNFTShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:i.src=r.string();break;case 5:i.assetId=r.string();break;case 6:i.style=r.int32();break;case 7:i.color=Color3.decode(r,r.uint32());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$4=1040,NFTShape={serialize(e,t){const r=PBNFTShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBNFTShape.decode(t,t.length)}};function createBasePBPlaneShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBPlaneShape={encode(e,t=minimalExports.Writer.create()){!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t.uint32(34).fork();for(const r of e.uvs)t.float(r);return t.ldelim(),t},decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBPlaneShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;case 4:if(2==(7&e)){const e=r.uint32()+r.pos;for(;r.pos<e;)i.uvs.push(r.float())}else i.uvs.push(r.float());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$3=1014,PlaneShape={serialize(e,t){const r=PBPlaneShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBPlaneShape.decode(t,t.length)}};function createBasePBSphereShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1}}const PBSphereShape={encode:(e,t=minimalExports.Writer.create())=>(!0===e.withCollisions&&t.uint32(8).bool(e.withCollisions),!0===e.isPointerBlocker&&t.uint32(16).bool(e.isPointerBlocker),!0===e.visible&&t.uint32(24).bool(e.visible),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBSphereShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.withCollisions=r.bool();break;case 2:i.isPointerBlocker=r.bool();break;case 3:i.visible=r.bool();break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$2=1015,SphereShape={serialize(e,t){const r=PBSphereShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBSphereShape.decode(t,t.length)}};function createBasePBTextShape(){return{text:"",visible:!1,font:"",opacity:0,fontSize:0,fontAutoSize:!1,hTextAlign:"",vTextAlign:"",width:0,height:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,lineSpacing:0,lineCount:0,textWrapping:!1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,outlineWidth:0,shadowColor:void 0,outlineColor:void 0,textColor:void 0}}const PBTextShape={encode:(e,t=minimalExports.Writer.create())=>(""!==e.text&&t.uint32(10).string(e.text),!0===e.visible&&t.uint32(16).bool(e.visible),""!==e.font&&t.uint32(26).string(e.font),0!==e.opacity&&t.uint32(37).float(e.opacity),0!==e.fontSize&&t.uint32(45).float(e.fontSize),!0===e.fontAutoSize&&t.uint32(48).bool(e.fontAutoSize),""!==e.hTextAlign&&t.uint32(58).string(e.hTextAlign),""!==e.vTextAlign&&t.uint32(66).string(e.vTextAlign),0!==e.width&&t.uint32(77).float(e.width),0!==e.height&&t.uint32(85).float(e.height),0!==e.paddingTop&&t.uint32(93).float(e.paddingTop),0!==e.paddingRight&&t.uint32(101).float(e.paddingRight),0!==e.paddingBottom&&t.uint32(109).float(e.paddingBottom),0!==e.paddingLeft&&t.uint32(117).float(e.paddingLeft),0!==e.lineSpacing&&t.uint32(125).float(e.lineSpacing),0!==e.lineCount&&t.uint32(128).int32(e.lineCount),!0===e.textWrapping&&t.uint32(136).bool(e.textWrapping),0!==e.shadowBlur&&t.uint32(149).float(e.shadowBlur),0!==e.shadowOffsetX&&t.uint32(157).float(e.shadowOffsetX),0!==e.shadowOffsetY&&t.uint32(165).float(e.shadowOffsetY),0!==e.outlineWidth&&t.uint32(173).float(e.outlineWidth),void 0!==e.shadowColor&&Color3.encode(e.shadowColor,t.uint32(178).fork()).ldelim(),void 0!==e.outlineColor&&Color3.encode(e.outlineColor,t.uint32(186).fork()).ldelim(),void 0!==e.textColor&&Color3.encode(e.textColor,t.uint32(194).fork()).ldelim(),t),decode(e,t){const r=e instanceof minimalExports.Reader?e:new minimalExports.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=createBasePBTextShape();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.text=r.string();break;case 2:i.visible=r.bool();break;case 3:i.font=r.string();break;case 4:i.opacity=r.float();break;case 5:i.fontSize=r.float();break;case 6:i.fontAutoSize=r.bool();break;case 7:i.hTextAlign=r.string();break;case 8:i.vTextAlign=r.string();break;case 9:i.width=r.float();break;case 10:i.height=r.float();break;case 11:i.paddingTop=r.float();break;case 12:i.paddingRight=r.float();break;case 13:i.paddingBottom=r.float();break;case 14:i.paddingLeft=r.float();break;case 15:i.lineSpacing=r.float();break;case 16:i.lineCount=r.int32();break;case 17:i.textWrapping=r.bool();break;case 18:i.shadowBlur=r.float();break;case 19:i.shadowOffsetX=r.float();break;case 20:i.shadowOffsetY=r.float();break;case 21:i.outlineWidth=r.float();break;case 22:i.shadowColor=Color3.decode(r,r.uint32());break;case 23:i.outlineColor=Color3.decode(r,r.uint32());break;case 24:i.textColor=Color3.decode(r,r.uint32());break;default:r.skipType(7&e)}}return i}},COMPONENT_ID$1=1030,TextShape={serialize(e,t){const r=PBTextShape.encode(e),n=new Uint8Array(r.finish(),0,r.len);t.writeBuffer(n)},deserialize(e){const t=e.readBuffer();return PBTextShape.decode(t,t.length)}};function defineProtocolBufferComponents({defineComponent:e}){return{AudioSource:e(COMPONENT_ID$8,AudioSource),AudioStream:e(COMPONENT_ID$7,AudioStream),BoxShape:e(COMPONENT_ID$6,BoxShape),CylinderShape:e(COMPONENT_ID$5,CylinderShape),NFTShape:e(COMPONENT_ID$4,NFTShape),PlaneShape:e(COMPONENT_ID$3,PlaneShape),SphereShape:e(COMPONENT_ID$2,SphereShape),TextShape:e(COMPONENT_ID$1,TextShape)}}const TRANSFORM_LENGTH=44,Transform={serialize(e,t){const r=t.incrementWriteOffset(TRANSFORM_LENGTH);t.setFloat32(r,e.position.x),t.setFloat32(r+4,e.position.y),t.setFloat32(r+8,e.position.z),t.setFloat32(r+12,e.rotation.x),t.setFloat32(r+16,e.rotation.y),t.setFloat32(r+20,e.rotation.z),t.setFloat32(r+24,e.rotation.w),t.setFloat32(r+28,e.scale.x),t.setFloat32(r+32,e.scale.y),t.setFloat32(r+36,e.scale.z),t.setUint32(r+40,e.parent||0)},deserialize(e){const t=e.incrementReadOffset(TRANSFORM_LENGTH);return{position:distExports$1.Vector3.create(e.getFloat32(t),e.getFloat32(t+4),e.getFloat32(t+8)),rotation:distExports$1.Quaternion.create(e.getFloat32(t+12),e.getFloat32(t+16),e.getFloat32(t+20),e.getFloat32(t+24)),scale:distExports$1.Vector3.create(e.getFloat32(t+28),e.getFloat32(t+32),e.getFloat32(t+36)),parent:e.getUint32(t+40)}}};var LEGACY_COMPONENT_ID,COMPONENT_ID;function defineLegacyComponents({defineComponent:e}){return{Transform:e(LEGACY_COMPONENT_ID.TRANSFORM,Transform),...defineProtocolBufferComponents({defineComponent:e})}}function defineSdkComponents(e){return{...defineLegacyComponents(e)}}!function(e){e[e.TRANSFORM=1]="TRANSFORM",e[e.UUID_CALLBACK=8]="UUID_CALLBACK",e[e.BOX_SHAPE=16]="BOX_SHAPE",e[e.SPHERE_SHAPE=17]="SPHERE_SHAPE",e[e.PLANE_SHAPE=18]="PLANE_SHAPE",e[e.CONE_SHAPE=19]="CONE_SHAPE",e[e.CYLINDER_SHAPE=20]="CYLINDER_SHAPE",e[e.TEXT_SHAPE=21]="TEXT_SHAPE",e[e.NFT_SHAPE=22]="NFT_SHAPE",e[e.UI_WORLD_SPACE_SHAPE=23]="UI_WORLD_SPACE_SHAPE",e[e.UI_SCREEN_SPACE_SHAPE=24]="UI_SCREEN_SPACE_SHAPE",e[e.UI_CONTAINER_RECT=25]="UI_CONTAINER_RECT",e[e.UI_CONTAINER_STACK=26]="UI_CONTAINER_STACK",e[e.UI_TEXT_SHAPE=27]="UI_TEXT_SHAPE",e[e.UI_INPUT_TEXT_SHAPE=28]="UI_INPUT_TEXT_SHAPE",e[e.UI_IMAGE_SHAPE=29]="UI_IMAGE_SHAPE",e[e.UI_SLIDER_SHAPE=30]="UI_SLIDER_SHAPE",e[e.CIRCLE_SHAPE=31]="CIRCLE_SHAPE",e[e.BILLBOARD=32]="BILLBOARD",e[e.ANIMATION=33]="ANIMATION",e[e.FONT=34]="FONT",e[e.UI_FULLSCREEN_SHAPE=40]="UI_FULLSCREEN_SHAPE",e[e.UI_BUTTON_SHAPE=41]="UI_BUTTON_SHAPE",e[e.GLTF_SHAPE=54]="GLTF_SHAPE",e[e.OBJ_SHAPE=55]="OBJ_SHAPE",e[e.AVATAR_SHAPE=56]="AVATAR_SHAPE",e[e.BASIC_MATERIAL=64]="BASIC_MATERIAL",e[e.PBR_MATERIAL=65]="PBR_MATERIAL",e[e.HIGHLIGHT_ENTITY=66]="HIGHLIGHT_ENTITY",e[e.SOUND=67]="SOUND",e[e.TEXTURE=68]="TEXTURE",e[e.VIDEO_CLIP=70]="VIDEO_CLIP",e[e.VIDEO_TEXTURE=71]="VIDEO_TEXTURE",e[e.AVATAR_TEXTURE=72]="AVATAR_TEXTURE",e[e.AUDIO_CLIP=200]="AUDIO_CLIP",e[e.AUDIO_SOURCE=201]="AUDIO_SOURCE",e[e.AUDIO_STREAM=202]="AUDIO_STREAM",e[e.GIZMOS=203]="GIZMOS",e[e.SMART_ITEM=204]="SMART_ITEM",e[e.AVATAR_MODIFIER_AREA=205]="AVATAR_MODIFIER_AREA",e[e.AVATAR_ATTACH=206]="AVATAR_ATTACH",e[e.CAMERA_MODE_AREA=207]="CAMERA_MODE_AREA",e[e.NAME=300]="NAME",e[e.LOCKED_ON_EDIT=301]="LOCKED_ON_EDIT",e[e.VISIBLE_ON_EDIT=302]="VISIBLE_ON_EDIT"}(LEGACY_COMPONENT_ID||(LEGACY_COMPONENT_ID={})),function(e){e[e.SYNC=1e3]="SYNC"}(COMPONENT_ID||(COMPONENT_ID={}));var dist={},types={},hasRequiredTypes,hasRequiredDist;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0})),types}function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};function n(e,t){if(e===t)return!0;if(e instanceof Buffer&&t instanceof Buffer)return e.equals(t);if(e instanceof Uint8Array&&t instanceof Uint8Array){if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}return e===t}Object.defineProperty(e,"__esModule",{value:!0}),e.crdtProtocol=e.sameData=void 0,r(requireTypes(),e),e.sameData=n,e.crdtProtocol=function(){const e={};function t(t,r,n){const i=Math.max(n,e[t]?.timestamp||0);return e[t]={timestamp:i,data:r}}return{createEvent:function(r,n){const i=(e[r]?.timestamp||0)+1;return t(r,n,i),{key:r,data:n,timestamp:i}},processMessage:function(r){const{key:i,data:o,timestamp:s}=r,a=e[i];return!a||a.timestamp<s?(t(i,o,s),r):a.timestamp>s?{key:i,data:a.data,timestamp:a.timestamp}:n(a.data,o)?r:function(e,t){return e>t}(a.data,o)?{key:i,data:a.data,timestamp:a.timestamp}:(t(i,o,s).data,r)},getState:function(){return{...e}}}}}(dist)),dist}var distExports=requireDist(),EntityUtils;!function(e){e.MAX_ENTITIES=1e4;let t=e.MAX_ENTITIES;e.getOffset=function(){const r=t+1;return t+=e.MAX_ENTITIES,r};const r=[0,e.MAX_ENTITIES];e.isStaticEntity=function(e){const[t,n]=r;return e>=t&&e<=n}}(EntityUtils||(EntityUtils={}));var EntityUtils$1=EntityUtils;function getNextSize(e,t){const r=Math.max(e,t)+1024;return 1024*Math.ceil(r/1024)}const defaultInitialCapacity=10240;function createByteBuffer(e={}){const t=e.reading?.currentOffset||0;let r=null,n=0;e.writing?(r=e.writing.buffer,e.writing.currentOffset&&(n=e.writing.currentOffset)):e.reading?(r=e.reading.buffer,n=e.reading.length||e.reading.buffer.length):r=new Uint8Array(e.initialCapacity||defaultInitialCapacity);let i=r,o=new DataView(i.buffer,i.byteOffset),s=n,a=t;const u=e=>{if(s+e>i.byteLength){const t=getNextSize(i.byteLength,s+e),r=new Uint8Array(t);r.set(i),i=r,o=new DataView(i.buffer)}return s+=e,s-e},f=e=>{if(a+e>s)throw new Error("Outside of the bounds of writen data.");return a+=e,a-e};return{buffer:()=>i,bufferLength:()=>i.length,resetBuffer(){a=0,s=0},currentReadOffset:()=>a,currentWriteOffset:()=>s,incrementReadOffset:e=>f(e),remainingBytes:()=>s-a,readFloat32:()=>o.getFloat32(f(4)),readFloat64:()=>o.getFloat64(f(8)),readInt8:()=>o.getInt8(f(1)),readInt16:()=>o.getInt16(f(2)),readInt32:()=>o.getInt32(f(4)),readInt64:()=>o.getBigInt64(f(8)),readUint8:()=>o.getUint8(f(1)),readUint16:()=>o.getUint16(f(2)),readUint32:()=>o.getUint32(f(4)),readUint64:()=>o.getBigUint64(f(8)),readBuffer(){const e=o.getUint32(f(4));return i.subarray(f(e),f(0))},incrementWriteOffset:e=>u(e),size:()=>s,toBinary:()=>i.subarray(0,s),writeBuffer(e,t=!0){t&&this.writeUint32(e.byteLength);const r=u(e.byteLength);i.set(e,r)},writeFloat32(e){const t=u(4);o.setFloat32(t,e)},writeFloat64(e){const t=u(8);o.setFloat64(t,e)},writeInt8(e){const t=u(1);o.setInt8(t,e)},writeInt16(e){const t=u(2);o.setInt16(t,e)},writeInt32(e){const t=u(4);o.setInt32(t,e)},writeInt64(e){const t=u(8);o.setBigInt64(t,e)},writeUint8(e){const t=u(1);o.setUint8(t,e)},writeUint16(e){const t=u(2);o.setUint16(t,e)},writeUint32(e){const t=u(4);o.setUint32(t,e)},writeUint64(e){const t=u(8);o.setBigUint64(t,e)},getFloat32:e=>o.getFloat32(e),getFloat64:e=>o.getFloat64(e),getInt8:e=>o.getInt8(e),getInt16:e=>o.getInt16(e),getInt32:e=>o.getInt32(e),getInt64:e=>o.getBigInt64(e),getUint8:e=>o.getUint8(e),getUint16:e=>o.getUint16(e),getUint32:e=>o.getUint32(e),getUint64:e=>o.getBigUint64(e),setFloat32(e,t){o.setFloat32(e,t)},setFloat64(e,t){o.setFloat64(e,t)},setInt8(e,t){o.setInt8(e,t)},setInt16(e,t){o.setInt16(e,t)},setInt32(e,t){o.setInt32(e,t)},setInt64(e,t){o.setBigInt64(e,t)},setUint8(e,t){o.setUint8(e,t)},setUint16(e,t){o.setUint16(e,t)},setUint32(e,t){o.setUint32(e,t)},setUint64(e,t){o.setBigUint64(e,t)}}}var WireMessage;!function(e){function t(t){const r=t.remainingBytes();if(r<e.HEADER_LENGTH)return!1;return!(r<t.getUint32(t.currentReadOffset()))}!function(e){e[e.RESERVED=0]="RESERVED",e[e.PUT_COMPONENT=1]="PUT_COMPONENT",e[e.DELETE_COMPONENT=2]="DELETE_COMPONENT",e[e.MAX_MESSAGE_TYPE=3]="MAX_MESSAGE_TYPE"}(e.Enum||(e.Enum={})),e.HEADER_LENGTH=8,e.validate=t,e.readHeader=function(e){return t(e)?{length:e.readUint32(),type:e.readUint32()}:null}}(WireMessage||(WireMessage={}));var WireMessage$1=WireMessage,PutComponentOperation,CrdtUtils;function networkTransport(){const e="network-transport";return{send:()=>{},type:e,filter:t=>t.transportType!==e&&!!t}}function getTransports(){return[networkTransport()]}!function(e){e.MESSAGE_HEADER_LENGTH=20,e.write=function(t,r,n,i){const o=i.incrementWriteOffset(WireMessage$1.HEADER_LENGTH+e.MESSAGE_HEADER_LENGTH);n.writeToByteBuffer(t,i);const s=i.size()-o;i.setUint32(o,s),i.setUint32(o+4,WireMessage$1.Enum.PUT_COMPONENT),i.setUint32(o+8,t),i.setUint32(o+12,n._id),i.setUint64(o+16,BigInt(r)),i.setUint32(o+24,s-e.MESSAGE_HEADER_LENGTH-WireMessage$1.HEADER_LENGTH)},e.read=function(e){const t=WireMessage$1.readHeader(e);return t?{...t,entity:e.readUint32(),componentId:e.readInt32(),timestamp:Number(e.readUint64()),data:e.readBuffer()}:null}}(PutComponentOperation||(PutComponentOperation={})),function(e){var t;e.getKey=function(e,t){return`${e}.${t}`},(t=e.SynchronizedEntityType||(e.SynchronizedEntityType={}))[t.NETWORKED=0]="NETWORKED",t[t.RENDERER=1]="RENDERER"}(CrdtUtils||(CrdtUtils={}));var CrdtUtils$1=CrdtUtils;function crdtSceneSystem(e){const t=distExports.crdtProtocol(),r=[],n=[],i=new Map,o=getTransports();function s(e){const t=Array.from(e);return e.length=0,t}return o.forEach((e=>{return e.onmessage=(t=e.type,function(e){if(!e.data?.length)return;const n=createByteBuffer({reading:{buffer:e.data,currentOffset:0}});for(;WireMessage$1.validate(n);){const e=n.currentReadOffset(),i=PutComponentOperation.read(n),{entity:o,componentId:s,data:a,timestamp:u}=i;r.push({entity:o,componentId:s,data:a,timestamp:u,transportType:t,messageBuffer:n.buffer().subarray(e,n.currentReadOffset())})}});var t})),{createMessages:function(r){const a=s(n),u=createByteBuffer();for(const[n,o]of r){for(const r of o){const o=e.getComponent(r),s=t.createEvent(CrdtUtils$1.getKey(n,r),o.toBinary(n).toBinary()),f=u.currentWriteOffset();EntityUtils$1.isStaticEntity(n)&&!i.has(n)||(PutComponentOperation.write(n,s.timestamp,o,u),a.push({componentId:r,entity:n,timestamp:s.timestamp,messageBuffer:u.buffer().subarray(f,u.currentWriteOffset())}))}i.set(n,!0)}const f=createByteBuffer();for(const e of o){f.resetBuffer();for(const t of a)e.filter(t)&&f.writeBuffer(t.messageBuffer,!1);f.size()&&e.send(f.toBinary())}},receiveMessages:function(){const i=s(r);for(const r of o){const o=createByteBuffer();for(const r of i){const{data:i,timestamp:s,componentId:a,entity:u}=r,f={key:CrdtUtils$1.getKey(u,a),data:i,timestamp:s},l=e.getComponent(a),c=t.processMessage(f);if(f!==c)PutComponentOperation.write(u,c.timestamp,l,o);else{const e=createByteBuffer({reading:{buffer:r.data,currentOffset:0}});l.upsertFromBinary(r.entity,e),l.clearDirty(),n.push(r)}}o.size()&&r.send(o.toBinary())}}}}function EntityContainer(){const e=Entity(),t=Entity(!0);return{generateEntity:(r=!1)=>r?t.generateEntity():e.generateEntity(),removeEntity(r){e.removeEntity(r),t.removeEntity(r)},getUnusedEntities:()=>new Set([...e.getUnusedEntities(),...t.getUnusedEntities()]),getUsedEntities:()=>new Set([...e.getUsedEntities(),...t.getUsedEntities()])}}function Entity(e=!1){const t=e?EntityUtils.getOffset():0,r=new Set,n=new Set;return{getUnusedEntities:()=>new Set(n),getUsedEntities:()=>new Set(r),generateEntity:function(){if(!n.size&&!r.size){const e=t;return r.add(e),e}const e=n[Symbol.iterator]().next();if(e.done){const e=Math.max(...r.values())+1;if(e>=EntityUtils.MAX_ENTITIES+t)throw new Error("Entity rate limit exceed");return r.add(e),e}const i=e.value;return n.delete(i),r.add(i),i},removeEntity:function(e){r.has(e)&&(r.delete(e),n.add(e))}}}const isProd=()=>!!process.env.PRODUCTION||!1;function deepReadonly(e){return isProd()?e:Object.freeze({...e})}function defineComponent(e,t){const r=new Map,n=new Set;return{_id:e,isDirty:function(e){return n.has(e)},has:function(e){return r.has(e)},deleteFrom:function(e){const t=r.get(e);return r.delete(e),n.add(e),t||null},getOrNull:function(e){const t=r.get(e);return t?deepReadonly(t):null},getFrom:function(t){const n=r.get(t);if(!n)throw new Error(`[getFrom] Component ${e} for ${t} not found`);return deepReadonly(n)},create:function(t,i){if(r.get(t))throw new Error(`[create] Component ${e} for ${t} already exists`);return r.set(t,i),n.add(t),i},createOrReplace:function(e,t){return r.set(e,t),n.add(e),t},mutable:function(t){const i=r.get(t);if(!i)throw new Error(`[mutable] Component ${e} for ${t} not found`);return n.add(t),i},iterator:function*(){for(const[e,t]of r)yield[e,t]},dirtyIterator:function*(){for(const e of n)yield e},toBinary(n){const i=r.get(n);if(!i)throw new Error(`Component ${e} for ${n} not found`);const o=createByteBuffer();return t.serialize(i,o),o},writeToByteBuffer(n,i){const o=r.get(n);if(!o)throw new Error(`[toBinary] Component ${e} for ${n} not found`);t.serialize(o,i)},updateFromBinary(t,n){if(!r.get(t))throw new Error(`[updateFromBinary] Component ${e} for ${t} not found`);return this.upsertFromBinary(t,n)},upsertFromBinary(e,i){const o=t.deserialize(i);return r.set(e,o),n.add(e),o},clearDirty:function(){n.clear()}}}function preEngine(){const e=EntityContainer(),t=new Map,r=new Map,n=new Set;function i(t=!1){return e.generateEntity(t)}function*o(...e){const[t,...r]=e;for(const[n]of t.iterator()){let t=!0;for(const e of r)if(!e.has(n)){t=!1;break}t&&(yield[n,...e])}}return{entitiesComponent:r,componentsDefinition:t,systems:n,addEntity:i,addDynamicEntity:function(){return i(!0)},removeEntity:function(r){for(const[,e]of t)e.has(r)&&e.deleteFrom(r);return e.removeEntity(r)},addSystem:function(e){if(n.has(e))throw new Error("System already added");n.add(e)},defineComponent:function(e,r){if(t.get(e))throw new Error(`Component ${e} already declared`);const n=defineComponent(e,r);return t.set(e,n),n},mutableGroupOf:function*(...e){for(const[t,...r]of o(...e))yield[t,...r.map((e=>e.mutable(t)))]},groupOf:function*(...e){for(const[t,...r]of o(...e))yield[t,...r.map((e=>e.getFrom(t)))]},getComponent:function(e){const r=t.get(e);if(!r)throw new Error("Component not found. You need to declare the components at the beginnig of the engine declaration");return r}}}function Engine(){const e=preEngine(),t=crdtSceneSystem(e),r=defineSdkComponents(e);return{addEntity:e.addEntity,addDynamicEntity:e.addDynamicEntity,removeEntity:e.removeEntity,addSystem:e.addSystem,defineComponent:e.defineComponent,mutableGroupOf:e.mutableGroupOf,groupOf:e.groupOf,getComponent:e.getComponent,update:function(r){t.receiveMessages();for(const t of e.systems)t(r);const n=new Map;for(const[t,r]of e.componentsDefinition)for(const e of r.dirtyIterator())n.has(e)||n.set(e,new Set),n.get(e).add(t);t.createMessages(n);for(const[t,r]of e.componentsDefinition)r.clearDirty()},baseComponents:r}}function MapType(e){return{serialize(t,r){for(const n in e)e[n].serialize(t[n],r)},deserialize(t){const r={};for(const n in e)r[n]=e[n].deserialize(t);return r}}}function ArrayType(e){return{serialize(t,r){r.writeUint32(t.length);for(const n of t)e.serialize(n,r)},deserialize(t){const r=[],n=t.readUint32();for(let i=0;i<n;i++)r.push(e.deserialize(t));return r}}}function Optional(e){return{serialize(t,r){t?(r.writeInt8(1),e.serialize(t,r)):r.writeInt8(0)},deserialize(t){if(t.readInt8())return e.deserialize(t)}}}const Int64={serialize(e,t){t.writeInt64(BigInt(e))},deserialize:e=>Number(e.readInt64())},Int32={serialize(e,t){t.writeInt32(e)},deserialize:e=>e.readInt32()},Int16={serialize(e,t){t.writeInt16(e)},deserialize:e=>e.readInt16()},Int8={serialize(e,t){t.writeInt8(e)},deserialize:e=>e.readInt8()},Float32={serialize(e,t){t.writeFloat32(e)},deserialize:e=>e.readFloat32()},Float64={serialize(e,t){t.writeFloat64(e)},deserialize:e=>e.readFloat64()},FlatString={serialize(e,t){t.writeBuffer((new TextEncoder).encode(e))},deserialize:e=>(new TextDecoder).decode(e.readBuffer())},EcsString=FlatString;function Enum(e){return{serialize(t,r){e.serialize(t,r)},deserialize:t=>e.deserialize(t)}}const EcsBoolean={serialize(e,t){t.writeInt8(e?1:0)},deserialize:e=>1===e.readInt8()};exports.ArrayType=ArrayType,exports.DEG2RAD=distExports$1.DEG2RAD,exports.EcsBoolean=EcsBoolean,exports.EcsString=EcsString,exports.Engine=Engine,exports.Enum=Enum,exports.Epsilon=distExports$1.Epsilon,exports.FlatString=FlatString,exports.Float32=Float32,exports.Float64=Float64,exports.Int16=Int16,exports.Int32=Int32,exports.Int64=Int64,exports.Int8=Int8,exports.MapType=MapType,exports.Optional=Optional,exports.Orientation=distExports$1.Orientation,exports.Quaternion=distExports$1.Quaternion,exports.RAD2DEG=distExports$1.RAD2DEG,exports.Space=distExports$1.Space,exports.ToGammaSpace=distExports$1.ToGammaSpace,exports.ToLinearSpace=distExports$1.ToLinearSpace,exports.Vector3=distExports$1.Vector3,Object.defineProperty(exports,"__esModule",{value:!0})})(this.self=this.self||{});
|
1
|
+
(function(exports){"use strict";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},dist$1={},Quaternion={},Vector3={},hasRequiredVector3;function requireVector3(){return hasRequiredVector3||(hasRequiredVector3=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Vector3=void 0,function(t){function e(t=0,e=0,n=0){return{x:t,y:e,z:n}}function n(t,e){e.x=t.x,e.y=t.y,e.z=t.z}function i(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z)}function r(t,e,n){n.x=t.x*e,n.y=t.y*e,n.z=t.z*e}function o(t,n){const i=e(0,0,0);return a(t,n,i),i}function a(t,e,i){0!==e&&1!==e?r(t,1/e,i):n(t,i)}function s(t,e,n,i){i.x=t.x+(e.x-t.x)*n,i.y=t.y+(e.y-t.y)*n,i.z=t.z+(e.z-t.z)*n}t.create=e,t.add=function(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}},t.subtract=function(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}},t.subtractToRef=function(t,e,n){n.x=t.x-e.x,n.y=t.y-e.y,n.z=t.z-e.z},t.opposite=function(t){return{x:-t.x,y:-t.y,z:-t.z}},t.copy=n,t.clone=function(t){return Object.assign({},t)},t.length=i,t.lengthSquared=function(t){return t.x*t.x+t.y*t.y+t.z*t.z},t.scaleToRef=r,t.scale=function(t,n){return e(t.x*n,t.y*n,t.z*n)},t.normalizeFromLength=o,t.normalizeFromLengthToRef=a,t.normalize=function(t){return o(t,i(t))},t.normalizeToRef=function(t,e){a(t,i(t),e)},t.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},t.rotate=function(t,e){const{x:n,y:i,z:r}=t,{x:o,y:a,z:s,w:u}=e,l=u*n+a*r-s*i,f=u*i+s*n-o*r,c=u*r+o*i-a*n,d=-o*n-a*i-s*r;return{x:l*u+d*-o+f*-s-c*-a,y:f*u+d*-a+c*-o-l*-s,z:c*u+d*-s+l*-a-f*-o}},t.lerp=function(t,n,i){const r=e(0,0,0);return s(t,n,i,r),r},t.lerpToRef=s,t.cross=function(e,n){const i=t.Zero();return t.crossToRef(e,n,i),i},t.crossToRef=function(t,e,n){n.x=t.y*e.z-t.z*e.y,n.y=t.z*e.x-t.x*e.z,n.z=t.x*e.y-t.y*e.x},t.Zero=function(){return e(0,0,0)},t.One=function(){return e(1,1,1)},t.Up=function(){return e(0,1,0)},t.Down=function(){return e(0,-1,0)},t.Forward=function(){return e(0,0,1)},t.Backward=function(){return e(0,0,-1)},t.Right=function(){return e(1,0,0)},t.Left=function(){return e(-1,0,0)}}(t.Vector3||(t.Vector3={}))}(Vector3)),Vector3}var Scalar={},hasRequiredScalar;function requireScalar(){if(hasRequiredScalar)return Scalar;hasRequiredScalar=1,Object.defineProperty(Scalar,"__esModule",{value:!0}),Scalar.Scalar=void 0;const t=2*Math.PI;function e(t){const e=+t;return 0===e||isNaN(e)?e:e>0?1:-1}function n(t,e=0,n=1){return Math.min(n,Math.max(e,t))}function i(t,e){return t-Math.floor(t/e)*e}function r(t,e){let n=i(e-t,360);return n>180&&(n-=360),n}function o(t,n,i){let r=0;return r=Math.abs(n-t)<=i?n:t+e(n-t)*i,r}return Scalar.Scalar={withinEpsilon:function(t,e,n=1401298e-51){const i=t-e;return-n<=i&&i<=n},toHex:function(t){const e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},sign:e,clamp:n,log2:function(t){return Math.log(t)*Math.LOG2E},repeat:i,normalize:function(t,e,n){return(t-e)/(n-e)},denormalize:function(t,e,n){return t*(n-e)+e},deltaAngle:r,pingPong:function(t,e){const n=i(t,2*e);return e-Math.abs(n-e)},smoothStep:function(t,e,i){let r=n(i);return r=-2*r*r*r+3*r*r,e*r+t*(1-r)},moveTowards:o,moveTowardsAngle:function(t,e,n){const i=r(t,e);let a=0;return a=-n<i&&i<n?e:o(t,t+i,n),a},lerp:function(t,e,n){return t+(e-t)*n},lerpAngle:function(t,e,r){let o=i(e-t,360);return o>180&&(o-=360),t+o*n(r)},inverseLerp:function(t,e,i){let r=0;return r=t!==e?n((i-t)/(e-t)):0,r},hermite:function(t,e,n,i,r){const o=r*r,a=r*o;return t*(2*a-3*o+1)+n*(-2*a+3*o)+e*(a-2*o+r)+i*(a-o)},randomRange:function(t,e){return t===e?t:Math.random()*(e-t)+t},rangeToPercent:function(t,e,n){return(t-e)/(n-e)},percentToRange:function(t,e,n){return(n-e)*t+e},normalizeRadians:function(e){return e-t*Math.floor((e+Math.PI)/t)},TwoPi:t},Scalar}var types$1={},hasRequiredTypes$1,hasRequiredQuaternion,hasRequiredDist$1;function requireTypes$1(){return hasRequiredTypes$1||(hasRequiredTypes$1=1,function(t){var e,n;Object.defineProperty(t,"__esModule",{value:!0}),t.RAD2DEG=t.DEG2RAD=t.Epsilon=t.ToLinearSpace=t.ToGammaSpace=t.Space=t.Orientation=void 0,(e=t.Orientation||(t.Orientation={}))[e.CW=0]="CW",e[e.CCW=1]="CCW",(n=t.Space||(t.Space={}))[n.LOCAL=0]="LOCAL",n[n.WORLD=1]="WORLD",n[n.BONE=2]="BONE",t.ToGammaSpace=1/2.2,t.ToLinearSpace=2.2,t.Epsilon=1e-6,t.DEG2RAD=Math.PI/180,t.RAD2DEG=360/(2*Math.PI)}(types$1)),types$1}function requireQuaternion(){return hasRequiredQuaternion||(hasRequiredQuaternion=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Quaternion=void 0;const e=requireVector3(),n=requireScalar(),i=requireTypes$1();!function(t){function r(t=0,e=0,n=0,i=1){return{x:t,y:e,z:n,w:i}}function o(t,e,n){const i=.5*e,o=.5*t,a=.5*n,s=Math.cos(i),u=Math.cos(o),l=Math.cos(a),f=Math.sin(i),c=Math.sin(o),d=Math.sin(a);return r(u*f*l+c*s*d,c*s*l-u*f*d,u*s*d-c*f*l,u*s*l+c*f*d)}function a(t){return Math.sqrt(s(t))}function s(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w}function u(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w}function l(t,e){const n=u(t,e);return 2*Math.acos(Math.min(Math.abs(n),1))*i.RAD2DEG}function f(t){const e=1/a(t);return r(t.x*e,t.y*e,t.z*e,t.w*e)}function c(){return r(0,0,0,1)}function d(e,n,i){const r=t.Identity();return t.slerpToRef(e,n,i,r),r}function p(t,e,n){n.x=t.x*e.w+t.y*e.z-t.z*e.y+t.w*e.x,n.y=-t.x*e.z+t.y*e.w+t.z*e.x+t.w*e.y,n.z=t.x*e.y-t.y*e.x+t.z*e.w+t.w*e.z,n.w=-t.x*e.x-t.y*e.y-t.z*e.z+t.w*e.w}t.create=r,t.add=function(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z,w:t.w+e.w}},t.rotationYawPitchRoll=o,t.euler=function(t,e,n){return o(e*i.DEG2RAD,t*i.DEG2RAD,n*i.DEG2RAD)},t.length=a,t.lengthSquared=s,t.dot=u,t.angle=l,t.rotateTowards=function(t,e,n){const i=l(t,e);return 0===i?e:d(t,e,Math.min(1,n/i))},t.lookRotation=function(t,n={x:0,y:1,z:0}){const i=e.Vector3.normalize(t),o=e.Vector3.normalize(e.Vector3.cross(n,i)),a=e.Vector3.cross(i,o),s=o.x,u=o.y,l=o.z,f=a.x,c=a.y,d=a.z,p=i.x,h=i.y,m=i.z,g=s+c+m,y=r();if(g>0){let t=Math.sqrt(g+1);return y.w=.5*t,t=.5/t,y.x=(d-h)*t,y.y=(p-l)*t,y.z=(u-f)*t,y}if(s>=c&&s>=m){const t=Math.sqrt(1+s-c-m),e=.5/t;return y.x=.5*t,y.y=(u+f)*e,y.z=(l+p)*e,y.w=(d-h)*e,y}if(c>m){const t=Math.sqrt(1+c-s-m),e=.5/t;return y.x=(f+u)*e,y.y=.5*t,y.z=(h+d)*e,y.w=(p-l)*e,y}const E=Math.sqrt(1+m-s-c),b=.5/E;return y.x=(p+l)*b,y.y=(h+d)*b,y.z=.5*E,y.w=(u-f)*b,y},t.normalize=f,t.fromToRotation=function(t,n,i=e.Vector3.Up()){const o=e.Vector3.normalize(t),a=e.Vector3.normalize(n),s=e.Vector3.cross(o,a),u=Math.sqrt(e.Vector3.lengthSquared(o)*e.Vector3.lengthSquared(a))+e.Vector3.dot(o,a);return e.Vector3.lengthSquared(s)<1e-4?Math.abs(u)<1e-4?f(r(i.x,i.y,i.z,0)):c():f(r(s.x,s.y,s.z,u))},t.Identity=c,t.eulerAngles=function(t){const r=e.Vector3.create(),o=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w,a=t.x*t.w-t.y*t.z;return a>.4995*o?(r.x=Math.PI/2,r.y=2*Math.atan2(t.y,t.x),r.z=0):a<-.4995*o?(r.x=-Math.PI/2,r.y=-2*Math.atan2(t.y,t.x),r.z=0):(r.x=Math.asin(2*(t.w*t.x-t.y*t.z)),r.y=Math.atan2(2*t.w*t.y+2*t.z*t.x,1-2*(t.x*t.x+t.y*t.y)),r.z=Math.atan2(2*t.w*t.z+2*t.x*t.y,1-2*(t.z*t.z+t.x*t.x))),r.x*=i.RAD2DEG,r.y*=i.RAD2DEG,r.z*=i.RAD2DEG,r.x=n.Scalar.repeat(r.x,360),r.y=n.Scalar.repeat(r.y,360),r.z=n.Scalar.repeat(r.z,360),r},t.rotationYawPitchRollToRef=function(t,e,n,i){const r=.5*e,o=.5*t,a=.5*n,s=Math.cos(r),u=Math.cos(o),l=Math.cos(a),f=Math.sin(r),c=Math.sin(o),d=Math.sin(a);i.x=u*f*l+c*s*d,i.y=c*s*l-u*f*d,i.z=u*s*d-c*f*l,i.w=u*s*l+c*f*d},t.fromRotationMatrixToRef=function(t,e){const n=t._m,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],u=n[9],l=n[2],f=n[6],c=n[10],d=i+s+c;let p;d>0?(p=.5/Math.sqrt(d+1),e.w=.25/p,e.x=(f-u)*p,e.y=(o-l)*p,e.z=(a-r)*p):i>s&&i>c?(p=2*Math.sqrt(1+i-s-c),e.w=(f-u)/p,e.x=.25*p,e.y=(r+a)/p,e.z=(o+l)/p):s>c?(p=2*Math.sqrt(1+s-i-c),e.w=(o-l)/p,e.x=(r+a)/p,e.y=.25*p,e.z=(u+f)/p):(p=2*Math.sqrt(1+c-i-s),e.w=(a-r)/p,e.x=(o+l)/p,e.y=(u+f)/p,e.z=.25*p)},t.slerp=d,t.slerpToRef=function(t,e,n,i){let r,o,a=t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w,s=!1;if(a<0&&(s=!0,a=-a),a>.999999)o=1-n,r=s?-n:n;else{const t=Math.acos(a),e=1/Math.sin(t);o=Math.sin((1-n)*t)*e,r=s?-Math.sin(n*t)*e:Math.sin(n*t)*e}i.x=o*t.x+r*e.x,i.y=o*t.y+r*e.y,i.z=o*t.z+r*e.z,i.w=o*t.w+r*e.w},t.multiply=function(t,e){const n=r(0,0,0,1);return p(t,e,n),n},t.multiplyToRef=p,t.angleAxis=function(n,r){if(0===e.Vector3.lengthSquared(r))return t.Identity();const o=c();let a=n*i.DEG2RAD;a*=.5;const s=e.Vector3.normalize(r);return e.Vector3.scaleToRef(s,Math.sin(a),s),o.x=s.x,o.y=s.y,o.z=s.z,o.w=Math.cos(a),f(o)},t.Zero=function(){return r(0,0,0,0)}}(t.Quaternion||(t.Quaternion={}))}(Quaternion)),Quaternion}function requireDist$1(){return hasRequiredDist$1||(hasRequiredDist$1=1,function(t){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),n=commonjsGlobal&&commonjsGlobal.__exportStar||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||e(n,t,i)};Object.defineProperty(t,"__esModule",{value:!0}),n(requireQuaternion(),t),n(requireVector3(),t),n(requireTypes$1(),t),n(requireDist$1(),t)}(dist$1)),dist$1}var distExports$1=requireDist$1(),minimal$1={exports:{}},indexMinimal={},minimal={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;return hasRequiredAspromise=1,aspromise=function(t,e){var n=new Array(arguments.length-1),i=0,r=2,o=!0;for(;r<arguments.length;)n[i++]=arguments[r++];return new Promise((function(r,a){n[i]=function(t){if(o)if(o=!1,t)a(t);else{for(var e=new Array(arguments.length-1),n=0;n<e.length;)e[n++]=arguments[n];r.apply(null,e)}};try{t.apply(e||null,n)}catch(t){o&&(o=!1,a(t))}}))}}var base64={},hasRequiredBase64,eventemitter,hasRequiredEventemitter,float,hasRequiredFloat,inquire_1,hasRequiredInquire;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(t){var e=t;e.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&"="===t.charAt(e);)++n;return Math.ceil(3*t.length)/4-n};for(var n=new Array(64),i=new Array(123),r=0;r<64;)i[n[r]=r<26?r+65:r<52?r+71:r<62?r-4:r-59|43]=r++;e.encode=function(t,e,i){for(var r,o=null,a=[],s=0,u=0;e<i;){var l=t[e++];switch(u){case 0:a[s++]=n[l>>2],r=(3&l)<<4,u=1;break;case 1:a[s++]=n[r|l>>4],r=(15&l)<<2,u=2;break;case 2:a[s++]=n[r|l>>6],a[s++]=n[63&l],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=n[r],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var o="invalid encoding";e.decode=function(t,e,n){for(var r,a=n,s=0,u=0;u<t.length;){var l=t.charCodeAt(u++);if(61===l&&s>1)break;if(void 0===(l=i[l]))throw Error(o);switch(s){case 0:r=l,s=1;break;case 1:e[n++]=r<<2|(48&l)>>4,r=l,s=2;break;case 2:e[n++]=(15&r)<<4|(60&l)>>2,r=l,s=3;break;case 3:e[n++]=(3&r)<<6|l,s=0}}if(1===s)throw Error(o);return n-a},e.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}}(base64)),base64}function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;function t(){this._listeners={}}return hasRequiredEventemitter=1,eventemitter=t,t.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this},t.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===e?n.splice(i,1):++i;return this},t.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,n)}return this},eventemitter}function requireFloat(){if(hasRequiredFloat)return float;function t(t){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),n=new Uint8Array(e.buffer),i=128===n[3];function r(t,i,r){e[0]=t,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3]}function o(t,i,r){e[0]=t,i[r]=n[3],i[r+1]=n[2],i[r+2]=n[1],i[r+3]=n[0]}function a(t,i){return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n[3]=t[i+3],e[0]}function s(t,i){return n[3]=t[i],n[2]=t[i+1],n[1]=t[i+2],n[0]=t[i+3],e[0]}t.writeFloatLE=i?r:o,t.writeFloatBE=i?o:r,t.readFloatLE=i?a:s,t.readFloatBE=i?s:a}():function(){function o(t,e,n,i){var r=e<0?1:0;if(r&&(e=-e),0===e)t(1/e>0?0:2147483648,n,i);else if(isNaN(e))t(2143289344,n,i);else if(e>34028234663852886e22)t((r<<31|2139095040)>>>0,n,i);else if(e<11754943508222875e-54)t((r<<31|Math.round(e/1401298464324817e-60))>>>0,n,i);else{var o=Math.floor(Math.log(e)/Math.LN2);t((r<<31|o+127<<23|8388607&Math.round(e*Math.pow(2,-o)*8388608))>>>0,n,i)}}function a(t,e,n){var i=t(e,n),r=2*(i>>31)+1,o=i>>>23&255,a=8388607&i;return 255===o?a?NaN:r*(1/0):0===o?1401298464324817e-60*r*a:r*Math.pow(2,o-150)*(a+8388608)}t.writeFloatLE=o.bind(null,e),t.writeFloatBE=o.bind(null,n),t.readFloatLE=a.bind(null,i),t.readFloatBE=a.bind(null,r)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),n=new Uint8Array(e.buffer),i=128===n[7];function r(t,i,r){e[0]=t,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3],i[r+4]=n[4],i[r+5]=n[5],i[r+6]=n[6],i[r+7]=n[7]}function o(t,i,r){e[0]=t,i[r]=n[7],i[r+1]=n[6],i[r+2]=n[5],i[r+3]=n[4],i[r+4]=n[3],i[r+5]=n[2],i[r+6]=n[1],i[r+7]=n[0]}function a(t,i){return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n[3]=t[i+3],n[4]=t[i+4],n[5]=t[i+5],n[6]=t[i+6],n[7]=t[i+7],e[0]}function s(t,i){return n[7]=t[i],n[6]=t[i+1],n[5]=t[i+2],n[4]=t[i+3],n[3]=t[i+4],n[2]=t[i+5],n[1]=t[i+6],n[0]=t[i+7],e[0]}t.writeDoubleLE=i?r:o,t.writeDoubleBE=i?o:r,t.readDoubleLE=i?a:s,t.readDoubleBE=i?s:a}():function(){function o(t,e,n,i,r,o){var a=i<0?1:0;if(a&&(i=-i),0===i)t(0,r,o+e),t(1/i>0?0:2147483648,r,o+n);else if(isNaN(i))t(0,r,o+e),t(2146959360,r,o+n);else if(i>17976931348623157e292)t(0,r,o+e),t((a<<31|2146435072)>>>0,r,o+n);else{var s;if(i<22250738585072014e-324)t((s=i/5e-324)>>>0,r,o+e),t((a<<31|s/4294967296)>>>0,r,o+n);else{var u=Math.floor(Math.log(i)/Math.LN2);1024===u&&(u=1023),t(4503599627370496*(s=i*Math.pow(2,-u))>>>0,r,o+e),t((a<<31|u+1023<<20|1048576*s&1048575)>>>0,r,o+n)}}}function a(t,e,n,i,r){var o=t(i,r+e),a=t(i,r+n),s=2*(a>>31)+1,u=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===u?l?NaN:s*(1/0):0===u?5e-324*s*l:s*Math.pow(2,u-1075)*(l+4503599627370496)}t.writeDoubleLE=o.bind(null,e,0,4),t.writeDoubleBE=o.bind(null,n,4,0),t.readDoubleLE=a.bind(null,i,0,4),t.readDoubleBE=a.bind(null,r,4,0)}(),t}function e(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}function n(t,e,n){e[n]=t>>>24,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=255&t}function i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function r(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}return hasRequiredFloat=1,float=t(t)}function requireInquire(){if(hasRequiredInquire)return inquire_1;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}return hasRequiredInquire=1,inquire_1=inquire,inquire_1}var utf8={},hasRequiredUtf8,pool_1,hasRequiredPool,longbits,hasRequiredLongbits,hasRequiredMinimal$1,writer,hasRequiredWriter,writer_buffer,hasRequiredWriter_buffer,reader,hasRequiredReader,reader_buffer,hasRequiredReader_buffer;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(t){var e=t;e.length=function(t){for(var e=0,n=0,i=0;i<t.length;++i)(n=t.charCodeAt(i))<128?e+=1:n<2048?e+=2:55296==(64512&n)&&56320==(64512&t.charCodeAt(i+1))?(++i,e+=4):e+=3;return e},e.read=function(t,e,n){if(n-e<1)return"";for(var i,r=null,o=[],a=0;e<n;)(i=t[e++])<128?o[a++]=i:i>191&&i<224?o[a++]=(31&i)<<6|63&t[e++]:i>239&&i<365?(i=((7&i)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[a++]=55296+(i>>10),o[a++]=56320+(1023&i)):o[a++]=(15&i)<<12|(63&t[e++])<<6|63&t[e++],a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),a=0);return r?(a&&r.push(String.fromCharCode.apply(String,o.slice(0,a))),r.join("")):String.fromCharCode.apply(String,o.slice(0,a))},e.write=function(t,e,n){for(var i,r,o=n,a=0;a<t.length;++a)(i=t.charCodeAt(a))<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&56320==(64512&(r=t.charCodeAt(a+1)))?(i=65536+((1023&i)<<10)+(1023&r),++a,e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128);return n-o}}(utf8)),utf8}function requirePool(){if(hasRequiredPool)return pool_1;return hasRequiredPool=1,pool_1=function(t,e,n){var i=n||8192,r=i>>>1,o=null,a=i;return function(n){if(n<1||n>r)return t(n);a+n>i&&(o=t(i),a=0);var s=e.call(o,a,a+=n);return 7&a&&(a=1+(7|a)),s}}}function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=e;var t=requireMinimal$1();function e(t,e){this.lo=t>>>0,this.hi=e>>>0}var n=e.zero=new e(0,0);n.toNumber=function(){return 0},n.zzEncode=n.zzDecode=function(){return this},n.length=function(){return 1};var i=e.zeroHash="\0\0\0\0\0\0\0\0";e.fromNumber=function(t){if(0===t)return n;var i=t<0;i&&(t=-t);var r=t>>>0,o=(t-r)/4294967296>>>0;return i&&(o=~o>>>0,r=~r>>>0,++r>4294967295&&(r=0,++o>4294967295&&(o=0))),new e(r,o)},e.from=function(i){if("number"==typeof i)return e.fromNumber(i);if(t.isString(i)){if(!t.Long)return e.fromNumber(parseInt(i,10));i=t.Long.fromString(i)}return i.low||i.high?new e(i.low>>>0,i.high>>>0):n},e.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+4294967296*n)}return this.lo+4294967296*this.hi},e.prototype.toLong=function(e){return t.Long?new t.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var r=String.prototype.charCodeAt;return e.fromHash=function(t){return t===i?n:new e((r.call(t,0)|r.call(t,1)<<8|r.call(t,2)<<16|r.call(t,3)<<24)>>>0,(r.call(t,4)|r.call(t,5)<<8|r.call(t,6)<<16|r.call(t,7)<<24)>>>0)},e.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},e.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},e.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},e.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10},longbits}function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,function(t){var e=t;function n(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;++r)void 0!==t[i[r]]&&n||(t[i[r]]=e[i[r]]);return t}function i(t){function e(t,i){if(!(this instanceof e))return new e(t,i);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&n(this,i)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return t}}),e.prototype.toString=function(){return this.name+": "+this.message},e}e.asPromise=requireAspromise(),e.base64=requireBase64(),e.EventEmitter=requireEventemitter(),e.float=requireFloat(),e.inquire=requireInquire(),e.utf8=requireUtf8(),e.pool=requirePool(),e.LongBits=requireLongbits(),e.isNode=Boolean(void 0!==commonjsGlobal&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),e.global=e.isNode&&commonjsGlobal||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||commonjsGlobal,e.emptyArray=Object.freeze?Object.freeze([]):[],e.emptyObject=Object.freeze?Object.freeze({}):{},e.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},e.isString=function(t){return"string"==typeof t||t instanceof String},e.isObject=function(t){return t&&"object"==typeof t},e.isset=e.isSet=function(t,e){var n=t[e];return!(null==n||!t.hasOwnProperty(e))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},e.Buffer=function(){try{var t=e.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),e._Buffer_from=null,e._Buffer_allocUnsafe=null,e.newBuffer=function(t){return"number"==typeof t?e.Buffer?e._Buffer_allocUnsafe(t):new e.Array(t):e.Buffer?e._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},e.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,e.Long=e.global.dcodeIO&&e.global.dcodeIO.Long||e.global.Long||e.inquire("long"),e.key2Re=/^true|false|0|1$/,e.key32Re=/^-?(?:0|[1-9][0-9]*)$/,e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,e.longToHash=function(t){return t?e.LongBits.from(t).toHash():e.LongBits.zeroHash},e.longFromHash=function(t,n){var i=e.LongBits.fromHash(t);return e.Long?e.Long.fromBits(i.lo,i.hi,n):i.toNumber(Boolean(n))},e.merge=n,e.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},e.newError=i,e.ProtocolError=i("ProtocolError"),e.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var t=Object.keys(this),n=t.length-1;n>-1;--n)if(1===e[t[n]]&&void 0!==this[t[n]]&&null!==this[t[n]])return t[n]}},e.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}},e.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},e._configure=function(){var t=e.Buffer;t?(e._Buffer_from=t.from!==Uint8Array.from&&t.from||function(e,n){return new t(e,n)},e._Buffer_allocUnsafe=t.allocUnsafe||function(e){return new t(e)}):e._Buffer_from=e._Buffer_allocUnsafe=null}}(minimal)),minimal}function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=u;var t,e=requireMinimal$1(),n=e.LongBits,i=e.base64,r=e.utf8;function o(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}function a(){}function s(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function u(){this.len=0,this.head=new o(a,0,0),this.tail=this.head,this.states=null}var l=function(){return e.Buffer?function(){return(u.create=function(){return new t})()}:function(){return new u}};function f(t,e,n){e[n]=255&t}function c(t,e){this.len=t,this.next=void 0,this.val=e}function d(t,e,n){for(;t.hi;)e[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[n++]=127&t.lo|128,t.lo=t.lo>>>7;e[n++]=t.lo}function p(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}u.create=l(),u.alloc=function(t){return new e.Array(t)},e.Array!==Array&&(u.alloc=e.pool(u.alloc,e.Array.prototype.subarray)),u.prototype._push=function(t,e,n){return this.tail=this.tail.next=new o(t,e,n),this.len+=e,this},c.prototype=Object.create(o.prototype),c.prototype.fn=function(t,e,n){for(;t>127;)e[n++]=127&t|128,t>>>=7;e[n]=t},u.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new c((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},u.prototype.int32=function(t){return t<0?this._push(d,10,n.fromNumber(t)):this.uint32(t)},u.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},u.prototype.uint64=function(t){var e=n.from(t);return this._push(d,e.length(),e)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(t){var e=n.from(t).zzEncode();return this._push(d,e.length(),e)},u.prototype.bool=function(t){return this._push(f,1,t?1:0)},u.prototype.fixed32=function(t){return this._push(p,4,t>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(t){var e=n.from(t);return this._push(p,4,e.lo)._push(p,4,e.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(t){return this._push(e.float.writeFloatLE,4,t)},u.prototype.double=function(t){return this._push(e.float.writeDoubleLE,8,t)};var h=e.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var i=0;i<t.length;++i)e[n+i]=t[i]};return u.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(f,1,0);if(e.isString(t)){var r=u.alloc(n=i.length(t));i.decode(t,r,0),t=r}return this.uint32(n)._push(h,n,t)},u.prototype.string=function(t){var e=r.length(t);return e?this.uint32(e)._push(r.write,e,t):this._push(f,1,0)},u.prototype.fork=function(){return this.states=new s(this),this.head=this.tail=new o(a,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(a,0,0),this.len=0),this},u.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this},u.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e},u._configure=function(e){t=e,u.create=l(),t._configure()},writer}function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=n;var t=requireWriter();(n.prototype=Object.create(t.prototype)).constructor=n;var e=requireMinimal$1();function n(){t.call(this)}function i(t,n,i){t.length<40?e.utf8.write(t,n,i):n.utf8Write?n.utf8Write(t,i):n.write(t,i)}return n._configure=function(){n.alloc=e._Buffer_allocUnsafe,n.writeBytesBuffer=e.Buffer&&e.Buffer.prototype instanceof Uint8Array&&"set"===e.Buffer.prototype.set.name?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var i=0;i<t.length;)e[n++]=t[i++]}},n.prototype.bytes=function(t){e.isString(t)&&(t=e._Buffer_from(t,"base64"));var i=t.length>>>0;return this.uint32(i),i&&this._push(n.writeBytesBuffer,i,t),this},n.prototype.string=function(t){var n=e.Buffer.byteLength(t);return this.uint32(n),n&&this._push(i,n,t),this},n._configure(),writer_buffer}function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=o;var t,e=requireMinimal$1(),n=e.LongBits,i=e.utf8;function r(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function o(t){this.buf=t,this.pos=0,this.len=t.length}var a,s="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new o(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new o(t);throw Error("illegal buffer")},u=function(){return e.Buffer?function(n){return(o.create=function(n){return e.Buffer.isBuffer(n)?new t(n):s(n)})(n)}:s};function l(){var t=new n(0,0),e=0;if(!(this.len-this.pos>4)){for(;e<3;++e){if(this.pos>=this.len)throw r(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw r(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function f(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function c(){if(this.pos+8>this.len)throw r(this,8);return new n(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}return o.create=u(),o.prototype._slice=e.Array.prototype.subarray||e.Array.prototype.slice,o.prototype.uint32=(a=4294967295,function(){if(a=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return a;if(a=(a|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return a;if((this.pos+=5)>this.len)throw this.pos=this.len,r(this,10);return a}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},o.prototype.bool=function(){return 0!==this.uint32()},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw r(this,4);return f(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw r(this,4);return 0|f(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw r(this,4);var t=e.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},o.prototype.double=function(){if(this.pos+8>this.len)throw r(this,4);var t=e.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},o.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw r(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)},o.prototype.string=function(){var t=this.bytes();return i.read(t,0,t.length)},o.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw r(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw r(this)}while(128&this.buf[this.pos++]);return this},o.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},o._configure=function(n){t=n,o.create=u(),t._configure();var i=e.Long?"toLong":"toNumber";e.merge(o.prototype,{int64:function(){return l.call(this)[i](!1)},uint64:function(){return l.call(this)[i](!0)},sint64:function(){return l.call(this).zzDecode()[i](!1)},fixed64:function(){return c.call(this)[i](!0)},sfixed64:function(){return c.call(this)[i](!1)}})},reader}function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=n;var t=requireReader();(n.prototype=Object.create(t.prototype)).constructor=n;var e=requireMinimal$1();function n(e){t.call(this,e)}return n._configure=function(){e.Buffer&&(n.prototype._slice=e.Buffer.prototype.slice)},n.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},n._configure(),reader_buffer}var rpc={},service,hasRequiredService,hasRequiredRpc,roots,hasRequiredRoots,hasRequiredIndexMinimal,hasRequiredMinimal;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=e;var t=requireMinimal$1();function e(e,n,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");t.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(n),this.responseDelimited=Boolean(i)}return(e.prototype=Object.create(t.EventEmitter.prototype)).constructor=e,e.prototype.rpcCall=function e(n,i,r,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return t.asPromise(e,s,n,i,r,o);if(s.rpcImpl)try{return s.rpcImpl(n,i[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(t,e){if(t)return s.emit("error",t,n),a(t);if(null!==e){if(!(e instanceof r))try{e=r[s.responseDelimited?"decodeDelimited":"decode"](e)}catch(t){return s.emit("error",t,n),a(t)}return s.emit("data",e,n),a(null,e)}s.end(!0)}))}catch(t){return s.emit("error",t,n),void setTimeout((function(){a(t)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},e.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(t){t.Service=requireService()}(rpc)),rpc}function requireRoots(){return hasRequiredRoots?roots:(hasRequiredRoots=1,roots={})}function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(t){var e=t;function n(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=requireWriter(),e.BufferWriter=requireWriter_buffer(),e.Reader=requireReader(),e.BufferReader=requireReader_buffer(),e.util=requireMinimal$1(),e.rpc=requireRpc(),e.roots=requireRoots(),e.configure=n,n()}(indexMinimal)),indexMinimal}function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal$1.exports=requireIndexMinimal()),minimal$1.exports}var minimalExports=requireMinimal();function createBasePBAudioSource(){return{playing:!1,volume:0,loop:!1,pitch:0,playedAtTimestamp:0,audioClipUrl:""}}const PBAudioSource={encode:(t,e=minimalExports.Writer.create())=>(!0===t.playing&&e.uint32(8).bool(t.playing),0!==t.volume&&e.uint32(21).float(t.volume),!0===t.loop&&e.uint32(24).bool(t.loop),0!==t.pitch&&e.uint32(37).float(t.pitch),0!==t.playedAtTimestamp&&e.uint32(40).int32(t.playedAtTimestamp),""!==t.audioClipUrl&&e.uint32(50).string(t.audioClipUrl),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBAudioSource();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.playing=n.bool();break;case 2:r.volume=n.float();break;case 3:r.loop=n.bool();break;case 4:r.pitch=n.float();break;case 5:r.playedAtTimestamp=n.int32();break;case 6:r.audioClipUrl=n.string();break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$9=1020,AudioSource={serialize(t,e){const n=PBAudioSource.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBAudioSource.decode(t.buffer(),t.remainingBytes()),create:()=>PBAudioSource.decode(new Uint8Array)};function createBasePBAudioStream(){return{playing:!1,volume:0,url:""}}const PBAudioStream={encode:(t,e=minimalExports.Writer.create())=>(!0===t.playing&&e.uint32(8).bool(t.playing),0!==t.volume&&e.uint32(21).float(t.volume),""!==t.url&&e.uint32(26).string(t.url),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBAudioStream();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.playing=n.bool();break;case 2:r.volume=n.float();break;case 3:r.url=n.string();break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$8=1021,AudioStream={serialize(t,e){const n=PBAudioStream.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBAudioStream.decode(t.buffer(),t.remainingBytes()),create:()=>PBAudioStream.decode(new Uint8Array)};function createBasePBBoxShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBBoxShape={encode(t,e=minimalExports.Writer.create()){!0===t.withCollisions&&e.uint32(8).bool(t.withCollisions),!0===t.isPointerBlocker&&e.uint32(16).bool(t.isPointerBlocker),!0===t.visible&&e.uint32(24).bool(t.visible),e.uint32(34).fork();for(const n of t.uvs)e.float(n);return e.ldelim(),e},decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBBoxShape();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.withCollisions=n.bool();break;case 2:r.isPointerBlocker=n.bool();break;case 3:r.visible=n.bool();break;case 4:if(2==(7&t)){const t=n.uint32()+n.pos;for(;n.pos<t;)r.uvs.push(n.float())}else r.uvs.push(n.float());break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$7=1013,BoxShape={serialize(t,e){const n=PBBoxShape.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBBoxShape.decode(t.buffer(),t.remainingBytes()),create:()=>PBBoxShape.decode(new Uint8Array)};function createBasePBCylinderShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,radiusTop:0,radiusBottom:0}}const PBCylinderShape={encode:(t,e=minimalExports.Writer.create())=>(!0===t.withCollisions&&e.uint32(8).bool(t.withCollisions),!0===t.isPointerBlocker&&e.uint32(16).bool(t.isPointerBlocker),!0===t.visible&&e.uint32(24).bool(t.visible),0!==t.radiusTop&&e.uint32(37).float(t.radiusTop),0!==t.radiusBottom&&e.uint32(45).float(t.radiusBottom),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBCylinderShape();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.withCollisions=n.bool();break;case 2:r.isPointerBlocker=n.bool();break;case 3:r.visible=n.bool();break;case 4:r.radiusTop=n.float();break;case 5:r.radiusBottom=n.float();break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$6=1016,CylinderShape={serialize(t,e){const n=PBCylinderShape.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBCylinderShape.decode(t.buffer(),t.remainingBytes()),create:()=>PBCylinderShape.decode(new Uint8Array)};function createBaseColor3(){return{r:0,g:0,b:0}}const Color3={encode:(t,e=minimalExports.Writer.create())=>(0!==t.r&&e.uint32(13).float(t.r),0!==t.g&&e.uint32(21).float(t.g),0!==t.b&&e.uint32(29).float(t.b),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBaseColor3();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.r=n.float();break;case 2:r.g=n.float();break;case 3:r.b=n.float();break;default:n.skipType(7&t)}}return r}};function createBasePBNFTShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,src:"",assetId:"",style:0,color:void 0}}const PBNFTShape={encode:(t,e=minimalExports.Writer.create())=>(!0===t.withCollisions&&e.uint32(8).bool(t.withCollisions),!0===t.isPointerBlocker&&e.uint32(16).bool(t.isPointerBlocker),!0===t.visible&&e.uint32(24).bool(t.visible),""!==t.src&&e.uint32(34).string(t.src),""!==t.assetId&&e.uint32(42).string(t.assetId),0!==t.style&&e.uint32(48).int32(t.style),void 0!==t.color&&Color3.encode(t.color,e.uint32(58).fork()).ldelim(),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBNFTShape();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.withCollisions=n.bool();break;case 2:r.isPointerBlocker=n.bool();break;case 3:r.visible=n.bool();break;case 4:r.src=n.string();break;case 5:r.assetId=n.string();break;case 6:r.style=n.int32();break;case 7:r.color=Color3.decode(n,n.uint32());break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$5=1040,NFTShape={serialize(t,e){const n=PBNFTShape.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBNFTShape.decode(t.buffer(),t.remainingBytes()),create:()=>PBNFTShape.decode(new Uint8Array)};function createBasePBPlaneShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1,uvs:[]}}const PBPlaneShape={encode(t,e=minimalExports.Writer.create()){!0===t.withCollisions&&e.uint32(8).bool(t.withCollisions),!0===t.isPointerBlocker&&e.uint32(16).bool(t.isPointerBlocker),!0===t.visible&&e.uint32(24).bool(t.visible),e.uint32(34).fork();for(const n of t.uvs)e.float(n);return e.ldelim(),e},decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBPlaneShape();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.withCollisions=n.bool();break;case 2:r.isPointerBlocker=n.bool();break;case 3:r.visible=n.bool();break;case 4:if(2==(7&t)){const t=n.uint32()+n.pos;for(;n.pos<t;)r.uvs.push(n.float())}else r.uvs.push(n.float());break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$4=1014,PlaneShape={serialize(t,e){const n=PBPlaneShape.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBPlaneShape.decode(t.buffer(),t.remainingBytes()),create:()=>PBPlaneShape.decode(new Uint8Array)};function createBasePBSphereShape(){return{withCollisions:!1,isPointerBlocker:!1,visible:!1}}const PBSphereShape={encode:(t,e=minimalExports.Writer.create())=>(!0===t.withCollisions&&e.uint32(8).bool(t.withCollisions),!0===t.isPointerBlocker&&e.uint32(16).bool(t.isPointerBlocker),!0===t.visible&&e.uint32(24).bool(t.visible),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBSphereShape();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.withCollisions=n.bool();break;case 2:r.isPointerBlocker=n.bool();break;case 3:r.visible=n.bool();break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$3=1015,SphereShape={serialize(t,e){const n=PBSphereShape.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBSphereShape.decode(t.buffer(),t.remainingBytes()),create:()=>PBSphereShape.decode(new Uint8Array)};function createBasePBTextShape(){return{text:"",visible:!1,font:"",opacity:0,fontSize:0,fontAutoSize:!1,hTextAlign:"",vTextAlign:"",width:0,height:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,lineSpacing:0,lineCount:0,textWrapping:!1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,outlineWidth:0,shadowColor:void 0,outlineColor:void 0,textColor:void 0}}const PBTextShape={encode:(t,e=minimalExports.Writer.create())=>(""!==t.text&&e.uint32(10).string(t.text),!0===t.visible&&e.uint32(16).bool(t.visible),""!==t.font&&e.uint32(26).string(t.font),0!==t.opacity&&e.uint32(37).float(t.opacity),0!==t.fontSize&&e.uint32(45).float(t.fontSize),!0===t.fontAutoSize&&e.uint32(48).bool(t.fontAutoSize),""!==t.hTextAlign&&e.uint32(58).string(t.hTextAlign),""!==t.vTextAlign&&e.uint32(66).string(t.vTextAlign),0!==t.width&&e.uint32(77).float(t.width),0!==t.height&&e.uint32(85).float(t.height),0!==t.paddingTop&&e.uint32(93).float(t.paddingTop),0!==t.paddingRight&&e.uint32(101).float(t.paddingRight),0!==t.paddingBottom&&e.uint32(109).float(t.paddingBottom),0!==t.paddingLeft&&e.uint32(117).float(t.paddingLeft),0!==t.lineSpacing&&e.uint32(125).float(t.lineSpacing),0!==t.lineCount&&e.uint32(128).int32(t.lineCount),!0===t.textWrapping&&e.uint32(136).bool(t.textWrapping),0!==t.shadowBlur&&e.uint32(149).float(t.shadowBlur),0!==t.shadowOffsetX&&e.uint32(157).float(t.shadowOffsetX),0!==t.shadowOffsetY&&e.uint32(165).float(t.shadowOffsetY),0!==t.outlineWidth&&e.uint32(173).float(t.outlineWidth),void 0!==t.shadowColor&&Color3.encode(t.shadowColor,e.uint32(178).fork()).ldelim(),void 0!==t.outlineColor&&Color3.encode(t.outlineColor,e.uint32(186).fork()).ldelim(),void 0!==t.textColor&&Color3.encode(t.textColor,e.uint32(194).fork()).ldelim(),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBTextShape();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.text=n.string();break;case 2:r.visible=n.bool();break;case 3:r.font=n.string();break;case 4:r.opacity=n.float();break;case 5:r.fontSize=n.float();break;case 6:r.fontAutoSize=n.bool();break;case 7:r.hTextAlign=n.string();break;case 8:r.vTextAlign=n.string();break;case 9:r.width=n.float();break;case 10:r.height=n.float();break;case 11:r.paddingTop=n.float();break;case 12:r.paddingRight=n.float();break;case 13:r.paddingBottom=n.float();break;case 14:r.paddingLeft=n.float();break;case 15:r.lineSpacing=n.float();break;case 16:r.lineCount=n.int32();break;case 17:r.textWrapping=n.bool();break;case 18:r.shadowBlur=n.float();break;case 19:r.shadowOffsetX=n.float();break;case 20:r.shadowOffsetY=n.float();break;case 21:r.outlineWidth=n.float();break;case 22:r.shadowColor=Color3.decode(n,n.uint32());break;case 23:r.outlineColor=Color3.decode(n,n.uint32());break;case 24:r.textColor=Color3.decode(n,n.uint32());break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$2=1030,TextShape={serialize(t,e){const n=PBTextShape.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBTextShape.decode(t.buffer(),t.remainingBytes()),create:()=>PBTextShape.decode(new Uint8Array)};var YGPositionType,YGAlign,YGUnit,YGDirection,YGFlexDirection,YGWrap,YGJustify,YGOverflow,YGDisplay,YGEdge;function createBasePBUiTransform(){return{positionType:0,alignContent:0,alignItems:0,alignSelf:0,flexDirection:0,flexWrap:0,justifyContent:0,overflow:0,display:0,direction:0,flex:0,flexBasisUnit:0,flexBasis:0,flexGrow:0,flexShrink:0,widthUnit:0,width:0,heightUnit:0,height:0,minWidthUnit:0,minWidth:0,minHeightUnit:0,minHeight:0,maxWidthUnit:0,maxWidth:0,maxHeightUnit:0,maxHeight:0,positionLeftUnit:0,positionLeft:0,positionTopUnit:0,positionTop:0,positionRightUnit:0,positionRight:0,positionBottomUnit:0,positionBottom:0,marginLeftUnit:0,marginLeft:0,marginTopUnit:0,marginTop:0,marginRightUnit:0,marginRight:0,marginBottomUnit:0,marginBottom:0,paddingLeftUnit:0,paddingLeft:0,paddingTopUnit:0,paddingTop:0,paddingRightUnit:0,paddingRight:0,paddingBottomUnit:0,paddingBottom:0,borderLeft:0,borderTop:0,borderRight:0,borderBottom:0}}!function(t){t[t.YGPositionTypeStatic=0]="YGPositionTypeStatic",t[t.YGPositionTypeRelative=1]="YGPositionTypeRelative",t[t.YGPositionTypeAbsolute=2]="YGPositionTypeAbsolute",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGPositionType||(YGPositionType={})),function(t){t[t.YGAlignAuto=0]="YGAlignAuto",t[t.YGAlignFlexStart=1]="YGAlignFlexStart",t[t.YGAlignCenter=2]="YGAlignCenter",t[t.YGAlignFlexEnd=3]="YGAlignFlexEnd",t[t.YGAlignStretch=4]="YGAlignStretch",t[t.YGAlignBaseline=5]="YGAlignBaseline",t[t.YGAlignSpaceBetween=6]="YGAlignSpaceBetween",t[t.YGAlignSpaceAround=7]="YGAlignSpaceAround",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGAlign||(YGAlign={})),function(t){t[t.YGUnitUndefined=0]="YGUnitUndefined",t[t.YGUnitPoint=1]="YGUnitPoint",t[t.YGUnitPercent=2]="YGUnitPercent",t[t.YGUnitAuto=3]="YGUnitAuto",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGUnit||(YGUnit={})),function(t){t[t.YGDirectionInherit=0]="YGDirectionInherit",t[t.YGDirectionLTR=1]="YGDirectionLTR",t[t.YGDirectionRTL=2]="YGDirectionRTL",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGDirection||(YGDirection={})),function(t){t[t.YGFlexDirectionColumn=0]="YGFlexDirectionColumn",t[t.YGFlexDirectionColumnReverse=1]="YGFlexDirectionColumnReverse",t[t.YGFlexDirectionRow=2]="YGFlexDirectionRow",t[t.YGFlexDirectionRowReverse=3]="YGFlexDirectionRowReverse",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGFlexDirection||(YGFlexDirection={})),function(t){t[t.YGWrapNoWrap=0]="YGWrapNoWrap",t[t.YGWrapWrap=1]="YGWrapWrap",t[t.YGWrapWrapReverse=2]="YGWrapWrapReverse",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGWrap||(YGWrap={})),function(t){t[t.YGJustifyFlexStart=0]="YGJustifyFlexStart",t[t.YGJustifyCenter=1]="YGJustifyCenter",t[t.YGJustifyFlexEnd=2]="YGJustifyFlexEnd",t[t.YGJustifySpaceBetween=3]="YGJustifySpaceBetween",t[t.YGJustifySpaceAround=4]="YGJustifySpaceAround",t[t.YGJustifySpaceEvenly=5]="YGJustifySpaceEvenly",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGJustify||(YGJustify={})),function(t){t[t.YGOverflowVisible=0]="YGOverflowVisible",t[t.YGOverflowHidden=1]="YGOverflowHidden",t[t.YGOverflowScroll=2]="YGOverflowScroll",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGOverflow||(YGOverflow={})),function(t){t[t.YGDisplayFlex=0]="YGDisplayFlex",t[t.YGDisplayNone=1]="YGDisplayNone",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGDisplay||(YGDisplay={})),function(t){t[t.YGEdgeLeft=0]="YGEdgeLeft",t[t.YGEdgeTop=1]="YGEdgeTop",t[t.YGEdgeRight=2]="YGEdgeRight",t[t.YGEdgeBottom=3]="YGEdgeBottom",t[t.YGEdgeStart=4]="YGEdgeStart",t[t.YGEdgeEnd=5]="YGEdgeEnd",t[t.YGEdgeHorizontal=6]="YGEdgeHorizontal",t[t.YGEdgeVertical=7]="YGEdgeVertical",t[t.YGEdgeAll=8]="YGEdgeAll",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED"}(YGEdge||(YGEdge={}));const PBUiTransform={encode:(t,e=minimalExports.Writer.create())=>(0!==t.positionType&&e.uint32(8).int32(t.positionType),0!==t.alignContent&&e.uint32(16).int32(t.alignContent),0!==t.alignItems&&e.uint32(24).int32(t.alignItems),0!==t.alignSelf&&e.uint32(32).int32(t.alignSelf),0!==t.flexDirection&&e.uint32(40).int32(t.flexDirection),0!==t.flexWrap&&e.uint32(48).int32(t.flexWrap),0!==t.justifyContent&&e.uint32(56).int32(t.justifyContent),0!==t.overflow&&e.uint32(64).int32(t.overflow),0!==t.display&&e.uint32(72).int32(t.display),0!==t.direction&&e.uint32(80).int32(t.direction),0!==t.flex&&e.uint32(93).float(t.flex),0!==t.flexBasisUnit&&e.uint32(104).int32(t.flexBasisUnit),0!==t.flexBasis&&e.uint32(117).float(t.flexBasis),0!==t.flexGrow&&e.uint32(125).float(t.flexGrow),0!==t.flexShrink&&e.uint32(133).float(t.flexShrink),0!==t.widthUnit&&e.uint32(136).int32(t.widthUnit),0!==t.width&&e.uint32(149).float(t.width),0!==t.heightUnit&&e.uint32(152).int32(t.heightUnit),0!==t.height&&e.uint32(165).float(t.height),0!==t.minWidthUnit&&e.uint32(168).int32(t.minWidthUnit),0!==t.minWidth&&e.uint32(181).float(t.minWidth),0!==t.minHeightUnit&&e.uint32(184).int32(t.minHeightUnit),0!==t.minHeight&&e.uint32(197).float(t.minHeight),0!==t.maxWidthUnit&&e.uint32(248).int32(t.maxWidthUnit),0!==t.maxWidth&&e.uint32(261).float(t.maxWidth),0!==t.maxHeightUnit&&e.uint32(264).int32(t.maxHeightUnit),0!==t.maxHeight&&e.uint32(277).float(t.maxHeight),0!==t.positionLeftUnit&&e.uint32(328).int32(t.positionLeftUnit),0!==t.positionLeft&&e.uint32(341).float(t.positionLeft),0!==t.positionTopUnit&&e.uint32(344).int32(t.positionTopUnit),0!==t.positionTop&&e.uint32(357).float(t.positionTop),0!==t.positionRightUnit&&e.uint32(360).int32(t.positionRightUnit),0!==t.positionRight&&e.uint32(373).float(t.positionRight),0!==t.positionBottomUnit&&e.uint32(376).int32(t.positionBottomUnit),0!==t.positionBottom&&e.uint32(389).float(t.positionBottom),0!==t.marginLeftUnit&&e.uint32(408).int32(t.marginLeftUnit),0!==t.marginLeft&&e.uint32(421).float(t.marginLeft),0!==t.marginTopUnit&&e.uint32(424).int32(t.marginTopUnit),0!==t.marginTop&&e.uint32(437).float(t.marginTop),0!==t.marginRightUnit&&e.uint32(440).int32(t.marginRightUnit),0!==t.marginRight&&e.uint32(453).float(t.marginRight),0!==t.marginBottomUnit&&e.uint32(456).int32(t.marginBottomUnit),0!==t.marginBottom&&e.uint32(469).float(t.marginBottom),0!==t.paddingLeftUnit&&e.uint32(488).int32(t.paddingLeftUnit),0!==t.paddingLeft&&e.uint32(501).float(t.paddingLeft),0!==t.paddingTopUnit&&e.uint32(504).int32(t.paddingTopUnit),0!==t.paddingTop&&e.uint32(517).float(t.paddingTop),0!==t.paddingRightUnit&&e.uint32(520).int32(t.paddingRightUnit),0!==t.paddingRight&&e.uint32(533).float(t.paddingRight),0!==t.paddingBottomUnit&&e.uint32(536).int32(t.paddingBottomUnit),0!==t.paddingBottom&&e.uint32(549).float(t.paddingBottom),0!==t.borderLeft&&e.uint32(581).float(t.borderLeft),0!==t.borderTop&&e.uint32(597).float(t.borderTop),0!==t.borderRight&&e.uint32(613).float(t.borderRight),0!==t.borderBottom&&e.uint32(629).float(t.borderBottom),e),decode(t,e){const n=t instanceof minimalExports.Reader?t:new minimalExports.Reader(t);let i=void 0===e?n.len:n.pos+e;const r=createBasePBUiTransform();for(;n.pos<i;){const t=n.uint32();switch(t>>>3){case 1:r.positionType=n.int32();break;case 2:r.alignContent=n.int32();break;case 3:r.alignItems=n.int32();break;case 4:r.alignSelf=n.int32();break;case 5:r.flexDirection=n.int32();break;case 6:r.flexWrap=n.int32();break;case 7:r.justifyContent=n.int32();break;case 8:r.overflow=n.int32();break;case 9:r.display=n.int32();break;case 10:r.direction=n.int32();break;case 11:r.flex=n.float();break;case 13:r.flexBasisUnit=n.int32();break;case 14:r.flexBasis=n.float();break;case 15:r.flexGrow=n.float();break;case 16:r.flexShrink=n.float();break;case 17:r.widthUnit=n.int32();break;case 18:r.width=n.float();break;case 19:r.heightUnit=n.int32();break;case 20:r.height=n.float();break;case 21:r.minWidthUnit=n.int32();break;case 22:r.minWidth=n.float();break;case 23:r.minHeightUnit=n.int32();break;case 24:r.minHeight=n.float();break;case 31:r.maxWidthUnit=n.int32();break;case 32:r.maxWidth=n.float();break;case 33:r.maxHeightUnit=n.int32();break;case 34:r.maxHeight=n.float();break;case 41:r.positionLeftUnit=n.int32();break;case 42:r.positionLeft=n.float();break;case 43:r.positionTopUnit=n.int32();break;case 44:r.positionTop=n.float();break;case 45:r.positionRightUnit=n.int32();break;case 46:r.positionRight=n.float();break;case 47:r.positionBottomUnit=n.int32();break;case 48:r.positionBottom=n.float();break;case 51:r.marginLeftUnit=n.int32();break;case 52:r.marginLeft=n.float();break;case 53:r.marginTopUnit=n.int32();break;case 54:r.marginTop=n.float();break;case 55:r.marginRightUnit=n.int32();break;case 56:r.marginRight=n.float();break;case 57:r.marginBottomUnit=n.int32();break;case 58:r.marginBottom=n.float();break;case 61:r.paddingLeftUnit=n.int32();break;case 62:r.paddingLeft=n.float();break;case 63:r.paddingTopUnit=n.int32();break;case 64:r.paddingTop=n.float();break;case 65:r.paddingRightUnit=n.int32();break;case 66:r.paddingRight=n.float();break;case 67:r.paddingBottomUnit=n.int32();break;case 68:r.paddingBottom=n.float();break;case 72:r.borderLeft=n.float();break;case 74:r.borderTop=n.float();break;case 76:r.borderRight=n.float();break;case 78:r.borderBottom=n.float();break;default:n.skipType(7&t)}}return r}},COMPONENT_ID$1=1050,UiTransform={serialize(t,e){const n=PBUiTransform.encode(t),i=new Uint8Array(n.finish(),0,n.len);e.writeBuffer(i,!1)},deserialize:t=>PBUiTransform.decode(t.buffer(),t.remainingBytes()),create:()=>PBUiTransform.decode(new Uint8Array)};function defineProtocolBufferComponents({defineComponent:t}){return{AudioSource:t(COMPONENT_ID$9,AudioSource),AudioStream:t(COMPONENT_ID$8,AudioStream),BoxShape:t(COMPONENT_ID$7,BoxShape),CylinderShape:t(COMPONENT_ID$6,CylinderShape),NFTShape:t(COMPONENT_ID$5,NFTShape),PlaneShape:t(COMPONENT_ID$4,PlaneShape),SphereShape:t(COMPONENT_ID$3,SphereShape),TextShape:t(COMPONENT_ID$2,TextShape),UiTransform:t(COMPONENT_ID$1,UiTransform)}}const TRANSFORM_LENGTH=44,Transform={serialize(t,e){const n=e.incrementWriteOffset(TRANSFORM_LENGTH);e.setFloat32(n,t.position.x),e.setFloat32(n+4,t.position.y),e.setFloat32(n+8,t.position.z),e.setFloat32(n+12,t.rotation.x),e.setFloat32(n+16,t.rotation.y),e.setFloat32(n+20,t.rotation.z),e.setFloat32(n+24,t.rotation.w),e.setFloat32(n+28,t.scale.x),e.setFloat32(n+32,t.scale.y),e.setFloat32(n+36,t.scale.z),e.setUint32(n+40,t.parent||0)},deserialize(t){const e=t.incrementReadOffset(TRANSFORM_LENGTH);return{position:distExports$1.Vector3.create(t.getFloat32(e),t.getFloat32(e+4),t.getFloat32(e+8)),rotation:distExports$1.Quaternion.create(t.getFloat32(e+12),t.getFloat32(e+16),t.getFloat32(e+20),t.getFloat32(e+24)),scale:distExports$1.Vector3.create(t.getFloat32(e+28),t.getFloat32(e+32),t.getFloat32(e+36)),parent:t.getUint32(e+40)}},create:()=>({position:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},rotation:{x:0,y:0,z:0,w:1},parent:void 0})};var LEGACY_COMPONENT_ID,COMPONENT_ID;function defineLegacyComponents({defineComponent:t}){return{Transform:t(LEGACY_COMPONENT_ID.TRANSFORM,Transform),...defineProtocolBufferComponents({defineComponent:t})}}function defineSdkComponents(t){return{...defineLegacyComponents(t)}}!function(t){t[t.TRANSFORM=1]="TRANSFORM",t[t.UUID_CALLBACK=8]="UUID_CALLBACK",t[t.BOX_SHAPE=16]="BOX_SHAPE",t[t.SPHERE_SHAPE=17]="SPHERE_SHAPE",t[t.PLANE_SHAPE=18]="PLANE_SHAPE",t[t.CONE_SHAPE=19]="CONE_SHAPE",t[t.CYLINDER_SHAPE=20]="CYLINDER_SHAPE",t[t.TEXT_SHAPE=21]="TEXT_SHAPE",t[t.NFT_SHAPE=22]="NFT_SHAPE",t[t.UI_WORLD_SPACE_SHAPE=23]="UI_WORLD_SPACE_SHAPE",t[t.UI_SCREEN_SPACE_SHAPE=24]="UI_SCREEN_SPACE_SHAPE",t[t.UI_CONTAINER_RECT=25]="UI_CONTAINER_RECT",t[t.UI_CONTAINER_STACK=26]="UI_CONTAINER_STACK",t[t.UI_TEXT_SHAPE=27]="UI_TEXT_SHAPE",t[t.UI_INPUT_TEXT_SHAPE=28]="UI_INPUT_TEXT_SHAPE",t[t.UI_IMAGE_SHAPE=29]="UI_IMAGE_SHAPE",t[t.UI_SLIDER_SHAPE=30]="UI_SLIDER_SHAPE",t[t.CIRCLE_SHAPE=31]="CIRCLE_SHAPE",t[t.BILLBOARD=32]="BILLBOARD",t[t.ANIMATION=33]="ANIMATION",t[t.FONT=34]="FONT",t[t.UI_FULLSCREEN_SHAPE=40]="UI_FULLSCREEN_SHAPE",t[t.UI_BUTTON_SHAPE=41]="UI_BUTTON_SHAPE",t[t.GLTF_SHAPE=54]="GLTF_SHAPE",t[t.OBJ_SHAPE=55]="OBJ_SHAPE",t[t.AVATAR_SHAPE=56]="AVATAR_SHAPE",t[t.BASIC_MATERIAL=64]="BASIC_MATERIAL",t[t.PBR_MATERIAL=65]="PBR_MATERIAL",t[t.HIGHLIGHT_ENTITY=66]="HIGHLIGHT_ENTITY",t[t.SOUND=67]="SOUND",t[t.TEXTURE=68]="TEXTURE",t[t.VIDEO_CLIP=70]="VIDEO_CLIP",t[t.VIDEO_TEXTURE=71]="VIDEO_TEXTURE",t[t.AVATAR_TEXTURE=72]="AVATAR_TEXTURE",t[t.AUDIO_CLIP=200]="AUDIO_CLIP",t[t.AUDIO_SOURCE=201]="AUDIO_SOURCE",t[t.AUDIO_STREAM=202]="AUDIO_STREAM",t[t.GIZMOS=203]="GIZMOS",t[t.SMART_ITEM=204]="SMART_ITEM",t[t.AVATAR_MODIFIER_AREA=205]="AVATAR_MODIFIER_AREA",t[t.AVATAR_ATTACH=206]="AVATAR_ATTACH",t[t.CAMERA_MODE_AREA=207]="CAMERA_MODE_AREA",t[t.NAME=300]="NAME",t[t.LOCKED_ON_EDIT=301]="LOCKED_ON_EDIT",t[t.VISIBLE_ON_EDIT=302]="VISIBLE_ON_EDIT"}(LEGACY_COMPONENT_ID||(LEGACY_COMPONENT_ID={})),function(t){t[t.SYNC=1e3]="SYNC"}(COMPONENT_ID||(COMPONENT_ID={}));var dist={},types={},hasRequiredTypes,hasRequiredDist;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0})),types}function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(t){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),n=commonjsGlobal&&commonjsGlobal.__exportStar||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||e(n,t,i)};function i(t,e){if(t===e)return!0;if(t instanceof Buffer&&e instanceof Buffer)return t.equals(e);if(t instanceof Uint8Array&&e instanceof Uint8Array){if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t[n]!==e[n])return!1;return!0}return t===e}Object.defineProperty(t,"__esModule",{value:!0}),t.crdtProtocol=t.sameData=void 0,n(requireTypes(),t),t.sameData=i,t.crdtProtocol=function(){const t={};function e(e,n,i){const r=Math.max(i,t[e]?.timestamp||0);return t[e]={timestamp:r,data:n}}return{createEvent:function(n,i){const r=(t[n]?.timestamp||0)+1;return e(n,i,r),{key:n,data:i,timestamp:r}},processMessage:function(n){const{key:r,data:o,timestamp:a}=n,s=t[r];return!s||s.timestamp<a?(e(r,o,a),n):s.timestamp>a?{key:r,data:s.data,timestamp:s.timestamp}:i(s.data,o)?n:function(t,e){return t>e}(s.data,o)?{key:r,data:s.data,timestamp:s.timestamp}:(e(r,o,a).data,n)},getState:function(){return{...t}}}}}(dist)),dist}var distExports=requireDist(),EntityUtils;!function(t){t.MAX_ENTITIES=1e4;let e=t.MAX_ENTITIES;t.getOffset=function(){const n=e+1;return e+=t.MAX_ENTITIES,n};const n=[0,t.MAX_ENTITIES];t.isStaticEntity=function(t){const[e,i]=n;return t>=e&&t<=i}}(EntityUtils||(EntityUtils={}));var EntityUtils$1=EntityUtils;function getNextSize(t,e){const n=Math.max(t,e)+1024;return 1024*Math.ceil(n/1024)}const defaultInitialCapacity=10240;function createByteBuffer(t={}){const e=t.reading?.currentOffset||0;let n=null,i=0;t.writing?(n=t.writing.buffer,t.writing.currentOffset&&(i=t.writing.currentOffset)):t.reading?(n=t.reading.buffer,i=t.reading.length||t.reading.buffer.length):n=new Uint8Array(t.initialCapacity||defaultInitialCapacity);let r=n,o=new DataView(r.buffer,r.byteOffset),a=i,s=e;const u=t=>{if(a+t>r.byteLength){const e=getNextSize(r.byteLength,a+t),n=new Uint8Array(e);n.set(r),r=n,o=new DataView(r.buffer)}return a+=t,a-t},l=t=>{if(s+t>a)throw new Error("Outside of the bounds of writen data.");return s+=t,s-t};return{buffer:()=>r,bufferLength:()=>r.length,resetBuffer(){s=0,a=0},currentReadOffset:()=>s,currentWriteOffset:()=>a,incrementReadOffset:t=>l(t),remainingBytes:()=>a-s,readFloat32:()=>o.getFloat32(l(4)),readFloat64:()=>o.getFloat64(l(8)),readInt8:()=>o.getInt8(l(1)),readInt16:()=>o.getInt16(l(2)),readInt32:()=>o.getInt32(l(4)),readInt64:()=>o.getBigInt64(l(8)),readUint8:()=>o.getUint8(l(1)),readUint16:()=>o.getUint16(l(2)),readUint32:()=>o.getUint32(l(4)),readUint64:()=>o.getBigUint64(l(8)),readBuffer(){const t=o.getUint32(l(4));return r.subarray(l(t),l(0))},incrementWriteOffset:t=>u(t),size:()=>a,toBinary:()=>r.subarray(0,a),writeBuffer(t,e=!0){e&&this.writeUint32(t.byteLength);const n=u(t.byteLength);r.set(t,n)},writeFloat32(t){const e=u(4);o.setFloat32(e,t)},writeFloat64(t){const e=u(8);o.setFloat64(e,t)},writeInt8(t){const e=u(1);o.setInt8(e,t)},writeInt16(t){const e=u(2);o.setInt16(e,t)},writeInt32(t){const e=u(4);o.setInt32(e,t)},writeInt64(t){const e=u(8);o.setBigInt64(e,t)},writeUint8(t){const e=u(1);o.setUint8(e,t)},writeUint16(t){const e=u(2);o.setUint16(e,t)},writeUint32(t){const e=u(4);o.setUint32(e,t)},writeUint64(t){const e=u(8);o.setBigUint64(e,t)},getFloat32:t=>o.getFloat32(t),getFloat64:t=>o.getFloat64(t),getInt8:t=>o.getInt8(t),getInt16:t=>o.getInt16(t),getInt32:t=>o.getInt32(t),getInt64:t=>o.getBigInt64(t),getUint8:t=>o.getUint8(t),getUint16:t=>o.getUint16(t),getUint32:t=>o.getUint32(t),getUint64:t=>o.getBigUint64(t),setFloat32(t,e){o.setFloat32(t,e)},setFloat64(t,e){o.setFloat64(t,e)},setInt8(t,e){o.setInt8(t,e)},setInt16(t,e){o.setInt16(t,e)},setInt32(t,e){o.setInt32(t,e)},setInt64(t,e){o.setBigInt64(t,e)},setUint8(t,e){o.setUint8(t,e)},setUint16(t,e){o.setUint16(t,e)},setUint32(t,e){o.setUint32(t,e)},setUint64(t,e){o.setBigUint64(t,e)}}}var WireMessage;!function(t){function e(e){const n=e.remainingBytes();if(n<t.HEADER_LENGTH)return!1;return!(n<e.getUint32(e.currentReadOffset()))}!function(t){t[t.RESERVED=0]="RESERVED",t[t.PUT_COMPONENT=1]="PUT_COMPONENT",t[t.DELETE_COMPONENT=2]="DELETE_COMPONENT",t[t.MAX_MESSAGE_TYPE=3]="MAX_MESSAGE_TYPE"}(t.Enum||(t.Enum={})),t.HEADER_LENGTH=8,t.validate=e,t.readHeader=function(t){return e(t)?{length:t.readUint32(),type:t.readUint32()}:null}}(WireMessage||(WireMessage={}));var WireMessage$1=WireMessage,PutComponentOperation,CrdtUtils;function networkTransport(){const t="network-transport";return{send:()=>{},type:t,filter:e=>e.transportType!==t&&!!e}}function getTransports(){return[networkTransport()]}!function(t){t.MESSAGE_HEADER_LENGTH=20,t.write=function(e,n,i,r){const o=r.incrementWriteOffset(WireMessage$1.HEADER_LENGTH+t.MESSAGE_HEADER_LENGTH);i.writeToByteBuffer(e,r);const a=r.size()-o;r.setUint32(o,a),r.setUint32(o+4,WireMessage$1.Enum.PUT_COMPONENT),r.setUint32(o+8,e),r.setUint32(o+12,i._id),r.setUint64(o+16,BigInt(n)),r.setUint32(o+24,a-t.MESSAGE_HEADER_LENGTH-WireMessage$1.HEADER_LENGTH)},t.read=function(t){const e=WireMessage$1.readHeader(t);return e?{...e,entity:t.readUint32(),componentId:t.readInt32(),timestamp:Number(t.readUint64()),data:t.readBuffer()}:null}}(PutComponentOperation||(PutComponentOperation={})),function(t){var e;t.getKey=function(t,e){return`${t}.${e}`},(e=t.SynchronizedEntityType||(t.SynchronizedEntityType={}))[e.NETWORKED=0]="NETWORKED",e[e.RENDERER=1]="RENDERER"}(CrdtUtils||(CrdtUtils={}));var CrdtUtils$1=CrdtUtils;function crdtSceneSystem({engine:t,availableTransports:e}){const n=distExports.crdtProtocol(),i=[],r=[],o=new Map,a=[...getTransports(),...e||[]];function s(t){const e=Array.from(t);return t.length=0,e}return a.forEach((t=>{return t.onmessage=(e=t.type,function(t){const n=createByteBuffer({reading:{buffer:t,currentOffset:0}});for(;WireMessage$1.validate(n);){const t=n.currentReadOffset(),r=PutComponentOperation.read(n),{entity:o,componentId:a,data:s,timestamp:u}=r;i.push({entity:o,componentId:a,data:s,timestamp:u,transportType:e,messageBuffer:n.buffer().subarray(t,n.currentReadOffset())})}});var e})),{createMessages:function(e){const i=s(r),u=createByteBuffer();for(const[r,a]of e){for(const e of a){const a=t.getComponent(e),s=n.createEvent(CrdtUtils$1.getKey(r,e),a.toBinary(r).toBinary()),l=u.currentWriteOffset();EntityUtils$1.isStaticEntity(r)&&!o.has(r)||(PutComponentOperation.write(r,s.timestamp,a,u),i.push({componentId:e,entity:r,timestamp:s.timestamp,messageBuffer:u.buffer().subarray(l,u.currentWriteOffset())}))}o.set(r,!0)}const l=createByteBuffer();for(const t of a){l.resetBuffer();for(const e of i)t.filter(e)&&l.writeBuffer(e.messageBuffer,!1);l.size()&&t.send(l.toBinary())}},receiveMessages:function(){const e=s(i);for(const i of a){const o=createByteBuffer();for(const i of e){const{data:e,timestamp:a,componentId:s,entity:u}=i,l={key:CrdtUtils$1.getKey(u,s),data:e,timestamp:a},f=t.getComponent(s),c=n.processMessage(l);if(l!==c)PutComponentOperation.write(u,c.timestamp,f,o);else{const t=createByteBuffer({reading:{buffer:i.data,currentOffset:0}});f.upsertFromBinary(i.entity,t),f.clearDirty(),r.push(i)}}o.size()&&i.send(o.toBinary())}}}}function EntityContainer(){const t=Entity(),e=Entity(!0);return{generateEntity:(n=!1)=>n?e.generateEntity():t.generateEntity(),removeEntity(n){t.removeEntity(n),e.removeEntity(n)},getUnusedEntities:()=>new Set([...t.getUnusedEntities(),...e.getUnusedEntities()]),getUsedEntities:()=>new Set([...t.getUsedEntities(),...e.getUsedEntities()])}}function Entity(t=!1){const e=t?EntityUtils.getOffset():0,n=new Set,i=new Set;return{getUnusedEntities:()=>new Set(i),getUsedEntities:()=>new Set(n),generateEntity:function(){if(!i.size&&!n.size){const t=e;return n.add(t),t}const t=i[Symbol.iterator]().next();if(t.done){const t=Math.max(...n.values())+1;if(t>=EntityUtils.MAX_ENTITIES+e)throw new Error("Entity rate limit exceed");return n.add(t),t}const r=t.value;return i.delete(r),n.add(r),r},removeEntity:function(t){n.has(t)&&(n.delete(t),i.add(t))}}}function deepReadonly(t){return Object.freeze({...t})}function defineComponent(t,e){const n=new Map,i=new Set;return{_id:t,isDirty:function(t){return i.has(t)},has:function(t){return n.has(t)},deleteFrom:function(t){const e=n.get(t);return n.delete(t),i.add(t),e||null},getOrNull:function(t){const e=n.get(t);return e?deepReadonly(e):null},getFrom:function(e){const i=n.get(e);if(!i)throw new Error(`[getFrom] Component ${t} for ${e} not found`);return deepReadonly(i)},create:function(r,o){if(n.get(r))throw new Error(`[create] Component ${t} for ${r} already exists`);const a=void 0===o?e.create():o;return n.set(r,a),i.add(r),a},createOrReplace:function(t,r){const o=void 0===r?e.create():r;return n.set(t,o),i.add(t),o},mutable:function(e){const r=n.get(e);if(!r)throw new Error(`[mutable] Component ${t} for ${e} not found`);return i.add(e),r},iterator:function*(){for(const[t,e]of n)yield[t,e]},dirtyIterator:function*(){for(const t of i)yield t},toBinary(i){const r=n.get(i);if(!r)throw new Error(`Component ${t} for ${i} not found`);const o=createByteBuffer();return e.serialize(r,o),o},writeToByteBuffer(i,r){const o=n.get(i);if(!o)throw new Error(`[toBinary] Component ${t} for ${i} not found`);e.serialize(o,r)},updateFromBinary(e,i){if(!n.get(e))throw new Error(`[updateFromBinary] Component ${t} for ${e} not found`);return this.upsertFromBinary(e,i)},upsertFromBinary(t,r){const o=e.deserialize(r);return n.set(t,o),i.add(t),o},clearDirty:function(){i.clear()}}}function preEngine(){const t=EntityContainer(),e=new Map,n=new Map,i=new Set;function r(e=!1){return t.generateEntity(e)}function*o(...t){const[e,...n]=t;for(const[i]of e.iterator()){let e=!0;for(const t of n)if(!t.has(i)){e=!1;break}e&&(yield[i,...t])}}return{entitiesComponent:n,componentsDefinition:e,systems:i,addEntity:r,addDynamicEntity:function(){return r(!0)},removeEntity:function(n){for(const[,t]of e)t.has(n)&&t.deleteFrom(n);return t.removeEntity(n)},addSystem:function(t){if(i.has(t))throw new Error("System already added");i.add(t)},defineComponent:function(t,n){if(e.get(t))throw new Error(`Component ${t} already declared`);const i=defineComponent(t,n);return e.set(t,i),i},mutableGroupOf:function*(...t){for(const[e,...n]of o(...t))yield[e,...n.map((t=>t.mutable(e)))]},groupOf:function*(...t){for(const[e,...n]of o(...t))yield[e,...n.map((t=>t.getFrom(e)))]},getComponent:function(t){const n=e.get(t);if(!n)throw new Error("Component not found. You need to declare the components at the beginnig of the engine declaration");return n}}}function Engine({transports:t}={}){const e=preEngine(),n=crdtSceneSystem({engine:e,availableTransports:t}),i=defineSdkComponents(e);return{addEntity:e.addEntity,addDynamicEntity:e.addDynamicEntity,removeEntity:e.removeEntity,addSystem:e.addSystem,defineComponent:e.defineComponent,mutableGroupOf:e.mutableGroupOf,groupOf:e.groupOf,getComponent:e.getComponent,update:function(t){n.receiveMessages();for(const n of e.systems)n(t);const i=new Map;for(const[t,n]of e.componentsDefinition)for(const e of n.dirtyIterator())i.has(e)||i.set(e,new Set),i.get(e).add(t);n.createMessages(i);for(const[t,n]of e.componentsDefinition)n.clearDirty()},baseComponents:i}}function MapType(t){return{serialize(e,n){for(const i in t)t[i].serialize(e[i],n)},deserialize(e){const n={};for(const i in t)n[i]=t[i].deserialize(e);return n},create(){const e={};for(const n in t)e[n]=t[n].create();return e}}}function ArrayType(t){return{serialize(e,n){n.writeUint32(e.length);for(const i of e)t.serialize(i,n)},deserialize(e){const n=[],i=e.readUint32();for(let r=0;r<i;r++)n.push(t.deserialize(e));return n},create:()=>[]}}function Optional(t){return{serialize(e,n){e?(n.writeInt8(1),t.serialize(e,n)):n.writeInt8(0)},deserialize(e){if(e.readInt8())return t.deserialize(e)},create(){}}}const Int64={serialize(t,e){e.writeInt64(BigInt(t))},deserialize:t=>Number(t.readInt64()),create:()=>0},Int32={serialize(t,e){e.writeInt32(t)},deserialize:t=>t.readInt32(),create:()=>0},Int16={serialize(t,e){e.writeInt16(t)},deserialize:t=>t.readInt16(),create:()=>0},Int8={serialize(t,e){e.writeInt8(t)},deserialize:t=>t.readInt8(),create:()=>0},Float32={serialize(t,e){e.writeFloat32(t)},deserialize:t=>t.readFloat32(),create:()=>0},Float64={serialize(t,e){e.writeFloat64(t)},deserialize:t=>t.readFloat64(),create:()=>0},FlatString={serialize(t,e){e.writeBuffer((new TextEncoder).encode(t))},deserialize:t=>(new TextDecoder).decode(t.readBuffer()),create:()=>""},EcsString=FlatString;function Enum(t){return{serialize(e,n){t.serialize(e,n)},deserialize:e=>t.deserialize(e),create:()=>t.create()}}const EcsBoolean={serialize(t,e){e.writeInt8(t?1:0)},deserialize:t=>1===t.readInt8(),create:()=>!1};let ExperimentalAPI;const engine=Engine({transports:[createRendererTransport()]});function createRendererTransport(){return{type:"renderer",send(t){ExperimentalAPI&&dcl.callRpc("@decentraland/ExperimentalAPI","sendToRenderer",[{data:t}]).catch(dcl.error)},onmessage(t){},filter:t=>"renderer"!==t.transportType&&!!t}}dcl&&(dcl.loadModule("@decentraland/ExperimentalAPI",{}).then((t=>{ExperimentalAPI=t})).catch((t=>{dcl.error("ExperimentalAPI couldn't be loaded, the message to renderer can't be sent without this API.",t)})),dcl.onUpdate((t=>{engine.update(t)}))),exports.ArrayType=ArrayType,exports.DEG2RAD=distExports$1.DEG2RAD,exports.EcsBoolean=EcsBoolean,exports.EcsString=EcsString,exports.Engine=Engine,exports.Enum=Enum,exports.Epsilon=distExports$1.Epsilon,exports.FlatString=FlatString,exports.Float32=Float32,exports.Float64=Float64,exports.Int16=Int16,exports.Int32=Int32,exports.Int64=Int64,exports.Int8=Int8,exports.MapType=MapType,exports.Optional=Optional,exports.Orientation=distExports$1.Orientation,exports.Quaternion=distExports$1.Quaternion,exports.RAD2DEG=distExports$1.RAD2DEG,exports.Space=distExports$1.Space,exports.ToGammaSpace=distExports$1.ToGammaSpace,exports.ToLinearSpace=distExports$1.ToLinearSpace,exports.Vector3=distExports$1.Vector3,exports.engine=engine,Object.defineProperty(exports,"__esModule",{value:!0})})(this.self=this.self||{});
|