From 7e61ef5200c0fe0aa8f4612f1a84b1f3c3d759ce Mon Sep 17 00:00:00 2001 From: MatthijsBurgh Date: Mon, 19 Dec 2022 19:56:33 +0000 Subject: [PATCH] Update Build --- build/ros3d.cjs.js | 8 ++++++-- build/ros3d.esm.js | 8 ++++++-- build/ros3d.js | 8 ++++++-- build/ros3d.min.js | 5 +++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/build/ros3d.cjs.js b/build/ros3d.cjs.js index 93d73028..6cc9d4cc 100644 --- a/build/ros3d.cjs.js +++ b/build/ros3d.cjs.js @@ -53251,7 +53251,11 @@ var InteractiveMarker = /*@__PURE__*/(function (superclass) { return InteractiveMarker; }(THREE.Object3D)); -var eventemitter2 = {exports: {}}; +var eventemitter2Exports = {}; +var eventemitter2 = { + get exports(){ return eventemitter2Exports; }, + set exports(v){ eventemitter2Exports = v; }, +}; /*! * EventEmitter2 @@ -54887,7 +54891,7 @@ var eventemitter2 = {exports: {}}; }(); } (eventemitter2)); -var EventEmitter2 = eventemitter2.exports; +var EventEmitter2 = eventemitter2Exports; /** * @fileOverview diff --git a/build/ros3d.esm.js b/build/ros3d.esm.js index 32b9952b..1d417b08 100644 --- a/build/ros3d.esm.js +++ b/build/ros3d.esm.js @@ -53227,7 +53227,11 @@ var InteractiveMarker = /*@__PURE__*/(function (superclass) { return InteractiveMarker; }(THREE.Object3D)); -var eventemitter2 = {exports: {}}; +var eventemitter2Exports = {}; +var eventemitter2 = { + get exports(){ return eventemitter2Exports; }, + set exports(v){ eventemitter2Exports = v; }, +}; /*! * EventEmitter2 @@ -54863,7 +54867,7 @@ var eventemitter2 = {exports: {}}; }(); } (eventemitter2)); -var EventEmitter2 = eventemitter2.exports; +var EventEmitter2 = eventemitter2Exports; /** * @fileOverview diff --git a/build/ros3d.js b/build/ros3d.js index 5011e9de..fd1f5dba 100644 --- a/build/ros3d.js +++ b/build/ros3d.js @@ -53319,7 +53319,11 @@ var ROS3D = (function (exports, ROSLIB) { }; } - var eventemitter2 = {exports: {}}; + var eventemitter2Exports = {}; + var eventemitter2 = { + get exports(){ return eventemitter2Exports; }, + set exports(v){ eventemitter2Exports = v; }, + }; /*! * EventEmitter2 @@ -54949,7 +54953,7 @@ var ROS3D = (function (exports, ROSLIB) { }(); } (eventemitter2)); - var EventEmitter2 = eventemitter2.exports; + var EventEmitter2 = eventemitter2Exports; /** * @fileOverview diff --git a/build/ros3d.min.js b/build/ros3d.min.js index 01ba7886..ccd97f59 100644 --- a/build/ros3d.min.js +++ b/build/ros3d.min.js @@ -2,11 +2,12 @@ var ROS3D=function(e,t){"use strict";function i(e){if(e&&e.__esModule)return e;v //!\ DECLARE ALIAS AFTER assign prototype ! Object.assign(Uo.prototype,{beforeStart_:Uo.prototype.copySampleValue_,afterEnd_:Uo.prototype.copySampleValue_}),Fo.prototype=Object.assign(Object.create(Uo.prototype),{constructor:Fo,interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=(i-t)/(r-t),h=s+a;s!==h;s+=4)ne.slerpFlat(n,0,o,s-a,o,s,c);return n}}),Bo.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Bo,ValueTypeName:"quaternion",DefaultInterpolation:Y,InterpolantFactoryMethodLinear:function(e){return new Fo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),zo.prototype=Object.assign(Object.create(Wo.prototype),{constructor:zo,ValueTypeName:"color"}),ko.prototype=Object.assign(Object.create(Wo.prototype),{constructor:ko,ValueTypeName:"number"}),Go.prototype=Object.assign(Object.create(Uo.prototype),{constructor:Go,DefaultSettings_:{endingStart:J,endingEnd:J},intervalChanged_:function(e,t,i){var r=this.parameterPositions,n=e-2,o=e+1,a=r[n],s=r[o];if(void 0===a)switch(this.getSettings_().endingStart){case K:n=e,a=2*t-i;break;case Q:a=t+r[n=r.length-2]-r[n+1];break;default:n=e,a=i}if(void 0===s)switch(this.getSettings_().endingEnd){case K:o=e,s=2*i-t;break;case Q:o=1,s=i+r[1]-r[0];break;default:o=e-1,s=t}var c=.5*(i-t),h=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(s-i),this._offsetPrev=n*h,this._offsetNext=o*h},interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-t)/(r-t),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==a;++b)n[b]=v*o[h+b]+g*o[c+b]+y*o[s+b]+x*o[l+b];return n}}),Vo.prototype=Object.assign(Object.create(Uo.prototype),{constructor:Vo,interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,h=(i-t)/(r-t),l=1-h,u=0;u!==a;++u)n[u]=o[c+u]*l+o[s+u]*h;return n}}),jo.prototype=Object.assign(Object.create(Uo.prototype),{constructor:jo,interpolate_:function(e){return this.copySampleValue_(e-1)}});var Ho={arraySlice:function(e,t,i){return Ho.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==i?i:e.length)):e.slice(t,i)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,i=new Array(t),r=0;r!==t;++r)i[r]=r;return i.sort((function(t,i){return e[t]-e[i]})),i},sortedArray:function(e,t,i){for(var r=e.length,n=new e.constructor(r),o=0,a=0;a!==r;++o)for(var s=i[o]*t,c=0;c!==t;++c)n[a++]=e[s+c];return n},flattenJSON:function(e,t,i,r){for(var n=1,o=e[0];void 0!==o&&void 0===o[r];)o=e[n++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[r])&&(t.push(o.time),i.push.apply(i,a)),o=e[n++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[r])&&(t.push(o.time),a.toArray(i,i.length)),o=e[n++]}while(void 0!==o);else do{void 0!==(a=o[r])&&(t.push(o.time),i.push(a)),o=e[n++]}while(void 0!==o)}}};function Wo(e,t,i,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ho.convertArray(t,this.TimeBufferType),this.values=Ho.convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Xo(e,t,i,r){Wo.call(this,e,t,i,r)}function qo(e,t,i){this.name=e,this.tracks=i,this.duration=void 0!==t?t:-1,this.uuid=te.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Yo(e){this.manager=void 0!==e?e:Xn,this.textures={}}function Zo(e){this.manager=void 0!==e?e:Xn}Object.assign(Wo,{parse:function(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=Wo._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var i=[],r=[];Ho.flattenJSON(e.keys,i,r,"value"),e.times=i,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,i=e.constructor;if(void 0!==i.toJSON)t=i.toJSON(e);else{t={name:e.name,times:Ho.convertArray(e.times,Array),values:Ho.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ko;case"vector":case"vector2":case"vector3":case"vector4":return Xo;case"color":return zo;case"quaternion":return Bo;case"bool":case"boolean":return Do;case"string":return Io}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}}),Object.assign(Wo.prototype,{constructor:Wo,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Y,InterpolantFactoryMethodDiscrete:function(e){return new jo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Vo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Go(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case q:t=this.InterpolantFactoryMethodDiscrete;break;case Y:t=this.InterpolantFactoryMethodLinear;break;case Z:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)this.createInterpolant=t;else{var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrack:",i)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return q;case this.InterpolantFactoryMethodLinear:return Y;case this.InterpolantFactoryMethodSmooth:return Z}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]*=e;return this},trim:function(e,t){for(var i=this.times,r=i.length,n=0,o=r-1;n!==r&&i[n]t;)--o;if(++o,0!==n||o!==r){n>=o&&(n=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Ho.arraySlice(i,n,o),this.values=Ho.arraySlice(this.values,n*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var i=this.times,r=this.values,n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var o=null,a=0;a!==n;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==r&&Ho.isTypedArray(r)){a=0;for(var c=r.length;a!==c;++a){var h=r[a];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,h),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),r=this.getInterpolation()===Z,n=1,o=e.length-1,a=1;a0){e[n]=e[o];for(f=o*i,m=n*i,p=0;p!==i;++p)t[m+p]=t[f+p];++n}return n!==e.length&&(this.times=Ho.arraySlice(e,0,n),this.values=Ho.arraySlice(t,0,n*i)),this}}),Xo.prototype=Object.assign(Object.create(Wo.prototype),{constructor:Xo,ValueTypeName:"vector"}),Object.assign(qo,{parse:function(e){for(var t=[],i=e.tracks,r=1/(e.fps||1),n=0,o=i.length;n!==o;++n)t.push(Wo.parse(i[n]).scale(r));return new qo(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t},n=0,o=i.length;n!==o;++n)t.push(Wo.toJSON(i[n]));return r},CreateFromMorphTargetSequence:function(e,t,i,r){for(var n=t.length,o=[],a=0;a1){var h=r[u=c[1]];h||(r[u]=h=[]),h.push(s)}}var l=[];for(var u in r)l.push(qo.CreateFromMorphTargetSequence(u,r[u],t,i));return l},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(e,t,i,r,n){if(0!==i.length){var o=[],a=[];Ho.flattenJSON(i,o,a,r),0!==o.length&&n.push(new e(t,o,a))}},r=[],n=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],c=0;c1?e.skinWeights[r+1]:0,s=i>2?e.skinWeights[r+2]:0,c=i>3?e.skinWeights[r+3]:0;t.skinWeights.push(new he(o,a,s,c))}if(e.skinIndices)for(r=0,n=e.skinIndices.length;r1?e.skinIndices[r+1]:0,u=i>2?e.skinIndices[r+2]:0,p=i>3?e.skinIndices[r+3]:0;t.skinIndices.push(new he(h,l,u,p))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,i),function(e,t){var i=e.scale;if(void 0!==e.morphTargets)for(var r=0,n=e.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var l=t.faces,u=e.morphColors[0].colors;for(r=0,n=l.length;r0&&(t.animations=i)}(e,i),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:i}:{geometry:i,materials:ta.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}),Object.assign(na.prototype,{load:function(e,t,i,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this;new Yn(n.manager).load(e,(function(i){var o=null;try{o=JSON.parse(i)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?n.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.")}),i,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,i),n=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),o=this.parseTextures(e.textures,n),a=this.parseMaterials(e.materials,o),s=this.parseObject(e.object,r,a);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var i=0,r=e.length;i0){var o=new Kn(new Wn(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new dr(s,c):new vi(s,c);break;case"LOD":n=new lr;break;case"Line":n=new mr(o(t.geometry),a(t.material),t.mode);break;case"LineLoop":n=new gr(o(t.geometry),a(t.material));break;case"LineSegments":n=new vr(o(t.geometry),a(t.material));break;case"PointCloud":case"Points":n=new xr(o(t.geometry),a(t.material));break;case"Sprite":n=new hr(a(t.material));break;case"Group":n=new br;break;default:n=new Ot}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.children)for(var h=t.children,l=0;lNumber.EPSILON){if(h<0&&(a=t[o],c=-c,s=t[n],h=-h),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var l=h*(e.x-a.x)-c*(e.y-a.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return r}var n=pn.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return i(o);var a,s,c,h=[];if(1===o.length)return s=o[0],(c=new Mo).curves=s.curves,h.push(c),h;var l=!n(o[0].getPoints());l=e?!l:l;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;g1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],E=0;E0&&(x||(m=d))}g=0;for(var L=f.length;g0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==n;++o)e[t+o]=e[i+o]},_slerp:function(e,t,i,r){ne.slerpFlat(e,t,e,t,e,i,r)},_lerp:function(e,t,i,r,n){for(var o=1-r,a=0;a!==n;++a){var s=t+a;e[s]=e[s]*o+e[i+a]*r}}}),Object.assign(Ba.prototype,{getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}),Object.assign(za,{Composite:Ba,create:function(e,t,i){return e&&e.isAnimationObjectGroup?new za.Composite(e,t,i):new za(e,t,i)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:(Ma=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),Ea=["material","materials","bones"],function(e){var t=Ma.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var n=i.nodeName.substring(r+1);-1!==Ea.indexOf(n)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=n)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var i=function(e){for(var i=0;i=t){var l=t++,u=e[l];i[u.uuid]=h,e[h]=u,i[c]=l,e[l]=s;for(var p=0,d=n;p!==d;++p){var f=r[p],m=f[l],v=f[h];f[h]=m,f[l]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],h=c.uuid,l=r[h];if(void 0!==l)if(delete r[h],l0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(a),h[l].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=2202===r;if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=i||t<0){var a=Math.floor(t/i);t-=i*a,n+=Math.abs(a);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&n))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var r=this._interpolantSettings;i?(r.endingStart=K,r.endingEnd=K):(r.endingStart=e?this.zeroSlopeAtStart?K:J:Q,r.endingEnd=t?this.zeroSlopeAtEnd?K:J:Q)},_scheduleFading:function(e,t,i){var r=this._mixer,n=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=n,s[0]=t,a[1]=n+e,s[1]=i,this}}),Va.prototype=Object.assign(Object.create(n.prototype),{constructor:Va,_bindAction:function(e,t){var i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,o=e._propertyBindings,a=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==n;++l){var u=r[l],p=u.name,d=h[p];if(void 0!==d)o[l]=d;else{if(void 0!==(d=o[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[l].binding.parsedPath;++(d=new Fa(za.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[l]=d}a[l].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,o=0,a=n.length;o!==a;++o){var s=n[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(La.set(e.z,0,-e.x).normalize(),Aa=Math.acos(e.y),this.quaternion.setFromAxisAngle(La,Aa))}),gs.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},gs.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},ys.prototype=Object.create(vr.prototype),ys.prototype.constructor=ys;var xs={createMultiMaterialObject:function(e,t){for(var i=new br,r=0,n=t.length;r0.99)"," {"," vec4 depthColor2 = texture2D( map, vUv2 );"," float depth2 = ( depthColor2.r + depthColor2.g + depthColor2.b ) / 3.0 ;"," depth = 0.99+depth2;"," }"," "," return depth;"," }","","float median(float a, float b, float c)"," {"," float r=a;"," "," if ( (a0.5) || (vUvP.y<0.5) || (vUvP.y>0.0))"," {"," vec2 smp = decodeDepth(vec2(position.x, position.y));"," float depth = smp.x;"," depthVariance = smp.y;"," "," float z = -depth;"," "," pos = vec4("," ( position.x / width - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength) * -1.0,"," ( position.y / height - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength),"," (- z + zOffset / 1000.0) * maxDepthPerTile,"," 1.0);"," "," vec2 maskP = vec2( position.x / (width*2.0), position.y / (height*2.0) );"," vec4 maskColor = texture2D( map, maskP );"," maskVal = ( maskColor.r + maskColor.g + maskColor.b ) / 3.0 ;"," }"," "," gl_PointSize = pointSize;"," gl_Position = projectionMatrix * modelViewMatrix * pos;"," ","}"].join("\n"),this.fragment_shader=["uniform sampler2D map;","uniform float varianceThreshold;","uniform float whiteness;","","varying vec2 vUvP;","varying vec2 colorP;","","varying float depthVariance;","varying float maskVal;","","","void main() {"," "," vec4 color;"," "," if ( (depthVariance>varianceThreshold) || (maskVal>0.5) ||(vUvP.x<0.0)|| (vUvP.x>0.5) || (vUvP.y<0.5) || (vUvP.y>1.0))"," { "," discard;"," }"," else "," {"," color = texture2D( map, colorP );"," "," float fader = whiteness /100.0;"," "," color.r = color.r * (1.0-fader)+ fader;"," "," color.g = color.g * (1.0-fader)+ fader;"," "," color.b = color.b * (1.0-fader)+ fader;"," "," color.a = 1.0;//smoothstep( 20000.0, -20000.0, gl_FragCoord.z / gl_FragCoord.w );"," }"," "," gl_FragColor = vec4( color.r, color.g, color.b, color.a );"," ","}"].join("\n")}metaLoaded(){this.metaLoaded=!0,this.initStreamer()}initStreamer(){if(this.metaLoaded){this.texture=new Ss.Texture(this.video),this.geometry=new Ss.Geometry;for(var e=0,t=this.width*this.height;e>5&31)/31,r=(w>>10&31)/31):(t=o,i=a,r=s)}for(var _=1;_<=3;_++){var M=g+12*_;f.push(h.getFloat32(M,!0)),f.push(h.getFloat32(M+4,!0)),f.push(h.getFloat32(M+8,!0)),m.push(y,x,b),u&&n.push(t,i,r)}}return d.addAttribute("position",new Ss.BufferAttribute(new Float32Array(f),3)),d.addAttribute("normal",new Ss.BufferAttribute(new Float32Array(m),3)),u&&(d.addAttribute("color",new Ss.BufferAttribute(new Float32Array(n),3)),d.hasColors=!0,d.alpha=c),d}(t):function(e){for(var t,i=new Ss.BufferGeometry,r=/facet([\s\S]*?)endfacet/g,n=0,o=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),s=new RegExp("normal"+o+o+o,"g"),c=[],h=[],l=new Ss.Vector3;null!==(t=r.exec(e));){for(var u=0,p=0,d=t[0];null!==(t=s.exec(d));)l.x=parseFloat(t[1]),l.y=parseFloat(t[2]),l.z=parseFloat(t[3]),p++;for(;null!==(t=a.exec(d));)c.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),h.push(l.x,l.y,l.z),u++;1!==p&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+n),3!==u&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+n),n++}return i.addAttribute("position",new Ss.Float32BufferAttribute(c,3)),i.addAttribute("normal",new Ss.Float32BufferAttribute(h,3)),i}(function(e){if("string"!=typeof e){var t=new Uint8Array(e);if(void 0!==window.TextDecoder)return(new TextDecoder).decode(t);for(var i="",r=0,n=e.byteLength;r0?t[t.length-1]:"",smooth:void 0!==i?i.smooth:this.smooth,groupStart:void 0!==i?i.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(var i=this.materials.length-1;i>=0;i--)this.materials[i].groupCount<=0&&this.materials.splice(i,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},i&&i.name&&"function"==typeof i.clone){var r=i.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseNormalIndex:function(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseUVIndex:function(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)},addVertex:function(e,t,i){var r=this.vertices,n=this.object.geometry.vertices;n.push(r[e+0],r[e+1],r[e+2]),n.push(r[t+0],r[t+1],r[t+2]),n.push(r[i+0],r[i+1],r[i+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,i){var r=this.normals,n=this.object.geometry.normals;n.push(r[e+0],r[e+1],r[e+2]),n.push(r[t+0],r[t+1],r[t+2]),n.push(r[i+0],r[i+1],r[i+2])},addColor:function(e,t,i){var r=this.colors,n=this.object.geometry.colors;n.push(r[e+0],r[e+1],r[e+2]),n.push(r[t+0],r[t+1],r[t+2]),n.push(r[i+0],r[i+1],r[i+2])},addUV:function(e,t,i){var r=this.uvs,n=this.object.geometry.uvs;n.push(r[e+0],r[e+1]),n.push(r[t+0],r[t+1]),n.push(r[i+0],r[i+1])},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,i,r,n,o,a,s,c){var h=this.vertices.length,l=this.parseVertexIndex(e,h),u=this.parseVertexIndex(t,h),p=this.parseVertexIndex(i,h);if(this.addVertex(l,u,p),void 0!==r&&""!==r){var d=this.uvs.length;l=this.parseUVIndex(r,d),u=this.parseUVIndex(n,d),p=this.parseUVIndex(o,d),this.addUV(l,u,p)}if(void 0!==a&&""!==a){var f=this.normals.length;l=this.parseNormalIndex(a,f),u=a===s?l:this.parseNormalIndex(s,f),p=a===c?l:this.parseNormalIndex(c,f),this.addNormal(l,u,p)}this.colors.length>0&&this.addColor(l,u,p)},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,i=0,r=e.length;i0){var m=f.split("/");u.push(m)}}var v=u[0];for(p=1,d=u.length-1;p1){var A=o[1].trim().toLowerCase();t.object.smooth="0"!==A&&"off"!==A}else t.object.smooth=!0;(G=t.object.currentMaterial())&&(G.smooth=t.object.smooth)}t.finalize();var L=new Ss.Object3D;L.materialLibraries=[].concat(t.materialLibraries);for(s=0,c=t.objects.length;s0?D.addAttribute("normal",new Ss.Float32BufferAttribute(C.normals,3)):D.computeVertexNormals(),C.colors.length>0&&(I=!0,D.addAttribute("color",new Ss.Float32BufferAttribute(C.colors,3))),C.uvs.length>0&&D.addAttribute("uv",new Ss.Float32BufferAttribute(C.uvs,2));for(var U,F=[],B=0,z=P.length;B1){for(B=0,z=P.length;B=0?s.substring(0,c):s;h=h.toLowerCase();var l=c>=0?s.substring(c+1):"";if(l=l.trim(),"newmtl"===h)r={name:l},o[l]=r;else if("ka"===h||"kd"===h||"ks"===h||"ke"===h){var u=l.split(n,3);r[h]=[parseFloat(u[0]),parseFloat(u[1]),parseFloat(u[2])]}else r[h]=l}}var p=new Ss.MTLLoader.MaterialCreator(this.resourcePath||t,this.materialOptions);return p.setCrossOrigin(this.crossOrigin),p.setManager(this.manager),p.setMaterials(o),p}},Ss.MTLLoader.MaterialCreator=function(e,t){this.baseUrl=e||"",this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:Ss.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:Ss.RepeatWrapping},Ss.MTLLoader.MaterialCreator.prototype={constructor:Ss.MTLLoader.MaterialCreator,crossOrigin:"anonymous",setCrossOrigin:function(e){return this.crossOrigin=e,this},setManager:function(e){this.manager=e},setMaterials:function(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(e){if(!this.options)return e;var t={};for(var i in e){var r=e[i],n={};for(var o in t[i]=n,r){var a=!0,s=r[o],c=o.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(s=[s[0]/255,s[1]/255,s[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===s[0]&&0===s[1]&&0===s[2]&&(a=!1)}a&&(n[c]=s)}}return t},preload:function(){for(var e in this.materialsInfo)this.create(e)},getIndex:function(e){return this.nameLookup[e]},getAsArray:function(){var e=0;for(var t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray},create:function(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]},createMaterial_:function(e){var t=this,i=this.materialsInfo[e],r={name:e,side:this.side};function n(e,i){if(!r[e]){var n,o,a=t.getTextureParams(i,r),s=t.loadTexture((n=t.baseUrl,"string"!=typeof(o=a.url)||""===o?"":/^https?:\/\//i.test(o)?o:n+o));s.repeat.copy(a.scale),s.offset.copy(a.offset),s.wrapS=t.wrap,s.wrapT=t.wrap,r[e]=s}}for(var o in i){var a,s=i[o];if(""!==s)switch(o.toLowerCase()){case"kd":r.color=(new Ss.Color).fromArray(s);break;case"ks":r.specular=(new Ss.Color).fromArray(s);break;case"ke":r.emissive=(new Ss.Color).fromArray(s);break;case"map_kd":n("map",s);break;case"map_ks":n("specularMap",s);break;case"map_ke":n("emissiveMap",s);break;case"norm":n("normalMap",s);break;case"map_bump":case"bump":n("bumpMap",s);break;case"map_d":n("alphaMap",s),r.transparent=!0;break;case"ns":r.shininess=parseFloat(s);break;case"d":(a=parseFloat(s))<1&&(r.opacity=a,r.transparent=!0);break;case"tr":a=parseFloat(s),this.options&&this.options.invertTrProperty&&(a=1-a),a>0&&(r.opacity=1-a,r.transparent=!0)}}return this.materials[e]=new Ss.MeshPhongMaterial(r),this.materials[e]},getTextureParams:function(e,t){var i,r={scale:new Ss.Vector2(1,1),offset:new Ss.Vector2(0,0)},n=e.split(/\s+/);return(i=n.indexOf("-bm"))>=0&&(t.bumpScale=parseFloat(n[i+1]),n.splice(i,2)),(i=n.indexOf("-s"))>=0&&(r.scale.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),(i=n.indexOf("-o"))>=0&&(r.offset.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),r.url=n.join(" ").trim(),r},loadTexture:function(e,t,i,r,n){var o,a=Ss.Loader.Handlers.get(e),s=void 0!==this.manager?this.manager:Ss.DefaultLoadingManager;return null===a&&(a=new Ss.TextureLoader(s)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin),o=a.load(e,i,r,n),void 0!==t&&(o.mapping=t),o}},Ss.ColladaLoader=function(e){this.manager=void 0!==e?e:Ss.DefaultLoadingManager},Ss.ColladaLoader.prototype={constructor:Ss.ColladaLoader,crossOrigin:"Anonymous",load:function(e,t,i,r){var n=this,o=Ss.Loader.prototype.extractUrlBase(e);new Ss.FileLoader(n.manager).load(e,(function(e){t(n.parse(e,o))}),i,r)},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){function i(e,t){for(var i=[],r=e.childNodes,n=0,o=r.length;n0&&t.push(new Ss.VectorKeyframeTrack(r+".position",n,o)),a.length>0&&t.push(new Ss.QuaternionKeyframeTrack(r+".quaternion",n,a)),s.length>0&&t.push(new Ss.VectorKeyframeTrack(r+".scale",n,s)),t}function _(e,t,i){var r,n,o,a=!0;for(n=0,o=e.length;n=0;){var r=e[t];if(null!==r.value[i])return r;t--}return null}function E(e,t,i){for(;t0&&p.addAttribute("position",new Ss.Float32BufferAttribute(n.array,n.stride)),o.array.length>0&&p.addAttribute("normal",new Ss.Float32BufferAttribute(o.array,o.stride)),s.array.length>0&&p.addAttribute("color",new Ss.Float32BufferAttribute(s.array,s.stride)),a.array.length>0&&p.addAttribute("uv",new Ss.Float32BufferAttribute(a.array,a.stride)),c.length>0&&p.addAttribute("skinIndex",new Ss.Float32BufferAttribute(c,h)),l.length>0&&p.addAttribute("skinWeight",new Ss.Float32BufferAttribute(l,u)),r.data=p,r.type=e[0].type,r.materialKeys=d,r}function ne(e,t,i,r){var n=e.p,o=e.stride,a=e.vcount;function s(e){for(var t=n[e+i]*l,o=t+l;t0&&console.log("THREE.ColladaLoader: Geometry has faces with more than 4 vertices.")}else for(p=0,d=n.length;p=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function le(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},i=0;ir.limits.max||t0){var q=this.msgColor,Y=document.createElement("canvas"),Z=Y.getContext("2d"),J="normal 100px sans-serif";Z.font=J;var K=Z.measureText(i.text).width;Y.width=K,Y.height=150,Z.font=J,Z.fillStyle="rgba("+Math.round(255*q.r)+", "+Math.round(255*q.g)+", "+Math.round(255*q.b)+", "+q.a+")",Z.textAlign="left",Z.textBaseline="middle",Z.fillText(i.text,0,Y.height/2);var Q=new Ss.Texture(Y);Q.needsUpdate=!0;var $=new Ss.SpriteMaterial({map:Q,useScreenCoordinates:!1}),ee=new Ss.Sprite($),te=i.scale.x;ee.scale.set(K/Y.height*te,te,1),this.add(ee)}break;case 10:var ie=null;0===i.color.r&&0===i.color.g&&0===i.color.b&&0===i.color.a||(ie=r),this.msgMesh=i.mesh_resource.substr(10);var re=new Bs({path:t,resource:this.msgMesh,material:ie});this.add(re);break;case 11:var ne=new zs({material:r,vertices:i.points,colors:i.colors});ne.scale.set(i.scale.x,i.scale.y,i.scale.z),this.add(ne);break;default:console.error("Currently unsupported marker type: "+i.type)}}setPose(e){this.position.x=e.position.x,this.position.y=e.position.y,this.position.z=e.position.z,this.quaternion.set(e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w),this.quaternion.normalize(),this.updateMatrixWorld()}update(e){if(this.setPose(e.pose),e.color.r!==this.msgColor.r||e.color.g!==this.msgColor.g||e.color.b!==this.msgColor.b||e.color.a!==this.msgColor.a){var t=As(e.color.r,e.color.g,e.color.b,e.color.a);switch(e.type){case 4:case 5:case 8:break;case 0:case 1:case 2:case 3:case 11:case 9:this.traverse((function(e){e instanceof Ss.Mesh&&(e.material=t)}));break;case 10:var i=null;0===e.color.r&&0===e.color.g&&0===e.color.b&&0===e.color.a||(i=this.colorMaterial),this.traverse((function(e){e instanceof Ss.Mesh&&(e.material=i)}));break;default:return!1}this.msgColor=e.color}var r=Math.abs(this.msgScale[0]-e.scale.x)>1e-6||Math.abs(this.msgScale[1]-e.scale.y)>1e-6||Math.abs(this.msgScale[2]-e.scale.z)>1e-6;switch(this.msgScale=[e.scale.x,e.scale.y,e.scale.z],e.type){case 1:case 2:case 3:if(r)return!1;break;case 9:if(r||this.text!==e.text)return!1;break;case 10:if(e.mesh_resource.substr(10)!==this.msgMesh)return!1;if(r)return!1;break;case 0:case 4:case 5:case 6:case 7:case 8:case 11:return!1}return!0}dispose(){this.children.forEach((function(e){e instanceof Bs?e.children.forEach((function(t){void 0!==t.material&&t.material.dispose(),t.children.forEach((function(e){void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose(),t.remove(e)})),e.remove(t)})):(void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose()),e.parent.remove(e)}))}}class Gs extends Ss.Object3D{constructor(e){super();var t=this;e=e||{},this.parent=e.parent;var i=e.handle,n=e.message;this.message=n,this.name=n.name,this.camera=e.camera,this.path=e.path||"/",this.loader=e.loader,this.dragging=!1,this.startMousePos=new Ss.Vector2,this.isShift=!1;var o=new Ss.Quaternion(n.orientation.x,n.orientation.y,n.orientation.z,n.orientation.w);o.normalize();var a=new Ss.Vector3(1,0,0);switch(a.applyQuaternion(o),this.currentControlOri=new Ss.Quaternion,n.interaction_mode){case 9:case 7:this.addEventListener("mousemove",this.parent.move3d.bind(this.parent,this,a));break;case 3:this.addEventListener("mousemove",this.parent.moveAxis.bind(this.parent,this,a)),this.addEventListener("touchmove",this.parent.moveAxis.bind(this.parent,this,a));break;case 5:this.addEventListener("mousemove",this.parent.rotateAxis.bind(this.parent,this,o));break;case 4:this.addEventListener("mousemove",this.parent.movePlane.bind(this.parent,this,a));break;case 2:this.addEventListener("click",this.parent.buttonClick.bind(this.parent,this))}function s(e){e.stopPropagation()}0!==n.interaction_mode&&(this.addEventListener("mousedown",this.parent.startDrag.bind(this.parent,this)),this.addEventListener("mouseup",this.parent.stopDrag.bind(this.parent,this)),this.addEventListener("contextmenu",this.parent.showMenu.bind(this.parent,this)),this.addEventListener("mouseup",(function(e){0===t.startMousePos.distanceToSquared(e.mousePos)&&(e.type="contextmenu",t.dispatchEvent(e))})),this.addEventListener("mouseover",s),this.addEventListener("mouseout",s),this.addEventListener("click",s),this.addEventListener("mousedown",(function(e){t.startMousePos=e.mousePos})),this.addEventListener("touchstart",(function(e){1===e.domEvent.touches.length&&(e.type="mousedown",e.domEvent.button=0,t.dispatchEvent(e))})),this.addEventListener("touchmove",(function(e){1===e.domEvent.touches.length&&(e.type="mousemove",e.domEvent.button=0,t.dispatchEvent(e))})),this.addEventListener("touchend",(function(e){0===e.domEvent.touches.length&&(e.domEvent.button=0,e.type="mouseup",t.dispatchEvent(e),e.type="click",t.dispatchEvent(e))})),window.addEventListener("keydown",(function(e){16===e.keyCode&&(t.isShift=!0)})),window.addEventListener("keyup",(function(e){16===e.keyCode&&(t.isShift=!1)})));var c=new Ss.Quaternion,h=this.parent.position.clone().multiplyScalar(-1);switch(n.orientation_mode){case 0:c=this.parent.quaternion.clone().inverse();break;case 1:case 2:break;default:console.error("Unkown orientation mode: "+n.orientation_mode)}var l=new r.TFClient({ros:i.tfClient.ros,fixedFrame:i.message.header.frame_id,serverName:i.tfClient.serverName});n.markers.forEach((function(e){var i=function(i){var n=new ks({message:e,path:t.path,loader:t.loader});if(null!==i){var o=new r.Pose({position:n.position,orientation:n.quaternion});o.applyTransform(new r.Transform(i));var a=new ks({message:e,path:t.path,loader:t.loader});a.position.add(h),a.position.applyQuaternion(c),a.quaternion.multiplyQuaternions(c,a.quaternion);var s=new Ss.Vector3(a.position.x,a.position.y,a.position.z),u=new r.Transform({translation:s,orientation:a.quaternion});o.applyTransform(u),n.setPose(o),n.updateMatrixWorld(),l.unsubscribe(e.header.frame_id)}t.add(n)};""!==e.header.frame_id?l.subscribe(e.header.frame_id,i):i(null)}))}updateMatrixWorld(e){var t=this,i=this.message;switch(i.orientation_mode){case 0:super.updateMatrixWorld(e),t.currentControlOri.copy(t.quaternion),t.currentControlOri.normalize();break;case 1:t.quaternion.copy(t.parent.quaternion.clone().inverse()),t.updateMatrix(),t.matrixWorldNeedsUpdate=!0,super.updateMatrixWorld(e),t.currentControlOri.copy(t.quaternion);break;case 2:t.camera.updateMatrixWorld();var r=(new Ss.Matrix4).extractRotation(t.camera.matrixWorld),n=new Ss.Matrix4,o=.5*Math.PI,a=new Ss.Euler(-o,0,o);n.makeRotationFromEuler(a);var s=new Ss.Matrix4;s.getInverse(t.parent.matrixWorld),r.multiplyMatrices(r,n),r.multiplyMatrices(s,r),t.currentControlOri.setFromRotationMatrix(r),i.independent_marker_orientation||(t.quaternion.copy(t.currentControlOri),t.updateMatrix(),t.matrixWorldNeedsUpdate=!0),super.updateMatrixWorld(e);break;default:console.error("Unkown orientation mode: "+i.orientation_mode)}}}class Vs extends Ss.EventDispatcher{constructor(e){super();var t=this,i=(e=e||{}).menuEntries,r=e.className||"default-interactive-marker-menu";e.entryClassName;var n,o,a,s=e.overlayClassName||"default-interactive-marker-overlay",c=e.menuFontSize||"0.8em",h=[];if(h[0]={children:[]},null===document.getElementById("default-interactive-marker-menu-css")){var l=document.createElement("style");l.id="default-interactive-marker-menu-css",l.type="text/css",l.innerHTML=".default-interactive-marker-menu {background-color: #444444;border: 1px solid #888888;border: 1px solid #888888;padding: 0px 0px 0px 0px;color: #FFFFFF;font-family: sans-serif;font-size: "+c+";z-index: 1002;}.default-interactive-marker-menu ul {padding: 0px 0px 5px 0px;margin: 0px;list-style-type: none;}.default-interactive-marker-menu ul li div {-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: default;padding: 3px 10px 3px 10px;}.default-interactive-marker-menu-entry:hover { background-color: #666666; cursor: pointer;}.default-interactive-marker-menu ul ul { font-style: italic; padding-left: 10px;}.default-interactive-marker-overlay { position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index: 1001; -moz-opacity: 0.0; opacity: .0; filter: alpha(opacity = 0);}",document.getElementsByTagName("head")[0].appendChild(l)}for(this.menuDomElem=document.createElement("div"),this.menuDomElem.style.position="absolute",this.menuDomElem.className=r,this.menuDomElem.addEventListener("contextmenu",(function(e){e.preventDefault()})),this.overlayDomElem=document.createElement("div"),this.overlayDomElem.className=s,this.hideListener=this.hide.bind(this),this.overlayDomElem.addEventListener("contextmenu",this.hideListener),this.overlayDomElem.addEventListener("click",this.hideListener),this.overlayDomElem.addEventListener("touchstart",this.hideListener),n=0;n0?(e(s,o[a]),c.addEventListener("click",t.hide.bind(t)),c.addEventListener("touchstart",t.hide.bind(t))):(c.addEventListener("click",p.bind(t,o[a])),c.addEventListener("touchstart",p.bind(t,o[a])),c.className="default-interactive-marker-menu-entry")}}(this.menuDomElem,h[0])}show(e,t){t&&t.preventDefault&&t.preventDefault(),this.controlName=e.name,void 0!==t.domEvent.changedTouches?(this.menuDomElem.style.left=t.domEvent.changedTouches[0].pageX+"px",this.menuDomElem.style.top=t.domEvent.changedTouches[0].pageY+"px"):(this.menuDomElem.style.left=t.domEvent.clientX+"px",this.menuDomElem.style.top=t.domEvent.clientY+"px"),document.body.appendChild(this.overlayDomElem),document.body.appendChild(this.menuDomElem)}hide(e){e&&e.preventDefault&&e.preventDefault(),document.body.removeChild(this.overlayDomElem),document.body.removeChild(this.menuDomElem)}}class js extends Ss.Object3D{constructor(e){super();var t=this,i=(e=e||{}).handle;this.name=i.name;var r=e.camera,n=e.path||"/",o=e.loader;this.dragging=!1,this.onServerSetPose({pose:i.pose}),this.dragStart={position:new Ss.Vector3,orientation:new Ss.Quaternion,positionWorld:new Ss.Vector3,orientationWorld:new Ss.Quaternion,event3d:{}},i.controls.forEach((function(e){t.add(new Gs({parent:t,handle:i,message:e,camera:r,path:n,loader:o}))})),i.menuEntries.length>0&&(this.menu=new Vs({menuEntries:i.menuEntries,menuFontSize:i.menuFontSize}),this.menu.addEventListener("menu-select",(function(e){t.dispatchEvent(e)})))}showMenu(e,t){this.menu&&this.menu.show(e,t)}moveAxis(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld.clone()),s=new Ss.Ray(o,a),c=Cs(s,i.camera,i.mousePos),h=new Ss.Vector3;h.addVectors(this.dragStart.position,n.clone().applyQuaternion(this.dragStart.orientation).multiplyScalar(c)),this.setPosition(e,h),i.stopPropagation()}}move3d(e,t,i){if(this.dragging)if(e.isShift);else{var r=e.camera.getWorldDirection(),n=Math.abs(r.x),o=Math.abs(r.y),a=Math.abs(r.z),s=new Ss.Quaternion(1,0,0,1);o>n&&o>a?s=new Ss.Quaternion(0,0,1,1):a>n&&a>o&&(s=new Ss.Quaternion(0,1,0,1)),s.normalize(),(t=new Ss.Vector3(1,0,0)).applyQuaternion(s),this.movePlane(e,t,i)}}movePlane(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld),s=Ls(i.mouseRay,o,a),c=new Ss.Vector3;c.subVectors(s,o),c.add(this.dragStart.positionWorld),this.setPosition(e,c),i.stopPropagation()}}rotateAxis(e,t,i){if(this.dragging){e.updateMatrixWorld();var r=e.currentControlOri.clone().multiply(t.clone()),n=new Ss.Vector3(1,0,0).applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.applyQuaternion(this.dragStart.orientationWorld),s=Ls(i.mouseRay,o,a),c=new Ss.Ray(this.dragStart.positionWorld,a),h=Ls(c,o,a),l=this.dragStart.orientationWorld.clone().multiply(r).clone().inverse();s.sub(h),s.applyQuaternion(l);var u=this.dragStart.event3d.intersection.point.clone();u.sub(h),u.applyQuaternion(l);var p=Math.atan2(s.y,s.z),d=Math.atan2(u.y,u.z)-p,f=new Ss.Quaternion;f.setFromAxisAngle(n,d),this.setOrientation(e,f.multiply(this.dragStart.orientationWorld)),i.stopPropagation()}}feedbackEvent(e,t){this.dispatchEvent({type:e,position:this.position.clone(),orientation:this.quaternion.clone(),controlName:t.name})}startDrag(e,t){if(0===t.domEvent.button){t.stopPropagation(),this.dragging=!0,this.updateMatrixWorld(!0);var i=new Ss.Vector3;this.matrixWorld.decompose(this.dragStart.positionWorld,this.dragStart.orientationWorld,i),this.dragStart.position=this.position.clone(),this.dragStart.orientation=this.quaternion.clone(),this.dragStart.event3d=t,this.feedbackEvent("user-mousedown",e)}}stopDrag(e,t){0===t.domEvent.button&&(t.stopPropagation(),this.dragging=!1,this.dragStart.event3d={},this.onServerSetPose(this.bufferedPoseEvent),this.bufferedPoseEvent=void 0,this.feedbackEvent("user-mouseup",e))}buttonClick(e,t){t.stopPropagation(),this.feedbackEvent("user-button-click",e)}setPosition(e,t){this.position.copy(t),this.feedbackEvent("user-pose-change",e)}setOrientation(e,t){t.normalize(),this.quaternion.copy(t),this.feedbackEvent("user-pose-change",e)}onServerSetPose(e){if(void 0!==e)if(this.dragging)this.bufferedPoseEvent=e;else{var t=e.pose;this.position.copy(t.position),this.quaternion.copy(t.orientation),this.updateMatrixWorld(!0)}}dispose(){var e=this;this.children.forEach((function(t){t.children.forEach((function(e){e.dispose(),t.remove(e)})),e.remove(t)}))}}var Hs,Ws={exports:{}}; +Object.assign(za.prototype,{_getValue_unbound:za.prototype.getValue,_setValue_unbound:za.prototype.setValue}),Object.assign(ka.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,c=0,h=arguments.length;c!==h;++c){var l=arguments[c],u=l.uuid,p=r[u],d=void 0;if(void 0===p){p=t++,r[u]=p,e.push(l);for(var f=0,m=s;f!==m;++f)a[f].push(new za(l,n[f],o[f]))}else if(p=t){var l=t++,u=e[l];i[u.uuid]=h,e[h]=u,i[c]=l,e[l]=s;for(var p=0,d=n;p!==d;++p){var f=r[p],m=f[l],v=f[h];f[h]=m,f[l]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],h=c.uuid,l=r[h];if(void 0!==l)if(delete r[h],l0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(a),h[l].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=2202===r;if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=i||t<0){var a=Math.floor(t/i);t-=i*a,n+=Math.abs(a);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&n))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var r=this._interpolantSettings;i?(r.endingStart=K,r.endingEnd=K):(r.endingStart=e?this.zeroSlopeAtStart?K:J:Q,r.endingEnd=t?this.zeroSlopeAtEnd?K:J:Q)},_scheduleFading:function(e,t,i){var r=this._mixer,n=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=n,s[0]=t,a[1]=n+e,s[1]=i,this}}),Va.prototype=Object.assign(Object.create(n.prototype),{constructor:Va,_bindAction:function(e,t){var i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,o=e._propertyBindings,a=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==n;++l){var u=r[l],p=u.name,d=h[p];if(void 0!==d)o[l]=d;else{if(void 0!==(d=o[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[l].binding.parsedPath;++(d=new Fa(za.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[l]=d}a[l].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,o=0,a=n.length;o!==a;++o){var s=n[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(La.set(e.z,0,-e.x).normalize(),Aa=Math.acos(e.y),this.quaternion.setFromAxisAngle(La,Aa))}),gs.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},gs.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},ys.prototype=Object.create(vr.prototype),ys.prototype.constructor=ys;var xs={createMultiMaterialObject:function(e,t){for(var i=new br,r=0,n=t.length;r0.99)"," {"," vec4 depthColor2 = texture2D( map, vUv2 );"," float depth2 = ( depthColor2.r + depthColor2.g + depthColor2.b ) / 3.0 ;"," depth = 0.99+depth2;"," }"," "," return depth;"," }","","float median(float a, float b, float c)"," {"," float r=a;"," "," if ( (a0.5) || (vUvP.y<0.5) || (vUvP.y>0.0))"," {"," vec2 smp = decodeDepth(vec2(position.x, position.y));"," float depth = smp.x;"," depthVariance = smp.y;"," "," float z = -depth;"," "," pos = vec4("," ( position.x / width - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength) * -1.0,"," ( position.y / height - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength),"," (- z + zOffset / 1000.0) * maxDepthPerTile,"," 1.0);"," "," vec2 maskP = vec2( position.x / (width*2.0), position.y / (height*2.0) );"," vec4 maskColor = texture2D( map, maskP );"," maskVal = ( maskColor.r + maskColor.g + maskColor.b ) / 3.0 ;"," }"," "," gl_PointSize = pointSize;"," gl_Position = projectionMatrix * modelViewMatrix * pos;"," ","}"].join("\n"),this.fragment_shader=["uniform sampler2D map;","uniform float varianceThreshold;","uniform float whiteness;","","varying vec2 vUvP;","varying vec2 colorP;","","varying float depthVariance;","varying float maskVal;","","","void main() {"," "," vec4 color;"," "," if ( (depthVariance>varianceThreshold) || (maskVal>0.5) ||(vUvP.x<0.0)|| (vUvP.x>0.5) || (vUvP.y<0.5) || (vUvP.y>1.0))"," { "," discard;"," }"," else "," {"," color = texture2D( map, colorP );"," "," float fader = whiteness /100.0;"," "," color.r = color.r * (1.0-fader)+ fader;"," "," color.g = color.g * (1.0-fader)+ fader;"," "," color.b = color.b * (1.0-fader)+ fader;"," "," color.a = 1.0;//smoothstep( 20000.0, -20000.0, gl_FragCoord.z / gl_FragCoord.w );"," }"," "," gl_FragColor = vec4( color.r, color.g, color.b, color.a );"," ","}"].join("\n")}metaLoaded(){this.metaLoaded=!0,this.initStreamer()}initStreamer(){if(this.metaLoaded){this.texture=new Ss.Texture(this.video),this.geometry=new Ss.Geometry;for(var e=0,t=this.width*this.height;e>5&31)/31,r=(w>>10&31)/31):(t=o,i=a,r=s)}for(var _=1;_<=3;_++){var M=g+12*_;f.push(h.getFloat32(M,!0)),f.push(h.getFloat32(M+4,!0)),f.push(h.getFloat32(M+8,!0)),m.push(y,x,b),u&&n.push(t,i,r)}}return d.addAttribute("position",new Ss.BufferAttribute(new Float32Array(f),3)),d.addAttribute("normal",new Ss.BufferAttribute(new Float32Array(m),3)),u&&(d.addAttribute("color",new Ss.BufferAttribute(new Float32Array(n),3)),d.hasColors=!0,d.alpha=c),d}(t):function(e){for(var t,i=new Ss.BufferGeometry,r=/facet([\s\S]*?)endfacet/g,n=0,o=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),s=new RegExp("normal"+o+o+o,"g"),c=[],h=[],l=new Ss.Vector3;null!==(t=r.exec(e));){for(var u=0,p=0,d=t[0];null!==(t=s.exec(d));)l.x=parseFloat(t[1]),l.y=parseFloat(t[2]),l.z=parseFloat(t[3]),p++;for(;null!==(t=a.exec(d));)c.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),h.push(l.x,l.y,l.z),u++;1!==p&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+n),3!==u&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+n),n++}return i.addAttribute("position",new Ss.Float32BufferAttribute(c,3)),i.addAttribute("normal",new Ss.Float32BufferAttribute(h,3)),i}(function(e){if("string"!=typeof e){var t=new Uint8Array(e);if(void 0!==window.TextDecoder)return(new TextDecoder).decode(t);for(var i="",r=0,n=e.byteLength;r0?t[t.length-1]:"",smooth:void 0!==i?i.smooth:this.smooth,groupStart:void 0!==i?i.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(var i=this.materials.length-1;i>=0;i--)this.materials[i].groupCount<=0&&this.materials.splice(i,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},i&&i.name&&"function"==typeof i.clone){var r=i.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseNormalIndex:function(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseUVIndex:function(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)},addVertex:function(e,t,i){var r=this.vertices,n=this.object.geometry.vertices;n.push(r[e+0],r[e+1],r[e+2]),n.push(r[t+0],r[t+1],r[t+2]),n.push(r[i+0],r[i+1],r[i+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,i){var r=this.normals,n=this.object.geometry.normals;n.push(r[e+0],r[e+1],r[e+2]),n.push(r[t+0],r[t+1],r[t+2]),n.push(r[i+0],r[i+1],r[i+2])},addColor:function(e,t,i){var r=this.colors,n=this.object.geometry.colors;n.push(r[e+0],r[e+1],r[e+2]),n.push(r[t+0],r[t+1],r[t+2]),n.push(r[i+0],r[i+1],r[i+2])},addUV:function(e,t,i){var r=this.uvs,n=this.object.geometry.uvs;n.push(r[e+0],r[e+1]),n.push(r[t+0],r[t+1]),n.push(r[i+0],r[i+1])},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,i,r,n,o,a,s,c){var h=this.vertices.length,l=this.parseVertexIndex(e,h),u=this.parseVertexIndex(t,h),p=this.parseVertexIndex(i,h);if(this.addVertex(l,u,p),void 0!==r&&""!==r){var d=this.uvs.length;l=this.parseUVIndex(r,d),u=this.parseUVIndex(n,d),p=this.parseUVIndex(o,d),this.addUV(l,u,p)}if(void 0!==a&&""!==a){var f=this.normals.length;l=this.parseNormalIndex(a,f),u=a===s?l:this.parseNormalIndex(s,f),p=a===c?l:this.parseNormalIndex(c,f),this.addNormal(l,u,p)}this.colors.length>0&&this.addColor(l,u,p)},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,i=0,r=e.length;i0){var m=f.split("/");u.push(m)}}var v=u[0];for(p=1,d=u.length-1;p1){var A=o[1].trim().toLowerCase();t.object.smooth="0"!==A&&"off"!==A}else t.object.smooth=!0;(G=t.object.currentMaterial())&&(G.smooth=t.object.smooth)}t.finalize();var L=new Ss.Object3D;L.materialLibraries=[].concat(t.materialLibraries);for(s=0,c=t.objects.length;s0?D.addAttribute("normal",new Ss.Float32BufferAttribute(C.normals,3)):D.computeVertexNormals(),C.colors.length>0&&(I=!0,D.addAttribute("color",new Ss.Float32BufferAttribute(C.colors,3))),C.uvs.length>0&&D.addAttribute("uv",new Ss.Float32BufferAttribute(C.uvs,2));for(var U,F=[],B=0,z=P.length;B1){for(B=0,z=P.length;B=0?s.substring(0,c):s;h=h.toLowerCase();var l=c>=0?s.substring(c+1):"";if(l=l.trim(),"newmtl"===h)r={name:l},o[l]=r;else if("ka"===h||"kd"===h||"ks"===h||"ke"===h){var u=l.split(n,3);r[h]=[parseFloat(u[0]),parseFloat(u[1]),parseFloat(u[2])]}else r[h]=l}}var p=new Ss.MTLLoader.MaterialCreator(this.resourcePath||t,this.materialOptions);return p.setCrossOrigin(this.crossOrigin),p.setManager(this.manager),p.setMaterials(o),p}},Ss.MTLLoader.MaterialCreator=function(e,t){this.baseUrl=e||"",this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:Ss.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:Ss.RepeatWrapping},Ss.MTLLoader.MaterialCreator.prototype={constructor:Ss.MTLLoader.MaterialCreator,crossOrigin:"anonymous",setCrossOrigin:function(e){return this.crossOrigin=e,this},setManager:function(e){this.manager=e},setMaterials:function(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(e){if(!this.options)return e;var t={};for(var i in e){var r=e[i],n={};for(var o in t[i]=n,r){var a=!0,s=r[o],c=o.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(s=[s[0]/255,s[1]/255,s[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===s[0]&&0===s[1]&&0===s[2]&&(a=!1)}a&&(n[c]=s)}}return t},preload:function(){for(var e in this.materialsInfo)this.create(e)},getIndex:function(e){return this.nameLookup[e]},getAsArray:function(){var e=0;for(var t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray},create:function(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]},createMaterial_:function(e){var t=this,i=this.materialsInfo[e],r={name:e,side:this.side};function n(e,i){if(!r[e]){var n,o,a=t.getTextureParams(i,r),s=t.loadTexture((n=t.baseUrl,"string"!=typeof(o=a.url)||""===o?"":/^https?:\/\//i.test(o)?o:n+o));s.repeat.copy(a.scale),s.offset.copy(a.offset),s.wrapS=t.wrap,s.wrapT=t.wrap,r[e]=s}}for(var o in i){var a,s=i[o];if(""!==s)switch(o.toLowerCase()){case"kd":r.color=(new Ss.Color).fromArray(s);break;case"ks":r.specular=(new Ss.Color).fromArray(s);break;case"ke":r.emissive=(new Ss.Color).fromArray(s);break;case"map_kd":n("map",s);break;case"map_ks":n("specularMap",s);break;case"map_ke":n("emissiveMap",s);break;case"norm":n("normalMap",s);break;case"map_bump":case"bump":n("bumpMap",s);break;case"map_d":n("alphaMap",s),r.transparent=!0;break;case"ns":r.shininess=parseFloat(s);break;case"d":(a=parseFloat(s))<1&&(r.opacity=a,r.transparent=!0);break;case"tr":a=parseFloat(s),this.options&&this.options.invertTrProperty&&(a=1-a),a>0&&(r.opacity=1-a,r.transparent=!0)}}return this.materials[e]=new Ss.MeshPhongMaterial(r),this.materials[e]},getTextureParams:function(e,t){var i,r={scale:new Ss.Vector2(1,1),offset:new Ss.Vector2(0,0)},n=e.split(/\s+/);return(i=n.indexOf("-bm"))>=0&&(t.bumpScale=parseFloat(n[i+1]),n.splice(i,2)),(i=n.indexOf("-s"))>=0&&(r.scale.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),(i=n.indexOf("-o"))>=0&&(r.offset.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),r.url=n.join(" ").trim(),r},loadTexture:function(e,t,i,r,n){var o,a=Ss.Loader.Handlers.get(e),s=void 0!==this.manager?this.manager:Ss.DefaultLoadingManager;return null===a&&(a=new Ss.TextureLoader(s)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin),o=a.load(e,i,r,n),void 0!==t&&(o.mapping=t),o}},Ss.ColladaLoader=function(e){this.manager=void 0!==e?e:Ss.DefaultLoadingManager},Ss.ColladaLoader.prototype={constructor:Ss.ColladaLoader,crossOrigin:"Anonymous",load:function(e,t,i,r){var n=this,o=Ss.Loader.prototype.extractUrlBase(e);new Ss.FileLoader(n.manager).load(e,(function(e){t(n.parse(e,o))}),i,r)},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){function i(e,t){for(var i=[],r=e.childNodes,n=0,o=r.length;n0&&t.push(new Ss.VectorKeyframeTrack(r+".position",n,o)),a.length>0&&t.push(new Ss.QuaternionKeyframeTrack(r+".quaternion",n,a)),s.length>0&&t.push(new Ss.VectorKeyframeTrack(r+".scale",n,s)),t}function _(e,t,i){var r,n,o,a=!0;for(n=0,o=e.length;n=0;){var r=e[t];if(null!==r.value[i])return r;t--}return null}function E(e,t,i){for(;t0&&p.addAttribute("position",new Ss.Float32BufferAttribute(n.array,n.stride)),o.array.length>0&&p.addAttribute("normal",new Ss.Float32BufferAttribute(o.array,o.stride)),s.array.length>0&&p.addAttribute("color",new Ss.Float32BufferAttribute(s.array,s.stride)),a.array.length>0&&p.addAttribute("uv",new Ss.Float32BufferAttribute(a.array,a.stride)),c.length>0&&p.addAttribute("skinIndex",new Ss.Float32BufferAttribute(c,h)),l.length>0&&p.addAttribute("skinWeight",new Ss.Float32BufferAttribute(l,u)),r.data=p,r.type=e[0].type,r.materialKeys=d,r}function ne(e,t,i,r){var n=e.p,o=e.stride,a=e.vcount;function s(e){for(var t=n[e+i]*l,o=t+l;t0&&console.log("THREE.ColladaLoader: Geometry has faces with more than 4 vertices.")}else for(p=0,d=n.length;p=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function le(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},i=0;ir.limits.max||t0){var q=this.msgColor,Y=document.createElement("canvas"),Z=Y.getContext("2d"),J="normal 100px sans-serif";Z.font=J;var K=Z.measureText(i.text).width;Y.width=K,Y.height=150,Z.font=J,Z.fillStyle="rgba("+Math.round(255*q.r)+", "+Math.round(255*q.g)+", "+Math.round(255*q.b)+", "+q.a+")",Z.textAlign="left",Z.textBaseline="middle",Z.fillText(i.text,0,Y.height/2);var Q=new Ss.Texture(Y);Q.needsUpdate=!0;var $=new Ss.SpriteMaterial({map:Q,useScreenCoordinates:!1}),ee=new Ss.Sprite($),te=i.scale.x;ee.scale.set(K/Y.height*te,te,1),this.add(ee)}break;case 10:var ie=null;0===i.color.r&&0===i.color.g&&0===i.color.b&&0===i.color.a||(ie=r),this.msgMesh=i.mesh_resource.substr(10);var re=new Bs({path:t,resource:this.msgMesh,material:ie});this.add(re);break;case 11:var ne=new zs({material:r,vertices:i.points,colors:i.colors});ne.scale.set(i.scale.x,i.scale.y,i.scale.z),this.add(ne);break;default:console.error("Currently unsupported marker type: "+i.type)}}setPose(e){this.position.x=e.position.x,this.position.y=e.position.y,this.position.z=e.position.z,this.quaternion.set(e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w),this.quaternion.normalize(),this.updateMatrixWorld()}update(e){if(this.setPose(e.pose),e.color.r!==this.msgColor.r||e.color.g!==this.msgColor.g||e.color.b!==this.msgColor.b||e.color.a!==this.msgColor.a){var t=As(e.color.r,e.color.g,e.color.b,e.color.a);switch(e.type){case 4:case 5:case 8:break;case 0:case 1:case 2:case 3:case 11:case 9:this.traverse((function(e){e instanceof Ss.Mesh&&(e.material=t)}));break;case 10:var i=null;0===e.color.r&&0===e.color.g&&0===e.color.b&&0===e.color.a||(i=this.colorMaterial),this.traverse((function(e){e instanceof Ss.Mesh&&(e.material=i)}));break;default:return!1}this.msgColor=e.color}var r=Math.abs(this.msgScale[0]-e.scale.x)>1e-6||Math.abs(this.msgScale[1]-e.scale.y)>1e-6||Math.abs(this.msgScale[2]-e.scale.z)>1e-6;switch(this.msgScale=[e.scale.x,e.scale.y,e.scale.z],e.type){case 1:case 2:case 3:if(r)return!1;break;case 9:if(r||this.text!==e.text)return!1;break;case 10:if(e.mesh_resource.substr(10)!==this.msgMesh)return!1;if(r)return!1;break;case 0:case 4:case 5:case 6:case 7:case 8:case 11:return!1}return!0}dispose(){this.children.forEach((function(e){e instanceof Bs?e.children.forEach((function(t){void 0!==t.material&&t.material.dispose(),t.children.forEach((function(e){void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose(),t.remove(e)})),e.remove(t)})):(void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose()),e.parent.remove(e)}))}}class Gs extends Ss.Object3D{constructor(e){super();var t=this;e=e||{},this.parent=e.parent;var i=e.handle,n=e.message;this.message=n,this.name=n.name,this.camera=e.camera,this.path=e.path||"/",this.loader=e.loader,this.dragging=!1,this.startMousePos=new Ss.Vector2,this.isShift=!1;var o=new Ss.Quaternion(n.orientation.x,n.orientation.y,n.orientation.z,n.orientation.w);o.normalize();var a=new Ss.Vector3(1,0,0);switch(a.applyQuaternion(o),this.currentControlOri=new Ss.Quaternion,n.interaction_mode){case 9:case 7:this.addEventListener("mousemove",this.parent.move3d.bind(this.parent,this,a));break;case 3:this.addEventListener("mousemove",this.parent.moveAxis.bind(this.parent,this,a)),this.addEventListener("touchmove",this.parent.moveAxis.bind(this.parent,this,a));break;case 5:this.addEventListener("mousemove",this.parent.rotateAxis.bind(this.parent,this,o));break;case 4:this.addEventListener("mousemove",this.parent.movePlane.bind(this.parent,this,a));break;case 2:this.addEventListener("click",this.parent.buttonClick.bind(this.parent,this))}function s(e){e.stopPropagation()}0!==n.interaction_mode&&(this.addEventListener("mousedown",this.parent.startDrag.bind(this.parent,this)),this.addEventListener("mouseup",this.parent.stopDrag.bind(this.parent,this)),this.addEventListener("contextmenu",this.parent.showMenu.bind(this.parent,this)),this.addEventListener("mouseup",(function(e){0===t.startMousePos.distanceToSquared(e.mousePos)&&(e.type="contextmenu",t.dispatchEvent(e))})),this.addEventListener("mouseover",s),this.addEventListener("mouseout",s),this.addEventListener("click",s),this.addEventListener("mousedown",(function(e){t.startMousePos=e.mousePos})),this.addEventListener("touchstart",(function(e){1===e.domEvent.touches.length&&(e.type="mousedown",e.domEvent.button=0,t.dispatchEvent(e))})),this.addEventListener("touchmove",(function(e){1===e.domEvent.touches.length&&(e.type="mousemove",e.domEvent.button=0,t.dispatchEvent(e))})),this.addEventListener("touchend",(function(e){0===e.domEvent.touches.length&&(e.domEvent.button=0,e.type="mouseup",t.dispatchEvent(e),e.type="click",t.dispatchEvent(e))})),window.addEventListener("keydown",(function(e){16===e.keyCode&&(t.isShift=!0)})),window.addEventListener("keyup",(function(e){16===e.keyCode&&(t.isShift=!1)})));var c=new Ss.Quaternion,h=this.parent.position.clone().multiplyScalar(-1);switch(n.orientation_mode){case 0:c=this.parent.quaternion.clone().inverse();break;case 1:case 2:break;default:console.error("Unkown orientation mode: "+n.orientation_mode)}var l=new r.TFClient({ros:i.tfClient.ros,fixedFrame:i.message.header.frame_id,serverName:i.tfClient.serverName});n.markers.forEach((function(e){var i=function(i){var n=new ks({message:e,path:t.path,loader:t.loader});if(null!==i){var o=new r.Pose({position:n.position,orientation:n.quaternion});o.applyTransform(new r.Transform(i));var a=new ks({message:e,path:t.path,loader:t.loader});a.position.add(h),a.position.applyQuaternion(c),a.quaternion.multiplyQuaternions(c,a.quaternion);var s=new Ss.Vector3(a.position.x,a.position.y,a.position.z),u=new r.Transform({translation:s,orientation:a.quaternion});o.applyTransform(u),n.setPose(o),n.updateMatrixWorld(),l.unsubscribe(e.header.frame_id)}t.add(n)};""!==e.header.frame_id?l.subscribe(e.header.frame_id,i):i(null)}))}updateMatrixWorld(e){var t=this,i=this.message;switch(i.orientation_mode){case 0:super.updateMatrixWorld(e),t.currentControlOri.copy(t.quaternion),t.currentControlOri.normalize();break;case 1:t.quaternion.copy(t.parent.quaternion.clone().inverse()),t.updateMatrix(),t.matrixWorldNeedsUpdate=!0,super.updateMatrixWorld(e),t.currentControlOri.copy(t.quaternion);break;case 2:t.camera.updateMatrixWorld();var r=(new Ss.Matrix4).extractRotation(t.camera.matrixWorld),n=new Ss.Matrix4,o=.5*Math.PI,a=new Ss.Euler(-o,0,o);n.makeRotationFromEuler(a);var s=new Ss.Matrix4;s.getInverse(t.parent.matrixWorld),r.multiplyMatrices(r,n),r.multiplyMatrices(s,r),t.currentControlOri.setFromRotationMatrix(r),i.independent_marker_orientation||(t.quaternion.copy(t.currentControlOri),t.updateMatrix(),t.matrixWorldNeedsUpdate=!0),super.updateMatrixWorld(e);break;default:console.error("Unkown orientation mode: "+i.orientation_mode)}}}class Vs extends Ss.EventDispatcher{constructor(e){super();var t=this,i=(e=e||{}).menuEntries,r=e.className||"default-interactive-marker-menu";e.entryClassName;var n,o,a,s=e.overlayClassName||"default-interactive-marker-overlay",c=e.menuFontSize||"0.8em",h=[];if(h[0]={children:[]},null===document.getElementById("default-interactive-marker-menu-css")){var l=document.createElement("style");l.id="default-interactive-marker-menu-css",l.type="text/css",l.innerHTML=".default-interactive-marker-menu {background-color: #444444;border: 1px solid #888888;border: 1px solid #888888;padding: 0px 0px 0px 0px;color: #FFFFFF;font-family: sans-serif;font-size: "+c+";z-index: 1002;}.default-interactive-marker-menu ul {padding: 0px 0px 5px 0px;margin: 0px;list-style-type: none;}.default-interactive-marker-menu ul li div {-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: default;padding: 3px 10px 3px 10px;}.default-interactive-marker-menu-entry:hover { background-color: #666666; cursor: pointer;}.default-interactive-marker-menu ul ul { font-style: italic; padding-left: 10px;}.default-interactive-marker-overlay { position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index: 1001; -moz-opacity: 0.0; opacity: .0; filter: alpha(opacity = 0);}",document.getElementsByTagName("head")[0].appendChild(l)}for(this.menuDomElem=document.createElement("div"),this.menuDomElem.style.position="absolute",this.menuDomElem.className=r,this.menuDomElem.addEventListener("contextmenu",(function(e){e.preventDefault()})),this.overlayDomElem=document.createElement("div"),this.overlayDomElem.className=s,this.hideListener=this.hide.bind(this),this.overlayDomElem.addEventListener("contextmenu",this.hideListener),this.overlayDomElem.addEventListener("click",this.hideListener),this.overlayDomElem.addEventListener("touchstart",this.hideListener),n=0;n0?(e(s,o[a]),c.addEventListener("click",t.hide.bind(t)),c.addEventListener("touchstart",t.hide.bind(t))):(c.addEventListener("click",p.bind(t,o[a])),c.addEventListener("touchstart",p.bind(t,o[a])),c.className="default-interactive-marker-menu-entry")}}(this.menuDomElem,h[0])}show(e,t){t&&t.preventDefault&&t.preventDefault(),this.controlName=e.name,void 0!==t.domEvent.changedTouches?(this.menuDomElem.style.left=t.domEvent.changedTouches[0].pageX+"px",this.menuDomElem.style.top=t.domEvent.changedTouches[0].pageY+"px"):(this.menuDomElem.style.left=t.domEvent.clientX+"px",this.menuDomElem.style.top=t.domEvent.clientY+"px"),document.body.appendChild(this.overlayDomElem),document.body.appendChild(this.menuDomElem)}hide(e){e&&e.preventDefault&&e.preventDefault(),document.body.removeChild(this.overlayDomElem),document.body.removeChild(this.menuDomElem)}}class js extends Ss.Object3D{constructor(e){super();var t=this,i=(e=e||{}).handle;this.name=i.name;var r=e.camera,n=e.path||"/",o=e.loader;this.dragging=!1,this.onServerSetPose({pose:i.pose}),this.dragStart={position:new Ss.Vector3,orientation:new Ss.Quaternion,positionWorld:new Ss.Vector3,orientationWorld:new Ss.Quaternion,event3d:{}},i.controls.forEach((function(e){t.add(new Gs({parent:t,handle:i,message:e,camera:r,path:n,loader:o}))})),i.menuEntries.length>0&&(this.menu=new Vs({menuEntries:i.menuEntries,menuFontSize:i.menuFontSize}),this.menu.addEventListener("menu-select",(function(e){t.dispatchEvent(e)})))}showMenu(e,t){this.menu&&this.menu.show(e,t)}moveAxis(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld.clone()),s=new Ss.Ray(o,a),c=Cs(s,i.camera,i.mousePos),h=new Ss.Vector3;h.addVectors(this.dragStart.position,n.clone().applyQuaternion(this.dragStart.orientation).multiplyScalar(c)),this.setPosition(e,h),i.stopPropagation()}}move3d(e,t,i){if(this.dragging)if(e.isShift);else{var r=e.camera.getWorldDirection(),n=Math.abs(r.x),o=Math.abs(r.y),a=Math.abs(r.z),s=new Ss.Quaternion(1,0,0,1);o>n&&o>a?s=new Ss.Quaternion(0,0,1,1):a>n&&a>o&&(s=new Ss.Quaternion(0,1,0,1)),s.normalize(),(t=new Ss.Vector3(1,0,0)).applyQuaternion(s),this.movePlane(e,t,i)}}movePlane(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld),s=Ls(i.mouseRay,o,a),c=new Ss.Vector3;c.subVectors(s,o),c.add(this.dragStart.positionWorld),this.setPosition(e,c),i.stopPropagation()}}rotateAxis(e,t,i){if(this.dragging){e.updateMatrixWorld();var r=e.currentControlOri.clone().multiply(t.clone()),n=new Ss.Vector3(1,0,0).applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.applyQuaternion(this.dragStart.orientationWorld),s=Ls(i.mouseRay,o,a),c=new Ss.Ray(this.dragStart.positionWorld,a),h=Ls(c,o,a),l=this.dragStart.orientationWorld.clone().multiply(r).clone().inverse();s.sub(h),s.applyQuaternion(l);var u=this.dragStart.event3d.intersection.point.clone();u.sub(h),u.applyQuaternion(l);var p=Math.atan2(s.y,s.z),d=Math.atan2(u.y,u.z)-p,f=new Ss.Quaternion;f.setFromAxisAngle(n,d),this.setOrientation(e,f.multiply(this.dragStart.orientationWorld)),i.stopPropagation()}}feedbackEvent(e,t){this.dispatchEvent({type:e,position:this.position.clone(),orientation:this.quaternion.clone(),controlName:t.name})}startDrag(e,t){if(0===t.domEvent.button){t.stopPropagation(),this.dragging=!0,this.updateMatrixWorld(!0);var i=new Ss.Vector3;this.matrixWorld.decompose(this.dragStart.positionWorld,this.dragStart.orientationWorld,i),this.dragStart.position=this.position.clone(),this.dragStart.orientation=this.quaternion.clone(),this.dragStart.event3d=t,this.feedbackEvent("user-mousedown",e)}}stopDrag(e,t){0===t.domEvent.button&&(t.stopPropagation(),this.dragging=!1,this.dragStart.event3d={},this.onServerSetPose(this.bufferedPoseEvent),this.bufferedPoseEvent=void 0,this.feedbackEvent("user-mouseup",e))}buttonClick(e,t){t.stopPropagation(),this.feedbackEvent("user-button-click",e)}setPosition(e,t){this.position.copy(t),this.feedbackEvent("user-pose-change",e)}setOrientation(e,t){t.normalize(),this.quaternion.copy(t),this.feedbackEvent("user-pose-change",e)}onServerSetPose(e){if(void 0!==e)if(this.dragging)this.bufferedPoseEvent=e;else{var t=e.pose;this.position.copy(t.position),this.quaternion.copy(t.orientation),this.updateMatrixWorld(!0)}}dispose(){var e=this;this.children.forEach((function(t){t.children.forEach((function(e){e.dispose(),t.remove(e)})),e.remove(t)}))}}var Hs,Ws={},Xs={get exports(){return Ws},set exports(e){Ws=e}}; /*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. - */Hs=Ws,function(e){var t=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r="object"==typeof process&&"function"==typeof process.nextTick,n="function"==typeof Symbol,o="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,s=n?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function c(){this._events={},this._conf&&h.call(this,this._conf)}function h(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function l(e,t){var i="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(i+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(i);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(i),console.trace&&console.trace()}var u=function(e,t,i){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,i];default:for(var n=new Array(r);r--;)n[r]=arguments[r];return n}};function p(t,i){for(var r={},n=t.length,o=i?value.length:0,a=0;a0;)if(o===e[a])return r;n(t)}}Object.assign(d.prototype,{subscribe:function(e,t,i){var r=this,n=this._target,o=this._emitter,a=this._listeners,s=function(){var r=u.apply(null,arguments),a={data:r,name:t,original:e};if(i){var s=i.call(n,a);!1!==s&&o.emit.apply(o,[a.name].concat(r))}else o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(i){i===t&&null===a[e]&&(a[e]=s,r._on.call(n,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(i){i===t&&!o.hasListeners(i)&&a[e]&&(a[e]=null,r._off.call(n,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(n,e,s))},unsubscribe:function(e){var t,i,r,n=this,o=this._listeners,a=this._emitter,c=this._off,h=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function l(){n._onNewListener&&(a.off("newListener",n._onNewListener),a.off("removeListener",n._onRemoveListener),n._onNewListener=null,n._onRemoveListener=null);var e=b.call(a,n);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;c.call(h,e,t),delete o[e],--this._listenersCount||l()}else{for(r=(i=s(o)).length;r-- >0;)e=i[r],c.call(h,e,o[e]);this._listeners={},this._listenersCount=0,l()}}});var g=v(["function"]),y=v(["object","function"]);function x(e,t,i){var r,n,o,a=0,s=new e((function(c,h,l){function u(){n&&(n=null),a&&(clearTimeout(a),a=0)}i=f(i,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!i.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof l;var p=function(e){u(),c(e)},d=function(e){u(),h(e)};r?t(p,d,l):(n=[function(e){d(e||Error("canceled"))}],t(p,d,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");n.push(e)})),o=!0),i.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),h(e)}),i.timeout))}));return r||(s.cancel=function(e){if(n){for(var t=n.length,i=1;i0;)"_listeners"!==(d=y[c])&&(x=w(e,t,i[d],r+1,n))&&(b?b.push.apply(b,x):b=x);return b}if("**"===_){for((g=r+1===n||r+2===n&&"*"===M)&&i._listeners&&(b=w(e,t,i,n,n)),c=(y=s(i)).length;c-- >0;)"_listeners"!==(d=y[c])&&("*"===d||"**"===d?(i[d]._listeners&&!g&&(x=w(e,t,i[d],n,n))&&(b?b.push.apply(b,x):b=x),x=w(e,t,i[d],r,n)):x=w(e,t,i[d],d===M?r+2:r,n),x&&(b?b.push.apply(b,x):b=x));return b}i[_]&&(b=w(e,t,i[_],r+1,n))}if((f=i["*"])&&w(e,t,f,r+1,n),m=i["**"])if(r0;)"_listeners"!==(d=y[c])&&(d===M?w(e,t,m[d],r+2,n):d===_?w(e,t,m[d],r+1,n):((v={})[d]=m[d],w(e,t,{"**":v},r+1,n)));else m._listeners?w(e,t,m,n,n):m["*"]&&m["*"]._listeners&&w(e,t,m["*"],n,n);return b}function _(e,t,i){var r,n,o=0,a=0,s=this.delimiter,c=s.length;if("string"==typeof e)if(-1!==(r=e.indexOf(s))){n=new Array(5);do{n[o++]=e.slice(a,r),a=r+c}while(-1!==(r=e.indexOf(s,a)));n[o++]=e.slice(a)}else n=[e],o=1;else n=e,o=e.length;if(o>1)for(r=0;r+10&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,l.call(this,u._listeners.length,h))):u._listeners=t,!0;return!0}function M(e,t,i,r){for(var n,o,a,c,h=s(e),l=h.length,u=e._listeners;l-- >0;)n=e[o=h[l]],a="_listeners"===o?i:i?i.concat(o):[o],c=r||"symbol"==typeof o,u&&t.push(c?a:a.join(this.delimiter)),"object"==typeof n&&M.call(this,n,t,a,c);return t}function E(e){for(var t,i,r,n=s(e),o=n.length;o-- >0;)(t=e[i=n[o]])&&(r=!0,"_listeners"===i||E(t)||delete e[i]);return r}function T(e,t,i){this.emitter=e,this.event=t,this.listener=i}function S(t,i,n){if(!0===n)s=!0;else if(!1===n)o=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var o=n.async,s=n.promisify,c=n.nextTick,h=n.objectify}if(o||c||s){var l=i,u=i._origin||i;if(c&&!r)throw Error("process.nextTick is not supported");s===e&&(s="AsyncFunction"===i.constructor.name),i=function(){var e=arguments,t=this,i=this.event;return s?c?Promise.resolve():new Promise((function(e){a(e)})).then((function(){return t.event=i,l.apply(t,e)})):(c?process.nextTick:a)((function(){t.event=i,l.apply(t,e)}))},i._async=!0,i._origin=u}return[i,h?new T(this,t,i):this]}function A(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,h.call(this,e)}T.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},A.EventEmitter2=A,A.prototype.listenTo=function(t,r,n){if("object"!=typeof t)throw TypeError("target musts be an object");var o=this;function a(e){if("object"!=typeof e)throw TypeError("events must be an object");var i,r=n.reducers,a=b.call(o,t);i=-1===a?new d(o,t,n):o._observers[a];for(var c,h=s(e),l=h.length,u="function"==typeof r,p=0;p0;)r=i[n],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(e,t,i){return this._once(e,t,!1,i)},A.prototype.prependOnceListener=function(e,t,i){return this._once(e,t,!0,i)},A.prototype._once=function(e,t,i,r){return this._many(e,1,t,i,r)},A.prototype.many=function(e,t,i,r){return this._many(e,t,i,!1,r)},A.prototype.prependMany=function(e,t,i,r){return this._many(e,t,i,!0,r)},A.prototype._many=function(e,t,i,r,n){var o=this;if("function"!=typeof i)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),i.apply(this,arguments)}return a._origin=i,this._on(e,a,r,n)},A.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,i,r,o,a,s=arguments[0],h=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(h&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(i=s.length,n)for(r=0;r3)for(t=new Array(u-1),o=1;o3)for(i=new Array(p-1),a=1;a0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,l.call(this,this._events[t].length,t))):this._events[t]=i,a)},A.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=w.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var a=0;a0){for(i=0,r=(t=this._all).length;i0;)"function"==typeof(r=c[i[o]])?n.push(r):n.push.apply(n,r);return n}if(this.wildcard){if(!(a=this.listenerTree))return[];var h=[],l="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,h,l,a,0),h}return c&&(r=c[t])?"function"==typeof r?[r]:r:[]},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?M.call(this,this.listenerTree,[],null,e):t?s(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.prototype.hasListeners=function(t){if(this.wildcard){var i=[],r="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,i,r,this.listenerTree,0),i.length>0}var n=this._events,o=this._all;return!!(o&&o.length||n&&(t===e?s(n).length:n[t]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.prototype.waitFor=function(t,i){var r=this,n=typeof i;return"number"===n?i={timeout:i}:"function"===n&&(i={filter:i}),x((i=f(i,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:g,Promise:m})).Promise,(function(e,n,o){function a(){var o=i.filter;if(!o||o.apply(r,arguments))if(r.off(t,a),i.handleError){var s=arguments[0];s?n(s):e(u.apply(null,arguments).slice(1))}else e(u.apply(null,arguments))}o((function(){r.off(t,a)})),r._on(t,a,!1)}),{timeout:i.timeout,overload:i.overload})};var L=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return L._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");L._maxListeners=e},enumerable:!0},once:{value:function(e,t,i){return x((i=f(i,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,(function(i,r,n){var o;if("function"==typeof e.addEventListener)return o=function(){i(u.apply(null,arguments))},n((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var a,s=function(){a&&e.removeListener("error",a),i(u.apply(null,arguments))};"error"!==t&&(a=function(i){e.removeListener(t,s),r(i)},e.once("error",a)),n((function(){a&&e.removeListener("error",a),e.removeListener(t,s)})),e.once(t,s)}),{timeout:i.timeout,overload:i.overload})},writable:!0,configurable:!0}}),Object.defineProperties(L,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),Hs.exports=A}();var Xs=Ws.exports;class qs extends Xs{constructor(e){super(),e=e||{},this.message=e.message,this.feedbackTopic=e.feedbackTopic,this.tfClient=e.tfClient,this.menuFontSize=e.menuFontSize||"0.8em",this.name=this.message.name,this.header=this.message.header,this.controls=this.message.controls,this.menuEntries=this.message.menu_entries,this.dragging=!1,this.timeoutHandle=null,this.tfTransform=new r.Transform,this.pose=new r.Pose,this.setPoseFromClientBound=this.setPoseFromClient.bind(this),this.onMouseDownBound=this.onMouseDown.bind(this),this.onMouseUpBound=this.onMouseUp.bind(this),this.onButtonClickBound=this.onButtonClick.bind(this),this.onMenuSelectBound=this.onMenuSelect.bind(this),this.setPoseFromServer(this.message.pose),this.tfUpdateBound=this.tfUpdate.bind(this)}subscribeTf(){0===this.message.header.stamp.secs&&0===this.message.header.stamp.nsecs&&this.tfClient.subscribe(this.message.header.frame_id,this.tfUpdateBound)}unsubscribeTf(){this.tfClient.unsubscribe(this.message.header.frame_id,this.tfUpdateBound)}emitServerPoseUpdate(){var e=new r.Pose(this.pose);e.applyTransform(this.tfTransform),this.emit("pose",e)}setPoseFromServer(e){this.pose=new r.Pose(e),this.emitServerPoseUpdate()}tfUpdate(e){this.tfTransform=new r.Transform(e),this.emitServerPoseUpdate()}setPoseFromClient(e){this.pose=new r.Pose(e);var t=this.tfTransform.clone();t.rotation.invert(),t.translation.multiplyQuaternion(t.rotation),t.translation.x*=-1,t.translation.y*=-1,t.translation.z*=-1,this.pose.applyTransform(t),this.sendFeedback(1,void 0,0,e.controlName),this.dragging&&(this.timeoutHandle&&clearTimeout(this.timeoutHandle),this.timeoutHandle=setTimeout(this.setPoseFromClient.bind(this,e),250))}onButtonClick(e){this.sendFeedback(3,e.clickPosition,0,e.controlName)}onMouseDown(e){this.sendFeedback(4,e.clickPosition,0,e.controlName),this.dragging=!0}onMouseUp(e){this.sendFeedback(5,e.clickPosition,0,e.controlName),this.dragging=!1,this.timeoutHandle&&clearTimeout(this.timeoutHandle)}onMenuSelect(e){this.sendFeedback(2,void 0,e.id,e.controlName)}sendFeedback(e,t,i,r){var n=void 0!==t;t=t||{x:0,y:0,z:0};var o={header:this.header,client_id:this.clientID,marker_name:this.name,control_name:r,event_type:e,pose:this.pose,mouse_point:t,mouse_point_valid:n,menu_entry_id:i};this.feedbackTopic.publish(o)}}class Ys extends Ss.Object3D{constructor(e){super(),e=e||{};var t=this;this.tfClient=e.tfClient,this.frameID=e.frameID;var i=e.object;this.pose=e.pose||new r.Pose,this.visible=!1,this.add(i),this.updatePose(this.pose),this.tfUpdate=function(e){var i=new r.Transform(e),n=new r.Pose(t.pose);n.applyTransform(i),t.updatePose(n),t.visible=!0},this.tfClient.subscribe(this.frameID,this.tfUpdate)}updatePose(e){this.position.set(e.position.x,e.position.y,e.position.z),this.quaternion.set(e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w),this.updateMatrixWorld(!0)}unsubscribeTf(){this.tfClient.unsubscribe(this.frameID,this.tfUpdate)}}class Zs extends Ss.ArrowHelper{constructor(e){var t=(e=e||{}).origin||new Ss.Vector3(0,0,0),i=e.direction||new Ss.Vector3(1,0,0),r=e.length||1;e.headLength,e.shaftDiameter,e.headDiameter,e.material||new Ss.MeshBasicMaterial,super(i,t,r,16711680)}dispose(){void 0!==this.line&&(this.line.material.dispose(),this.line.geometry.dispose()),void 0!==this.cone&&(this.cone.material.dispose(),this.cone.geometry.dispose())}}class Js extends Ss.Object3D{constructor(e){super();var t=this,i=(e=e||{}).shaftRadius||.008,r=e.headRadius||.023,n=e.headLength||.1,o=e.scale||1,a=e.lineType||"full",s=e.lineDashLength||.1;function c(e){var r=new Ss.Color;r.setRGB(e.x,e.y,e.z);var n=new Ss.MeshBasicMaterial({color:r.getHex()}),o=new Ss.Vector3;o.crossVectors(e,new Ss.Vector3(0,-1,0));var c=new Ss.Quaternion;c.setFromAxisAngle(o,.5*Math.PI);var h,l=new Ss.Mesh(t.headGeom,n);if(l.position.copy(e),l.position.multiplyScalar(.95),l.quaternion.copy(c),l.updateMatrix(),t.add(l),"dashed"===a)for(var u=s,p=0;u/2+3*u*p+u/2<=1;++p){var d=new Ss.CylinderGeometry(i,i,u);(h=new Ss.Mesh(d,n)).position.copy(e),h.position.multiplyScalar(u/2+3*u*p),h.quaternion.copy(c),h.updateMatrix(),t.add(h)}else"full"===a?((h=new Ss.Mesh(t.lineGeom,n)).position.copy(e),h.position.multiplyScalar(.45),h.quaternion.copy(c),h.updateMatrix(),t.add(h)):console.warn("[Axes]: Unsupported line type. Not drawing any axes.")}this.scale.set(o,o,o),this.lineGeom=new Ss.CylinderGeometry(i,i,1-n),this.headGeom=new Ss.CylinderGeometry(0,r,n),c(new Ss.Vector3(1,0,0)),c(new Ss.Vector3(0,1,0)),c(new Ss.Vector3(0,0,1))}}class Ks extends Ss.Object3D{constructor(e){var t=(e=e||{}).num_cells||10,i=e.color||"#cccccc",r=e.lineWidth||1,n=e.cellSize||1;super();for(var o=new Ss.LineBasicMaterial({color:i,linewidth:r}),a=0;a<=t;++a){var s=n*t/2,c=s-a*n,h=new Ss.Geometry;h.vertices.push(new Ss.Vector3(-s,c,0),new Ss.Vector3(s,c,0));var l=new Ss.Geometry;l.vertices.push(new Ss.Vector3(c,-s,0),new Ss.Vector3(c,s,0)),this.add(new Ss.Line(h,o)),this.add(new Ss.Line(l,o))}}}class Qs extends Ss.Mesh{constructor(e){var t=(e=e||{}).message,i=e.opacity||1,r=e.color||{r:255,g:255,b:255,a:255},n=t.info,o=n.origin,a=n.width,s=n.height,c=new Ss.PlaneBufferGeometry(a,s),h=new Uint8Array(a*s*4),l=new Ss.DataTexture(h,a,s,Ss.RGBAFormat);l.flipY=!0,l.minFilter=Ss.NearestFilter,l.magFilter=Ss.NearestFilter,l.needsUpdate=!0;var u=new Ss.MeshBasicMaterial({map:l,transparent:i<1,opacity:i});u.side=Ss.DoubleSide,super(c,u),Object.assign(this,e),this.quaternion.copy(new Ss.Quaternion(o.orientation.x,o.orientation.y,o.orientation.z,o.orientation.w)),this.position.x=a*n.resolution/2+o.position.x,this.position.y=s*n.resolution/2+o.position.y,this.position.z=o.position.z,this.scale.x=n.resolution,this.scale.y=n.resolution;var p=t.data;this.color=r,this.material=u,this.texture=l;for(var d=0;d{const t="read"+e.kind,i="get"+e.kind;this[t]=()=>{if(this._cursor+e.width>this.length)throw new Error("Cannot read data stream. Overflow. Len="+this.length+" crsr="+this._cursor);const t=this._dataView[i](this._cursor,this.isLittleEndian);return this._cursor+=e.width,t}})),Object.defineProperty(this,"isEnd",{get:()=>this.cursor>=this.data.length}),this}class oc{constructor(e){this.resolution=void 0!==e.resolution?e.resolution:1,this.color=new Ss.Color(void 0!==e.color?e.color:"green"),this.opacity=void 0!==e.opacity?e.opacity:1,this.voxelRenderMode=void 0!==e.voxelRenderMode?e.voxelRenderMode:ec,this._rootNode=null,this._treeDepth=16,this._treeMaxKeyVal=32768,this._BINARY_UNALLOCATED=0,this._BINARY_LEAF_FREE=1,this._BINARY_LEAF_OCCUPIED=2,this._BINARY_HAS_CHILDREN=3,this._BINARY_CHILD_BUILD_TABLE={},this._BINARY_CHILD_BUILD_TABLE[this._BINARY_LEAF_FREE]=function(e){e.value=this._defaultFreeValue},this._BINARY_CHILD_BUILD_TABLE[this._BINARY_LEAF_OCCUPIED]=function(e){e.value=this._defaultOccupiedValue},this._BINARY_CHILD_BUILD_TABLE[this._BINARY_HAS_CHILDREN]=function(e){e.value=null},this._FACES=[{normal:[-1,0,0],vertices:[[0,1,0],[0,0,0],[0,1,1],[0,0,1]],childIndex:[1,3,5,7]},{normal:[1,0,0],vertices:[[1,1,1],[1,0,1],[1,1,0],[1,0,0]],childIndex:[0,2,4,6]},{normal:[0,-1,0],vertices:[[1,0,1],[0,0,1],[1,0,0],[0,0,0]],childIndex:[2,3,6,7]},{normal:[0,1,0],vertices:[[0,1,1],[1,1,1],[0,1,0],[1,1,0]],childIndex:[0,1,4,5]},{normal:[0,0,-1],vertices:[[1,0,0],[0,0,0],[1,1,0],[0,1,0]],childIndex:[4,5,6,7]},{normal:[0,0,1],vertices:[[0,0,1],[1,0,1],[0,1,1],[1,1,1]],childIndex:[0,1,2,3]}],this.nodeSizeTable=new Array(this._treeDepth);let t=this.resolution;for(let e=this._treeDepth-1;e>=0;--e)this.nodeSizeTable[e]=t,t*=2;this._defaultOccupiedValue=!0,this._defaultFreeValue=!1,this.object=null}searchAtDepth(e,t){t=void 0!==t&&t>0?t:this._treeDepth;const i=this._adjustKeyAtDepth(e,t),r=this._treeDepth-t;let n=this._rootNode;for(let e=this._treeDepth-1;e>=r;--e){const t=this._computeChildIdx(i,e);if(!n.hasChildAt(t))return n.hasChildren()?null:n;n=n.getChildAt(t)}return n}_computeCoordFromKey(e){return e.map((e=>this.resolution*(e-this._treeMaxKeyVal)))}_computeChildIdx(e,t){let i=0;return e[0]&1<(e-this._treeMaxKeyVal>>i<0;){let e=i.pop();const r=t.readUint16();let n=8;for(;0!==n;){--n;const t=(r&3<<2*n)>>2*n;if(t!==this._BINARY_UNALLOCATED){let r=this._newNode();this._BINARY_CHILD_BUILD_TABLE[t].bind(this)(r),e.createChildNodeAt(r,n),t===this._BINARY_HAS_CHILDREN&&i.push(r)}}}}read(e){null!==this._rootNode&&delete this._rootNode,this._rootNode=this._newNode();let t=new nc(e,!0),i=new Array;for(i.push(this._rootNode);i.length>0;){let e=i.pop();this._readNodeData(t,e);const r=t.readUint8();let n=8;for(;0!==n;){--n;if(r&1<0;){let i=t.pop();if(i.node.isLeafNode())e(i.node,i.key,i.depth-1);else for(let e=0;e<8;++e)if(i.node.hasChildAt(e)){const r=this._computeKeyFromChildIdx(e,i.key,i.depth);t.push({node:i.node.getChildAt(e),depth:i.depth+1,key:r})}}}_obtainColor(e){return this.color}_checkOccupied(e){return!1!==e.value}_buildFaces(){let e={vertices:[],indices:[],normals:[],colors:[],_insertFace:function(e,t,i,r){const n=this.vertices.length/3;e.vertices.forEach((function(e){this.vertices.push(t[0]+e[0]*i,t[1]+e[1]*i,t[2]+e[2]*i)}));const o=[r.r,r.g,r.b];this.colors.push(...o,...o,...o,...o),this.normals.push(...e.normal,...e.normal,...e.normal,...e.normal),this.indices.push(n,n+1,n+2,n+2,n+1,n+3)},_checkNeighborsTouchingFace:function(e,t,i){let r=new Array;for(r.push(t);0!==r.length;){const t=r.pop();t.hasChildren()&&e.childIndex.forEach((function(e){if(!t.hasChildAt(e))return!0;{const n=t.getChildAt(e),o=this._checkOccupied(t);(o&&i===ROS3D.OcTreeVoxelRenderMode.OCCUPIED||!o&&i===tc)&&r.push(n)}}))}return!1}};return this._traverseLeaves(((t,i,r)=>{const n=this._computeCoordFromKey(i),o=this.nodeSizeTable[r],a=this._treeDepth-r,s=this._checkOccupied(t);(s||this.voxelRenderMode!==ec)&&(s&&this.voxelRenderMode===tc||this._FACES.forEach((function(s){const c=[i[0]+s.normal[0]*a*a,i[1]+s.normal[1]*a*a,i[2]+s.normal[2]*a*a],h=this.searchAtDepth(c);null===h?e._insertFace(s,n,o,this._obtainColor(t)):rnew Ss.Color(e))):[{r:0,g:0,b:128},{r:0,g:255,b:0},{r:255,g:255,b:0},{r:255,g:128,b:0},{r:255,g:0,b:0}],this.paletteScale=void 0!==e.paletteScale?e.paletteScale:1}_readNodeData(e,t){t.value=e.readFloat32()}_obtainColor(e){if(this.useFlatColoring)return this.color;const t=1/(1+Math.exp(-e.value*this.paletteScale))*this.palette.length,i=Math.trunc(t),r=t-i;return i<0?this.palette[0]:i>=this.palette.length-1?this.palette[this.palette.length-1]:{r:r*this.palette[i].r+(1-r)*this.palette[i+1].r,g:r*this.palette[i].g+(1-r)*this.palette[i+1].g,b:r*this.palette[i].b+(1-r)*this.palette[i+1].b}}_checkOccupied(e){return e.value>=this.occupancyThreshold}}class sc extends ac{constructor(e){super(e),this.useOwnColor=void 0!==e.palette&&e.colorMode===rc}_readNodeData(e,t){t.value=e.readFloat32(),t.color={r:e.readUint8(),g:e.readUint8(),b:e.readUint8()}}_obtainColor(e){return this.useOwnColor?e.color:ac.prototype._obtainColor.call(this,e)}}class cc extends Ss.Object3D{constructor(e){super(),this.options=e||{},this.ros=e.ros,this.topicName=e.topic||"/particlecloud",this.tfClient=e.tfClient,this.color=e.color||13369599,this.length=e.length||1,this.rootObject=e.rootObject||new Ss.Object3D,this.keep=e.keep||1,this.sns=[],this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"nav_msgs/Odometry"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.sns.length>=this.keep&&(this.sns[0].unsubscribeTf(),this.rootObject.remove(this.sns[0]),this.sns.shift()),this.options.origin=new Ss.Vector3(e.pose.pose.position.x,e.pose.pose.position.y,e.pose.pose.position.z);var t=new Ss.Quaternion(e.pose.pose.orientation.x,e.pose.pose.orientation.y,e.pose.pose.orientation.z,e.pose.pose.orientation.w);this.options.direction=new Ss.Vector3(1,0,0),this.options.direction.applyQuaternion(t),this.options.material=new Ss.MeshBasicMaterial({color:this.color});var i=new Ns(this.options);this.sns.push(new Ys({frameID:e.header.frame_id,tfClient:this.tfClient,object:i})),this.rootObject.add(this.sns[this.sns.length-1])}}class hc extends Ss.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/path",this.tfClient=e.tfClient,this.color=e.color||13369599,this.rootObject=e.rootObject||new Ss.Object3D,this.sn=null,this.line=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"nav_msgs/Path"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){null!==this.sn&&(this.sn.unsubscribeTf(),this.rootObject.remove(this.sn));for(var t=new Ss.Geometry,i=0;i=e.range_min&&n<=e.range_max){var o=e.angle_min+r*e.angle_increment;this.points.positions.array[i++]=n*Math.cos(o),this.points.positions.array[i++]=n*Math.sin(o),this.points.positions.array[i++]=0}}this.points.update(i/3)}}}class gc extends Ss.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/gps/fix",this.rootObject=e.rootObject||new Ss.Object3D,this.object3d=e.object3d||new Ss.Object3D;var t=e.material||{};this.altitudeNaN=e.altitudeNaN||0,this.keep=e.keep||100,this.convert=e.convert||function(e,t,i){return new Ss.Vector3(e,t,i)},this.count=0,this.next1=0,this.next2=this.keep,this.geom=new Ss.BufferGeometry,this.vertices=new Ss.BufferAttribute(new Float32Array(6*this.keep),3),this.geom.addAttribute("position",this.vertices),this.material=t.isMaterial?t:new Ss.LineBasicMaterial(t),this.line=new Ss.Line(this.geom,this.material),this.rootObject.add(this.object3d),this.rootObject.add(this.line),this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"sensor_msgs/NavSatFix"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){var t=isNaN(e.altitude)?this.altitudeNaN:e.altitude,i=this.convert(e.longitude,e.latitude,t);this.object3d.position.copy(i),this.object3d.updateMatrixWorld(!0),this.vertices.array[3*this.next1]=i.x,this.vertices.array[3*this.next1+1]=i.y,this.vertices.array[3*this.next1+2]=i.z,this.vertices.array[3*this.next2]=i.x,this.vertices.array[3*this.next2+1]=i.y,this.vertices.array[3*this.next2+2]=i.z,this.vertices.needsUpdate=!0,this.next1=(this.next1+1)%this.keep,this.next2=this.next1+this.keep,this.count=Math.min(this.count+1,this.keep),this.geom.setDrawRange(this.next2-this.count,this.count)}}function yc(e,t,i,r){var n,o=0,a=0,s=0,c=e.length,h=t.length,l=((r=r||1)-1)*(i=i||h)*8;for(n=0;n=8&&(a-=8,t[s++]=o>>>a&255,s%i==0&&(n+=Math.ceil((l-a)/6),(a%=8)>0&&(o=yc.e[e.charAt(n)])));return Math.floor(s/i)}yc.S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yc.e={};for(var xc=0;xc<64;xc++)yc.e[yc.S.charAt(xc)]=xc;class bc extends Ss.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/points",this.throttle_rate=e.throttle_rate||null,this.compression=e.compression||"cbor",this.max_pts=e.max_pts||1e4,this.points=new mc(e),this.rosTopic=void 0,this.buffer=null,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"sensor_msgs/PointCloud2",throttle_rate:this.throttle_rate,queue_length:1,compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){if(this.points.setup(e.header.frame_id,e.point_step,e.fields)){var t,i=this.points.pointRatio,r=this.max_pts*e.point_step;e.data.buffer?(this.buffer=e.data.slice(0,Math.min(e.data.byteLength,r)),t=Math.min(e.height*e.width/i,this.points.positions.array.length/3)):((!this.buffer||this.buffer.byteLength0?(r=d[0].object,p.intersection=this.lastIntersection=d[0]):r=this.fallbackTarget,r!==this.lastTarget&&e.type.match(/mouse/)){var f=this.notify(r,"mouseover",p);0===f?this.notify(this.lastTarget,"mouseout",p):1===f&&(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(r,"mouseover",p),this.notify(this.lastTarget,"mouseout",p))}r!==this.lastTarget&&e.type.match(/touch/)&&(this.notify(r,e.type,p)?(this.notify(this.lastTarget,"touchleave",p),this.notify(this.lastTarget,"touchend",p)):(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(this.lastTarget,"touchmove",p),this.notify(this.lastTarget,"touchend",p)));this.notify(r,e.type,p),"mousedown"!==e.type&&"touchstart"!==e.type&&"touchmove"!==e.type||(this.dragging=!0),this.lastTarget=r}notify(e,t,i){for(i.type=t,i.cancelBubble=!1,i.continueBubble=!1,i.stopPropagation=function(){i.cancelBubble=!0},i.continuePropagation=function(){i.continueBubble=!0},i.currentTarget=e;i.currentTarget;){if(i.currentTarget.dispatchEvent&&i.currentTarget.dispatchEvent instanceof Function){if(i.currentTarget.dispatchEvent(i),i.cancelBubble)return this.dispatchEvent(i),0;if(i.continueBubble)return 2}i.currentTarget=i.currentTarget.parent}return 1}}class Tc extends Ss.EventDispatcher{constructor(e){super();var t=this,i=(e=e||{}).scene;this.camera=e.camera,this.center=new Ss.Vector3,this.userZoom=!0,this.userZoomSpeed=e.userZoomSpeed||1,this.userRotate=!0,this.userRotateSpeed=e.userRotateSpeed||1,this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed||2,this.displayPanAndZoomFrame=void 0===e.displayPanAndZoomFrame||!!e.displayPanAndZoomFrame,this.lineTypePanAndZoomFrame=e.dashedPanAndZoomFrame||"full",this.camera.up=new Ss.Vector3(0,0,1);var r=1800,n=new Ss.Vector2,o=new Ss.Vector2,a=new Ss.Vector2,s=new Ss.Vector2,c=new Ss.Vector2,h=new Ss.Vector2,l=new Ss.Vector3,u=new Ss.Vector3,p=new Ss.Vector3,d=new Ss.Vector3,f=new Array(2),m=new Array(2);this.phiDelta=0,this.thetaDelta=0,this.scale=1,this.lastPosition=new Ss.Vector3;var v=-1,g=0,y=1,x=2,b=v;function w(e,t,i){var r=new Ss.Vector3;new Ss.Vector3;r.subVectors(t,e.origin);var n=e.direction.dot(i);if(Math.abs(n)0?t.zoomIn():t.zoomOut(),this.showAxes()}}this.axes=new Js({shaftRadius:.025,headRadius:.07,headLength:.2,lineType:this.lineTypePanAndZoomFrame}),this.displayPanAndZoomFrame&&(i.add(this.axes),this.axes.traverse((function(e){e.visible=!1}))),this.addEventListener("mousedown",(function(e){var i=e.domEvent;switch(i.preventDefault(),i.button){case 0:b=g,n.set(i.clientX,i.clientY);break;case 1:b=x,u=new Ss.Vector3(0,0,1);var r=(new Ss.Matrix4).extractRotation(this.camera.matrix);u.applyMatrix4(r),l=t.center.clone(),p=t.camera.position.clone(),d=w(e.mouseRay,l,u);break;case 2:b=y,s.set(i.clientX,i.clientY)}this.showAxes()})),this.addEventListener("mouseup",(function(e){t.userRotate&&(b=v)})),this.addEventListener("mousemove",(function(e){var i=e.domEvent;if(b===g)o.set(i.clientX,i.clientY),a.subVectors(o,n),t.rotateLeft(2*Math.PI*a.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*a.y/r*t.userRotateSpeed),n.copy(o),this.showAxes();else if(b===y)c.set(i.clientX,i.clientY),h.subVectors(c,s),h.y>0?t.zoomIn():t.zoomOut(),s.copy(c),this.showAxes();else if(b===x){var f=w(e.mouseRay,t.center,u);if(!f)return;var m=(new Ss.Vector3).subVectors(d.clone(),f.clone());t.center.addVectors(l.clone(),m.clone()),t.camera.position.addVectors(p.clone(),m.clone()),t.update(),t.camera.updateMatrixWorld(),this.showAxes()}})),this.addEventListener("touchstart",(function(e){var i=e.domEvent;switch(i.touches.length){case 1:b=g,n.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY);break;case 2:b=v,u=new Ss.Vector3(0,0,1);var r=(new Ss.Matrix4).extractRotation(this.camera.matrix);u.applyMatrix4(r),l=t.center.clone(),p=t.camera.position.clone(),d=w(e.mouseRay,l,u),f[0]=new Ss.Vector2(i.touches[0].pageX,i.touches[0].pageY),f[1]=new Ss.Vector2(i.touches[1].pageX,i.touches[1].pageY),m[0]=new Ss.Vector2(0,0),m[1]=new Ss.Vector2(0,0)}this.showAxes(),i.preventDefault()})),this.addEventListener("touchmove",(function(e){var i=e.domEvent;if(b===g)o.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY),a.subVectors(o,n),t.rotateLeft(2*Math.PI*a.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*a.y/r*t.userRotateSpeed),n.copy(o),this.showAxes();else{if(m[0].set(f[0].x-i.touches[0].pageX,f[0].y-i.touches[0].pageY),m[1].set(f[1].x-i.touches[1].pageX,f[1].y-i.touches[1].pageY),m[0].lengthSq()>10&&m[1].lengthSq()>10&&(f[0].set(i.touches[0].pageX,i.touches[0].pageY),f[1].set(i.touches[1].pageX,i.touches[1].pageY),m[0].dot(m[1])>0&&b!==y?b=x:m[0].dot(m[1])<0&&b!==x&&(b=y),b===y)){var s=new Ss.Vector2;s.subVectors(f[0],f[1]),m[0].dot(s)<0&&m[1].dot(s)>0?t.zoomOut():m[0].dot(s)>0&&m[1].dot(s)<0&&t.zoomIn()}if(b===x){var c=w(e.mouseRay,t.center,u);if(!c)return;var h=(new Ss.Vector3).subVectors(d.clone(),c.clone());t.center.addVectors(l.clone(),h.clone()),t.camera.position.addVectors(p.clone(),h.clone()),t.update(),t.camera.updateMatrixWorld()}this.showAxes(),i.preventDefault()}})),this.addEventListener("touchend",(function(e){var t=e.domEvent;1===t.touches.length&&b!==g?(b=g,n.set(t.touches[0].pageX-window.scrollX,t.touches[0].pageY-window.scrollY)):b=v})),this.addEventListener("mousewheel",_),this.addEventListener("DOMMouseScroll",_)}showAxes(){var e=this;this.axes.traverse((function(e){e.visible=!0})),this.hideTimeout&&clearTimeout(this.hideTimeout),this.hideTimeout=setTimeout((function(){e.axes.traverse((function(e){e.visible=!1})),e.hideTimeout=!1}),1e3)}rotateLeft(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta-=e}rotateRight(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta+=e}rotateUp(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta-=e}rotateDown(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta+=e}zoomIn(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale/=e}zoomOut(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale*=e}update(){var e=this.camera.position,t=e.clone().sub(this.center),i=Math.atan2(t.y,t.x),r=Math.atan2(Math.sqrt(t.y*t.y+t.x*t.x),t.z);this.autoRotate&&this.rotateLeft(2*Math.PI/60/60*this.autoRotateSpeed),i+=this.thetaDelta,r+=this.phiDelta;var n=1e-6;r=Math.max(n,Math.min(Math.PI-n,r));var o=t.length();t.set(o*Math.sin(r)*Math.cos(i),o*Math.sin(r)*Math.sin(i),o*Math.cos(r)),t.multiplyScalar(this.scale),e.copy(this.center).add(t),this.camera.lookAt(this.center),o=t.length(),this.axes.position.copy(this.center),this.axes.scale.set(.05*o,.05*o,.05*o),this.axes.updateMatrixWorld(!0),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.lastPosition.distanceTo(this.camera.position)>0&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position))}}return e.Arrow=Ns,e.Arrow2=Zs,e.Axes=Js,e.ColorOcTree=sc,e.DepthCloud=Ps,e.Grid=Ks,e.Highlighter=Mc,e.INTERACTIVE_MARKER_BUTTON=2,e.INTERACTIVE_MARKER_BUTTON_CLICK=3,e.INTERACTIVE_MARKER_FIXED=1,e.INTERACTIVE_MARKER_INHERIT=0,e.INTERACTIVE_MARKER_KEEP_ALIVE=0,e.INTERACTIVE_MARKER_MENU=1,e.INTERACTIVE_MARKER_MENU_SELECT=2,e.INTERACTIVE_MARKER_MOUSE_DOWN=4,e.INTERACTIVE_MARKER_MOUSE_UP=5,e.INTERACTIVE_MARKER_MOVE_3D=7,e.INTERACTIVE_MARKER_MOVE_AXIS=3,e.INTERACTIVE_MARKER_MOVE_PLANE=4,e.INTERACTIVE_MARKER_MOVE_ROTATE=6,e.INTERACTIVE_MARKER_MOVE_ROTATE_3D=9,e.INTERACTIVE_MARKER_NONE=0,e.INTERACTIVE_MARKER_POSE_UPDATE=1,e.INTERACTIVE_MARKER_ROTATE_3D=8,e.INTERACTIVE_MARKER_ROTATE_AXIS=5,e.INTERACTIVE_MARKER_VIEW_FACING=2,e.InteractiveMarker=js,e.InteractiveMarkerClient=class{constructor(e){e=e||{},this.ros=e.ros,this.tfClient=e.tfClient,this.topicName=e.topic,this.path=e.path||"/",this.camera=e.camera,this.rootObject=e.rootObject||new Ss.Object3D,this.loader=e.loader,this.menuFontSize=e.menuFontSize||"0.8em",this.interactiveMarkers={},this.updateTopic=null,this.feedbackTopic=null,this.topicName&&this.subscribe(this.topicName)}subscribe(e){this.unsubscribe(),this.updateTopic=new r.Topic({ros:this.ros,name:e+"/tunneled/update",messageType:"visualization_msgs/InteractiveMarkerUpdate",compression:"png"}),this.updateTopic.subscribe(this.processUpdate.bind(this)),this.feedbackTopic=new r.Topic({ros:this.ros,name:e+"/feedback",messageType:"visualization_msgs/InteractiveMarkerFeedback",compression:"png"}),this.feedbackTopic.advertise(),this.initService=new r.Service({ros:this.ros,name:e+"/tunneled/get_init",serviceType:"demo_interactive_markers/GetInit"});var t=new r.ServiceRequest({});this.initService.callService(t,this.processInit.bind(this))}unsubscribe(){for(var e in this.updateTopic&&this.updateTopic.unsubscribe(this.processUpdate),this.feedbackTopic&&this.feedbackTopic.unadvertise(),this.interactiveMarkers)this.eraseIntMarker(e);this.interactiveMarkers={}}processInit(e){var t=e.msg;for(var i in t.erases=[],this.interactiveMarkers)t.erases.push(i);t.poses=[],this.processUpdate(t)}processUpdate(e){var t=this;e.erases.forEach((function(e){t.eraseIntMarker(e)})),e.poses.forEach((function(e){var i=t.interactiveMarkers[e.name];i&&i.setPoseFromServer(e.pose)})),e.markers.forEach((function(e){var i=t.interactiveMarkers[e.name];i&&t.eraseIntMarker(i.name);var r=new qs({message:e,feedbackTopic:t.feedbackTopic,tfClient:t.tfClient,menuFontSize:t.menuFontSize});t.interactiveMarkers[e.name]=r;var n=new js({handle:r,camera:t.camera,path:t.path,loader:t.loader});n.name=e.name,t.rootObject.add(n),r.on("pose",(function(e){n.onServerSetPose({pose:e})})),n.addEventListener("user-pose-change",r.setPoseFromClientBound),n.addEventListener("user-mousedown",r.onMouseDownBound),n.addEventListener("user-mouseup",r.onMouseUpBound),n.addEventListener("user-button-click",r.onButtonClickBound),n.addEventListener("menu-select",r.onMenuSelectBound),r.subscribeTf()}))}eraseIntMarker(e){if(this.interactiveMarkers[e]){var t=this.rootObject.getObjectByName(e);this.rootObject.remove(t);var i=this.interactiveMarkers[e];i.unsubscribeTf(),t.removeEventListener("user-pose-change",i.setPoseFromClientBound),t.removeEventListener("user-mousedown",i.onMouseDownBound),t.removeEventListener("user-mouseup",i.onMouseUpBound),t.removeEventListener("user-button-click",i.onButtonClickBound),t.removeEventListener("menu-select",i.onMenuSelectBound),delete this.interactiveMarkers[e],t.dispose()}}},e.InteractiveMarkerControl=Gs,e.InteractiveMarkerHandle=qs,e.InteractiveMarkerMenu=Vs,e.LaserScan=vc,e.MARKER_ARROW=0,e.MARKER_CUBE=1,e.MARKER_CUBE_LIST=6,e.MARKER_CYLINDER=3,e.MARKER_LINE_LIST=5,e.MARKER_LINE_STRIP=4,e.MARKER_MESH_RESOURCE=10,e.MARKER_POINTS=8,e.MARKER_SPHERE=2,e.MARKER_SPHERE_LIST=7,e.MARKER_TEXT_VIEW_FACING=9,e.MARKER_TRIANGLE_LIST=11,e.Marker=ks,e.MarkerArrayClient=class extends Xs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.path=e.path||"/",this.markers={},this.rosTopic=void 0,this.subscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"visualization_msgs/MarkerArray",compression:"png"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){e.markers.forEach(function(e){var t=e.ns+e.id;if(0===e.action){var i=!1;if(t in this.markers&&((i=this.markers[t].children[0].update(e))||this.removeMarker(t)),!i){var r=new ks({message:e,path:this.path});this.markers[t]=new Ys({frameID:e.header.frame_id,tfClient:this.tfClient,object:r}),this.rootObject.add(this.markers[t])}}else if(1===e.action)console.warn('Received marker message with deprecated action identifier "1"');else if(2===e.action)this.removeMarker(t);else if(3===e.action){for(var n in this.markers)this.removeMarker(n);this.markers={}}else console.warn('Received marker message with unknown action identifier "'+e.action+'"')}.bind(this)),this.emit("change")}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}removeMarker(e){var t=this.markers[e];t&&(t.unsubscribeTf(),this.rootObject.remove(t),t.children.forEach((e=>{e.dispose()})),delete this.markers[e])}},e.MarkerClient=class extends Xs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.path=e.path||"/",this.lifetime=e.lifetime||0,this.markers={},this.rosTopic=void 0,this.updatedTime={},this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}checkTime(e){if((new Date).getTime()-this.updatedTime[e]>this.lifetime)this.removeMarker(e),this.emit("change");else{var t=this;setTimeout((function(){t.checkTime(e)}),100)}}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"visualization_msgs/Marker",compression:"png"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){var t=e.ns+e.id,i=this.markers[t];if(this.updatedTime[t]=(new Date).getTime(),i?this.removeMarker(t):this.lifetime&&this.checkTime(e.ns+e.id),0===e.action){var r=new ks({message:e,path:this.path});this.markers[t]=new Ys({frameID:e.header.frame_id,tfClient:this.tfClient,object:r}),this.rootObject.add(this.markers[t])}this.emit("change")}removeMarker(e){var t=this.markers[e];t&&(t.unsubscribeTf(),this.rootObject.remove(t),t.children.forEach((e=>{e.dispose()})),delete this.markers[e])}},e.MeshLoader=Fs,e.MeshResource=Bs,e.MouseHandler=Ec,e.NavSatFix=gc,e.OcTree=ac,e.OcTreeClient=class extends Xs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/octomap",this.compression=e.compression||"cbor",this.continuous=e.continuous,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.offsetPose=e.offsetPose||new r.Pose,this.options={},void 0!==e.color&&(this.options.color=e.color),void 0!==e.opacity&&(this.options.opacity=e.opacity),void 0!==e.colorMode&&(this.options.colorMode=e.colorMode),void 0!==e.palette&&(this.options.palette=e.palette),void 0!==e.paletteScale&&(this.options.paletteScale=e.palette),void 0!==e.voxelRenderMode&&(this.options.voxelRenderMode=e.voxelRenderMode),this.currentMap=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"octomap_msgs/Octomap",queue_length:1,compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.currentMap&&this.currentMap.tfClient&&this.currentMap.unsubscribeTf(),this._processMessagePrivate(e),this.continuous||this.rosTopic.unsubscribe(this.processMessage)}_loadOcTree(e){return new Promise(function(t,i){const r=Object.assign({resolution:e.resolution},this.options);let n=null;if(e.binary)n=new oc(r),n.readBinary(e.data);else{const t={OcTree:ac,ColorOcTree:sc};e.id in t&&(console.log(e.id,t),n=new t[e.id](r),n.read(e.data))}n.buildGeometry(),t(n)}.bind(this))}_processMessagePrivate(e){this._loadOcTree(e).then(function(t){const i=this.sceneNode;this.tfClient?(this.currentMap=t,this.sceneNode=new Ys({frameID:e.header.frame_id,tfClient:this.tfClient,object:t.object,pose:this.offsetPose})):(this.sceneNode=t.object,this.currentMap=t),this.rootObject.remove(i),this.rootObject.add(this.sceneNode),this.emit("change")}.bind(this))}},e.OccupancyGrid=Qs,e.OccupancyGridClient=class extends Xs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/map",this.compression=e.compression||"cbor",this.continuous=e.continuous,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.offsetPose=e.offsetPose||new r.Pose,this.color=e.color||{r:255,g:255,b:255},this.opacity=e.opacity||1,this.currentGrid=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"nav_msgs/OccupancyGrid",queue_length:1,compression:this.compression}),this.sceneNode=null,this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.currentGrid&&(this.tfClient?(this.sceneNode.unsubscribeTf(),this.sceneNode.remove(this.currentGrid)):this.rootObject.remove(this.currentGrid),this.currentGrid.dispose());var t=new Qs({message:e,color:this.color,opacity:this.opacity});this.tfClient?(this.currentGrid=t,null===this.sceneNode?(this.sceneNode=new Ys({frameID:e.header.frame_id,tfClient:this.tfClient,object:t,pose:this.offsetPose}),this.rootObject.add(this.sceneNode)):this.sceneNode.add(this.currentGrid)):(this.sceneNode=this.currentGrid=t,this.rootObject.add(this.currentGrid)),this.emit("change"),this.continuous||this.rosTopic.unsubscribe(this.processMessage)}},e.Odometry=cc,e.OrbitControls=Tc,e.Path=hc,e.Point=lc,e.PointCloud2=bc,e.Points=mc,e.Polygon=uc,e.Pose=pc,e.PoseArray=dc,e.PoseWithCovariance=fc,e.SceneNode=Ys,e.TFAxes=wc,e.TriangleList=zs,e.Urdf=_c,e.UrdfClient=class{constructor(e){var t=this,i=(e=e||{}).ros;this.param=e.param||"robot_description",this.path=e.path||"/",this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.tfPrefix=e.tfPrefix||"",this.loader=e.loader,new r.Param({ros:i,name:this.param}).get((function(e){var i=new r.UrdfModel({string:e});t.urdf=new _c({urdfModel:i,path:t.path,tfClient:t.tfClient,tfPrefix:t.tfPrefix,loader:t.loader}),t.rootObject.add(t.urdf)}))}},e.Viewer=class{constructor(e){var t=(e=e||{}).divID,i=e.elem,r=e.width,n=e.height,o=e.background||"#111111",a=e.antialias,s=e.intensity||.66,c=e.near||.01,h=e.far||1e3,l=e.alpha||1,u=e.cameraPose||{x:3,y:3,z:3},p=e.cameraZoomSpeed||.5,d=void 0===e.displayPanAndZoomFrame||!!e.displayPanAndZoomFrame,f=e.lineTypePanAndZoomFrame||"full";this.renderer=new Ss.WebGLRenderer({antialias:a,alpha:!0}),this.renderer.setClearColor(parseInt(o.replace("#","0x"),16),l),this.renderer.sortObjects=!1,this.renderer.setSize(r,n),this.renderer.shadowMap.enabled=!1,this.renderer.autoClear=!1,this.scene=new Ss.Scene,this.camera=new Ss.PerspectiveCamera(40,r/n,c,h),this.camera.position.x=u.x,this.camera.position.y=u.y,this.camera.position.z=u.z,this.cameraControls=new Tc({scene:this.scene,camera:this.camera,displayPanAndZoomFrame:d,lineTypePanAndZoomFrame:f}),this.cameraControls.userZoomSpeed=p,this.scene.add(new Ss.AmbientLight(5592405)),this.directionalLight=new Ss.DirectionalLight(16777215,s),this.scene.add(this.directionalLight),this.selectableObjects=new Ss.Group,this.scene.add(this.selectableObjects);var m=new Ec({renderer:this.renderer,camera:this.camera,rootObject:this.selectableObjects,fallbackTarget:this.cameraControls});this.highlighter=new Mc({mouseHandler:m}),this.stopped=!0,this.animationRequestId=void 0,(i||document.getElementById(t)).appendChild(this.renderer.domElement),this.start()}start(){this.stopped=!1,this.draw()}draw(){this.stopped||(this.cameraControls.update(),this.directionalLight.position.normalize(),this.renderer.clear(!0,!0,!0),this.renderer.render(this.scene,this.camera),this.highlighter.renderHighlights(this.scene,this.renderer,this.camera),this.animationRequestId=requestAnimationFrame(this.draw.bind(this)))}stop(){this.stopped||cancelAnimationFrame(this.animationRequestId),this.stopped=!0}addObject(e,t){t?this.selectableObjects.add(e):this.scene.add(e)}resize(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t)}},e.closestAxisPoint=Cs,e.findClosestPoint=Rs,e.intersectPlane=Ls,e.makeColorMaterial=As,Object.defineProperty(e,"__esModule",{value:!0}),e}({},ROSLIB); + */ +Hs=Xs,function(e){var t=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r="object"==typeof process&&"function"==typeof process.nextTick,n="function"==typeof Symbol,o="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,s=n?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function c(){this._events={},this._conf&&h.call(this,this._conf)}function h(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function l(e,t){var i="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(i+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(i);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(i),console.trace&&console.trace()}var u=function(e,t,i){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,i];default:for(var n=new Array(r);r--;)n[r]=arguments[r];return n}};function p(t,i){for(var r={},n=t.length,o=i?value.length:0,a=0;a0;)if(o===e[a])return r;n(t)}}Object.assign(d.prototype,{subscribe:function(e,t,i){var r=this,n=this._target,o=this._emitter,a=this._listeners,s=function(){var r=u.apply(null,arguments),a={data:r,name:t,original:e};if(i){var s=i.call(n,a);!1!==s&&o.emit.apply(o,[a.name].concat(r))}else o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(i){i===t&&null===a[e]&&(a[e]=s,r._on.call(n,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(i){i===t&&!o.hasListeners(i)&&a[e]&&(a[e]=null,r._off.call(n,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(n,e,s))},unsubscribe:function(e){var t,i,r,n=this,o=this._listeners,a=this._emitter,c=this._off,h=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function l(){n._onNewListener&&(a.off("newListener",n._onNewListener),a.off("removeListener",n._onRemoveListener),n._onNewListener=null,n._onRemoveListener=null);var e=b.call(a,n);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;c.call(h,e,t),delete o[e],--this._listenersCount||l()}else{for(r=(i=s(o)).length;r-- >0;)e=i[r],c.call(h,e,o[e]);this._listeners={},this._listenersCount=0,l()}}});var g=v(["function"]),y=v(["object","function"]);function x(e,t,i){var r,n,o,a=0,s=new e((function(c,h,l){function u(){n&&(n=null),a&&(clearTimeout(a),a=0)}i=f(i,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!i.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof l;var p=function(e){u(),c(e)},d=function(e){u(),h(e)};r?t(p,d,l):(n=[function(e){d(e||Error("canceled"))}],t(p,d,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");n.push(e)})),o=!0),i.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),h(e)}),i.timeout))}));return r||(s.cancel=function(e){if(n){for(var t=n.length,i=1;i0;)"_listeners"!==(d=y[c])&&(x=w(e,t,i[d],r+1,n))&&(b?b.push.apply(b,x):b=x);return b}if("**"===_){for((g=r+1===n||r+2===n&&"*"===M)&&i._listeners&&(b=w(e,t,i,n,n)),c=(y=s(i)).length;c-- >0;)"_listeners"!==(d=y[c])&&("*"===d||"**"===d?(i[d]._listeners&&!g&&(x=w(e,t,i[d],n,n))&&(b?b.push.apply(b,x):b=x),x=w(e,t,i[d],r,n)):x=w(e,t,i[d],d===M?r+2:r,n),x&&(b?b.push.apply(b,x):b=x));return b}i[_]&&(b=w(e,t,i[_],r+1,n))}if((f=i["*"])&&w(e,t,f,r+1,n),m=i["**"])if(r0;)"_listeners"!==(d=y[c])&&(d===M?w(e,t,m[d],r+2,n):d===_?w(e,t,m[d],r+1,n):((v={})[d]=m[d],w(e,t,{"**":v},r+1,n)));else m._listeners?w(e,t,m,n,n):m["*"]&&m["*"]._listeners&&w(e,t,m["*"],n,n);return b}function _(e,t,i){var r,n,o=0,a=0,s=this.delimiter,c=s.length;if("string"==typeof e)if(-1!==(r=e.indexOf(s))){n=new Array(5);do{n[o++]=e.slice(a,r),a=r+c}while(-1!==(r=e.indexOf(s,a)));n[o++]=e.slice(a)}else n=[e],o=1;else n=e,o=e.length;if(o>1)for(r=0;r+10&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,l.call(this,u._listeners.length,h))):u._listeners=t,!0;return!0}function M(e,t,i,r){for(var n,o,a,c,h=s(e),l=h.length,u=e._listeners;l-- >0;)n=e[o=h[l]],a="_listeners"===o?i:i?i.concat(o):[o],c=r||"symbol"==typeof o,u&&t.push(c?a:a.join(this.delimiter)),"object"==typeof n&&M.call(this,n,t,a,c);return t}function E(e){for(var t,i,r,n=s(e),o=n.length;o-- >0;)(t=e[i=n[o]])&&(r=!0,"_listeners"===i||E(t)||delete e[i]);return r}function T(e,t,i){this.emitter=e,this.event=t,this.listener=i}function S(t,i,n){if(!0===n)s=!0;else if(!1===n)o=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var o=n.async,s=n.promisify,c=n.nextTick,h=n.objectify}if(o||c||s){var l=i,u=i._origin||i;if(c&&!r)throw Error("process.nextTick is not supported");s===e&&(s="AsyncFunction"===i.constructor.name),i=function(){var e=arguments,t=this,i=this.event;return s?c?Promise.resolve():new Promise((function(e){a(e)})).then((function(){return t.event=i,l.apply(t,e)})):(c?process.nextTick:a)((function(){t.event=i,l.apply(t,e)}))},i._async=!0,i._origin=u}return[i,h?new T(this,t,i):this]}function A(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,h.call(this,e)}T.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},A.EventEmitter2=A,A.prototype.listenTo=function(t,r,n){if("object"!=typeof t)throw TypeError("target musts be an object");var o=this;function a(e){if("object"!=typeof e)throw TypeError("events must be an object");var i,r=n.reducers,a=b.call(o,t);i=-1===a?new d(o,t,n):o._observers[a];for(var c,h=s(e),l=h.length,u="function"==typeof r,p=0;p0;)r=i[n],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(e,t,i){return this._once(e,t,!1,i)},A.prototype.prependOnceListener=function(e,t,i){return this._once(e,t,!0,i)},A.prototype._once=function(e,t,i,r){return this._many(e,1,t,i,r)},A.prototype.many=function(e,t,i,r){return this._many(e,t,i,!1,r)},A.prototype.prependMany=function(e,t,i,r){return this._many(e,t,i,!0,r)},A.prototype._many=function(e,t,i,r,n){var o=this;if("function"!=typeof i)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),i.apply(this,arguments)}return a._origin=i,this._on(e,a,r,n)},A.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,i,r,o,a,s=arguments[0],h=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(h&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(i=s.length,n)for(r=0;r3)for(t=new Array(u-1),o=1;o3)for(i=new Array(p-1),a=1;a0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,l.call(this,this._events[t].length,t))):this._events[t]=i,a)},A.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=w.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var a=0;a0){for(i=0,r=(t=this._all).length;i0;)"function"==typeof(r=c[i[o]])?n.push(r):n.push.apply(n,r);return n}if(this.wildcard){if(!(a=this.listenerTree))return[];var h=[],l="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,h,l,a,0),h}return c&&(r=c[t])?"function"==typeof r?[r]:r:[]},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?M.call(this,this.listenerTree,[],null,e):t?s(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.prototype.hasListeners=function(t){if(this.wildcard){var i=[],r="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,i,r,this.listenerTree,0),i.length>0}var n=this._events,o=this._all;return!!(o&&o.length||n&&(t===e?s(n).length:n[t]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.prototype.waitFor=function(t,i){var r=this,n=typeof i;return"number"===n?i={timeout:i}:"function"===n&&(i={filter:i}),x((i=f(i,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:g,Promise:m})).Promise,(function(e,n,o){function a(){var o=i.filter;if(!o||o.apply(r,arguments))if(r.off(t,a),i.handleError){var s=arguments[0];s?n(s):e(u.apply(null,arguments).slice(1))}else e(u.apply(null,arguments))}o((function(){r.off(t,a)})),r._on(t,a,!1)}),{timeout:i.timeout,overload:i.overload})};var L=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return L._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");L._maxListeners=e},enumerable:!0},once:{value:function(e,t,i){return x((i=f(i,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,(function(i,r,n){var o;if("function"==typeof e.addEventListener)return o=function(){i(u.apply(null,arguments))},n((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var a,s=function(){a&&e.removeListener("error",a),i(u.apply(null,arguments))};"error"!==t&&(a=function(i){e.removeListener(t,s),r(i)},e.once("error",a)),n((function(){a&&e.removeListener("error",a),e.removeListener(t,s)})),e.once(t,s)}),{timeout:i.timeout,overload:i.overload})},writable:!0,configurable:!0}}),Object.defineProperties(L,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),Hs.exports=A}();var qs=Ws;class Ys extends qs{constructor(e){super(),e=e||{},this.message=e.message,this.feedbackTopic=e.feedbackTopic,this.tfClient=e.tfClient,this.menuFontSize=e.menuFontSize||"0.8em",this.name=this.message.name,this.header=this.message.header,this.controls=this.message.controls,this.menuEntries=this.message.menu_entries,this.dragging=!1,this.timeoutHandle=null,this.tfTransform=new r.Transform,this.pose=new r.Pose,this.setPoseFromClientBound=this.setPoseFromClient.bind(this),this.onMouseDownBound=this.onMouseDown.bind(this),this.onMouseUpBound=this.onMouseUp.bind(this),this.onButtonClickBound=this.onButtonClick.bind(this),this.onMenuSelectBound=this.onMenuSelect.bind(this),this.setPoseFromServer(this.message.pose),this.tfUpdateBound=this.tfUpdate.bind(this)}subscribeTf(){0===this.message.header.stamp.secs&&0===this.message.header.stamp.nsecs&&this.tfClient.subscribe(this.message.header.frame_id,this.tfUpdateBound)}unsubscribeTf(){this.tfClient.unsubscribe(this.message.header.frame_id,this.tfUpdateBound)}emitServerPoseUpdate(){var e=new r.Pose(this.pose);e.applyTransform(this.tfTransform),this.emit("pose",e)}setPoseFromServer(e){this.pose=new r.Pose(e),this.emitServerPoseUpdate()}tfUpdate(e){this.tfTransform=new r.Transform(e),this.emitServerPoseUpdate()}setPoseFromClient(e){this.pose=new r.Pose(e);var t=this.tfTransform.clone();t.rotation.invert(),t.translation.multiplyQuaternion(t.rotation),t.translation.x*=-1,t.translation.y*=-1,t.translation.z*=-1,this.pose.applyTransform(t),this.sendFeedback(1,void 0,0,e.controlName),this.dragging&&(this.timeoutHandle&&clearTimeout(this.timeoutHandle),this.timeoutHandle=setTimeout(this.setPoseFromClient.bind(this,e),250))}onButtonClick(e){this.sendFeedback(3,e.clickPosition,0,e.controlName)}onMouseDown(e){this.sendFeedback(4,e.clickPosition,0,e.controlName),this.dragging=!0}onMouseUp(e){this.sendFeedback(5,e.clickPosition,0,e.controlName),this.dragging=!1,this.timeoutHandle&&clearTimeout(this.timeoutHandle)}onMenuSelect(e){this.sendFeedback(2,void 0,e.id,e.controlName)}sendFeedback(e,t,i,r){var n=void 0!==t;t=t||{x:0,y:0,z:0};var o={header:this.header,client_id:this.clientID,marker_name:this.name,control_name:r,event_type:e,pose:this.pose,mouse_point:t,mouse_point_valid:n,menu_entry_id:i};this.feedbackTopic.publish(o)}}class Zs extends Ss.Object3D{constructor(e){super(),e=e||{};var t=this;this.tfClient=e.tfClient,this.frameID=e.frameID;var i=e.object;this.pose=e.pose||new r.Pose,this.visible=!1,this.add(i),this.updatePose(this.pose),this.tfUpdate=function(e){var i=new r.Transform(e),n=new r.Pose(t.pose);n.applyTransform(i),t.updatePose(n),t.visible=!0},this.tfClient.subscribe(this.frameID,this.tfUpdate)}updatePose(e){this.position.set(e.position.x,e.position.y,e.position.z),this.quaternion.set(e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w),this.updateMatrixWorld(!0)}unsubscribeTf(){this.tfClient.unsubscribe(this.frameID,this.tfUpdate)}}class Js extends Ss.ArrowHelper{constructor(e){var t=(e=e||{}).origin||new Ss.Vector3(0,0,0),i=e.direction||new Ss.Vector3(1,0,0),r=e.length||1;e.headLength,e.shaftDiameter,e.headDiameter,e.material||new Ss.MeshBasicMaterial,super(i,t,r,16711680)}dispose(){void 0!==this.line&&(this.line.material.dispose(),this.line.geometry.dispose()),void 0!==this.cone&&(this.cone.material.dispose(),this.cone.geometry.dispose())}}class Ks extends Ss.Object3D{constructor(e){super();var t=this,i=(e=e||{}).shaftRadius||.008,r=e.headRadius||.023,n=e.headLength||.1,o=e.scale||1,a=e.lineType||"full",s=e.lineDashLength||.1;function c(e){var r=new Ss.Color;r.setRGB(e.x,e.y,e.z);var n=new Ss.MeshBasicMaterial({color:r.getHex()}),o=new Ss.Vector3;o.crossVectors(e,new Ss.Vector3(0,-1,0));var c=new Ss.Quaternion;c.setFromAxisAngle(o,.5*Math.PI);var h,l=new Ss.Mesh(t.headGeom,n);if(l.position.copy(e),l.position.multiplyScalar(.95),l.quaternion.copy(c),l.updateMatrix(),t.add(l),"dashed"===a)for(var u=s,p=0;u/2+3*u*p+u/2<=1;++p){var d=new Ss.CylinderGeometry(i,i,u);(h=new Ss.Mesh(d,n)).position.copy(e),h.position.multiplyScalar(u/2+3*u*p),h.quaternion.copy(c),h.updateMatrix(),t.add(h)}else"full"===a?((h=new Ss.Mesh(t.lineGeom,n)).position.copy(e),h.position.multiplyScalar(.45),h.quaternion.copy(c),h.updateMatrix(),t.add(h)):console.warn("[Axes]: Unsupported line type. Not drawing any axes.")}this.scale.set(o,o,o),this.lineGeom=new Ss.CylinderGeometry(i,i,1-n),this.headGeom=new Ss.CylinderGeometry(0,r,n),c(new Ss.Vector3(1,0,0)),c(new Ss.Vector3(0,1,0)),c(new Ss.Vector3(0,0,1))}}class Qs extends Ss.Object3D{constructor(e){var t=(e=e||{}).num_cells||10,i=e.color||"#cccccc",r=e.lineWidth||1,n=e.cellSize||1;super();for(var o=new Ss.LineBasicMaterial({color:i,linewidth:r}),a=0;a<=t;++a){var s=n*t/2,c=s-a*n,h=new Ss.Geometry;h.vertices.push(new Ss.Vector3(-s,c,0),new Ss.Vector3(s,c,0));var l=new Ss.Geometry;l.vertices.push(new Ss.Vector3(c,-s,0),new Ss.Vector3(c,s,0)),this.add(new Ss.Line(h,o)),this.add(new Ss.Line(l,o))}}}class $s extends Ss.Mesh{constructor(e){var t=(e=e||{}).message,i=e.opacity||1,r=e.color||{r:255,g:255,b:255,a:255},n=t.info,o=n.origin,a=n.width,s=n.height,c=new Ss.PlaneBufferGeometry(a,s),h=new Uint8Array(a*s*4),l=new Ss.DataTexture(h,a,s,Ss.RGBAFormat);l.flipY=!0,l.minFilter=Ss.NearestFilter,l.magFilter=Ss.NearestFilter,l.needsUpdate=!0;var u=new Ss.MeshBasicMaterial({map:l,transparent:i<1,opacity:i});u.side=Ss.DoubleSide,super(c,u),Object.assign(this,e),this.quaternion.copy(new Ss.Quaternion(o.orientation.x,o.orientation.y,o.orientation.z,o.orientation.w)),this.position.x=a*n.resolution/2+o.position.x,this.position.y=s*n.resolution/2+o.position.y,this.position.z=o.position.z,this.scale.x=n.resolution,this.scale.y=n.resolution;var p=t.data;this.color=r,this.material=u,this.texture=l;for(var d=0;d{const t="read"+e.kind,i="get"+e.kind;this[t]=()=>{if(this._cursor+e.width>this.length)throw new Error("Cannot read data stream. Overflow. Len="+this.length+" crsr="+this._cursor);const t=this._dataView[i](this._cursor,this.isLittleEndian);return this._cursor+=e.width,t}})),Object.defineProperty(this,"isEnd",{get:()=>this.cursor>=this.data.length}),this}class ac{constructor(e){this.resolution=void 0!==e.resolution?e.resolution:1,this.color=new Ss.Color(void 0!==e.color?e.color:"green"),this.opacity=void 0!==e.opacity?e.opacity:1,this.voxelRenderMode=void 0!==e.voxelRenderMode?e.voxelRenderMode:tc,this._rootNode=null,this._treeDepth=16,this._treeMaxKeyVal=32768,this._BINARY_UNALLOCATED=0,this._BINARY_LEAF_FREE=1,this._BINARY_LEAF_OCCUPIED=2,this._BINARY_HAS_CHILDREN=3,this._BINARY_CHILD_BUILD_TABLE={},this._BINARY_CHILD_BUILD_TABLE[this._BINARY_LEAF_FREE]=function(e){e.value=this._defaultFreeValue},this._BINARY_CHILD_BUILD_TABLE[this._BINARY_LEAF_OCCUPIED]=function(e){e.value=this._defaultOccupiedValue},this._BINARY_CHILD_BUILD_TABLE[this._BINARY_HAS_CHILDREN]=function(e){e.value=null},this._FACES=[{normal:[-1,0,0],vertices:[[0,1,0],[0,0,0],[0,1,1],[0,0,1]],childIndex:[1,3,5,7]},{normal:[1,0,0],vertices:[[1,1,1],[1,0,1],[1,1,0],[1,0,0]],childIndex:[0,2,4,6]},{normal:[0,-1,0],vertices:[[1,0,1],[0,0,1],[1,0,0],[0,0,0]],childIndex:[2,3,6,7]},{normal:[0,1,0],vertices:[[0,1,1],[1,1,1],[0,1,0],[1,1,0]],childIndex:[0,1,4,5]},{normal:[0,0,-1],vertices:[[1,0,0],[0,0,0],[1,1,0],[0,1,0]],childIndex:[4,5,6,7]},{normal:[0,0,1],vertices:[[0,0,1],[1,0,1],[0,1,1],[1,1,1]],childIndex:[0,1,2,3]}],this.nodeSizeTable=new Array(this._treeDepth);let t=this.resolution;for(let e=this._treeDepth-1;e>=0;--e)this.nodeSizeTable[e]=t,t*=2;this._defaultOccupiedValue=!0,this._defaultFreeValue=!1,this.object=null}searchAtDepth(e,t){t=void 0!==t&&t>0?t:this._treeDepth;const i=this._adjustKeyAtDepth(e,t),r=this._treeDepth-t;let n=this._rootNode;for(let e=this._treeDepth-1;e>=r;--e){const t=this._computeChildIdx(i,e);if(!n.hasChildAt(t))return n.hasChildren()?null:n;n=n.getChildAt(t)}return n}_computeCoordFromKey(e){return e.map((e=>this.resolution*(e-this._treeMaxKeyVal)))}_computeChildIdx(e,t){let i=0;return e[0]&1<(e-this._treeMaxKeyVal>>i<0;){let e=i.pop();const r=t.readUint16();let n=8;for(;0!==n;){--n;const t=(r&3<<2*n)>>2*n;if(t!==this._BINARY_UNALLOCATED){let r=this._newNode();this._BINARY_CHILD_BUILD_TABLE[t].bind(this)(r),e.createChildNodeAt(r,n),t===this._BINARY_HAS_CHILDREN&&i.push(r)}}}}read(e){null!==this._rootNode&&delete this._rootNode,this._rootNode=this._newNode();let t=new oc(e,!0),i=new Array;for(i.push(this._rootNode);i.length>0;){let e=i.pop();this._readNodeData(t,e);const r=t.readUint8();let n=8;for(;0!==n;){--n;if(r&1<0;){let i=t.pop();if(i.node.isLeafNode())e(i.node,i.key,i.depth-1);else for(let e=0;e<8;++e)if(i.node.hasChildAt(e)){const r=this._computeKeyFromChildIdx(e,i.key,i.depth);t.push({node:i.node.getChildAt(e),depth:i.depth+1,key:r})}}}_obtainColor(e){return this.color}_checkOccupied(e){return!1!==e.value}_buildFaces(){let e={vertices:[],indices:[],normals:[],colors:[],_insertFace:function(e,t,i,r){const n=this.vertices.length/3;e.vertices.forEach((function(e){this.vertices.push(t[0]+e[0]*i,t[1]+e[1]*i,t[2]+e[2]*i)}));const o=[r.r,r.g,r.b];this.colors.push(...o,...o,...o,...o),this.normals.push(...e.normal,...e.normal,...e.normal,...e.normal),this.indices.push(n,n+1,n+2,n+2,n+1,n+3)},_checkNeighborsTouchingFace:function(e,t,i){let r=new Array;for(r.push(t);0!==r.length;){const t=r.pop();t.hasChildren()&&e.childIndex.forEach((function(e){if(!t.hasChildAt(e))return!0;{const n=t.getChildAt(e),o=this._checkOccupied(t);(o&&i===ROS3D.OcTreeVoxelRenderMode.OCCUPIED||!o&&i===ic)&&r.push(n)}}))}return!1}};return this._traverseLeaves(((t,i,r)=>{const n=this._computeCoordFromKey(i),o=this.nodeSizeTable[r],a=this._treeDepth-r,s=this._checkOccupied(t);(s||this.voxelRenderMode!==tc)&&(s&&this.voxelRenderMode===ic||this._FACES.forEach((function(s){const c=[i[0]+s.normal[0]*a*a,i[1]+s.normal[1]*a*a,i[2]+s.normal[2]*a*a],h=this.searchAtDepth(c);null===h?e._insertFace(s,n,o,this._obtainColor(t)):rnew Ss.Color(e))):[{r:0,g:0,b:128},{r:0,g:255,b:0},{r:255,g:255,b:0},{r:255,g:128,b:0},{r:255,g:0,b:0}],this.paletteScale=void 0!==e.paletteScale?e.paletteScale:1}_readNodeData(e,t){t.value=e.readFloat32()}_obtainColor(e){if(this.useFlatColoring)return this.color;const t=1/(1+Math.exp(-e.value*this.paletteScale))*this.palette.length,i=Math.trunc(t),r=t-i;return i<0?this.palette[0]:i>=this.palette.length-1?this.palette[this.palette.length-1]:{r:r*this.palette[i].r+(1-r)*this.palette[i+1].r,g:r*this.palette[i].g+(1-r)*this.palette[i+1].g,b:r*this.palette[i].b+(1-r)*this.palette[i+1].b}}_checkOccupied(e){return e.value>=this.occupancyThreshold}}class cc extends sc{constructor(e){super(e),this.useOwnColor=void 0!==e.palette&&e.colorMode===nc}_readNodeData(e,t){t.value=e.readFloat32(),t.color={r:e.readUint8(),g:e.readUint8(),b:e.readUint8()}}_obtainColor(e){return this.useOwnColor?e.color:sc.prototype._obtainColor.call(this,e)}}class hc extends Ss.Object3D{constructor(e){super(),this.options=e||{},this.ros=e.ros,this.topicName=e.topic||"/particlecloud",this.tfClient=e.tfClient,this.color=e.color||13369599,this.length=e.length||1,this.rootObject=e.rootObject||new Ss.Object3D,this.keep=e.keep||1,this.sns=[],this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"nav_msgs/Odometry"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.sns.length>=this.keep&&(this.sns[0].unsubscribeTf(),this.rootObject.remove(this.sns[0]),this.sns.shift()),this.options.origin=new Ss.Vector3(e.pose.pose.position.x,e.pose.pose.position.y,e.pose.pose.position.z);var t=new Ss.Quaternion(e.pose.pose.orientation.x,e.pose.pose.orientation.y,e.pose.pose.orientation.z,e.pose.pose.orientation.w);this.options.direction=new Ss.Vector3(1,0,0),this.options.direction.applyQuaternion(t),this.options.material=new Ss.MeshBasicMaterial({color:this.color});var i=new Ns(this.options);this.sns.push(new Zs({frameID:e.header.frame_id,tfClient:this.tfClient,object:i})),this.rootObject.add(this.sns[this.sns.length-1])}}class lc extends Ss.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/path",this.tfClient=e.tfClient,this.color=e.color||13369599,this.rootObject=e.rootObject||new Ss.Object3D,this.sn=null,this.line=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"nav_msgs/Path"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){null!==this.sn&&(this.sn.unsubscribeTf(),this.rootObject.remove(this.sn));for(var t=new Ss.Geometry,i=0;i=e.range_min&&n<=e.range_max){var o=e.angle_min+r*e.angle_increment;this.points.positions.array[i++]=n*Math.cos(o),this.points.positions.array[i++]=n*Math.sin(o),this.points.positions.array[i++]=0}}this.points.update(i/3)}}}class yc extends Ss.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/gps/fix",this.rootObject=e.rootObject||new Ss.Object3D,this.object3d=e.object3d||new Ss.Object3D;var t=e.material||{};this.altitudeNaN=e.altitudeNaN||0,this.keep=e.keep||100,this.convert=e.convert||function(e,t,i){return new Ss.Vector3(e,t,i)},this.count=0,this.next1=0,this.next2=this.keep,this.geom=new Ss.BufferGeometry,this.vertices=new Ss.BufferAttribute(new Float32Array(6*this.keep),3),this.geom.addAttribute("position",this.vertices),this.material=t.isMaterial?t:new Ss.LineBasicMaterial(t),this.line=new Ss.Line(this.geom,this.material),this.rootObject.add(this.object3d),this.rootObject.add(this.line),this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"sensor_msgs/NavSatFix"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){var t=isNaN(e.altitude)?this.altitudeNaN:e.altitude,i=this.convert(e.longitude,e.latitude,t);this.object3d.position.copy(i),this.object3d.updateMatrixWorld(!0),this.vertices.array[3*this.next1]=i.x,this.vertices.array[3*this.next1+1]=i.y,this.vertices.array[3*this.next1+2]=i.z,this.vertices.array[3*this.next2]=i.x,this.vertices.array[3*this.next2+1]=i.y,this.vertices.array[3*this.next2+2]=i.z,this.vertices.needsUpdate=!0,this.next1=(this.next1+1)%this.keep,this.next2=this.next1+this.keep,this.count=Math.min(this.count+1,this.keep),this.geom.setDrawRange(this.next2-this.count,this.count)}}function xc(e,t,i,r){var n,o=0,a=0,s=0,c=e.length,h=t.length,l=((r=r||1)-1)*(i=i||h)*8;for(n=0;n=8&&(a-=8,t[s++]=o>>>a&255,s%i==0&&(n+=Math.ceil((l-a)/6),(a%=8)>0&&(o=xc.e[e.charAt(n)])));return Math.floor(s/i)}xc.S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xc.e={};for(var bc=0;bc<64;bc++)xc.e[xc.S.charAt(bc)]=bc;class wc extends Ss.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/points",this.throttle_rate=e.throttle_rate||null,this.compression=e.compression||"cbor",this.max_pts=e.max_pts||1e4,this.points=new vc(e),this.rosTopic=void 0,this.buffer=null,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"sensor_msgs/PointCloud2",throttle_rate:this.throttle_rate,queue_length:1,compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){if(this.points.setup(e.header.frame_id,e.point_step,e.fields)){var t,i=this.points.pointRatio,r=this.max_pts*e.point_step;e.data.buffer?(this.buffer=e.data.slice(0,Math.min(e.data.byteLength,r)),t=Math.min(e.height*e.width/i,this.points.positions.array.length/3)):((!this.buffer||this.buffer.byteLength0?(r=d[0].object,p.intersection=this.lastIntersection=d[0]):r=this.fallbackTarget,r!==this.lastTarget&&e.type.match(/mouse/)){var f=this.notify(r,"mouseover",p);0===f?this.notify(this.lastTarget,"mouseout",p):1===f&&(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(r,"mouseover",p),this.notify(this.lastTarget,"mouseout",p))}r!==this.lastTarget&&e.type.match(/touch/)&&(this.notify(r,e.type,p)?(this.notify(this.lastTarget,"touchleave",p),this.notify(this.lastTarget,"touchend",p)):(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(this.lastTarget,"touchmove",p),this.notify(this.lastTarget,"touchend",p)));this.notify(r,e.type,p),"mousedown"!==e.type&&"touchstart"!==e.type&&"touchmove"!==e.type||(this.dragging=!0),this.lastTarget=r}notify(e,t,i){for(i.type=t,i.cancelBubble=!1,i.continueBubble=!1,i.stopPropagation=function(){i.cancelBubble=!0},i.continuePropagation=function(){i.continueBubble=!0},i.currentTarget=e;i.currentTarget;){if(i.currentTarget.dispatchEvent&&i.currentTarget.dispatchEvent instanceof Function){if(i.currentTarget.dispatchEvent(i),i.cancelBubble)return this.dispatchEvent(i),0;if(i.continueBubble)return 2}i.currentTarget=i.currentTarget.parent}return 1}}class Sc extends Ss.EventDispatcher{constructor(e){super();var t=this,i=(e=e||{}).scene;this.camera=e.camera,this.center=new Ss.Vector3,this.userZoom=!0,this.userZoomSpeed=e.userZoomSpeed||1,this.userRotate=!0,this.userRotateSpeed=e.userRotateSpeed||1,this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed||2,this.displayPanAndZoomFrame=void 0===e.displayPanAndZoomFrame||!!e.displayPanAndZoomFrame,this.lineTypePanAndZoomFrame=e.dashedPanAndZoomFrame||"full",this.camera.up=new Ss.Vector3(0,0,1);var r=1800,n=new Ss.Vector2,o=new Ss.Vector2,a=new Ss.Vector2,s=new Ss.Vector2,c=new Ss.Vector2,h=new Ss.Vector2,l=new Ss.Vector3,u=new Ss.Vector3,p=new Ss.Vector3,d=new Ss.Vector3,f=new Array(2),m=new Array(2);this.phiDelta=0,this.thetaDelta=0,this.scale=1,this.lastPosition=new Ss.Vector3;var v=-1,g=0,y=1,x=2,b=v;function w(e,t,i){var r=new Ss.Vector3;new Ss.Vector3;r.subVectors(t,e.origin);var n=e.direction.dot(i);if(Math.abs(n)0?t.zoomIn():t.zoomOut(),this.showAxes()}}this.axes=new Ks({shaftRadius:.025,headRadius:.07,headLength:.2,lineType:this.lineTypePanAndZoomFrame}),this.displayPanAndZoomFrame&&(i.add(this.axes),this.axes.traverse((function(e){e.visible=!1}))),this.addEventListener("mousedown",(function(e){var i=e.domEvent;switch(i.preventDefault(),i.button){case 0:b=g,n.set(i.clientX,i.clientY);break;case 1:b=x,u=new Ss.Vector3(0,0,1);var r=(new Ss.Matrix4).extractRotation(this.camera.matrix);u.applyMatrix4(r),l=t.center.clone(),p=t.camera.position.clone(),d=w(e.mouseRay,l,u);break;case 2:b=y,s.set(i.clientX,i.clientY)}this.showAxes()})),this.addEventListener("mouseup",(function(e){t.userRotate&&(b=v)})),this.addEventListener("mousemove",(function(e){var i=e.domEvent;if(b===g)o.set(i.clientX,i.clientY),a.subVectors(o,n),t.rotateLeft(2*Math.PI*a.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*a.y/r*t.userRotateSpeed),n.copy(o),this.showAxes();else if(b===y)c.set(i.clientX,i.clientY),h.subVectors(c,s),h.y>0?t.zoomIn():t.zoomOut(),s.copy(c),this.showAxes();else if(b===x){var f=w(e.mouseRay,t.center,u);if(!f)return;var m=(new Ss.Vector3).subVectors(d.clone(),f.clone());t.center.addVectors(l.clone(),m.clone()),t.camera.position.addVectors(p.clone(),m.clone()),t.update(),t.camera.updateMatrixWorld(),this.showAxes()}})),this.addEventListener("touchstart",(function(e){var i=e.domEvent;switch(i.touches.length){case 1:b=g,n.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY);break;case 2:b=v,u=new Ss.Vector3(0,0,1);var r=(new Ss.Matrix4).extractRotation(this.camera.matrix);u.applyMatrix4(r),l=t.center.clone(),p=t.camera.position.clone(),d=w(e.mouseRay,l,u),f[0]=new Ss.Vector2(i.touches[0].pageX,i.touches[0].pageY),f[1]=new Ss.Vector2(i.touches[1].pageX,i.touches[1].pageY),m[0]=new Ss.Vector2(0,0),m[1]=new Ss.Vector2(0,0)}this.showAxes(),i.preventDefault()})),this.addEventListener("touchmove",(function(e){var i=e.domEvent;if(b===g)o.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY),a.subVectors(o,n),t.rotateLeft(2*Math.PI*a.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*a.y/r*t.userRotateSpeed),n.copy(o),this.showAxes();else{if(m[0].set(f[0].x-i.touches[0].pageX,f[0].y-i.touches[0].pageY),m[1].set(f[1].x-i.touches[1].pageX,f[1].y-i.touches[1].pageY),m[0].lengthSq()>10&&m[1].lengthSq()>10&&(f[0].set(i.touches[0].pageX,i.touches[0].pageY),f[1].set(i.touches[1].pageX,i.touches[1].pageY),m[0].dot(m[1])>0&&b!==y?b=x:m[0].dot(m[1])<0&&b!==x&&(b=y),b===y)){var s=new Ss.Vector2;s.subVectors(f[0],f[1]),m[0].dot(s)<0&&m[1].dot(s)>0?t.zoomOut():m[0].dot(s)>0&&m[1].dot(s)<0&&t.zoomIn()}if(b===x){var c=w(e.mouseRay,t.center,u);if(!c)return;var h=(new Ss.Vector3).subVectors(d.clone(),c.clone());t.center.addVectors(l.clone(),h.clone()),t.camera.position.addVectors(p.clone(),h.clone()),t.update(),t.camera.updateMatrixWorld()}this.showAxes(),i.preventDefault()}})),this.addEventListener("touchend",(function(e){var t=e.domEvent;1===t.touches.length&&b!==g?(b=g,n.set(t.touches[0].pageX-window.scrollX,t.touches[0].pageY-window.scrollY)):b=v})),this.addEventListener("mousewheel",_),this.addEventListener("DOMMouseScroll",_)}showAxes(){var e=this;this.axes.traverse((function(e){e.visible=!0})),this.hideTimeout&&clearTimeout(this.hideTimeout),this.hideTimeout=setTimeout((function(){e.axes.traverse((function(e){e.visible=!1})),e.hideTimeout=!1}),1e3)}rotateLeft(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta-=e}rotateRight(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta+=e}rotateUp(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta-=e}rotateDown(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta+=e}zoomIn(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale/=e}zoomOut(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale*=e}update(){var e=this.camera.position,t=e.clone().sub(this.center),i=Math.atan2(t.y,t.x),r=Math.atan2(Math.sqrt(t.y*t.y+t.x*t.x),t.z);this.autoRotate&&this.rotateLeft(2*Math.PI/60/60*this.autoRotateSpeed),i+=this.thetaDelta,r+=this.phiDelta;var n=1e-6;r=Math.max(n,Math.min(Math.PI-n,r));var o=t.length();t.set(o*Math.sin(r)*Math.cos(i),o*Math.sin(r)*Math.sin(i),o*Math.cos(r)),t.multiplyScalar(this.scale),e.copy(this.center).add(t),this.camera.lookAt(this.center),o=t.length(),this.axes.position.copy(this.center),this.axes.scale.set(.05*o,.05*o,.05*o),this.axes.updateMatrixWorld(!0),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.lastPosition.distanceTo(this.camera.position)>0&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position))}}return e.Arrow=Ns,e.Arrow2=Js,e.Axes=Ks,e.ColorOcTree=cc,e.DepthCloud=Ps,e.Grid=Qs,e.Highlighter=Ec,e.INTERACTIVE_MARKER_BUTTON=2,e.INTERACTIVE_MARKER_BUTTON_CLICK=3,e.INTERACTIVE_MARKER_FIXED=1,e.INTERACTIVE_MARKER_INHERIT=0,e.INTERACTIVE_MARKER_KEEP_ALIVE=0,e.INTERACTIVE_MARKER_MENU=1,e.INTERACTIVE_MARKER_MENU_SELECT=2,e.INTERACTIVE_MARKER_MOUSE_DOWN=4,e.INTERACTIVE_MARKER_MOUSE_UP=5,e.INTERACTIVE_MARKER_MOVE_3D=7,e.INTERACTIVE_MARKER_MOVE_AXIS=3,e.INTERACTIVE_MARKER_MOVE_PLANE=4,e.INTERACTIVE_MARKER_MOVE_ROTATE=6,e.INTERACTIVE_MARKER_MOVE_ROTATE_3D=9,e.INTERACTIVE_MARKER_NONE=0,e.INTERACTIVE_MARKER_POSE_UPDATE=1,e.INTERACTIVE_MARKER_ROTATE_3D=8,e.INTERACTIVE_MARKER_ROTATE_AXIS=5,e.INTERACTIVE_MARKER_VIEW_FACING=2,e.InteractiveMarker=js,e.InteractiveMarkerClient=class{constructor(e){e=e||{},this.ros=e.ros,this.tfClient=e.tfClient,this.topicName=e.topic,this.path=e.path||"/",this.camera=e.camera,this.rootObject=e.rootObject||new Ss.Object3D,this.loader=e.loader,this.menuFontSize=e.menuFontSize||"0.8em",this.interactiveMarkers={},this.updateTopic=null,this.feedbackTopic=null,this.topicName&&this.subscribe(this.topicName)}subscribe(e){this.unsubscribe(),this.updateTopic=new r.Topic({ros:this.ros,name:e+"/tunneled/update",messageType:"visualization_msgs/InteractiveMarkerUpdate",compression:"png"}),this.updateTopic.subscribe(this.processUpdate.bind(this)),this.feedbackTopic=new r.Topic({ros:this.ros,name:e+"/feedback",messageType:"visualization_msgs/InteractiveMarkerFeedback",compression:"png"}),this.feedbackTopic.advertise(),this.initService=new r.Service({ros:this.ros,name:e+"/tunneled/get_init",serviceType:"demo_interactive_markers/GetInit"});var t=new r.ServiceRequest({});this.initService.callService(t,this.processInit.bind(this))}unsubscribe(){for(var e in this.updateTopic&&this.updateTopic.unsubscribe(this.processUpdate),this.feedbackTopic&&this.feedbackTopic.unadvertise(),this.interactiveMarkers)this.eraseIntMarker(e);this.interactiveMarkers={}}processInit(e){var t=e.msg;for(var i in t.erases=[],this.interactiveMarkers)t.erases.push(i);t.poses=[],this.processUpdate(t)}processUpdate(e){var t=this;e.erases.forEach((function(e){t.eraseIntMarker(e)})),e.poses.forEach((function(e){var i=t.interactiveMarkers[e.name];i&&i.setPoseFromServer(e.pose)})),e.markers.forEach((function(e){var i=t.interactiveMarkers[e.name];i&&t.eraseIntMarker(i.name);var r=new Ys({message:e,feedbackTopic:t.feedbackTopic,tfClient:t.tfClient,menuFontSize:t.menuFontSize});t.interactiveMarkers[e.name]=r;var n=new js({handle:r,camera:t.camera,path:t.path,loader:t.loader});n.name=e.name,t.rootObject.add(n),r.on("pose",(function(e){n.onServerSetPose({pose:e})})),n.addEventListener("user-pose-change",r.setPoseFromClientBound),n.addEventListener("user-mousedown",r.onMouseDownBound),n.addEventListener("user-mouseup",r.onMouseUpBound),n.addEventListener("user-button-click",r.onButtonClickBound),n.addEventListener("menu-select",r.onMenuSelectBound),r.subscribeTf()}))}eraseIntMarker(e){if(this.interactiveMarkers[e]){var t=this.rootObject.getObjectByName(e);this.rootObject.remove(t);var i=this.interactiveMarkers[e];i.unsubscribeTf(),t.removeEventListener("user-pose-change",i.setPoseFromClientBound),t.removeEventListener("user-mousedown",i.onMouseDownBound),t.removeEventListener("user-mouseup",i.onMouseUpBound),t.removeEventListener("user-button-click",i.onButtonClickBound),t.removeEventListener("menu-select",i.onMenuSelectBound),delete this.interactiveMarkers[e],t.dispose()}}},e.InteractiveMarkerControl=Gs,e.InteractiveMarkerHandle=Ys,e.InteractiveMarkerMenu=Vs,e.LaserScan=gc,e.MARKER_ARROW=0,e.MARKER_CUBE=1,e.MARKER_CUBE_LIST=6,e.MARKER_CYLINDER=3,e.MARKER_LINE_LIST=5,e.MARKER_LINE_STRIP=4,e.MARKER_MESH_RESOURCE=10,e.MARKER_POINTS=8,e.MARKER_SPHERE=2,e.MARKER_SPHERE_LIST=7,e.MARKER_TEXT_VIEW_FACING=9,e.MARKER_TRIANGLE_LIST=11,e.Marker=ks,e.MarkerArrayClient=class extends qs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.path=e.path||"/",this.markers={},this.rosTopic=void 0,this.subscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"visualization_msgs/MarkerArray",compression:"png"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){e.markers.forEach(function(e){var t=e.ns+e.id;if(0===e.action){var i=!1;if(t in this.markers&&((i=this.markers[t].children[0].update(e))||this.removeMarker(t)),!i){var r=new ks({message:e,path:this.path});this.markers[t]=new Zs({frameID:e.header.frame_id,tfClient:this.tfClient,object:r}),this.rootObject.add(this.markers[t])}}else if(1===e.action)console.warn('Received marker message with deprecated action identifier "1"');else if(2===e.action)this.removeMarker(t);else if(3===e.action){for(var n in this.markers)this.removeMarker(n);this.markers={}}else console.warn('Received marker message with unknown action identifier "'+e.action+'"')}.bind(this)),this.emit("change")}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}removeMarker(e){var t=this.markers[e];t&&(t.unsubscribeTf(),this.rootObject.remove(t),t.children.forEach((e=>{e.dispose()})),delete this.markers[e])}},e.MarkerClient=class extends qs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.path=e.path||"/",this.lifetime=e.lifetime||0,this.markers={},this.rosTopic=void 0,this.updatedTime={},this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}checkTime(e){if((new Date).getTime()-this.updatedTime[e]>this.lifetime)this.removeMarker(e),this.emit("change");else{var t=this;setTimeout((function(){t.checkTime(e)}),100)}}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"visualization_msgs/Marker",compression:"png"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){var t=e.ns+e.id,i=this.markers[t];if(this.updatedTime[t]=(new Date).getTime(),i?this.removeMarker(t):this.lifetime&&this.checkTime(e.ns+e.id),0===e.action){var r=new ks({message:e,path:this.path});this.markers[t]=new Zs({frameID:e.header.frame_id,tfClient:this.tfClient,object:r}),this.rootObject.add(this.markers[t])}this.emit("change")}removeMarker(e){var t=this.markers[e];t&&(t.unsubscribeTf(),this.rootObject.remove(t),t.children.forEach((e=>{e.dispose()})),delete this.markers[e])}},e.MeshLoader=Fs,e.MeshResource=Bs,e.MouseHandler=Tc,e.NavSatFix=yc,e.OcTree=sc,e.OcTreeClient=class extends qs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/octomap",this.compression=e.compression||"cbor",this.continuous=e.continuous,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.offsetPose=e.offsetPose||new r.Pose,this.options={},void 0!==e.color&&(this.options.color=e.color),void 0!==e.opacity&&(this.options.opacity=e.opacity),void 0!==e.colorMode&&(this.options.colorMode=e.colorMode),void 0!==e.palette&&(this.options.palette=e.palette),void 0!==e.paletteScale&&(this.options.paletteScale=e.palette),void 0!==e.voxelRenderMode&&(this.options.voxelRenderMode=e.voxelRenderMode),this.currentMap=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"octomap_msgs/Octomap",queue_length:1,compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.currentMap&&this.currentMap.tfClient&&this.currentMap.unsubscribeTf(),this._processMessagePrivate(e),this.continuous||this.rosTopic.unsubscribe(this.processMessage)}_loadOcTree(e){return new Promise(function(t,i){const r=Object.assign({resolution:e.resolution},this.options);let n=null;if(e.binary)n=new ac(r),n.readBinary(e.data);else{const t={OcTree:sc,ColorOcTree:cc};e.id in t&&(console.log(e.id,t),n=new t[e.id](r),n.read(e.data))}n.buildGeometry(),t(n)}.bind(this))}_processMessagePrivate(e){this._loadOcTree(e).then(function(t){const i=this.sceneNode;this.tfClient?(this.currentMap=t,this.sceneNode=new Zs({frameID:e.header.frame_id,tfClient:this.tfClient,object:t.object,pose:this.offsetPose})):(this.sceneNode=t.object,this.currentMap=t),this.rootObject.remove(i),this.rootObject.add(this.sceneNode),this.emit("change")}.bind(this))}},e.OccupancyGrid=$s,e.OccupancyGridClient=class extends qs{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/map",this.compression=e.compression||"cbor",this.continuous=e.continuous,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.offsetPose=e.offsetPose||new r.Pose,this.color=e.color||{r:255,g:255,b:255},this.opacity=e.opacity||1,this.currentGrid=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe(this.processMessage)}subscribe(){this.unsubscribe(),this.rosTopic=new r.Topic({ros:this.ros,name:this.topicName,messageType:"nav_msgs/OccupancyGrid",queue_length:1,compression:this.compression}),this.sceneNode=null,this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.currentGrid&&(this.tfClient?(this.sceneNode.unsubscribeTf(),this.sceneNode.remove(this.currentGrid)):this.rootObject.remove(this.currentGrid),this.currentGrid.dispose());var t=new $s({message:e,color:this.color,opacity:this.opacity});this.tfClient?(this.currentGrid=t,null===this.sceneNode?(this.sceneNode=new Zs({frameID:e.header.frame_id,tfClient:this.tfClient,object:t,pose:this.offsetPose}),this.rootObject.add(this.sceneNode)):this.sceneNode.add(this.currentGrid)):(this.sceneNode=this.currentGrid=t,this.rootObject.add(this.currentGrid)),this.emit("change"),this.continuous||this.rosTopic.unsubscribe(this.processMessage)}},e.Odometry=hc,e.OrbitControls=Sc,e.Path=lc,e.Point=uc,e.PointCloud2=wc,e.Points=vc,e.Polygon=pc,e.Pose=dc,e.PoseArray=fc,e.PoseWithCovariance=mc,e.SceneNode=Zs,e.TFAxes=_c,e.TriangleList=zs,e.Urdf=Mc,e.UrdfClient=class{constructor(e){var t=this,i=(e=e||{}).ros;this.param=e.param||"robot_description",this.path=e.path||"/",this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ss.Object3D,this.tfPrefix=e.tfPrefix||"",this.loader=e.loader,new r.Param({ros:i,name:this.param}).get((function(e){var i=new r.UrdfModel({string:e});t.urdf=new Mc({urdfModel:i,path:t.path,tfClient:t.tfClient,tfPrefix:t.tfPrefix,loader:t.loader}),t.rootObject.add(t.urdf)}))}},e.Viewer=class{constructor(e){var t=(e=e||{}).divID,i=e.elem,r=e.width,n=e.height,o=e.background||"#111111",a=e.antialias,s=e.intensity||.66,c=e.near||.01,h=e.far||1e3,l=e.alpha||1,u=e.cameraPose||{x:3,y:3,z:3},p=e.cameraZoomSpeed||.5,d=void 0===e.displayPanAndZoomFrame||!!e.displayPanAndZoomFrame,f=e.lineTypePanAndZoomFrame||"full";this.renderer=new Ss.WebGLRenderer({antialias:a,alpha:!0}),this.renderer.setClearColor(parseInt(o.replace("#","0x"),16),l),this.renderer.sortObjects=!1,this.renderer.setSize(r,n),this.renderer.shadowMap.enabled=!1,this.renderer.autoClear=!1,this.scene=new Ss.Scene,this.camera=new Ss.PerspectiveCamera(40,r/n,c,h),this.camera.position.x=u.x,this.camera.position.y=u.y,this.camera.position.z=u.z,this.cameraControls=new Sc({scene:this.scene,camera:this.camera,displayPanAndZoomFrame:d,lineTypePanAndZoomFrame:f}),this.cameraControls.userZoomSpeed=p,this.scene.add(new Ss.AmbientLight(5592405)),this.directionalLight=new Ss.DirectionalLight(16777215,s),this.scene.add(this.directionalLight),this.selectableObjects=new Ss.Group,this.scene.add(this.selectableObjects);var m=new Tc({renderer:this.renderer,camera:this.camera,rootObject:this.selectableObjects,fallbackTarget:this.cameraControls});this.highlighter=new Ec({mouseHandler:m}),this.stopped=!0,this.animationRequestId=void 0,(i||document.getElementById(t)).appendChild(this.renderer.domElement),this.start()}start(){this.stopped=!1,this.draw()}draw(){this.stopped||(this.cameraControls.update(),this.directionalLight.position.normalize(),this.renderer.clear(!0,!0,!0),this.renderer.render(this.scene,this.camera),this.highlighter.renderHighlights(this.scene,this.renderer,this.camera),this.animationRequestId=requestAnimationFrame(this.draw.bind(this)))}stop(){this.stopped||cancelAnimationFrame(this.animationRequestId),this.stopped=!0}addObject(e,t){t?this.selectableObjects.add(e):this.scene.add(e)}resize(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t)}},e.closestAxisPoint=Cs,e.findClosestPoint=Rs,e.intersectPlane=Ls,e.makeColorMaterial=As,Object.defineProperty(e,"__esModule",{value:!0}),e}({},ROSLIB);