diff --git a/SystemControl/README.md b/SystemControl/README.md index 346ea08..aa600a6 100644 --- a/SystemControl/README.md +++ b/SystemControl/README.md @@ -1,17 +1,8 @@ -# JarvisControl -This is an example project, generated by AntOS Development Kit +# SystemControl -## Howto -Use the CodePad command palette to access to the SDK functionalities: +System monitoring is a part of my ROS Based robot software system. -1. Create new project -2. Init the project from the current folder located in side bar -3. Build and run the project -4. Release the project in zip package - -## Set up build target - -Open the `project.json` file from the current project tree and add/remove -build target entries. Save the file +It allows to dislay the robot system info mation on Antos application +via the Antunnel service diff --git a/SystemControl/build/debug/README.md b/SystemControl/build/debug/README.md index 346ea08..aa600a6 100644 --- a/SystemControl/build/debug/README.md +++ b/SystemControl/build/debug/README.md @@ -1,17 +1,8 @@ -# JarvisControl -This is an example project, generated by AntOS Development Kit +# SystemControl -## Howto -Use the CodePad command palette to access to the SDK functionalities: +System monitoring is a part of my ROS Based robot software system. -1. Create new project -2. Init the project from the current folder located in side bar -3. Build and run the project -4. Release the project in zip package - -## Set up build target - -Open the `project.json` file from the current project tree and add/remove -build target entries. Save the file +It allows to dislay the robot system info mation on Antos application +via the Antunnel service diff --git a/SystemControl/build/debug/main.js b/SystemControl/build/debug/main.js index 302bc52..13e20f7 100644 --- a/SystemControl/build/debug/main.js +++ b/SystemControl/build/debug/main.js @@ -1,13769 +1 @@ -(function() { - var SysmondService, SystemControl; - - SysmondService = class SysmondService extends OS.application.BaseService { - constructor(args) { - super("SysmondService", args); - this.text = __("{0}%", 0..toString()); - this.iconclass = "fa fa-android"; - this.app = void 0; - //@nodes = [ - // {text: __("Status"), id: 1}, - // {text: __("Shutdown"), id: 3}, - // {text: __("Reboot"), id: 4}, - // {text: __("Exit service"), id: 2} - //] - this.onmenuselect = (e) => { - return this.openApp(); - }; - } - - init() { - var checklib; - checklib = () => { - if (!Antunnel.tunnel) { - this.error(__("The Antunnel service is not started, please start it first")); - this._gui.pushService("Antunnel/AntunnelService").catch((e) => { - return this.error(e.toString(), e); - }); - return this.quit(); - } else { - this.tunnel = Antunnel.tunnel; - this.sub = new Antunnel.Subscriber("fbf070ddea3ea90d07f456540b405d302554ec82"); - this.sub.onopen = () => { - //@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode("Hello") - return console.log("Subscribed to notification channel"); - }; - this.sub.onerror = (e) => { - return this.error(__("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e); - }; - //@sub = undefined - this.sub.onmessage = (e) => { - var obj; - if (e.data) { - obj = JSON.parse(new TextDecoder("utf-8").decode(e.data)); - } - // update the battery - this.text = __("{0}%", Math.round(obj.battery_percent).toString()); - if (this.app) { - this.app.feed(obj); - } - return this.update(); - }; - this.sub.onclose = () => { - this.sub = void 0; - this.notify(__("Unsubscribed to the notification service")); - return this.quit(); - }; - return Antunnel.tunnel.subscribe(this.sub); - } - }; - return checklib(); - } - - openApp() { - if (this.app) { - return; - } - return this._gui.launch("SystemControl", []); - } - - execute(cmd) {} - - //return unless @tunnel - //sub = new Antunnel.Subscriber("jarvis_control") - //sub.onopen = () => - // console.log("Subscribed to jarvis_control channel. Send the command") - // sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode(cmd) - // sub.close() - - //sub.onerror = (e) => - // @error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e - //@sub = undefined - - //sub.onclose = () => - // @notify __("Unsubscribed to the jarvis_control service") - //@tunnel.subscribe sub - awake() {} - - cleanup() { - if (this.sub) { - return this.sub.close(); - } - } - - }; - - this.OS.register("SysmondService", SysmondService); - - SystemControl = class SystemControl extends this.OS.application.BaseApplication { - constructor(args) { - super("SystemControl", args); - } - - main() { - this.diskchart = $(this.find("disk-area")).epoch({ - type: 'time.gauge', - value: 0 - }); - this.on("resize", () => { - var el; - el = this.find("cpu-area"); - if (this.cpu) { - $(el).children().hide(); - this.cpu.option("width", $(el).width()); - this.cpu.option("height", $(el).height()); - $(el).children().show(); - } - el = this.find("battery-area"); - el = this.find("memory-area"); - if (this.memory) { - $(el).children().hide(); - this.memory.option("width", $(el).width()); - this.memory.option("height", $(el).height()); - $(el).children().show(); - } - el = this.find("network-area"); - if (this.network) { - $(el).children().hide(); - this.network.option("width", $(el).width()); - this.network.option("height", $(el).height()); - $(el).children().show(); - } - el = this.find("temp-area"); - if (this.temp) { - $(el).children().hide(); - this.temp.option("width", $(el).width()); - this.temp.option("height", $(el).height()); - $(el).children().show(); - } - el = this.find("battery-area"); - if (this.battery) { - $(el).children().hide(); - this.battery.option("width", $(el).width()); - this.battery.option("height", $(el).height()); - return $(el).children().show(); - } - }); - return this._gui.pushService("SystemControl/SysmondService", []).then((p) => { - this.service = p; - return p.app = this; - }).catch((e) => { - return this.error(__("Unable to start sysmond service"), e); - }); - } - - streamline(name, data, range, labels) { - var dobj, i, item, j, k, legend, len, len1, options; - i = 0; - legend = $(this.find(`${name}-text`)); - if (!this[name]) { - options = { - type: 'time.line', - axes: ['bottom', 'left', "right"] - }; - if (range) { - options.range = range; - } - dobj = []; - for (j = 0, len = data.length; j < len; j++) { - item = data[j]; - dobj.push({ - label: `label-${i}`, - values: [] - }); - $("
=i.length)return n;var r=[],a=o[e++];return n.forEach((function(n,i){r.push({key:n,values:t(i,e)})})),a?r.sort((function(t,n){return a(t.key,n.key)})):r}(a(t.map,n,0),0)},r.key=function(t){return i.push(t),r},r.sortKeys=function(t){return o[i.length-1]=t,r},r.sortValues=function(t){return n=t,r},r.rollup=function(t){return e=t,r},r},t.set=function(t){var n=new C;if(t)for(var e=0,r=t.length;e 360?t-=360:t<0&&(t+=360),t<60?r+(i-r)*t/60:t<180?i:t<240?r+(i-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)||n<0?0:n>1?1:n,r=2*(e=e<0?0:e>1?1:e)-(i=e<=.5?e*(1+n):e+n-e*n),new en(o(t+120),o(t),o(t-120))}function $t(n,e,r){return this instanceof $t?(this.h=+n,this.c=+e,void(this.l=+r)):arguments.length<2?n instanceof $t?new $t(n.h,n.c,n.l):Jt(n instanceof Zt?n.l:(n=cn((n=t.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new $t(n,e,r)}Vt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new jt(this.h,this.s,this.l/t)},Vt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new jt(this.h,this.s,t*this.l)},Vt.rgb=function(){return Bt(this.h,this.s,this.l)},t.hcl=$t;var Yt=$t.prototype=new Ht;function Wt(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new Zt(e,Math.cos(t*=Nt)*n,Math.sin(t)*n)}function Zt(t,n,e){return this instanceof Zt?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof $t?Wt(t.h,t.c,t.l):cn((t=en(t)).r,t.g,t.b):new Zt(t,n,e)}Yt.brighter=function(t){return new $t(this.h,this.c,Math.min(100,this.l+Xt*(arguments.length?t:1)))},Yt.darker=function(t){return new $t(this.h,this.c,Math.max(0,this.l-Xt*(arguments.length?t:1)))},Yt.rgb=function(){return Wt(this.h,this.c,this.l).rgb()},t.lab=Zt;var Xt=18,Gt=Zt.prototype=new Ht;function Qt(t,n,e){var r=(t+16)/116,i=r+n/500,o=r-e/200;return new en(nn(3.2404542*(i=.95047*Kt(i))-1.5371385*(r=1*Kt(r))-.4985314*(o=1.08883*Kt(o))),nn(-.969266*i+1.8760108*r+.041556*o),nn(.0556434*i-.2040259*r+1.0572252*o))}function Jt(t,n,e){return t>0?new $t(Math.atan2(e,n)*Tt,Math.sqrt(n*n+e*e),t):new $t(NaN,NaN,t)}function Kt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function tn(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function nn(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function en(t,n,e){return this instanceof en?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof en?new en(t.r,t.g,t.b):sn(""+t,en,Bt):new en(t,n,e)}function rn(t){return new en(t>>16,t>>8&255,255&t)}function on(t){return rn(t)+""}Gt.brighter=function(t){return new Zt(Math.min(100,this.l+Xt*(arguments.length?t:1)),this.a,this.b)},Gt.darker=function(t){return new Zt(Math.max(0,this.l-Xt*(arguments.length?t:1)),this.a,this.b)},Gt.rgb=function(){return Qt(this.l,this.a,this.b)},t.rgb=en;var an=en.prototype=new Ht;function un(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function sn(t,n,e){var r,i,o,a=0,u=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return n(fn(i[0]),fn(i[1]),fn(i[2]))}return(o=pn.get(t))?n(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a|=a>>4,u=240&o,u|=u>>4,s=15&o,s|=s<<4):7===t.length&&(a=(16711680&o)>>16,u=(65280&o)>>8,s=255&o)),n(a,u,s))}function ln(t,n,e){var r,i,o=Math.min(t/=255,n/=255,e/=255),a=Math.max(t,n,e),u=a-o,s=(a+o)/2;return u?(i=s<.5?u/(a+o):u/(2-a-o),r=t==a?(n-e)/u+(n =h[0]&&s<=h[1]&&((u=l[t.bisect(f,s,1,g)-1]).y+=d,u.push(o[a]));return l}return o.value=function(t){return arguments.length?(e=t,o):e},o.range=function(t){return arguments.length?(r=gn(t),o):r},o.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return Go(n,t)}:gn(t),o):i},o.frequency=function(t){return arguments.length?(n=!!t,o):n},o},t.layout.pack=function(){var n,e=t.layout.hierarchy().sort(Jo),r=0,i=[1,1];function o(t,o){var a=e.call(this,t,o),u=a[0],s=i[0],l=i[1],c=null==n?Math.sqrt:"function"==typeof n?n:function(){return n};if(u.x=u.y=0,zo(u,(function(t){t.r=+c(t.value)})),zo(u,ea),r){var h=r*(n?1:Math.max(2*u.r/s,2*u.r/l))/2;zo(u,(function(t){t.r+=h})),zo(u,ea),zo(u,(function(t){t.r-=h}))}return function t(n,e,r,i){var o=n.children;if(n.x=e+=i*n.x,n.y=r+=i*n.y,n.r*=i,o)for(var a=-1,u=o.length;++ap.x&&(p=t),t.depth>g.depth&&(g=t)}));var d=e(f,p)/2-f.x,y=r[0]/(p.x+e(p,f)/2+d),v=r[1]/(g.depth||1);Lo(c,(function(t){t.x=(t.x+d)*y,t.y=t.depth*v}))}return l}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n.length){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+e(t._,i._));t.parent.A=function(t,n,r){if(n){for(var i,o=t,a=t,u=n,s=o.parent.children[0],l=o.m,c=a.m,h=u.m,f=s.m;u=sa(u),o=ua(o),u&&o;)s=ua(s),(a=sa(a)).a=t,(i=u.z+h-o.z-l+e(u._,o._))>0&&(la(ca(u,t,r),t,i),l+=i,c+=i),h+=u.m,l+=o.m,f+=s.m,c+=a.m;u&&!sa(a)&&(a.t=u,a.m+=h-c),o&&!ua(s)&&(s.t=o,s.m+=l-f,r=t)}return r}(t,i,t.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=r[0],t.y=t.depth*r[1]}return o.separation=function(t){return arguments.length?(e=t,o):e},o.size=function(t){return arguments.length?(i=null==(r=t)?s:null,o):i?null:r},o.nodeSize=function(t){return arguments.length?(i=null==(r=t)?null:s,o):i?r:null},Fo(o,n)},t.layout.cluster=function(){var n=t.layout.hierarchy().sort(null).value(null),e=aa,r=[1,1],i=!1;function o(o,a){var u,s=n.call(this,o,a),l=s[0],c=0;zo(l,(function(n){var r=n.children;r&&r.length?(n.x=function(t){return t.reduce((function(t,n){return t+n.x}),0)/t.length}(r),n.y=function(n){return 1+t.max(n,(function(t){return t.y}))}(r)):(n.x=u?c+=e(n,u):0,n.y=0,u=n)}));var h=function t(n){var e=n.children;return e&&e.length?t(e[0]):n}(l),f=function t(n){var e,r=n.children;return r&&(e=r.length)?t(r[e-1]):n}(l),p=h.x-e(h,f)/2,g=f.x+e(f,h)/2;return zo(l,i?function(t){t.x=(t.x-l.x)*r[0],t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-p)/(g-p)*r[0],t.y=(1-(l.y?t.y/l.y:1))*r[1]}),s}return o.separation=function(t){return arguments.length?(e=t,o):e},o.size=function(t){return arguments.length?(i=null==(r=t),o):i?null:r},o.nodeSize=function(t){return arguments.length?(i=null!=(r=t),o):i?r:null},Fo(o,n)},t.layout.treemap=function(){var n,e=t.layout.hierarchy(),r=Math.round,i=[1,1],o=null,a=ha,u=!1,s="squarify",l=.5*(1+Math.sqrt(5));function c(t,n){for(var e,r,i=-1,o=t.length;++i e)t.label=u[e];else if(o&&r.length>e)t.label=r[e];else if(i){for(a=[];e>=0;)a.push(String.fromCharCode(65+e%26)),e-=26;t.label=a.join("")}return t},Epoch.Data.Format.array=(f={x:function(t,n){return n},y:function(t,n){return t},time:function(t,n,e){return parseInt(e)+parseInt(n)},type:"area",autoLabels:!1,labels:[],startTime:parseInt((new Date).getTime()/1e3)},h=function(t,n,e){var r,i,o;if(i=[],Epoch.isArray(t[0]))for(r in t)a.call(t,r)&&(o=t[r],i.push(l({values:o.map(e)},n,parseInt(r))));else i.push(l({values:t.map(e)},n,0));return i},g=function(t,n){return h(t,n,(function(t,e){return{x:n.x(t,e),y:n.y(t,e)}}))},v=function(t,n){return h(t,n,(function(t,e){return{time:n.time(t,e,n.startTime),y:n.y(t,e)}}))},d=function(t,n){return h(t,n,(function(t,e){return{time:n.time(t,e,n.startTime),histogram:t}}))},y=function(t,n){var e,r,i;for(e in r=[],t)if(a.call(t,e)){if(i=t[e],!Epoch.isNumber(t[0]))return[];r.push(l({value:i},n,e))}return r},(p=function(t,n){var e;return null==t&&(t=[]),null==n&&(n={}),Epoch.isNonEmptyArray(t)?"time.heatmap"===(e=Epoch.Util.defaults(n,f)).type?d(t,e):e.type.match(/^time\./)?v(t,e):"pie"===e.type?y(t,e):g(t,e):[]}).entry=function(t,n){var e,r,i,o,a,u,s,l;if(null==n&&(n={}),"time.gauge"===n.type)return null==t?0:(u=Epoch.Util.defaults(n,f),e=Epoch.isArray(t)?t[0]:t,u.y(e,0));if(null==t)return[];for(null==n.startTime&&(n.startTime=parseInt((new Date).getTime()/1e3)),r=Epoch.isArray(t)?t.map((function(t){return[t]})):[t],l=[],i=0,a=(s=p(r,n)).length;i-1},i.prototype.innerWidth=function(){return this.width-(this.margins.left+this.margins.right)},i.prototype.innerHeight=function(){return this.height-(this.margins.top+this.margins.bottom)},i.prototype.x=function(){var t,n;return t=null!=(n=this.options.domain)?n:this.extent((function(t){return t.x})),d3.scale.linear().domain(t).range([0,this.innerWidth()])},i.prototype.y=function(t){return d3.scale.linear().domain(this._getScaleDomain(t)).range([this.innerHeight(),0])},i.prototype.bottomAxis=function(){return d3.svg.axis().scale(this.x()).orient("bottom").ticks(this.options.ticks.bottom).tickFormat(this.options.tickFormats.bottom)},i.prototype.topAxis=function(){return d3.svg.axis().scale(this.x()).orient("top").ticks(this.options.ticks.top).tickFormat(this.options.tickFormats.top)},i.prototype.leftAxis=function(){var t;return t=this.options.range?this.options.range.left:null,d3.svg.axis().scale(this.y(t)).orient("left").ticks(this.options.ticks.left).tickFormat(this.options.tickFormats.left)},i.prototype.rightAxis=function(){var t;return t=this.options.range?this.options.range.right:null,d3.svg.axis().scale(this.y(t)).orient("right").ticks(this.options.ticks.right).tickFormat(this.options.tickFormats.right)},i.prototype.draw=function(){return this._axesDrawn?this._redrawAxes():this._drawAxes(),i.__super__.draw.call(this)},i.prototype._redrawAxes=function(){if(this.hasAxis("bottom")&&this.g.selectAll(".x.axis.bottom").transition().duration(500).ease("linear").call(this.bottomAxis()),this.hasAxis("top")&&this.g.selectAll(".x.axis.top").transition().duration(500).ease("linear").call(this.topAxis()),this.hasAxis("left")&&this.g.selectAll(".y.axis.left").transition().duration(500).ease("linear").call(this.leftAxis()),this.hasAxis("right"))return this.g.selectAll(".y.axis.right").transition().duration(500).ease("linear").call(this.rightAxis())},i.prototype._drawAxes=function(){return this.hasAxis("bottom")&&this.g.append("g").attr("class","x axis bottom").attr("transform","translate(0, "+this.innerHeight()+")").call(this.bottomAxis()),this.hasAxis("top")&&this.g.append("g").attr("class","x axis top").call(this.topAxis()),this.hasAxis("left")&&this.g.append("g").attr("class","y axis left").call(this.leftAxis()),this.hasAxis("right")&&this.g.append("g").attr("class","y axis right").attr("transform","translate("+this.innerWidth()+", 0)").call(this.rightAxis()),this._axesDrawn=!0},i.prototype.dimensionsChanged=function(){return i.__super__.dimensionsChanged.call(this),this.g.selectAll(".axis").remove(),this._axesDrawn=!1,this.draw()},i.prototype.marginsChanged=function(){var t,n,e;if(null!=this.options.margins){for(t in n=this.options.margins)a.call(n,t)&&(e=n[t],this.margins[t]=null==e?6:e);return this.g.transition().duration(750).attr("transform","translate("+this.margins.left+", "+this.margins.top+")"),this.draw()}},i.prototype.axesChanged=function(){var t,e,r,i;for(t=0,e=(i=["top","right","bottom","left"]).length;t 0||this.options.paintZeroValues)&&(this.p.fillStyle=this._computeColor(M,y,i),this.p.fillRect(E,(c-1)*l,k-this.options.bucketPadding,l-this.options.bucketPadding)),w.push(c--)}return w},i.prototype._shiftPaintCanvas=function(){var t;return t=this.p.getImageData(this.w(),0,this.paintWidth-this.w(),this.paintHeight),this.p.putImageData(t,0,0)},i.prototype._avgLab=function(t,n){var e,r,i,o,u,s,l,c,h,f,p;for(l=(f=[0,0,0,0])[0],e=f[1],r=f[2],p=f[3],s=0,c=t.length;s0&&(n=n.slice(0,a));var s=gt.get(n);function l(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}return s&&(n=s,u=yt),a?r?function(){var t=u(r,e(arguments));l.call(this),this.addEventListener(n,this[o]=t,t.$=i),t._=r}:l:r?z:function(){var e,r=new RegExp("^__on([^.]+)"+t.requote(n)+"$");for(var i in this)if(e=i.match(r)){var o=this[i];this.removeEventListener(e[1],o,o.$),delete this[i]}}}t.selection.enter=ct,t.selection.enter.prototype=ht,ht.append=$.append,ht.empty=$.empty,ht.node=$.node,ht.call=$.call,ht.size=$.size,ht.select=function(t){for(var n,e,r,i,o,a=[],u=-1,s=this.length;++u0?1:t<0?-1:0}function Lt(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function zt(t){return t>1?0:t<-1?Et:Math.acos(t)}function Dt(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Pt(t){return(t=Math.sin(t/2))*t}var qt=Math.SQRT2;t.interpolateZoom=function(t,n){var e,r,i=t[0],o=t[1],a=t[2],u=n[0],s=n[1],l=n[2],c=u-i,h=s-o,f=c*c+h*h;if(f24?(isFinite(n)&&(clearTimeout(_n),_n=setTimeout(Mn,n)),xn=0):(xn=1,wn(Mn))}function kn(){for(var t=Date.now(),n=vn;n;)t>=n.t&&n.c(t-n.t)&&(n.c=null),n=n.n;return t}function En(){for(var t,n=vn,e=1/0;n;)n.c?(n.t1)if(f>g){if(o){if(o.y>=l)return}else o={x:(s-i)/r,y:s};e={x:(l-i)/r,y:l}}else{if(o){if(o.y=u)return}else o={x:a,y:r*a+i};e={x:u,y:r*u+i}}else{if(o){if(o.xMt||v(i-e)>Mt)&&(u.splice(a,0,new Li((m=o.site,x=c,_=v(r-h)0)for(a=-1;++a0;)l[--f].call(t,a);if(o>=1)return h.event&&h.event.end.call(t,t.__data__,n),--c.count?delete c[r]:delete t[e],1}h||(o=i.time,a=bn((function(t){var n=h.delay;if(a.t=n+o,n<=t)return f(t-n);a.c=f}),0,o),h=c[r]={tween:new _,time:o,timer:a,delay:i.delay,duration:i.duration,ease:i.ease,index:n},i=null,++c.count)}_u.call=$.call,_u.empty=$.empty,_u.node=$.node,_u.size=$.size,t.transition=function(n,e){return n&&n.transition?mu?n.transition(e):n:t.selection().transition(n)},t.transition.prototype=_u,_u.select=function(t){var n,e,r,i=this.id,o=this.namespace,a=[];t=Y(t);for(var u=-1,s=this.length;++urect,.s>rect").attr("width",u[1]-u[0])}function d(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function y(){var h,y,v=this,m=t.select(t.event.target),x=r.of(v,arguments),_=t.select(v),w=m.datum(),b=!/^(n|s)$/.test(w)&&i,M=!/^(e|w)$/.test(w)&&a,k=m.classed("extent"),E=xt(v),S=t.mouse(v),A=t.select(o(v)).on("keydown.brush",T).on("keyup.brush",F);if(t.event.changedTouches?A.on("touchmove.brush",L).on("touchend.brush",D):A.on("mousemove.brush",L).on("mouseup.brush",D),_.interrupt().selectAll("*").interrupt(),k)S[0]=u[0]-S[0],S[1]=s[0]-S[1];else if(w){var C=+/w$/.test(w),N=+/^n/.test(w);y=[u[1-C]-S[0],s[1-N]-S[1]],S[0]=u[C],S[1]=s[N]}else t.event.altKey&&(h=S.slice());function T(){32==t.event.keyCode&&(k||(h=null,S[0]-=u[1],S[1]-=s[1],k=2),P())}function F(){32==t.event.keyCode&&2==k&&(S[0]+=u[1],S[1]+=s[1],k=0,P())}function L(){var n=t.mouse(v),e=!1;y&&(n[0]+=y[0],n[1]+=y[1]),k||(t.event.altKey?(h||(h=[(u[0]+u[1])/2,(s[0]+s[1])/2]),S[0]=u[+(n[0]