From 530f7ec63778c83eaba4382395ee68b2dbc15808 Mon Sep 17 00:00:00 2001 From: MatthijsBurgh Date: Mon, 4 Oct 2021 19:44:29 +0000 Subject: [PATCH] Update Build --- build/ros3d.cjs.js | 124 +++++++++++++++++++++++---------------------- build/ros3d.esm.js | 124 +++++++++++++++++++++++---------------------- build/ros3d.js | 124 +++++++++++++++++++++++---------------------- build/ros3d.min.js | 2 +- 4 files changed, 193 insertions(+), 181 deletions(-) diff --git a/build/ros3d.cjs.js b/build/ros3d.cjs.js index a5314edb..bba1fb4b 100644 --- a/build/ros3d.cjs.js +++ b/build/ros3d.cjs.js @@ -48410,83 +48410,87 @@ var eventemitter2 = {exports: {}}; var listeners= null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], nextType = type[i + 1], branches, _listeners; - if (i === typeLength && tree._listeners) { + if (i === typeLength) { // // If at the end of the event(s) list and the tree has listeners // invoke those listeners. // - if (typeof tree._listeners === 'function') { - handlers && handlers.push(tree._listeners); - return [tree]; - } else { - handlers && handlers.push.apply(handlers, tree._listeners); - return [tree]; + + if(tree._listeners) { + if (typeof tree._listeners === 'function') { + handlers && handlers.push(tree._listeners); + listeners = [tree]; + } else { + handlers && handlers.push.apply(handlers, tree._listeners); + listeners = [tree]; + } } - } + } else { - if (currentType === '*') { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + if (currentType === '*') { + // + // If the event emitted is '*' at this part + // or there is a concrete match at this patch + // + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } } - } - return listeners; - } else if (currentType === '**') { - endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); - if (endReached && tree._listeners) { - // The next element has a _listeners, add it to the handlers. - listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); - } + return listeners; + } else if (currentType === '**') { + endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); + if (endReached && tree._listeners) { + // The next element has a _listeners, add it to the handlers. + listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); + } - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - if (branch === '*' || branch === '**') { - if (tree[branch]._listeners && !endReached) { - _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + if (branch === '*' || branch === '**') { + if (tree[branch]._listeners && !endReached) { + _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); + } else if (branch === nextType) { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); + } else { + // No match on this one, shift into the tree but not in the type array. + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); } - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } else if (branch === nextType) { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); - } else { - // No match on this one, shift into the tree but not in the type array. - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } } + return listeners; + } else if (tree[currentType]) { + listeners = searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); } - return listeners; - }else if (tree[currentType]) { - listeners= searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); } xTree = tree['*']; diff --git a/build/ros3d.esm.js b/build/ros3d.esm.js index 83a954ec..e748d08c 100644 --- a/build/ros3d.esm.js +++ b/build/ros3d.esm.js @@ -48386,83 +48386,87 @@ var eventemitter2 = {exports: {}}; var listeners= null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], nextType = type[i + 1], branches, _listeners; - if (i === typeLength && tree._listeners) { + if (i === typeLength) { // // If at the end of the event(s) list and the tree has listeners // invoke those listeners. // - if (typeof tree._listeners === 'function') { - handlers && handlers.push(tree._listeners); - return [tree]; - } else { - handlers && handlers.push.apply(handlers, tree._listeners); - return [tree]; + + if(tree._listeners) { + if (typeof tree._listeners === 'function') { + handlers && handlers.push(tree._listeners); + listeners = [tree]; + } else { + handlers && handlers.push.apply(handlers, tree._listeners); + listeners = [tree]; + } } - } + } else { - if (currentType === '*') { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + if (currentType === '*') { + // + // If the event emitted is '*' at this part + // or there is a concrete match at this patch + // + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } } - } - return listeners; - } else if (currentType === '**') { - endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); - if (endReached && tree._listeners) { - // The next element has a _listeners, add it to the handlers. - listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); - } + return listeners; + } else if (currentType === '**') { + endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); + if (endReached && tree._listeners) { + // The next element has a _listeners, add it to the handlers. + listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); + } - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - if (branch === '*' || branch === '**') { - if (tree[branch]._listeners && !endReached) { - _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + if (branch === '*' || branch === '**') { + if (tree[branch]._listeners && !endReached) { + _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); + } else if (branch === nextType) { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); + } else { + // No match on this one, shift into the tree but not in the type array. + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); } - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } else if (branch === nextType) { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); - } else { - // No match on this one, shift into the tree but not in the type array. - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } } + return listeners; + } else if (tree[currentType]) { + listeners = searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); } - return listeners; - }else if (tree[currentType]) { - listeners= searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); } xTree = tree['*']; diff --git a/build/ros3d.js b/build/ros3d.js index 8ab57d0e..a7f6dbeb 100644 --- a/build/ros3d.js +++ b/build/ros3d.js @@ -48476,83 +48476,87 @@ var ROS3D = (function (exports, ROSLIB) { var listeners= null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], nextType = type[i + 1], branches, _listeners; - if (i === typeLength && tree._listeners) { + if (i === typeLength) { // // If at the end of the event(s) list and the tree has listeners // invoke those listeners. // - if (typeof tree._listeners === 'function') { - handlers && handlers.push(tree._listeners); - return [tree]; - } else { - handlers && handlers.push.apply(handlers, tree._listeners); - return [tree]; + + if(tree._listeners) { + if (typeof tree._listeners === 'function') { + handlers && handlers.push(tree._listeners); + listeners = [tree]; + } else { + handlers && handlers.push.apply(handlers, tree._listeners); + listeners = [tree]; + } } - } + } else { - if (currentType === '*') { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + if (currentType === '*') { + // + // If the event emitted is '*' at this part + // or there is a concrete match at this patch + // + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } } - } - return listeners; - } else if (currentType === '**') { - endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); - if (endReached && tree._listeners) { - // The next element has a _listeners, add it to the handlers. - listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); - } + return listeners; + } else if (currentType === '**') { + endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); + if (endReached && tree._listeners) { + // The next element has a _listeners, add it to the handlers. + listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); + } - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - if (branch === '*' || branch === '**') { - if (tree[branch]._listeners && !endReached) { - _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + branches = ownKeys(tree); + n = branches.length; + while (n-- > 0) { + branch = branches[n]; + if (branch !== '_listeners') { + if (branch === '*' || branch === '**') { + if (tree[branch]._listeners && !endReached) { + _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); + } else if (branch === nextType) { + _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); + } else { + // No match on this one, shift into the tree but not in the type array. + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); } - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } else if (branch === nextType) { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); - } else { - // No match on this one, shift into the tree but not in the type array. - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else { - listeners = _listeners; + if (_listeners) { + if (listeners) { + listeners.push.apply(listeners, _listeners); + } else { + listeners = _listeners; + } } } } + return listeners; + } else if (tree[currentType]) { + listeners = searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); } - return listeners; - }else if (tree[currentType]) { - listeners= searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); } xTree = tree['*']; diff --git a/build/ros3d.min.js b/build/ros3d.min.js index ef1586e8..917a410a 100644 --- a/build/ros3d.min.js +++ b/build/ros3d.min.js @@ -9,4 +9,4 @@ Object.assign(za.prototype,{_getValue_unbound:za.prototype.getValue,_setValue_un * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. - */Us=Fs,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}if(i[_]&&(b=w(e,t,i[_],r+1,n)),(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)}))})._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 R=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return R._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");R._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(R,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),Us.exports=A}();var Bs=Fs.exports;class zs extends Bs{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(INTERACTIVE_MARKER_POSE_UPDATE,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(INTERACTIVE_MARKER_BUTTON_CLICK,e.clickPosition,0,e.controlName)}onMouseDown(e){this.sendFeedback(INTERACTIVE_MARKER_MOUSE_DOWN,e.clickPosition,0,e.controlName),this.dragging=!0}onMouseUp(e){this.sendFeedback(INTERACTIVE_MARKER_MOUSE_UP,e.clickPosition,0,e.controlName),this.dragging=!1,this.timeoutHandle&&clearTimeout(this.timeoutHandle)}onMenuSelect(e){this.sendFeedback(INTERACTIVE_MARKER_MENU_SELECT,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 ks 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 Gs 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 Vs 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 js 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))}}}Ss.STLLoader=function(e){this.manager=void 0!==e?e:Ss.DefaultLoadingManager},Ss.STLLoader.prototype={constructor:Ss.STLLoader,load:function(e,t,i,r){var n=this,o=new Ss.FileLoader(n.manager);o.setResponseType("arraybuffer"),o.load(e,(function(e){t(n.parse(e))}),i,r)},parse:function(e){var t=function(e){if("string"==typeof e){for(var t=new Uint8Array(e.length),i=0;i>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 R=new Ss.Object3D;R.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&&(O=!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||t{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 Qs{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:OcTreeVoxelRenderMode.OCCUPIED,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 Ks(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===OcTreeVoxelRenderMode.FREE)&&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!==OcTreeVoxelRenderMode.OCCUPIED)&&(s&&this.voxelRenderMode===OcTreeVoxelRenderMode.FREE||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 tc extends ec{constructor(e){super(e),this.useOwnColor=void 0!==e.palette&&e.colorMode===OcTreeColorMode.COLOR}_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:ec.prototype._obtainColor.call(this,e)}}class ic 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()}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 Ls(this.options);this.sns.push(new ks({frameID:e.header.frame_id,tfClient:this.tfClient,object:i})),this.rootObject.add(this.sns[this.sns.length-1])}}class rc 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()}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 uc 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()}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 pc(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=pc.e[e.charAt(n)])));return Math.floor(s/i)}pc.S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pc.e={};for(var dc=0;dc<64;dc++)pc.e[pc.S.charAt(dc)]=dc;class fc 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 hc(e),this.rosTopic=void 0,this.buffer=null,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}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 xc 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 Vs({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=Ls,e.Arrow2=Gs,e.Axes=Vs,e.ColorOcTree=tc,e.DepthCloud=Rs,e.Grid=js,e.Highlighter=gc,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=Ds,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.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 zs({message:e,feedbackTopic:t.feedbackTopic,tfClient:t.tfClient,menuFontSize:t.menuFontSize});t.interactiveMarkers[e.name]=r;var n=new Ds({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=Is,e.InteractiveMarkerHandle=zs,e.InteractiveMarkerMenu=Os,e.LaserScan=lc,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=Ns,e.MarkerArrayClient=class extends Bs{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){if(0===e.action){var t=!1;if(e.ns+e.id in this.markers&&((t=this.markers[e.ns+e.id].children[0].update(e))||this.removeMarker(e.ns+e.id)),!t){var i=new Ns({message:e,path:this.path});this.markers[e.ns+e.id]=new ks({frameID:e.header.frame_id,tfClient:this.tfClient,object:i}),this.rootObject.add(this.markers[e.ns+e.id])}}else if(1===e.action)console.warn('Received marker message with deprecated action identifier "1"');else if(2===e.action)this.removeMarker(e.ns+e.id);else if(3===e.action){for(var r in this.markers)this.removeMarker(r);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()}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 Bs{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()}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=this.markers[e.ns+e.id];if(this.updatedTime[e.ns+e.id]=(new Date).getTime(),t?this.removeMarker(e.ns+e.id):this.lifetime&&this.checkTime(e.ns+e.id),0===e.action){var i=new Ns({message:e,path:this.path});this.markers[e.ns+e.id]=new ks({frameID:e.header.frame_id,tfClient:this.tfClient,object:i}),this.rootObject.add(this.markers[e.ns+e.id])}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=Ys,e.MeshResource=Cs,e.MouseHandler=yc,e.NavSatFix=uc,e.OcTree=ec,e.OcTreeClient=class extends Bs{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()}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()}_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 Qs(r),n.readBinary(e.data);else{const t={OcTree:ec,ColorOcTree:tc};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 ks({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.OcTreeColorMode=$s,e.OcTreeVoxelRenderMode={OCCUPIED:"occupied",FREE:"free",ALL:"all"},e.OccupancyGrid=Zs,e.OccupancyGridClient=class extends Bs{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()}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.currentGrid.tfClient&&this.currentGrid.unsubscribeTf(),this.sceneNode.remove(this.currentGrid),this.currentGrid.dispose());var t=new Zs({message:e,color:this.color,opacity:this.opacity});this.tfClient?(this.currentGrid=t,null===this.sceneNode?(this.sceneNode=new ks({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()}},e.Odometry=ic,e.OrbitControls=xc,e.Path=rc,e.Point=nc,e.PointCloud2=fc,e.Points=hc,e.Polygon=oc,e.Pose=ac,e.PoseArray=sc,e.PoseWithCovariance=cc,e.REVISION="1.0.1",e.SceneNode=ks,e.TFAxes=mc,e.TriangleList=Ps,e.Urdf=vc,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 vc({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 xc({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 yc({renderer:this.renderer,camera:this.camera,rootObject:this.selectableObjects,fallbackTarget:this.cameraControls});this.highlighter=new gc({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=function(e,t,i){var r=e.origin.clone();r.project(t);var n=e.direction.clone().add(e.origin);n.project(t);var o=n.clone().sub(r),a=(new Ss.Vector2).subVectors(i,r).dot(o)/o.dot(o),s=new Ss.Vector2;s.addVectors(r,o.clone().multiplyScalar(a));var c=new Ss.Vector3(s.x,s.y,.5);c.unproject(t);var h=new Ss.Ray(t.position,c.sub(t.position).normalize());return As(e,h)},e.findClosestPoint=As,e.intersectPlane=function(e,t,i){var r=new Ss.Vector3,n=new Ss.Vector3;r.subVectors(t,e.origin);var o=e.direction.dot(i);if(!(Math.abs(o)0;)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)}))})._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 R=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return R._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");R._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(R,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),Us.exports=A}();var Bs=Fs.exports;class zs extends Bs{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(INTERACTIVE_MARKER_POSE_UPDATE,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(INTERACTIVE_MARKER_BUTTON_CLICK,e.clickPosition,0,e.controlName)}onMouseDown(e){this.sendFeedback(INTERACTIVE_MARKER_MOUSE_DOWN,e.clickPosition,0,e.controlName),this.dragging=!0}onMouseUp(e){this.sendFeedback(INTERACTIVE_MARKER_MOUSE_UP,e.clickPosition,0,e.controlName),this.dragging=!1,this.timeoutHandle&&clearTimeout(this.timeoutHandle)}onMenuSelect(e){this.sendFeedback(INTERACTIVE_MARKER_MENU_SELECT,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 ks 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 Gs 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 Vs 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 js 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))}}}Ss.STLLoader=function(e){this.manager=void 0!==e?e:Ss.DefaultLoadingManager},Ss.STLLoader.prototype={constructor:Ss.STLLoader,load:function(e,t,i,r){var n=this,o=new Ss.FileLoader(n.manager);o.setResponseType("arraybuffer"),o.load(e,(function(e){t(n.parse(e))}),i,r)},parse:function(e){var t=function(e){if("string"==typeof e){for(var t=new Uint8Array(e.length),i=0;i>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 R=new Ss.Object3D;R.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&&(O=!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||t{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 Qs{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:OcTreeVoxelRenderMode.OCCUPIED,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 Ks(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===OcTreeVoxelRenderMode.FREE)&&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!==OcTreeVoxelRenderMode.OCCUPIED)&&(s&&this.voxelRenderMode===OcTreeVoxelRenderMode.FREE||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 tc extends ec{constructor(e){super(e),this.useOwnColor=void 0!==e.palette&&e.colorMode===OcTreeColorMode.COLOR}_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:ec.prototype._obtainColor.call(this,e)}}class ic 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()}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 Ls(this.options);this.sns.push(new ks({frameID:e.header.frame_id,tfClient:this.tfClient,object:i})),this.rootObject.add(this.sns[this.sns.length-1])}}class rc 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()}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 uc 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()}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 pc(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=pc.e[e.charAt(n)])));return Math.floor(s/i)}pc.S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pc.e={};for(var dc=0;dc<64;dc++)pc.e[pc.S.charAt(dc)]=dc;class fc 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 hc(e),this.rosTopic=void 0,this.buffer=null,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}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 xc 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 Vs({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=Ls,e.Arrow2=Gs,e.Axes=Vs,e.ColorOcTree=tc,e.DepthCloud=Rs,e.Grid=js,e.Highlighter=gc,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=Ds,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.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 zs({message:e,feedbackTopic:t.feedbackTopic,tfClient:t.tfClient,menuFontSize:t.menuFontSize});t.interactiveMarkers[e.name]=r;var n=new Ds({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=Is,e.InteractiveMarkerHandle=zs,e.InteractiveMarkerMenu=Os,e.LaserScan=lc,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=Ns,e.MarkerArrayClient=class extends Bs{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){if(0===e.action){var t=!1;if(e.ns+e.id in this.markers&&((t=this.markers[e.ns+e.id].children[0].update(e))||this.removeMarker(e.ns+e.id)),!t){var i=new Ns({message:e,path:this.path});this.markers[e.ns+e.id]=new ks({frameID:e.header.frame_id,tfClient:this.tfClient,object:i}),this.rootObject.add(this.markers[e.ns+e.id])}}else if(1===e.action)console.warn('Received marker message with deprecated action identifier "1"');else if(2===e.action)this.removeMarker(e.ns+e.id);else if(3===e.action){for(var r in this.markers)this.removeMarker(r);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()}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 Bs{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()}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=this.markers[e.ns+e.id];if(this.updatedTime[e.ns+e.id]=(new Date).getTime(),t?this.removeMarker(e.ns+e.id):this.lifetime&&this.checkTime(e.ns+e.id),0===e.action){var i=new Ns({message:e,path:this.path});this.markers[e.ns+e.id]=new ks({frameID:e.header.frame_id,tfClient:this.tfClient,object:i}),this.rootObject.add(this.markers[e.ns+e.id])}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=Ys,e.MeshResource=Cs,e.MouseHandler=yc,e.NavSatFix=uc,e.OcTree=ec,e.OcTreeClient=class extends Bs{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()}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()}_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 Qs(r),n.readBinary(e.data);else{const t={OcTree:ec,ColorOcTree:tc};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 ks({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.OcTreeColorMode=$s,e.OcTreeVoxelRenderMode={OCCUPIED:"occupied",FREE:"free",ALL:"all"},e.OccupancyGrid=Zs,e.OccupancyGridClient=class extends Bs{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()}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.currentGrid.tfClient&&this.currentGrid.unsubscribeTf(),this.sceneNode.remove(this.currentGrid),this.currentGrid.dispose());var t=new Zs({message:e,color:this.color,opacity:this.opacity});this.tfClient?(this.currentGrid=t,null===this.sceneNode?(this.sceneNode=new ks({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()}},e.Odometry=ic,e.OrbitControls=xc,e.Path=rc,e.Point=nc,e.PointCloud2=fc,e.Points=hc,e.Polygon=oc,e.Pose=ac,e.PoseArray=sc,e.PoseWithCovariance=cc,e.REVISION="1.0.1",e.SceneNode=ks,e.TFAxes=mc,e.TriangleList=Ps,e.Urdf=vc,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 vc({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 xc({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 yc({renderer:this.renderer,camera:this.camera,rootObject:this.selectableObjects,fallbackTarget:this.cameraControls});this.highlighter=new gc({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=function(e,t,i){var r=e.origin.clone();r.project(t);var n=e.direction.clone().add(e.origin);n.project(t);var o=n.clone().sub(r),a=(new Ss.Vector2).subVectors(i,r).dot(o)/o.dot(o),s=new Ss.Vector2;s.addVectors(r,o.clone().multiplyScalar(a));var c=new Ss.Vector3(s.x,s.y,.5);c.unproject(t);var h=new Ss.Ray(t.position,c.sub(t.position).normalize());return As(e,h)},e.findClosestPoint=As,e.intersectPlane=function(e,t,i){var r=new Ss.Vector3,n=new Ss.Vector3;r.subVectors(t,e.origin);var o=e.direction.dot(i);if(!(Math.abs(o)