@openhps/core
Version:
Open Hybrid Positioning System - Core component
2 lines • 302 kB
JavaScript
/*! For license information please see openhps-core.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("OpenHPS",[],t):"object"==typeof exports?exports.OpenHPS=t():(e.OpenHPS=e.OpenHPS||{},e.OpenHPS.core=t())}("undefined"!=typeof self?self:this,(()=>(()=>{var __webpack_modules__={944:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{z:()=>DataSerializer});var events__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(7),events__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__),typedjson__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(695),typedjson__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(690),_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(611),_Deserializer__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(751),_Serializer__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(272),_decorators_SerializableMember__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(144);typedjson__WEBPACK_IMPORTED_MODULE_1__.zv.getFromConstructor=function(e){if(!e)return;const t=e.prototype;if(null==t)return;let r;if(Object.prototype.hasOwnProperty.call(t,_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.META_FIELD))r=t[_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.META_FIELD];else{const t=Object.getPrototypeOf(e.prototype);if(!t)return;r=typedjson__WEBPACK_IMPORTED_MODULE_1__.zv.getFromConstructor(t.constructor)}if(!0===(null==r?void 0:r.isExplicitlyMarked))return r;if(typedjson__WEBPACK_IMPORTED_MODULE_1__.zv.doesHandleWithoutAnnotation(e)){const t=new typedjson__WEBPACK_IMPORTED_MODULE_1__.zv(e);return t.isExplicitlyMarked=!0,t}};class DataSerializer{static registerType(e,t){if(DataSerializer.knownTypes.set(e.name,e),t){if(t.serializer&&DataSerializer.serializer.setSerializationStrategy(e,(e=>t.serializer(e,{fallback:(e,t)=>DataSerializer.serializer.convertSingleValue(e,t)}))),t.deserializer&&DataSerializer.deserializer.setDeserializationStrategy(e,(e=>t.deserializer(e,{fallback:(e,t)=>DataSerializer.deserializer.convertSingleValue(e,t,DataSerializer.knownTypes)}))),"Object"!==e.name){_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.createMetadata(e.prototype);const t={};(0,typedjson__WEBPACK_IMPORTED_MODULE_3__.o)(t)(e),DataSerializer.eventEmitter.emit("updateSerializableObject",e,t);const r=_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.getMetadata(e),i=_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.getRootMetadata(e.prototype);_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.updateObjectMetadata(e,t,r,i)}t.members&&Object.keys(t.members).forEach((r=>{const i=t.members[r];(0,_decorators_SerializableMember__WEBPACK_IMPORTED_MODULE_4__.G)(i)(e.prototype,r)}))}DataSerializer.eventEmitter.emit("registerType",e,t)}static getMetadata(e){return _DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.getMetadata(e)}static getRootMetadata(e){return _DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.getRootMetadata(e)}static findRootMetaInfo(e){return _DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.getRootMetadata(e)}static unregisterType(e){DataSerializer.knownTypes.delete(e.name),DataSerializer.eventEmitter.emit("unregisterType",e)}static findTypeByName(e){return DataSerializer.knownTypes.get(e)}static clone(e,t){return DataSerializer.deserialize(DataSerializer.serialize(e),t)}static serialize(e,t={}){var r;if(null==e)return;const i=Object.getPrototypeOf(e).constructor;if(!DataSerializer.findTypeByName(i.name)&&Array.isArray(e))return e.map(DataSerializer.serialize.bind(DataSerializer));return(null!==(r=t.serializer)&&void 0!==r?r:DataSerializer.serializer).convertSingleValue(e,_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.ensureTypeDescriptor(i),void 0,void 0,t)}static deserialize(e,t,r={}){var i;if("object"!=typeof e&&"function"!=typeof e||!e)return e;if(Array.isArray(e))return e.map((e=>DataSerializer.deserialize(e)));const n=null!==(i=r.deserializer)&&void 0!==i?i:DataSerializer.deserializer,s=null!=t?t:n.getTypeResolver()(e,DataSerializer.knownTypes);return n.convertSingleValue(e,_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_2__.ut.ensureTypeDescriptor(s),DataSerializer.knownTypes,void 0,void 0,r)}}DataSerializer.knownTypes=new Map,DataSerializer.serializer=new _Serializer__WEBPACK_IMPORTED_MODULE_5__.h,DataSerializer.deserializer=new _Deserializer__WEBPACK_IMPORTED_MODULE_6__.g,DataSerializer.eventEmitter=new events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter,(()=>{DataSerializer.registerType(Object,{serializer:e=>Object.assign(Object.assign({},Object.keys(e).map((t=>({[t]:"function"==typeof e[t]?{function:e[t].toString(),__type:"Function"}:DataSerializer.serialize(e[t])}))).reduce(((e,t)=>Object.assign(Object.assign({},e),t)),{})),{__type:"Object"}),deserializer:objectJson=>Object.keys(objectJson).map((key=>"__type"===key?{}:{[key]:"object"==typeof objectJson[key]&&"Function"===objectJson[key].__type?eval(objectJson[key].function):DataSerializer.deserialize(objectJson[key])})).reduce(((e,t)=>Object.assign(Object.assign({},e),t)),{})})})()},611:(e,t,r)=>{"use strict";r.d(t,{bS:()=>ConcreteTypeDescriptor,e2:()=>TypeDescriptor,ut:()=>DataSerializerUtils});var i=r(695),n=r(290),s=r(188);class DataSerializerUtils{static get META_FIELD(){return"__typedJsonJsonObjectMetadataInformation__"}static getOwnMetadata(e){return i.zv.getFromConstructor(e instanceof Function?e:e.constructor)}static getMetadata(e){var t;return null!==(t=DataSerializerUtils.getOwnMetadata(e))&&void 0!==t?t:DataSerializerUtils.getRootMetadata(e)}static createMetadata(e){if(Object.prototype.hasOwnProperty.call(e,this.META_FIELD))return e[this.META_FIELD];const t=new i.zv(e.constructor),r=e[this.META_FIELD];return void 0!==r&&(r.dataMembers.forEach(((e,r)=>{t.dataMembers.set(r,e)})),r.knownTypes.forEach((r=>{r!==e.constructor&&r.prototype instanceof e.constructor&&t.knownTypes.add(r)})),r.knownTypes.add(t.classType),t.typeResolver=r.typeResolver,t.typeHintEmitter=r.typeHintEmitter),Object.defineProperty(e,this.META_FIELD,{enumerable:!1,configurable:!1,writable:!1,value:t}),t}static getRootMetadata(e){const t=e instanceof Function?e.prototype:Object.getPrototypeOf(e);return t&&t[DataSerializerUtils.META_FIELD]?DataSerializerUtils.getRootMetadata(t):e[DataSerializerUtils.META_FIELD]}static ensureTypeDescriptor(e){return e instanceof TypeDescriptor?e:new ConcreteTypeDescriptor(e)}static getMemberOptions(e,t){const r=DataSerializerUtils.getMetadata(e);if(!r)return;const i=r.dataMembers.get(t);return i?i.options:void 0}static getIdentifierMemberOptions(e){const t=DataSerializerUtils.getMetadata(e);if(t)return Array.from(t.dataMembers.values()).filter((e=>e&&e.primaryKey))[0]}static mergeMemberOptions(e,t,r){if("function"==typeof r)return r;const i=DataSerializerUtils.getMemberOptions(e.constructor,t);return i?o(i,r):r}static updateMemberOptions(e,t,r){var a,c;const u=Reflect.getMetadata("design:type",e,t);if(r){const n=i.zv.ensurePresentInPrototype(e),u=DataSerializerUtils.getRootMetadata(e.constructor),l=n.dataMembers.get(t)||n.dataMembers.get(r.name),h=u?u.dataMembers.get(t)||u.dataMembers.get(r.name):void 0;if(!l)throw new Error(`Unable to get member metadata for ${e} on property ${t}!`);l.options=o(null!==(a=l.options)&&void 0!==a?a:{},r),h&&(l.options=o(null!==(c=h.options)&&void 0!==c?c:{},l.options)),u.knownTypes.forEach((n=>{var a,c,u;if(n===e.constructor||!(n.prototype instanceof e.constructor))return;const h=null!==(a=DataSerializerUtils.getMetadata(n))&&void 0!==a?a:i.zv.ensurePresentInPrototype(n),p=h.dataMembers.get(t)||h.dataMembers.get(r.name);p?p.options=o(null!==(c=l.options)&&void 0!==c?c:{},p.options):h.dataMembers.set(null!==(u=r.name)&&void 0!==u?u:t,(0,s.mg)(l))}))}const l=i.zv.ensurePresentInPrototype(e).dataMembers.get(r&&r.name||t);u!==Object||r&&(r.deserializer||Object.keys(r).includes("constructor"))?l&&"object"!=typeof r&&l.type()instanceof ConcreteTypeDescriptor&&(l.type=()=>new ConcreteTypeDescriptor(u)):l.type=()=>n.v6}static updateObjectMetadata(e,t,r,i){var n,s,a;return i.knownTypes.add(e),i.initializerCallback&&!r.initializerCallback&&(r.initializerCallback=i.initializerCallback),t&&(r.options=o(r===i?null!==(n=r.options)&&void 0!==n?n:{}:null!==(a=null!==(s=r.options)&&void 0!==s?s:i.options)&&void 0!==a?a:{},t),i.knownTypes.forEach((t=>{var i;if(t===e||!(t.prototype instanceof e))return;const n=DataSerializerUtils.getMetadata(t);n.options=o(null!==(i=r.options)&&void 0!==i?i:{},n.options),!n.initializerCallback&&r.initializerCallback&&(n.initializerCallback=r.initializerCallback)}))),i.knownTypes.forEach((t=>{if(t===e||!(e.prototype instanceof t))return;const i=DataSerializerUtils.getMetadata(t);i&&i.initializerCallback&&!r.initializerCallback&&(r.initializerCallback=i.initializerCallback)})),r}}class TypeDescriptor{constructor(e){this.ctor=e}getTypes(){return[this.ctor]}hasFriendlyName(){return"Object"!==this.ctor.name}}class ConcreteTypeDescriptor extends TypeDescriptor{constructor(e){super(e)}}function o(e,t){const r=(0,s.mg)(e);return(0,s.Gv)(e)&&(0,s.Gv)(t)&&Object.keys(t).forEach((i=>{if(Array.isArray(t[i])){r[i]=t[i];const n=void 0!==e[i]?Array.isArray(e[i])?e[i]:[e[i]]:[];r[i].push(...n.filter((e=>!t[i].includes(e))))}else(0,s.Gv)(t[i])?i in e?r[i]=o(e[i],t[i]):Object.assign(r,{[i]:t[i]}):Object.assign(r,{[i]:t[i]})})),r}},751:(e,t,r)=>{"use strict";r.d(t,{g:()=>Deserializer});var i=r(745),n=r(290),s=r(695),o=r(766),a=r(661),c=r(228);class Deserializer extends i.g{typeResolver(e,t){var r;return void 0!==e.__type?t.get(e.__type):null!==(r=e.constructor)&&void 0!==r?r:Object}constructor(){super(),this.errorHandler=e=>{throw e.message=e.message.replace("@jsonObject","@SerializableObject()"),e.message=e.message.replace("@jsonMember","@SerializableMember()"),e.message=e.message.replace("@jsonSetMember","@SerializableSetMember()"),e.message=e.message.replace("@jsonMapMember","@SerializableMapMember()"),e.message=e.message.replace("@jsonArrayMember","@SerializableArrayMember()"),e},this.setDeserializationStrategy(Map,this.convertAsMap.bind(this)),this.setDeserializationStrategy(Array,this.convertAsArray.bind(this)),this.setDeserializationStrategy(Set,this.convertAsSet.bind(this)),this.setDeserializationStrategy(Uint8Array,c.A.fromHexString),this.setDeserializationStrategy(n.v6.ctor,this.identityDeserializer.bind(this))}identityDeserializer(e,t,r,...i){const s=this.getTypeResolver()(e,r);return null!=s?this.convertSingleValue(e,(0,n.A4)(s),r,...i):e}convertSingleValue(e,t,r,i,n,s){return this._convertSingleValue.bind(this)(e,t,r,i,n,s)}_convertSingleValue(e,t,r,i,n,s){if(this.retrievePreserveNull(n)&&null===e)return null;if(!(0,a.J5)(e))return;const o=this.deserializationStrategy.get(t.ctor);if(void 0!==o)return o(e,t,r,i,this,n,s);if("object"==typeof e)return this.convertAsObject(e,t,r,i,this,n,s);let c=`Could not deserialize '${i}'; don't know how to deserialize type`;t.hasFriendlyName()&&(c+=` '${t.ctor.name}'`),this.errorHandler(new TypeError(`${c}.`))}convertAsObject(e,t,r,i,c,u,l){if("object"!=typeof e||null===e)return void c.getErrorHandler()(new TypeError(`Cannot deserialize ${i}: 'sourceObject' must be a defined object.`));let h=t.ctor,p=s.zv.getFromConstructor(h),d=c.getTypeResolver();void 0!==p&&null!=p.typeResolver&&(d=p.typeResolver);const f=d(e,r);if(null!=f&&(0,a.yK)(f,h)&&(h=f,p=s.zv.getFromConstructor(f)),!0===(null==p?void 0:p.isExplicitlyMarked)){const t=p,s={},u=(0,o.lL)(c.options,t.options);let d;if(t.dataMembers.forEach(((i,h)=>{const p=e[h],d=`${(0,a.bM)(t.classType)}.${h}`,f=(0,o.lL)(u,i.options);let y;if(null!=i.deserializer)y=i.deserializer(p,{fallback:(e,t)=>c.convertSingleValue(e,(0,n.A4)(t),r)});else{if(null==i.type)throw new TypeError(`Cannot deserialize ${d} there is no constructor nor deserialization function to use.`);y=c.convertSingleValue(p,i.type(),r,d,f,l)}(0,a.J5)(y)||c.retrievePreserveNull(f)&&null===y?s[i.key]=y:!0===i.isRequired&&c.getErrorHandler()(new TypeError(`Missing required member '${d}'.`))})),"function"==typeof p.initializerCallback)try{if(d=p.initializerCallback(s,e),null==d)throw new TypeError(`Cannot deserialize ${i}: 'initializer' function returned undefined/null, but '${(0,a.bM)(p.classType)}' was expected.`);if(!(d instanceof p.classType))throw new TypeError(`Cannot deserialize ${i}:'initializer' returned '${(0,a.bM)(d.constructor)}', but '${(0,a.bM)(p.classType)}' was expected, and '${(0,a.bM)(d.constructor)}' is not a subtype of '${(0,a.bM)(p.classType)}'`)}catch(e){return void c.getErrorHandler()(e)}else d=c.instantiateType(h);Object.assign(d,s);const f=p.onDeserializedMethodName;return null!=f&&("function"==typeof d[f]?d[f]():"function"==typeof d.constructor[f]?d.constructor[f]():c.getErrorHandler()(new TypeError(`onDeserialized callback'${(0,a.bM)(p.classType)}.${f}' is not a method.`))),d}{const t={};return Object.keys(e).forEach((i=>{t[i]=c.convertSingleValue(e[i],new n.bS(e[i].constructor),r,i,u,l)})),t}}convertAsArray(e,t,r,i,s,o,a){if(!(t instanceof n.ZD))throw new TypeError(`Could not deserialize ${i} as Array: incorrect TypeDescriptor detected, please use proper annotation or function for this type`);return Array.isArray(e)?null==t.elementType?(s.getErrorHandler()(new TypeError(`Could not deserialize ${i} as Array: missing constructor reference of Array elements.`)),[]):e.map(((e,n)=>{try{return s.convertSingleValue(e,t.elementType,r,`${i}[${n}]`,o,a)}catch(e){return void s.getErrorHandler()(e)}})):(s.getErrorHandler()(new TypeError(this.makeTypeErrorMessage(Array,e.constructor,i))),[])}convertAsSet(e,t,r,i,s,o,a){if(!(t instanceof n.oy))throw new TypeError(`Could not deserialize ${i} as Set: incorrect TypeDescriptor detected, please use proper annotation or function for this type`);if(!Array.isArray(e))return s.getErrorHandler()(new TypeError(this.makeTypeErrorMessage(Array,e.constructor,i))),new Set;if(null==t.elementType)return s.getErrorHandler()(new TypeError(`Could not deserialize ${i} as Set: missing constructor reference of Set elements.`)),new Set;const c=new Set;return e.forEach(((e,n)=>{try{c.add(s.convertSingleValue(e,t.elementType,r,`${i}[${n}]`,o,a))}catch(e){s.getErrorHandler()(e)}})),c}convertAsMap(e,t,r,i,s,o,c){if(!(t instanceof n.Ws))throw new TypeError(`Could not deserialize ${i} as Map: incorrect TypeDescriptor detected,please use proper annotation or function for this type`);const u=t.getCompleteOptions().shape;if(!this.isExpectedMapShape(e,u)){const t=0===u?Array:Object;return s.getErrorHandler()(new TypeError(this.makeTypeErrorMessage(t,e.constructor,i))),new Map}if(null==t.keyType)return s.getErrorHandler()(new TypeError(`Could not deserialize ${i} as Map: missing key constructor.`)),new Map;if(null==t.valueType)return s.getErrorHandler()(new TypeError(`Could not deserialize ${i} as Map: missing value constructor.`)),new Map;const l=`${i}[].key`,h=`${i}[].value`,p=new Map;return"OBJECT"===u.name?Object.keys(e).forEach((i=>{try{const n=s.convertSingleValue(i,t.keyType,r,l,o,c);(0,a.J5)(n)&&p.set(n,s.convertSingleValue(e[i],t.valueType,r,h,o,c))}catch(e){s.getErrorHandler()(e)}})):e.forEach((e=>{try{const i=s.convertSingleValue(e.key,t.keyType,r,l,o,c);(0,a.J5)(i)&&p.set(i,s.convertSingleValue(e.value,t.valueType,r,h,o,c))}catch(e){s.getErrorHandler()(e)}})),p}isExpectedMapShape(e,t){return 0===t&&Array.isArray(e)||1===t&&"object"==typeof e}makeTypeErrorMessage(e,t,r){return`Could not deserialize ${r}: expected '${"function"==typeof e?(0,a.bM)(e):e}', got '${"function"==typeof t?(0,a.bM)(t):t}'.`}}},272:(e,t,r)=>{"use strict";r.d(t,{h:()=>Serializer});var i=r(610),n=r(290),s=r(695),o=r(661),a=r(766),c=r(228);class Serializer extends i.h{constructor(){super(),this.errorHandler=e=>{throw e.message=e.message.replace("@jsonObject","@SerializableObject()"),e.message=e.message.replace("@jsonMember","@SerializableMember()"),e.message=e.message.replace("@jsonSetMember","@SerializableSetMember()"),e.message=e.message.replace("@jsonMapMember","@SerializableMapMember()"),e.message=e.message.replace("@jsonArrayMember","@SerializableArrayMember()"),e},this.setSerializationStrategy(Map,this.convertAsMap.bind(this)),this.setSerializationStrategy(Array,this.convertAsArray.bind(this)),this.setSerializationStrategy(Set,this.convertAsSet.bind(this)),this.setSerializationStrategy(Uint8Array,c.A.toHexString)}convertSingleValue(e,t,r,i,n){const s=this._convertSingleValue.bind(this)(e,t,r,i,n);return void 0===r&&"object"==typeof s&&(s.__type=t.ctor.name),s}_convertSingleValue(e,t,r,i,n){if(this.retrievePreserveNull(i)&&null===e)return null;if(!(0,o.J5)(e))return;if(!(0,o.tH)(e,t.ctor)){const i=(0,o.bM)(t.ctor),n=(0,o.bM)(e.constructor);return void this.errorHandler(new TypeError(`Could not serialize '${r}': expected '${i}', got '${n}'.`))}const s=this.serializationStrategy.get(t.ctor);if(void 0!==s)return s(e,t,r,this,i,n);if("object"==typeof e)return this.convertAsObject(e,t,r,this,i,n);let a=`Could not serialize '${r}'; don't know how to serialize type`;t.hasFriendlyName()&&(a+=` '${t.ctor.name}'`),this.errorHandler(new TypeError(`${a}.`))}convertAsObject(e,t,r,i,c,u){let l,h,p=i.getTypeHintEmitter();if(l=e.constructor!==t.ctor&&e instanceof t.ctor?s.zv.getFromConstructor(e.constructor):s.zv.getFromConstructor(t.ctor),void 0===l)h=Object.assign({},e);else{const t=l.beforeSerializationMethodName;null!=t&&("function"==typeof e[t]?e[t]():"function"==typeof e.constructor[t]?e.constructor[t]():i.getErrorHandler()(new TypeError(`beforeSerialization callback '${(0,o.bM)(l.classType)}.${t}' is not a method.`)));const r=l;h={};const s=(0,a.lL)(i.options,r.options);null!=r.typeHintEmitter&&(p=r.typeHintEmitter),r.dataMembers.forEach((t=>{const c=(0,a.lL)(s,t.options);let l;const p=e[t.key];if(null!=t.serializer)l=t.serializer(p,{fallback:(e,t)=>i.convertSingleValue(e,(0,n.A4)(t))});else{if(null==t.type)throw new TypeError(`Could not serialize ${t.name}, there is no constructor nor serialization function to use.`);if(t.type()===n.v6&&null!=p){const e=Object.getPrototypeOf(p).constructor;l=i.convertSingleValue(p,e?(0,n.A4)(e):t.type(),`${(0,o.bM)(r.classType)}.${t.key}`,c,u),"object"==typeof l&&null!==l&&(l.__type=e?e.name:"Object")}else l=i.convertSingleValue(p,t.type(),`${(0,o.bM)(r.classType)}.${t.key}`,c,u)}(i.retrievePreserveNull(c)&&null===l||(0,o.J5)(l))&&(h[t.name]=l)}))}return p(h,e,t.ctor,l),h}convertAsArray(e,t,r,i,s,a){if(!(t instanceof n.ZD))throw new TypeError(`Could not serialize ${r} as Array: incorrect TypeDescriptor detected, please use proper annotation or function for this type`);if(null==t.elementType)throw new TypeError(`Could not serialize ${r} as Array: missing element type definition.`);return e.forEach(((e,n)=>{if(!(i.retrievePreserveNull(s)&&null===e||(0,o.tH)(e,t.elementType.ctor))){const i=(0,o.bM)(t.elementType.ctor),s=e&&(0,o.bM)(e.constructor);throw new TypeError(`Could not serialize ${r}[${n}]: expected '${i}', got '${s}'.`)}})),e.map(((e,n)=>i.convertSingleValue(e,t.elementType,`${r}[${n}]`,s,a)))}convertAsSet(e,t,r,i,s,a){if(!(t instanceof n.oy))throw new TypeError(`Could not serialize ${r} as Set: incorrect TypeDescriptor detected, please use proper annotation or function for this type`);if(null==t.elementType)throw new TypeError(`Could not serialize ${r} as Set: missing element type definition.`);r+="[]";const c=[];return e.forEach((e=>{const n=i.convertSingleValue(e,t.elementType,r,s,a);(0,o.J5)(e)&&!(0,o.J5)(n)||c.push(n)})),c}convertAsMap(e,t,r,i,s,a){if(!(t instanceof n.Ws))return i.convertAsObject(e,t,r,i,s);if(null==t.valueType)throw new TypeError(`Could not serialize ${r} as Map: missing value type definition.`);if(null==t.keyType)throw new TypeError(`Could not serialize ${r} as Map: missing key type definition.`);const c=`${r}[].key`,u=`${r}[].value`,l=t.getCompleteOptions().shape,h=1===l?{}:[],p=i.retrievePreserveNull(s);return e.forEach(((e,r)=>{const n={key:i.convertSingleValue(r,t.keyType,c,s,a),value:i.convertSingleValue(e,t.valueType,u,s,a)},d=(0,o.J5)(n.key),f=null===n.value&&p||(0,o.J5)(n.value);d&&f&&(1===l?h[n.key]=n.value:h.push(n))})),h}}},144:(e,t,r)=>{"use strict";r.d(t,{G:()=>s});r(630);var i=r(171),n=r(611);function s(e){return(t,r)=>{const s=n.ut.mergeMemberOptions(t,r,e);(0,i.Z)(s)(t,r),n.ut.updateMemberOptions(t,r,s)}}},968:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{E:()=>SerializableMemberFunction});var _DataSerializerUtils__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(611),_SerializableMember__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(144);function SerializableMemberFunction(options={}){return(target,propertyKey)=>{options.serializer=e=>e.toString(),options.deserializer=fnStr=>eval(fnStr);const finalOptions=_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_0__.ut.mergeMemberOptions(target,propertyKey,options);(0,_SerializableMember__WEBPACK_IMPORTED_MODULE_1__.G)(finalOptions)(target,propertyKey),_DataSerializerUtils__WEBPACK_IMPORTED_MODULE_0__.ut.updateMemberOptions(target,propertyKey,finalOptions)}}},188:(e,t,r)=>{"use strict";r.d(t,{D9:()=>s,Gv:()=>n,aC:()=>o,mg:()=>i});const i=r(193);function n(e){return e&&"object"==typeof e&&!Array.isArray(e)}function s(e,t){const r=i(e);return n(e)&&n(t)&&Object.keys(t).forEach((i=>{if(Array.isArray(t[i])){r[i]=t[i];const n=void 0!==e[i]?Array.isArray(e[i])?e[i]:[e[i]]:[];r[i].push(...n.filter((e=>!t[i].includes(e))))}else n(t[i])?i in e?r[i]=s(e[i],t[i]):Object.assign(r,{[i]:t[i]}):Object.assign(r,{[i]:t[i]})})),r}const o={cloneDeep:i,mergeDeep:s}},366:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Absolute2DPosition:()=>At,Absolute3DPosition:()=>Dt,AbsoluteOrientationSensor:()=>Mt,AbsolutePosition:()=>Ee,Acceleration:()=>bt,AccelerationUnit:()=>rt,Accelerometer:()=>wt,Accuracy:()=>U,Accuracy1D:()=>F,Accuracy2D:()=>Jt,Accuracy3D:()=>Zt,AccuracyModifierNode:()=>AccuracyModifierNode,ActuatorObject:()=>Nt,ActuatorProperty:()=>Ot,AngleUnit:()=>w,AngularVelocity:()=>L,AngularVelocityUnit:()=>M,AxisAngle:()=>de,BalanceNode:()=>BalanceNode,BufferNode:()=>BufferNode,BufferUtils:()=>vt.A,CANBERRA:()=>Se,CHANGELOG_METADATA_KEY:()=>Oe,CHEBYSHEV:()=>xe,CalibrationNode:()=>CalibrationNode,CalibrationService:()=>CalibrationService,CallbackNode:()=>CallbackNode,CallbackSinkNode:()=>CallbackSinkNode,CallbackSourceNode:()=>CallbackSourceNode,CellIdentificationNode:()=>CellIdentificationNode,ChangeLog:()=>ChangeLog,ConcreteTypeDescriptor:()=>u.bS,DataFrame:()=>Je,DataFrameService:()=>DataFrameService,DataObject:()=>Ce,DataObjectService:()=>DataObjectService,DataSerializer:()=>c.z,DataSerializerUtils:()=>u.ut,DataService:()=>je,DataServiceDriver:()=>ke,DerivedUnit:()=>_,Deserializer:()=>Xt.g,DummyDataService:()=>DummyDataService,DummyService:()=>DummyService,EMAFilterNode:()=>EMAFilterNode,EUCLIDEAN:()=>be,Edge:()=>Edge,Euler:()=>he,FilterProcessingNode:()=>FilterProcessingNode,FrameChunkNode:()=>FrameChunkNode,FrameCloneNode:()=>FrameCloneNode,FrameDelayNode:()=>FrameDelayNode,FrameFilterNode:()=>FrameFilterNode,FrameFlattenNode:()=>FrameFlattenNode,FrameMergeNode:()=>FrameMergeNode,GCS:()=>ge,GeographicalPosition:()=>jt,GraphBuilder:()=>GraphBuilder,GraphShapeBuilder:()=>GraphShapeBuilder,GraphShapeNode:()=>GraphShapeNode,GravitySensor:()=>St,Gyroscope:()=>xt,HAVERSINE:()=>_e,HPFilterNode:()=>HPFilterNode,HistorySourceNode:()=>HistorySourceNode,Humidity:()=>Kt,KalmanFilter:()=>KalmanFilter,KalmanFilterNode:()=>KalmanFilterNode,KeyValueDataService:()=>KeyValueDataService,LPFilterNode:()=>LPFilterNode,LengthUnit:()=>g,LinearAccelerationSensor:()=>Et,LinearVelocity:()=>W,LinearVelocitySensor:()=>Tt,LinearVelocityUnit:()=>B,ListSourceNode:()=>ListSourceNode,LocationBasedService:()=>LocationBasedService,LoggingSinkNode:()=>LoggingSinkNode,LuminanceIntensityUnit:()=>ct,LuminanceUnit:()=>lt,MANHATTAN:()=>we,Magnetism:()=>Ct,MagnetismUnit:()=>nt,Magnetometer:()=>zt,Matrix3:()=>mt,Matrix4:()=>ue,MemoryBufferNode:()=>MemoryBufferNode,MemoryDataService:()=>MemoryDataService,MemoryQueryEvaluator:()=>MemoryQueryEvaluator,MergeShape:()=>MergeShape,ModelBuilder:()=>ModelBuilder,ModelSerializer:()=>ModelSerializer,MultilaterationNode:()=>MultilaterationNode,Node:()=>Te,NodeData:()=>Be,NodeDataService:()=>NodeDataService,NumberType:()=>n,ObjectMergeNode:()=>ObjectMergeNode,ObjectProcessingNode:()=>ObjectProcessingNode,Orientation:()=>me,Pose:()=>Wt,Pressure:()=>Qt,PressureUnit:()=>pt,ProcessingNode:()=>We,PropertyFilterProcessingNode:()=>PropertyFilterProcessingNode,PullPromise:()=>PullPromise,PushError:()=>PushError,PushPromise:()=>PushPromise,Quaternion:()=>fe,ReferenceSpace:()=>He,ReferenceSpaceConversionNode:()=>ReferenceSpaceConversionNode,Relative2DPosition:()=>Rt,Relative3DPosition:()=>It,RelativeAngle:()=>Ft,RelativeAngularVelocity:()=>Lt,RelativeDistance:()=>Vt,RelativeLinearVelocity:()=>Gt,RelativeOrientation:()=>Ut,RelativeOrientationSensor:()=>Pt,RelativePosition:()=>Me,RelativePositionFilter:()=>RelativePositionFilter,RelativePositionProcessing:()=>RelativePositionProcessing,RemoteNode:()=>RemoteNode,RemoteService:()=>hr,RemoteServiceProxy:()=>RemoteServiceProxy,RemoteSinkNode:()=>RemoteSinkNode,RemoteSourceNode:()=>RemoteSourceNode,SMAFilterNode:()=>SMAFilterNode,SensorCalibrationData:()=>gt,SensorObject:()=>_t,SensorValue:()=>V,SerializableArrayMember:()=>ce,SerializableMapMember:()=>Ke,SerializableMember:()=>o.G,SerializableMemberFunction:()=>R.E,SerializableObject:()=>l,SerializableSetMember:()=>Ht,SerializationUtils:()=>cr.aC,Serializer:()=>Yt.h,Service:()=>k,SinkNode:()=>Ze,SourceMergeNode:()=>SourceMergeNode,SourceNode:()=>Xe,Temperature:()=>qt,TemperatureUnit:()=>ot,ThrottleNode:()=>ThrottleNode,TimeService:()=>I,TimeSyncNode:()=>TimeSyncNode,TimeUnit:()=>x,TimedPullNode:()=>TimedPullNode,Trajectory:()=>Bt,TrajectoryService:()=>TrajectoryService,TriangulationNode:()=>TriangulationNode,TypeDescriptor:()=>u.e2,TypedJSON:()=>or,UUID:()=>lr,Unit:()=>m,UnitConversionNode:()=>UnitConversionNode,UnitPrefix:()=>UnitPrefix,UnitValue:()=>et,Vector2:()=>dt,Vector3:()=>f,Vector4:()=>ft,Velocity:()=>$,WorkerHandler:()=>WorkerHandler,WorkerNode:()=>WorkerNode,WorkerServiceProxy:()=>WorkerServiceProxy,cloneDeep:()=>cr.mg,createChangeLog:()=>De,getChangeLog:()=>Ne,isObject:()=>cr.Gv,mergeDeep:()=>cr.D9});var i={};r.r(i),r.d(i,{AnyT:()=>se.v6,ArrayT:()=>se.Yq,ArrayTypeDescriptor:()=>se.ZD,JsonObjectMetadata:()=>ie.zv,MapT:()=>se.P_,MapTypeDescriptor:()=>se.Ws,SetT:()=>se.jH,SetTypeDescriptor:()=>se.oy,TypedJSON:()=>rr,defaultTypeEmitter:()=>tr.s,defaultTypeResolver:()=>er.c,jsonArrayMember:()=>oe,jsonMapMember:()=>qe,jsonMember:()=>ir.Z,jsonObject:()=>a.o,jsonSetMember:()=>$t,toJson:()=>nr});r(630);var n,s=r(635),o=r(144),a=r(690),c=r(944),u=r(611);function l(e){return t=>{u.ut.createMetadata(t.prototype),(0,a.o)(e)(t),c.z.eventEmitter.emit("updateSerializableObject",t,e);const r=u.ut.getMetadata(t),i=u.ut.getRootMetadata(t.prototype);u.ut.updateObjectMetadata(t,e,r,i),c.z.registerType(t)}}class UnitPrefix{constructor(e,t,r){this.name=e,this.abbrevation=t,this.magnitude=r}get namePattern(){return new RegExp(`/^${this.name}/g`)}get abbrevationPattern(){return new RegExp(`/^${this.abbrevation}/g`)}}UnitPrefix.DECA=new UnitPrefix("deca","da",10),UnitPrefix.HECTO=new UnitPrefix("hecto","h",100),UnitPrefix.KILO=new UnitPrefix("kilo","k",1e3),UnitPrefix.MEGA=new UnitPrefix("mega","M",1e6),UnitPrefix.GIGA=new UnitPrefix("giga","G",1e9),UnitPrefix.TERA=new UnitPrefix("tera","T",1e12),UnitPrefix.PETA=new UnitPrefix("peta","P",1e15),UnitPrefix.EXA=new UnitPrefix("exa","E",1e18),UnitPrefix.ZETTA=new UnitPrefix("zetta","Z",1e21),UnitPrefix.YOTTA=new UnitPrefix("yotta","Y",1e24),UnitPrefix.DECI=new UnitPrefix("deci","d",.1),UnitPrefix.CENTI=new UnitPrefix("centi","c",.01),UnitPrefix.MILLI=new UnitPrefix("milli","m",.001),UnitPrefix.MICRO=new UnitPrefix("micro","u",1e-6),UnitPrefix.NANO=new UnitPrefix("nano","n",1e-9),UnitPrefix.PICO=new UnitPrefix("pico","p",1e-12),UnitPrefix.FEMTO=new UnitPrefix("femto","f",1e-15),UnitPrefix.ATTO=new UnitPrefix("atto","a",1e-18),UnitPrefix.ZEPTO=new UnitPrefix("zepto","z",1e-21),UnitPrefix.YOCTO=new UnitPrefix("yocto","y",1e-24),UnitPrefix.DECIMAL=[UnitPrefix.DECA,UnitPrefix.HECTO,UnitPrefix.KILO,UnitPrefix.MEGA,UnitPrefix.GIGA,UnitPrefix.TERA,UnitPrefix.PETA,UnitPrefix.EXA,UnitPrefix.ZETTA,UnitPrefix.YOTTA,UnitPrefix.DECI,UnitPrefix.CENTI,UnitPrefix.MILLI,UnitPrefix.MICRO,UnitPrefix.NANO,UnitPrefix.PICO,UnitPrefix.FEMTO,UnitPrefix.ATTO,UnitPrefix.ZEPTO,UnitPrefix.YOCTO],function(e){e[e.INTEGER=0]="INTEGER",e[e.FLOAT=1]="FLOAT",e[e.DOUBLE=2]="DOUBLE",e[e.DECIMAL=3]="DECIMAL",e[e.LONG=4]="LONG",e[e.SHORT=5]="SHORT"}(n||(n={}));Math.PI,Math.PI;function h(e,t,r){return Math.max(t,Math.min(r,e))}class Quaternion_Quaternion{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,n,s,o){let a=r[i+0],c=r[i+1],u=r[i+2],l=r[i+3];const h=n[s+0],p=n[s+1],d=n[s+2],f=n[s+3];if(0===o)return e[t+0]=a,e[t+1]=c,e[t+2]=u,void(e[t+3]=l);if(1===o)return e[t+0]=h,e[t+1]=p,e[t+2]=d,void(e[t+3]=f);if(l!==f||a!==h||c!==p||u!==d){let e=1-o;const t=a*h+c*p+u*d+l*f,r=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const n=Math.sqrt(i),s=Math.atan2(n,t*r);e=Math.sin(e*s)/n,o=Math.sin(o*s)/n}const n=o*r;if(a=a*e+h*n,c=c*e+p*n,u=u*e+d*n,l=l*e+f*n,e===1-o){const e=1/Math.sqrt(a*a+c*c+u*u+l*l);a*=e,c*=e,u*=e,l*=e}}e[t]=a,e[t+1]=c,e[t+2]=u,e[t+3]=l}static multiplyQuaternionsFlat(e,t,r,i,n,s){const o=r[i],a=r[i+1],c=r[i+2],u=r[i+3],l=n[s],h=n[s+1],p=n[s+2],d=n[s+3];return e[t]=o*d+u*l+a*p-c*h,e[t+1]=a*d+u*h+c*l-o*p,e[t+2]=c*d+u*p+o*h-a*l,e[t+3]=u*d-o*l-a*h-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,n=e._z,s=e._order,o=Math.cos,a=Math.sin,c=o(r/2),u=o(i/2),l=o(n/2),h=a(r/2),p=a(i/2),d=a(n/2);switch(s){case"XYZ":this._x=h*u*l+c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l-h*p*d;break;case"YXZ":this._x=h*u*l+c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l+h*p*d;break;case"ZXY":this._x=h*u*l-c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l-h*p*d;break;case"ZYX":this._x=h*u*l-c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l+h*p*d;break;case"YZX":this._x=h*u*l+c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l-h*p*d;break;case"XZY":this._x=h*u*l-c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],n=t[8],s=t[1],o=t[5],a=t[9],c=t[2],u=t[6],l=t[10],h=r+o+l;if(h>0){const e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-a)*e,this._y=(n-c)*e,this._z=(s-i)*e}else if(r>o&&r>l){const e=2*Math.sqrt(1+r-o-l);this._w=(u-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(n+c)/e}else if(o>l){const e=2*Math.sqrt(1+o-r-l);this._w=(n-c)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+u)/e}else{const e=2*Math.sqrt(1+l-r-o);this._w=(s-i)/e,this._x=(n+c)/e,this._y=(a+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(h(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(0===r)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,n=e._z,s=e._w,o=t._x,a=t._y,c=t._z,u=t._w;return this._x=r*u+s*o+i*c-n*a,this._y=i*u+s*a+n*o-r*c,this._z=n*u+s*c+r*a-i*o,this._w=s*u-r*o-i*a-n*c,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const r=this._x,i=this._y,n=this._z,s=this._w;let o=s*e._w+r*e._x+i*e._y+n*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=r,this._y=i,this._z=n,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*r+t*this._x,this._y=e*i+t*this._y,this._z=e*n+t*this._z,this.normalize(),this}const c=Math.sqrt(a),u=Math.atan2(c,o),l=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=s*l+this._w*h,this._x=r*l+this._x*h,this._y=i*l+this._y*h,this._z=n*l+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),n=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),n*Math.sin(t),n*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Vector3_Vector3{constructor(e=0,t=0,r=0){Vector3_Vector3.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(d.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(d.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,n=e.elements,s=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*s,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*s,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*s,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,n=e.x,s=e.y,o=e.z,a=e.w,c=2*(s*i-o*r),u=2*(o*t-n*i),l=2*(n*r-s*t);return this.x=t+a*c+s*l-o*u,this.y=r+a*u+o*c-n*l,this.z=i+a*l+n*u-s*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=h(this.x,e.x,t.x),this.y=h(this.y,e.y,t.y),this.z=h(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=h(this.x,e,t),this.y=h(this.y,e,t),this.z=h(this.z,e,t),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(h(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,n=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-n*o,this.y=n*s-r*a,this.z=r*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return p.copy(this).projectOnVector(e),this.sub(p)}reflect(e){return this.sub(p.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(h(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const p=new Vector3_Vector3,d=new Quaternion_Quaternion;let f=class Vector3 extends Vector3_Vector3{static fromArray(e){return(new this).fromArray(e)}static fromVector(e){return new this(e.x,e.y,e.z)}clone(){return(new this.constructor).copy(this)}};var y;(0,s.Cg)([(0,o.G)({numberType:n.DECIMAL}),(0,s.Sn)("design:type",Number)],f.prototype,"x",void 0),(0,s.Cg)([(0,o.G)({numberType:n.DECIMAL}),(0,s.Sn)("design:type",Number)],f.prototype,"y",void 0),(0,s.Cg)([(0,o.G)({numberType:n.DECIMAL}),(0,s.Sn)("design:type",Number)],f.prototype,"z",void 0),f=(0,s.Cg)([l()],f);let m=y=class Unit{constructor(e,t){this._definitions=new Map,this._prefixType="none",this._aliases=[];const r=t||{baseName:void 0};r.aliases=r.aliases||[],r.prefixes=r.prefixes||"none",r.definitions=r.definitions||[],this._name=e||r.name,this._baseName=r.baseName,this._aliases=r.aliases,this._prefixType=r.prefixes,r.definitions.forEach(this._initDefinition.bind(this)),this.name&&y.registerUnit(this,r.override)}static fromJSON(e){if(void 0!==e.name){const t=y.findByName(e.name);if(!t)throw new Error(`Unit with name '${e.name}' not found! Unable to deserialize!`);return t}throw new Error("Unit does not define a serialization name! Unable to deserialize!")}_initDefinition(e){const t=y.findByName(e.unit,this.baseName),r=t?t.name:e.unit;"toUnit"in e?this._initFunctionDefinition(e,r):this._initBasicDefinition(e,r)}_initFunctionDefinition(e,t){const r=e;this._definitions.set(t,r)}_initBasicDefinition(e,t){const r=Object.keys(e),i=e,n=r.indexOf("magnitude"),s=r.indexOf("offset"),o=i.magnitude||1,a=void 0!==i.offset?i.offset:0;let c,u;-1===n||s<n?(c=e=>(e+a)*o,u=e=>e/o-a):(c=e=>e*o+a,u=e=>(e-a)/o),this._definitions.set(t,{unit:i.unit,toUnit:c,fromUnit:u})}get name(){return this._name}set name(e){this._name=e;const t=y.findByName(e);t&&(this._baseName=t.baseName,this._definitions=t._definitions,this._prefixType=t._prefixType,this._aliases=t._aliases)}get aliases(){return this._aliases}get baseName(){return this._baseName}get prefixType(){return this._prefixType}get definitions(){return Array.from(this._definitions.values())}get prefixes(){switch(this._prefixType){case"decimal":return UnitPrefix.DECIMAL;case"none":return[]}}createBaseDefinition(){let e;const t=y.UNIT_BASES.get(this.baseName);if(this._definitions.has(t)){const r=this._definitions.get(t);e=r}else this._definitions.forEach((t=>{const r=y.findByName(t.unit,this.baseName).createBaseDefinition();r&&(e={unit:r.unit,toUnit:e=>r.toUnit(t.toUnit(e)),fromUnit:e=>t.fromUnit(r.fromUnit(e))})}));return e}createDefinition(e){let t;const r=y.UNIT_BASES.get(this.baseName),i=y.findByName(r);if(this._definitions.has(e.name)){t=this._definitions.get(e.name)}else if(e._definitions.has(this.name)){const r=e._definitions.get(this.name);t={inputType:r.inputType,outputType:r.outputType,unit:e.name,toUnit:r.fromUnit,fromUnit:r.toUnit},this._definitions.set(e.name,t)}else if(i.name!==this.name){const n=this._definitions.get(r),s=i.createDefinition(e);n&&s&&(t={inputType:n.inputType,outputType:n.outputType,unit:e.name,toUnit:e=>s.toUnit(n.toUnit(e)),fromUnit:e=>n.fromUnit(s.fromUnit(e))},this._definitions.set(e.name,t))}return t}specifier(e){const t=`${e.name}${this.name}`;if(y.UNITS.has(t))return y.UNITS.get(t);if(!this.prefixes.includes(e))throw new Error(`Prefix '${e.name}' is not allowed for this unit!`);const r=new(0,Object.getPrototypeOf(this).constructor);r._name=t,r._baseName=this.baseName;const i=[];return this.aliases.forEach((t=>{i.push(`${e.name}${t}`),i.push(`${e.abbrevation}${t}`)})),r._aliases=i,r._definitions.set(this.name,{unit:this.name,toUnit:t=>t*e.magnitude,fromUnit:t=>t/e.magnitude}),y.registerUnit(r)}findByName(e){for(const t of this.aliases.concat(this.name)){if(e===t)return this;if(e.endsWith(t))for(const t of this.prefixes)if(e.match(t.abbrevationPattern)||e.match(t.namePattern))return this.specifier(t)}}static findByName(e,t){if(void 0!==e){if(y.UNITS.has(e))return y.UNITS.get(e);for(const[,r]of y.UNITS){if(t&&t!==r.baseName)continue;const i=r.findByName(e);if(i)return i}}}convert(e,t){const r=t instanceof y?t:y.findByName(t,this.baseName);if(!r||r.name===this.name)return e;const i=this.createDefinition(r);if(i)return e instanceof f&&i.inputType!==f?e.clone().fromArray([i.toUnit(e.x),i.toUnit(e.y),i.toUnit(e.z)]):i.toUnit(e);throw new Error(`No conversion definition found from '${this.name}' to '${r.name}'!`)}static convert(e,t,r){return("string"==typeof t?y.findByName(t):t).convert(e,r)}static registerUnit(e,t=!1){if(!e.name)return e;y.UNITS.has(e.name)&&!t||y.UNITS.set(e.name,e);const r=e.baseName?e.baseName:e.name,i=y.UNIT_BASES.get(r);if(i){const t=y.findByName(i,r).createDefinition(e),n=e.createBaseDefinition();t||e._definitions.set(i,n)}else y.UNIT_BASES.set(r,e.name);return e}};var v;m.UNIT_BASES=new Map,m.UNITS=new Map,m.UNKNOWN=new y("unknown"),(0,s.Cg)([(0,o.G)(),(0,s.Sn)("design:type",String),(0,s.Sn)("design:paramtypes",[String])],m.prototype,"name",null),m=y=(0,s.Cg)([l({initializer:m.fromJSON}),(0,s.Sn)("design:paramtypes",[String,Object])],m);let g=v=class LengthUnit extends m{};g.METER=new v("meter",{baseName:"length",aliases:["m","meters"],prefixes:"decimal"}),g.CENTIMETER=v.METER.specifier(UnitPrefix.CENTI),g.MILLIMETER=v.METER.specifier(UnitPrefix.MILLI),g.KILOMETER=v.METER.specifier(UnitPrefix.KILO),g.MILE=new v("mile",{baseName:"length",aliases:["mil","miles"],definitions:[{unit:"meter",magnitude:1609.344}]}),g=v=(0,s.Cg)([l()],g);let _=class DerivedUnit extends m{constructor(){super(...arguments),this._units=new Map,this._unitPower=new Map}addUnit(e,t){if(this._units.has(e.baseName))throw new Error(`A unit with base name '${e.baseName}' already exists for this unit!`);return this._units.set(e.baseName,e),this._unitPower.set(e.baseName,t),this}swap(e,t){if(m.UNITS.has(t.name))return m.UNITS.get(t.name);const r=new(0,Object.getPrototypeOf(this).constructor);r._name=t.name,r._baseName=this.baseName,r._aliases=t.aliases?t.aliases:[];const i={unit:this.name,toUnit:void 0,fromUnit:void 0};return e.forEach((e=>{const t=this._units.get(e.baseName),r=this._unitPower.get(e.baseName),n=e.createDefinition(t),s=e=>Math.pow(n.toUnit(e),r),o=e=>Math.pow(n.fromUnit(e),r),a=i.toUnit,c=i.fromUnit;a&&c?(i.toUnit=e=>a(s(e)),i.fromUnit=e=>c(o(e))):(i.toUnit=s,i.fromUnit=o)})),r._definitions.set(this.name,i),m.registerUnit(r)}};var b;_=(0,s.Cg)([l()],_);let w=b=class AngleUnit extends m{};var S;w.RADIAN=new b("radian",{baseName:"angle",aliases:["rad","rads","radians"]}),w.DEGREE=new b("degree",{baseName:"angle",aliases:["deg","degs","degrees"],definitions:[{magnitude:Math.PI/180,unit:"rad"}]}),w=b=(0,s.Cg)([l()],w);let x=S=class TimeUnit extends m{};var E;x.SECOND=new S("second",{baseName:"time",aliases:["s","sec","seconds"],prefixes:"decimal"}),x.MILLISECOND=S.SECOND.specifier(UnitPrefix.MILLI),x.MICROSECOND=S.SECOND.specifier(UnitPrefix.MICRO),x.NANOSECOND=S.SECOND.specifier(UnitPrefix.NANO),x.MINUTE=new S("minute",{baseName:"time",aliases:["m","min","minutes"],definitions:[{magnitude:60,unit:"s"}]}),x.HOUR=new S("hour",{baseName:"time",aliases:["h","hr","hrs","hours"],definitions:[{magnitude:3600,unit:"s"},{magnitude:60,unit:"min"}]}),x=S=(0,s.Cg)([l()],x);let M=E=class AngularVelocityUnit extends _{};M.RADIAN_PER_SECOND=new E("radian per second",{baseName:"angularvelocity",aliases:["rad/s","radians per second"]}).addUnit(w.RADIAN,1).addUnit(x.SECOND,-1),M.DEGREE_PER_SECOND=E.RADIAN_PER_SECOND.swap([w.DEGREE],{baseName:"angularvelocity",name:"degree per second",aliases:["deg/s","degrees per second"]}),M.RADIAN_PER_MINUTE=E.RADIAN_PER_SECOND.swap([x.MINUTE],{baseName:"angularvelocity",name:"radian per minute",aliases:["rad/min","radian per minute"]}),M.DEGREE_PER_MINUTE=E.RADIAN_PER_SECOND.swap([w.DEGREE,x.MINUTE],{baseName:"angularvelocity",name:"degree per minute",aliases:["deg/min","degrees per minute"]}),M=E=(0,s.Cg)([l()],M);var P=r(7);class AsyncEventEmitter extends P.EventEmitter{emitAsync(e,...t){return new Promise(((r,i)=>{const n=this.listeners(e);if(0===n.length)return r(!1);const s=[];n.forEach((e=>{s.push(e(...t))})),Promise.all(s).then((()=>{r(!0)})).catch(i)}))}}const C={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let z;const T=new Uint8Array(16);function O(){if(!z&&(z="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!z))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return z(T)}const N=[];for(let e=0;e<256;++e)N.push((e+256).toString(16).slice(1));function A(e,t=0){return N[e[t+0]]+N[e[t+1]]+N[e[t+2]]+N[e[t+3]]+"-"+N[e[t+4]]+N[e[t+5]]+"-"+N[e[t+6]]+N[e[t+7]]+"-"+N[e[t+8]]+N[e[t+9]]+"-"+N[e[t+10]]+N[e[t+11]]+N[e[t+12]]+N[e[t+13]]+N[e[t+14]]+N[e[t+15]]}const D=function(e,t,r){if(C.randomUUID&&!t&&!e)return C.randomUUID();const i=(e=e||{}