whatsopt / XDSMjs

XDSM generator written in javascript.
Apache License 2.0
12 stars 4 forks source link

Fontello icons not showing in OpenMDAO #6

Closed onodip closed 5 years ago

onodip commented 5 years ago

In the OpenMDAO implementation the icons are not showing up correctly (see top left corner of the picture). This is surely related to the embedding of the styles and scripts. Somehow the path to the fontello icons is not correct. Any ideas?

image

Source:

<style type="text/css">
/*
 * XDSMjs
 * Copyright 2016 Rémi Lafage
 */

/* Component types */
.xdsm .driver {
    visibility: hidden;
}

.xdsm .optimization {
    fill: #CCCCFF;
    stroke: black;
    stroke-width: 1px;
}

.xdsm .lp_optimization {
    fill: #CCCCFF;
    stroke: black;
    stroke-width: 1px;
}

.xdsm .analysis {
    fill: #CCFFCC;
    stroke: black;
    stroke-width: 1px;
}

.xdsm .mdo {
    fill: #FFCCCC;
    stroke: black;
    stroke-width: 1px;
}

.xdsm .function {
    fill: #F2CCD9;
    stroke: black;
    stroke-width: 1px;
}

.xdsm .mda {
    fill: #FFE5CC;
    stroke: black;
    stroke-width: 1px;
}

.xdsm .metamodel {
    fill: #FFFCCC;
    stroke: black;
    stroke-width: 1px;
}

.xdsm .doe {
    fill: #FFFCCC;
    stroke: black;
    stroke-width: 1px;
}

/* Title */
.xdsm g.title text {
    display: block;
    font-size: 2em;
    margin-top: 0.67em;
    margin-bottom: 0.67em;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
}
.xdsm g.title rect {
    fill: none;
}

/* Text Default */
.xdsm text {
  fill: black;
  stroke: none;
  font-size: large;
  font-family: Arial, sans-serif;
}
.xdsm tspan.sub {
  font-size: small;
}
.xdsm tspan.sup {
  font-size: small;
}

/* Data */
.xdsm .dataInter polygon {
  fill: #E5E5E5;
  stroke: black;
  stroke-width: 1px;
}

.xdsm .dataIO polygon {
  fill: #FFFFFF;
  stroke: black;
  stroke-width: 1px;
}

/* Dataflow */
.xdsm g.dataflow {
    fill: none;
    stroke: grey;
    stroke-width: 8px;
}

/* Workflow */
.xdsm g.workflow {
    fill: none;
    stroke: black;
    stroke-width: 2px;
}

/* Tooltip */
div.tooltip {
    position: absolute;
    text-align: center;
    padding: 10px;
    background: lightsteelblue;
    border: 0px;
    border-radius: 8px;
    pointer-events: none;
}

/* Info */
div.optpb {
    position: absolute;
    padding: 10px;
    background: #CCCCFF;
    border: 0px;
    border-radius: 8px;
    font-size: 150%;
}

sub, sup {
  /* Specified in % so that the sup/sup is the right size relative to the surrounding text */
  font-size: 75%;
  /* Zero out the line-height so that it doesn't interfere with the positioning that follows */
  line-height: 0;
  /* Where the magic happens: makes all browsers position the sup/sup properly, relative to the surrounding text */
  position: relative;
  /* Note that if you're using Eric Meyer's reset.css, this is already set and you can remove this rule */
  vertical-align: baseline;
}

sup {
  /* Move the superscripted text up */
  top: -0.5em;
}

sub {
  /* Move the subscripted text down, but only half as far down as the superscript moved up */
  bottom: -0.5em;
}

@font-face {
  font-family: 'fontello';
  src: url('./fontello.woff?10863448') format('woff');
  font-weight: normal;
  font-style: normal;
}

[class^="icon-"]:before, [class*=" icon-"]:before {
  font-family: "fontello";
  font-style: normal;
  font-weight: normal;
  speak: none;

  display: inline-block;
  text-decoration: inherit;
  width: 1em;
  margin-right: .2em;
  text-align: center;
  /* opacity: .8; */

  /* For safety - reset parent styles, that can break glyph codes*/
  font-variant: normal;
  text-transform: none;

  /* fix buttons height, for twitter bootstrap */
  line-height: 1em;

  /* Animation center compensation - margins should be symmetric */
  /* remove if not needed */
  margin-left: .2em;

  /* you can be more comfortable with increased icons size */
  font-size: 200%;

  /* Font smoothing. That was taken from TWBS */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Uncomment for 3D effect */
  /*text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3);*/
}

.icon-start:before { content: '\e800'; } /* '' */
.icon-stop:before { content: '\e801'; } /* '' */
.icon-pause:before { content: '\e802'; } /* '' */
.icon-step-next:before { content: '\e803'; } /* '' */
.icon-step-prev:before { content: '\e804'; } /* '' */
</style>

<script >
!function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=69)}({0:function(t,n,e){"use strict";var r="_U_",i="User",o="_multi",a={UNKNOWN:"UNKNOWN",PENDING:"PENDING",RUNNING:"RUNNING",DONE:"DONE",FAILED:"FAILED"};function s(t,n,e,r){if(void 0===n&&(n=t),void 0===e&&(e="analysis"),void 0===r&&(r=a.UNKNOWN),void 0===a[r])throw Error("Unknown status '"+r+"' for node "+n+"(id="+t+")");this.id=t,this.name=n,this.isMulti=0<=e.search(/_multi$/),this.type=this.isMulti?e.substr(0,e.length-o.length):e,this.status=r}function u(t,n,e,r,i,o){var a=this;if(this.id="link_"+t+"_"+n,"string"==typeof e)this.name=e,this.vars={},this.name.split(",").forEach(function(t,n){return a.vars[n]=t.trim()});else{this.vars=e;var s=[];for(var u in this.vars)this.vars.hasOwnProperty(u)&&s.push(this.vars[u]);this.name=s.join(", ")}this.row=r,this.col=i,this.iotype=r<i?"in":"out",this.isMulti=o}function l(t,n,e){this.nodes=[new s(r,i,"driver")],e&&(this.nodes=[]),this.edges=[],this.chains=[],this.refname=n||"";var o=l.number(t.workflow),a=o.toNum;this.nodesByStep=o.toNode,t.nodes.forEach(function(t){var n=a[t.id];this.nodes.push(new s(t.id,n?n+":"+t.name:t.name,t.type,t.status))},this),this.uid=this.nodes[0].id,t.edges&&t.edges.forEach(function(t){this.addEdge(t.from,t.to,t.vars?t.vars:t.name)},this),t.workflow&&this._makeChaining(t.workflow)}s.prototype.isMdo=function(){return"mdo"===this.type},s.prototype.getScenarioId=function(){if(this.isMdo()){var t=this.name.indexOf("_scn-");return-1===t?(console.log("Warning: MDO Scenario not found. Bad type or name for node: "+JSON.stringify(this)),null):this.name.substr(t+1)}return null},u.prototype.addVar=function(t){if("string"==typeof t)""===this.name?this.name=t:this.name+=", "+t,this.vars[this.vars.length]=t;else for(var n in t)if(t.hasOwnProperty(n)){this.vars[n]=t[n];var e=[];for(var r in this.vars)this.vars.hasOwnProperty(r)&&e.push(this.vars[r]);this.name=e.join(", ")}},u.prototype.removeVar=function(t){var n=!1;for(var e in this.vars)e===t&&(this.vars.delete(e),n=!0);if(!n){var r={};for(var i in this.vars)this.vars[i]===t?n=!0:r[i]=this.vars[i];this.vars=r}if(n){var o=[];for(var a in this.vars)this.vars.hasOwnProperty(a)&&o.push(this.vars[a]);this.name=o.join(", ")}},l.NODE_STATUS=a,l.prototype._makeChaining=function(t){l.expand(t).forEach(function(t){if(t.length<2)throw new Error("Bad process chain ("+t.length+"elt)");this.chains.push([]);var n=this.nodes.map(function(t){return t.id});t.forEach(function(e,r){if(0!==r){var i=n.indexOf(t[r-1]);if(i<0)throw new Error("Process chain element ("+t[r-1]+") not found");var o=n.indexOf(t[r]);if(o<0)throw new Error("Process chain element ("+t[r]+") not found");i!==o&&this.chains[this.chains.length-1].push([i,o])}},this)},this)},l.prototype.idxOf=function(t){var n=this.nodes.map(function(t){return t.id}).indexOf(t);if(n<0)throw new Error("Graph.idxOf: "+t+" not found in "+JSON.stringify(this.nodes));return n},l.prototype.getNode=function(t){var n;return this.nodes.forEach(function(e){e.id===t&&(n=e)},this),n},l.prototype.getNodeFromIndex=function(t){if(!(0<=t&&t<this.nodes.length))throw new Error("Index out of range : "+t+" not in [0, "+(this.nodes.length-1)+"]");return this.nodes[t]},l.prototype.addNode=function(t){this.nodes.push(new s(t.id,t.name,t.kind))},l.prototype.removeNode=function(t){var n=this,e=this.findEdgesOf(t);e.toRemove.forEach(function(t){var e=n.edges.indexOf(t);-1<e&&n.edges.splice(e,1)},this),e.toShift.forEach(function(t){1<t.row&&(t.row-=1),1<t.col&&(t.col-=1)},this),this.nodes.splice(t,1)},l.prototype.moveLeft=function(t){if(1<t){var n=this.nodes[t-1];this.nodes[t-1]=this.nodes[t],this.nodes[t]=n}},l.prototype.moveRight=function(t){if(t<this.nodes.length-1){var n=this.nodes[t+1];this.nodes[t+1]=this.nodes[t],this.nodes[t]=n}},l.prototype.addEdge=function(t,n,e){var r=this.idxOf(t),i=this.idxOf(n),o=this.nodes[r].isMulti||this.nodes[i].isMulti;this.edges.push(new u(t,n,e,r,i,o))},l.prototype.removeEdge=function(t,n){var e=this.findEdge(t,n);this.edges.splice(e.index,1)},l.prototype.addEdgeVar=function(t,n,e){var r=this.findEdge(t,n).element;r?(console.log(e),r.addVar(e)):this.addEdge(t,n,e)},l.prototype.removeEdgeVar=function(t,n,e){var r=this.findEdge(t,n),i=r.element,o=r.index;i&&i.removeVar(e),""===i.name&&this.edges.splice(o,1)},l.prototype.findEdgesOf=function(t){var n=[],e=[];return this.edges.forEach(function(r){r.row===t||r.col===t?n.push(r):(r.row>t||r.col>t)&&e.push(r)},this),{toRemove:n,toShift:e}},l.prototype.findEdge=function(t,n){var e,r=-1,i=this.idxOf(t),o=this.idxOf(n);return this.edges.some(function(t,n){if(t.row===i&&t.col===o){if(e)throw Error("edge have be uniq between two nodes, but got: "+JSON.stringify(e)+" and "+JSON.stringify(t));return e=t,r=n,!0}},this),{element:e,index:r}},l._isPatchNeeded=function(t){for(var n=t.map(function(t){return t[t.length-1]}),e=n[0],r=0;r<n.length;r++)if(n[r]!==e)return!0;return!1},l._patchParallel=function(t){var n=[];t.forEach(function(t){t instanceof Array?n.push(t):l._isPatchNeeded(n)&&n.forEach(function(n){n.push(t)},this)},this)},l.expand=function(t){var n=function t(n){var e,r=[];return n.forEach(function(n){if(n instanceof Array){if(n[0].hasOwnProperty("parallel")){if(!e)throw new Error("Bad workflow structure : cannot parallel loop without previous starting point.");r=r.slice(0,r.length-1).concat(n[0].parallel.map(function(n){return[e].concat(t([n]),e)}))}else r=e?r.concat(t(n),e):r.concat(t(n));e=r[r.length-1]}else if(n.hasOwnProperty("parallel"))r=e?r.slice(0,r.length-1).concat(n.parallel.map(function(n){return[e].concat(t([n]))})):r.concat(n.parallel.map(function(n){return t([n])})),e=void 0;else{for(var i=r.length-1,o=!1;0<=i&&r[i]instanceof Array;)r[i]=r[i].concat(n),i-=1,o=!0;o||r.push(n),e=n}}),r}(t),e=[],r=[];return l._patchParallel(n),n.forEach(function(t){if(t instanceof Array)0<r.length&&(r.push(t[0]),e.push(r),r=[]),e.push(t);else{if(0<e.length&&0===r.length){var n=e[e.length-1],i=n[n.length-1];r.push(i)}r.push(t)}},this),0<r.length&&e.push(r),e},l.number=function(t,n){var e={},r=[];function i(t,n){t in r?r[t].push(n):r[t]=[n]}function o(t,r,o){void 0===o?(n=String(r),i(r,t)):(n=o+"-"+r,i(o,t)),t in e?e[t]+=","+n:e[t]=n}return function t(n,e){var r=0;if(n instanceof Array)if(0===n.length)r=e;else if(1===n.length)r=t(n[0],e);else{var i=n[0],a=n.slice(1),s=t(i,e);if(a[0]instanceof Array){var u=t(a[0],s);o(i,s,u),s=u+1,a.shift()}r=t(a,s)}else if(n instanceof Object&&"parallel"in n){var l=n.parallel.map(function(n){return t(n,e)});r=Math.max.apply(null,l)}else o(n,e),r=e+1;return r}(t,n=void 0===n?0:n),{toNum:e,toNode:r}},n.a=l},1:function(t,n,e){"use strict";function r(){}r.strParse=function(t,n){if(""===t)return[{base:"",sub:void 0,sup:void 0}];var e=t.split(",");if(!1===n)return e.map(function(t){return{base:t,sub:void 0,sup:void 0}});var r=/_/g,i=/([0-9\-]+:)?([&#;A-Za-z0-9\-\.]+)(_[&#;A-Za-z0-9\-\._]+)?(\^.+)?/;return e.map(function(t){var n,e,o;if(1<(t.match(r)||[]).length){var a=t.match(/(.+)\^(.+)/);return a?{base:a[1],sub:void 0,sup:a[2]}:{base:t,sub:void 0,sup:void 0}}var s=t.match(i);if(!s)throw new Error("Labelizer.strParse: Can not parse '"+t+"'");return n=(s[1]?s[1]:"")+s[2],s[3]&&(e=s[3].substring(1)),s[4]&&(o=s[4].substring(1)),{base:n,sub:e,sup:o}},this)},r._createVarListLabel=function(t,n,e,i,o){r.strParse(n,o).every(function(n,r,o){var a=0,s=0;return i<1||r<5&&e.nodes()[0].getBBox().width<100?(e.append("tspan").html(n.base),n.sub&&(a=10,e.append("tspan").attr("class","sub").attr("dy",a).html(n.sub)),n.sup&&(s=-10,e.append("tspan").attr("class","sup").attr("dx",-5).attr("dy",-a+s).html(n.sup),a=0),r<o.length-1&&e.append("tspan").attr("dy",-a-s).html(", "),!0):(e.append("tspan").attr("dy",-a-s).html("..."),t.classed("ellipsized",!0),!1)},this)},r._createLinkNbLabel=function(t,n,e){var r=n.split(","),i=r.length+" var";1<r.length&&(i+="s"),e.append("tspan").html(i),t.classed("ellipsized",!0)},r.labelize=function(){var t=0,n=!0,e=!1,i="node";function o(o){o.each(function(a){var s=o.append("text");e&&"node"!==i?r._createLinkNbLabel(o,a.name,s):r._createVarListLabel(o,a.name,s,t,n)})}return o.ellipsis=function(n){return arguments.length?(t=n,o):t},o.subSupScript=function(t){return arguments.length?(n=t,o):n},o.linkNbOnly=function(t){return arguments.length?(e=t,o):e},o.labelKind=function(t){return arguments.length?(i=t,o):i},o},r.tooltipize=function(){var t="",n=!1;function e(e){var i=[];n?r.strParse(t).forEach(function(t){var n=t.base;t.sub&&(n+="<sub>"+t.sub+"</sub>"),t.sup&&(n+="<sup>"+t.sup+"</sup>"),i.push(n)}):i=t.split(","),e.html(i.join(", "))}return e.text=function(n){return arguments.length?(t=n,e):t},e.subSupScript=function(t){return arguments.length?(n=t,e):n},e},n.a=r},69:function(t,n,e){"use strict";e.r(n);var r={},i={};function o(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}var a=function(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function a(t,n){var o,a=[],s=t.length,u=0,l=0,c=s<=0,h=!1;function f(){if(c)return i;if(h)return h=!1,r;var n,o,a=u;if(34===t.charCodeAt(a)){for(;u++<s&&34!==t.charCodeAt(u)||34===t.charCodeAt(++u););return(n=u)>=s?c=!0:10===(o=t.charCodeAt(u++))?h=!0:13===o&&(h=!0,10===t.charCodeAt(u)&&++u),t.slice(a+1,n-1).replace(/""/g,'"')}for(;u<s;){if(10===(o=t.charCodeAt(n=u++)))h=!0;else if(13===o)h=!0,10===t.charCodeAt(u)&&++u;else if(o!==e)continue;return t.slice(a,n)}return c=!0,t.slice(a,s)}for(10===t.charCodeAt(s-1)&&--s,13===t.charCodeAt(s-1)&&--s;(o=f())!==i;){for(var p=[];o!==r&&o!==i;)p.push(o),o=f();n&&null==(p=n(p,l++))||a.push(p)}return a}function s(n){return n.map(u).join(t)}function u(t){return null==t?"":n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,r,i=a(t,function(t,i){if(e)return e(t,i-1);var a,s,u;r=t,e=n?(s=n,u=o(a=t),function(t,n){return s(u(t),n,a)}):o(t)});return i.columns=r||[],i},parseRows:a,format:function(n,e){var r,i,o;return null==e&&(r=n,i=Object.create(null),o=[],r.forEach(function(t){for(var n in t)n in i||o.push(i[n]=n)}),e=o),[e.map(u).join(t)].concat(n.map(function(n){return e.map(function(t){return u(n[t])}).join(t)})).join("\n")},formatRows:function(t){return t.map(s).join("\n")}}},s=a(","),u=s.parse,l=(s.parseRows,s.format,s.formatRows,a("\t")),c=l.parse;function h(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}l.parseRows,l.format,l.formatRows;var f=function(t,n){return fetch(t,n).then(h)};function p(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=void 0),f(n,e).then(function(n){return t(n,r)})}}function d(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.json()}function g(t){return function(n,e){return f(n,e).then(function(n){return(new DOMParser).parseFromString(n,t)})}}p(u),p(c),g("application/xml"),g("text/html"),g("image/svg+xml");var y="http://www.w3.org/1999/xhtml",v={svg:"http://www.w3.org/2000/svg",xhtml:y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},m=function(t){var n=t+="",e=n.indexOf(":");return 0<=e&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),v.hasOwnProperty(n)?{space:v[n],local:t}:t},w=function(t){var n=m(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===y&&n.documentElement.namespaceURI===y?n.createElement(t):n.createElementNS(e,t)}})(n)};function _(){}var b=function(t){return null==t?_:function(){return this.querySelector(t)}};function x(){return[]}var N=function(t){return null==t?x:function(){return this.querySelectorAll(t)}},S=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var A=document.documentElement;if(!A.matches){var E=A.webkitMatchesSelector||A.msMatchesSelector||A.mozMatchesSelector||A.oMatchesSelector;S=function(t){return function(){return E.call(this,t)}}}}var k=S,M=function(t){return new Array(t.length)};function O(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function T(t,n,e,r,i,o){for(var a,s=0,u=n.length,l=o.length;s<l;++s)(a=n[s])?(a.__data__=o[s],r[s]=a):e[s]=new O(t,o[s]);for(;s<u;++s)(a=n[s])&&(i[s]=a)}function P(t,n,e,r,i,o,a){var s,u,l,c={},h=n.length,f=o.length,p=new Array(h);for(s=0;s<h;++s)(u=n[s])&&(p[s]=l="$"+a.call(u,u.__data__,s,n),l in c?i[s]=u:c[l]=u);for(s=0;s<f;++s)(u=c[l="$"+a.call(t,o[s],s,o)])?((r[s]=u).__data__=o[s],c[l]=null):e[s]=new O(t,o[s]);for(s=0;s<h;++s)(u=n[s])&&c[p[s]]===u&&(i[s]=u)}function z(t,n){return t<n?-1:n<t?1:n<=t?0:NaN}O.prototype={constructor:O,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var I=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function B(t,n){return t.style.getPropertyValue(n)||I(t).getComputedStyle(t,null).getPropertyValue(n)}function D(t){return t.trim().split(/^|\s+/)}function U(t){return t.classList||new R(t)}function R(t){this._node=t,this._names=D(t.getAttribute("class")||"")}function L(t,n){for(var e=U(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function j(t,n){for(var e=U(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function C(){this.textContent=""}function q(){this.innerHTML=""}function G(){this.nextSibling&&this.parentNode.appendChild(this)}function X(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function V(){return null}function Y(){var t=this.parentNode;t&&t.removeChild(this)}function $(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function F(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}R.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);0<=n&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return 0<=this._names.indexOf(t)}};var W={},J=null;function K(t,n,e){return t=H(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function H(t,n,e){return function(r){var i=J;J=r;try{t.call(this,this.__data__,n,e)}finally{J=i}}}function Z(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function Q(t,n,e){var r=W.hasOwnProperty(t.type)?K:H;return function(i,o,a){var s,u=this.__on,l=r(n,o,a);if(u)for(var c=0,h=u.length;c<h;++c)if((s=u[c]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=l,s.capture=e),void(s.value=n);this.addEventListener(t.type,l,e),s={type:t.type,name:t.name,value:n,listener:l,capture:e},u?u.push(s):this.__on=[s]}}function tt(t,n,e){var r=I(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(W={mouseenter:"mouseover",mouseleave:"mouseout"}));var nt=[null];function et(t,n){this._groups=t,this._parents=n}function rt(){return new et([[document.documentElement]],nt)}et.prototype=rt.prototype={constructor:et,select:function(t){"function"!=typeof t&&(t=b(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,s=n[i],u=s.length,l=r[i]=new Array(u),c=0;c<u;++c)(o=s[c])&&(a=t.call(o,o.__data__,c,s))&&("__data__"in o&&(a.__data__=o.__data__),l[c]=a);return new et(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=N(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,s=n[o],u=s.length,l=0;l<u;++l)(a=s[l])&&(r.push(t.call(a,a.__data__,l,s)),i.push(a));return new et(r,i)},filter:function(t){"function"!=typeof t&&(t=k(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],s=a.length,u=r[i]=[],l=0;l<s;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&u.push(o);return new et(r,this._parents)},data:function(t,n){if(!t)return d=new Array(this.size()),c=-1,this.each(function(t){d[++c]=t}),d;var e,r=n?P:T,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,s=new Array(a),u=new Array(a),l=new Array(a),c=0;c<a;++c){var h=i[c],f=o[c],p=f.length,d=t.call(h,h&&h.__data__,c,i),g=d.length,y=u[c]=new Array(g),v=s[c]=new Array(g);r(h,f,y,v,l[c]=new Array(p),d,n);for(var m,w,_=0,b=0;_<g;++_)if(m=y[_]){for(b<=_&&(b=_+1);!(w=v[b])&&++b<g;);m._next=w||null}}return(s=new et(s,i))._enter=u,s._exit=l,s},enter:function(){return new et(this._enter||this._groups.map(M),this._parents)},exit:function(){return new et(this._exit||this._groups.map(M),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,l=n[s],c=e[s],h=l.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)a[s]=n[s];return new et(a,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];0<=--o;)(r=i[o])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=z);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,s=e[o],u=s.length,l=i[o]=new Array(u),c=0;c<u;++c)(a=s[c])&&(l[c]=a);l.sort(n)}return new et(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=m(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return 1<arguments.length?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):B(this.node(),t)},property:function(t,n){return 1<arguments.length?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=D(t+"");if(arguments.length<2){for(var r=U(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?L:j)(this,t)}}:n?function(t){return function(){L(this,t)}}:function(t){return function(){j(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?C:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?q:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(G)},lower:function(){return this.each(X)},append:function(t){var n="function"==typeof t?t:w(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:w(t),r=null==n?V:"function"==typeof n?n:b(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Y)},clone:function(t){return this.select(t?F:$)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return 0<=e&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}),a=o.length;if(!(arguments.length<2)){for(s=n?Q:Z,null==e&&(e=!1),r=0;r<a;++r)this.each(s(o[r],n,e));return this}var s=this.node().__on;if(s)for(var u,l=0,c=s.length;l<c;++l)for(r=0,u=s[l];r<a;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return tt(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return tt(this,t,n)}})(t,n))}};var it=rt,ot=function(t){return"string"==typeof t?new et([[document.querySelector(t)]],[document.documentElement]):new et([[t]],nt)},at=0;function st(){this._="@"+(++at).toString(36)}st.prototype=function(){return new st}.prototype={constructor:st,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var ut=function(t){return"string"==typeof t?new et([document.querySelectorAll(t)],[document.documentElement]):new et([null==t?[]:t],nt)},lt=e(0),ct={value:function(){}};function ht(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new ft(r)}function ft(t){this._=t}function pt(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function dt(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=ct,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}ft.prototype=ht.prototype={constructor:ft,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(0<=e&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<s;)if(e=(t=o[a]).type)i[e]=dt(i[e],t.name,n);else if(null==n)for(e in i)i[e]=dt(i[e],t.name,null);return this}for(;++a<s;)if((e=(t=o[a]).type)&&(e=pt(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new ft(t)},call:function(t,n){if(0<(e=arguments.length-2))for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var gt,yt,vt=ht,mt=0,wt=0,_t=0,bt=1e3,xt=0,Nt=0,St=0,At="object"==typeof performance&&performance.now?performance:Date,Et="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function kt(){return Nt||(Et(Mt),Nt=At.now()+St)}function Mt(){Nt=0}function Ot(){this._call=this._time=this._next=null}function Tt(t,n,e){var r=new Ot;return r.restart(t,n,e),r}function Pt(){Nt=(xt=At.now())+St,mt=wt=0;try{!function(){kt(),++mt;for(var t,n=gt;n;)0<=(t=Nt-n._time)&&n._call.call(null,t),n=n._next;--mt}()}finally{mt=0,function(){for(var t,n,e=gt,r=1/0;e;)e=e._call?(r>e._time&&(r=e._time),(t=e)._next):(n=e._next,e._next=null,t?t._next=n:gt=n);yt=t,It(r)}(),Nt=0}}function zt(){var t=At.now(),n=t-xt;bt<n&&(St-=n,xt=t)}function It(t){mt||(wt&&(wt=clearTimeout(wt)),24<t-Nt?(t<1/0&&(wt=setTimeout(Pt,t-At.now()-St)),_t&&(_t=clearInterval(_t))):(_t||(xt=At.now(),_t=setInterval(zt,bt)),mt=1,Et(Pt)))}Ot.prototype=Tt.prototype={constructor:Ot,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?kt():+e)+(null==n?0:+n),this._next||yt===this||(yt?yt._next=this:gt=this,yt=this),this._call=t,this._time=e,It()},stop:function(){this._call&&(this._call=null,this._time=1/0,It())}};var Bt=function(t,n,e){var r=new Ot;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r},Dt=vt("start","end","interrupt"),Ut=[],Rt=0,Lt=2,jt=function(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(u){var l,c,h,f;if(1!==e.state)return s();for(l in i)if((f=i[l]).name===e.name){if(3===f.state)return Bt(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l<n&&(f.state=6,f.timer.stop(),delete i[l])}if(Bt(function(){3===e.state&&(e.state=4,e.timer.restart(a,e.delay,e.time),a(u))}),e.state=Lt,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Lt){for(e.state=3,r=new Array(h=e.tween.length),l=0,c=-1;l<h;++l)(f=e.tween[l].value.call(t,t.__data__,e.index,e.group))&&(r[++c]=f);r.length=c+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(s),e.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(null,i);5===e.state&&(e.on.call("end",t,t.__data__,e.index,e.group),s())}function s(){for(var r in e.state=6,e.timer.stop(),delete i[n],i)return;delete t.__transition}(i[n]=e).timer=Tt(function(t){e.state=1,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:Dt,tween:Ut,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Rt})};function Ct(t,n){var e=Gt(t,n);if(e.state>Rt)throw new Error("too late; already scheduled");return e}function qt(t,n){var e=Gt(t,n);if(e.state>Lt)throw new Error("too late; already started");return e}function Gt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var Xt=function(t,n,e){t.prototype=n.prototype=e,e.constructor=t};function Vt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Yt(){}var $t=1/.7,Ft="\\s*([+-]?\\d+)\\s*",Wt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Jt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kt=/^#([0-9a-f]{3})$/,Ht=/^#([0-9a-f]{6})$/,Zt=new RegExp("^rgb\\("+[Ft,Ft,Ft]+"\\)$"),Qt=new RegExp("^rgb\\("+[Jt,Jt,Jt]+"\\)$"),tn=new RegExp("^rgba\\("+[Ft,Ft,Ft,Wt]+"\\)$"),nn=new RegExp("^rgba\\("+[Jt,Jt,Jt,Wt]+"\\)$"),en=new RegExp("^hsl\\("+[Wt,Jt,Jt]+"\\)$"),rn=new RegExp("^hsla\\("+[Wt,Jt,Jt,Wt]+"\\)$"),on={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function an(t){var n;return t=(t+"").trim().toLowerCase(),(n=Kt.exec(t))?new hn((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=Ht.exec(t))?sn(parseInt(n[1],16)):(n=Zt.exec(t))?new hn(n[1],n[2],n[3],1):(n=Qt.exec(t))?new hn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=tn.exec(t))?un(n[1],n[2],n[3],n[4]):(n=nn.exec(t))?un(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=en.exec(t))?pn(n[1],n[2]/100,n[3]/100,1):(n=rn.exec(t))?pn(n[1],n[2]/100,n[3]/100,n[4]):on.hasOwnProperty(t)?sn(on[t]):"transparent"===t?new hn(NaN,NaN,NaN,0):null}function sn(t){return new hn(t>>16&255,t>>8&255,255&t,1)}function un(t,n,e,r){return r<=0&&(t=n=e=NaN),new hn(t,n,e,r)}function ln(t){return t instanceof Yt||(t=an(t)),t?new hn((t=t.rgb()).r,t.g,t.b,t.opacity):new hn}function cn(t,n,e,r){return 1===arguments.length?ln(t):new hn(t,n,e,null==r?1:r)}function hn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function fn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function pn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||1<=e?t=n=NaN:n<=0&&(t=NaN),new gn(t,n,e,r)}function dn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof gn)return new gn(t.h,t.s,t.l,t.opacity);if(t instanceof Yt||(t=an(t)),!t)return new gn;if(t instanceof gn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=0<u&&u<1?0:a,new gn(a,s,u,t.opacity)}(t):new gn(t,n,e,null==r?1:r)}function gn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function yn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Xt(Yt,an,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Xt(hn,cn,Vt(Yt,{brighter:function(t){return t=null==t?$t:Math.pow($t,t),new hn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new hn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+fn(this.r)+fn(this.g)+fn(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Xt(gn,dn,Vt(Yt,{brighter:function(t){return t=null==t?$t:Math.pow($t,t),new gn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new gn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new hn(yn(240<=t?t-240:t+120,i,r),yn(t,i,r),yn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var vn=Math.PI/180,mn=180/Math.PI,wn=.96422,_n=1,bn=.82521,xn=4/29,Nn=6/29,Sn=3*Nn*Nn,An=Nn*Nn*Nn;function En(t){if(t instanceof kn)return new kn(t.l,t.a,t.b,t.opacity);if(t instanceof In){if(isNaN(t.h))return new kn(t.l,0,0,t.opacity);var n=t.h*vn;return new kn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof hn||(t=ln(t));var e,r,i=Pn(t.r),o=Pn(t.g),a=Pn(t.b),s=Mn((.2225045*i+.7168786*o+.0606169*a)/_n);return i===o&&o===a?e=r=s:(e=Mn((.4360747*i+.3850649*o+.1430804*a)/wn),r=Mn((.0139322*i+.0971045*o+.7141733*a)/bn)),new kn(116*s-16,500*(e-s),200*(s-r),t.opacity)}function kn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Mn(t){return An<t?Math.pow(t,1/3):t/Sn+xn}function On(t){return Nn<t?t*t*t:Sn*(t-xn)}function Tn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Pn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function zn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof In)return new In(t.h,t.c,t.l,t.opacity);if(t instanceof kn||(t=En(t)),0===t.a&&0===t.b)return new In(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*mn;return new In(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new In(t,n,e,null==r?1:r)}function In(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}Xt(kn,function(t,n,e,r){return 1===arguments.length?En(t):new kn(t,n,e,null==r?1:r)},Vt(Yt,{brighter:function(t){return new kn(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new kn(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new hn(Tn(3.1338561*(n=wn*On(n))-1.6168667*(t=_n*On(t))-.4906146*(e=bn*On(e))),Tn(-.9787684*n+1.9161415*t+.033454*e),Tn(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Xt(In,zn,Vt(Yt,{brighter:function(t){return new In(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new In(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return En(this).rgb()}}));var Bn=1.78277,Dn=-.29227,Un=-.90649,Rn=1.97294,Ln=Rn*Un,jn=Rn*Bn,Cn=Bn*Dn- -.14861*Un;function qn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Gn)return new Gn(t.h,t.s,t.l,t.opacity);t instanceof hn||(t=ln(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Cn*r+Ln*n-jn*e)/(Cn+Ln-jn),o=r-i,a=(Rn*(e-i)-Dn*o)/Un,s=Math.sqrt(a*a+o*o)/(Rn*i*(1-i)),u=s?Math.atan2(a,o)*mn-120:NaN;return new Gn(u<0?u+360:u,s,i,t.opacity)}(t):new Gn(t,n,e,null==r?1:r)}function Gn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Xn(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}Xt(Gn,qn,Vt(Yt,{brighter:function(t){return t=null==t?$t:Math.pow($t,t),new Gn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Gn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*vn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new hn(255*(n+e*(-.14861*r+Bn*i)),255*(n+e*(Dn*r+Un*i)),255*(n+e*(Rn*r)),this.opacity)}}));var Vn=function(t){return function(){return t}};function Yn(t,n){return function(e){return t+e*n}}function $n(t,n){var e=n-t;return e?Yn(t,180<e||e<-180?e-360*Math.round(e/360):e):Vn(isNaN(t)?n:t)}function Fn(t,n){var e=n-t;return e?Yn(t,e):Vn(isNaN(t)?n:t)}var Wn=function t(n){var e,r=1==(e=+(e=n))?Fn:function(t,n){return n-t?(r=t,i=n,o=e,r=Math.pow(r,o),i=Math.pow(i,o)-r,o=1/o,function(t){return Math.pow(r+t*i,o)}):Vn(isNaN(t)?n:t);var r,i,o};function i(t,n){var e=r((t=cn(t)).r,(n=cn(n)).r),i=r(t.g,n.g),o=r(t.b,n.b),a=Fn(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return i.gamma=t,i}(1);function Jn(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),s=new Array(i);for(e=0;e<i;++e)r=cn(n[e]),o[e]=r.r||0,a[e]=r.g||0,s[e]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}Jn(function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:1<=e?n-(e=1):Math.floor(e*n),i=t[r],o=t[r+1],a=0<r?t[r-1]:2*i-o,s=r<n-1?t[r+2]:2*o-i;return Xn((e-r/n)*n,a,i,o,s)}}),Jn(function(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],s=t[(r+2)%n];return Xn((e-r/n)*n,i,o,a,s)}});var Kn,Hn,Zn,Qn,te=function(t,n){return n-=t=+t,function(e){return t+n*e}},ne=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ee=new RegExp(ne.source,"g"),re=180/Math.PI,ie={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},oe=function(t,n,e,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(u=t*e+n*r)&&(e-=t*u,r-=n*u),(s=Math.sqrt(e*e+r*r))&&(e/=s,r/=s,u/=s),t*r<n*e&&(t=-t,n=-n,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*re,skewX:Math.atan(u)*re,scaleX:a,scaleY:s}};function ae(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s,u,l,c,h,f,p=[],d=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push("translate(",null,n,null,e);s.push({i:u-4,x:te(t,i)},{i:u-2,x:te(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,p,d),s=o.rotate,u=a.rotate,l=p,s!==u?(180<s-u?u+=360:180<u-s&&(s+=360),d.push({i:l.push(i(l)+"rotate(",null,r)-2,x:te(s,u)})):u&&l.push(i(l)+"rotate("+u+r),c=o.skewX,h=a.skewX,f=p,c!==h?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:te(c,h)}):h&&f.push(i(f)+"skewX("+h+r),function(t,n,e,r,o,a){if(t!==e||n!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:te(t,e)},{i:s-2,x:te(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,p,d),o=a=null,function(t){for(var n,e=-1,r=d.length;++e<r;)p[(n=d[e]).i]=n.x(t);return p.join("")}}}var se=ae(function(t){return"none"===t?ie:(Kn||(Kn=document.createElement("DIV"),Hn=document.documentElement,Zn=document.defaultView),Kn.style.transform=t,t=Zn.getComputedStyle(Hn.appendChild(Kn),null).getPropertyValue("transform"),Hn.removeChild(Kn),t=t.slice(7,-1).split(","),oe(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),ue=ae(function(t){return null==t?ie:(Qn||(Qn=document.createElementNS("http://www.w3.org/2000/svg","g")),Qn.setAttribute("transform",t),(t=Qn.transform.baseVal.consolidate())?(t=t.matrix,oe(t.a,t.b,t.c,t.d,t.e,t.f)):ie)},", ",")",")");function le(t){return function(n,e){var r=t((n=dn(n)).h,(e=dn(e)).h),i=Fn(n.s,e.s),o=Fn(n.l,e.l),a=Fn(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}function ce(t){return function(n,e){var r=t((n=zn(n)).h,(e=zn(e)).h),i=Fn(n.c,e.c),o=Fn(n.l,e.l),a=Fn(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}function he(t){return function n(e){function r(n,r){var i=t((n=qn(n)).h,(r=qn(r)).h),o=Fn(n.s,r.s),a=Fn(n.l,r.l),s=Fn(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=s(t),n+""}}return e=+e,r.gamma=n,r}(1)}function fe(t,n,e){var r=t._id;return t.each(function(){var t=qt(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Gt(t,r).value[n]}}Math.SQRT2,le($n),le(Fn),ce($n),ce(Fn),he($n),he(Fn);var pe=function(t,n){var e;return("number"==typeof n?te:n instanceof an?Wn:(e=an(n))?(n=e,Wn):function(t,n){var e,r,i,o,a,s=ne.lastIndex=ee.lastIndex=0,u=-1,l=[],c=[];for(t+="",n+="";(e=ne.exec(t))&&(r=ee.exec(n));)(i=r.index)>s&&(i=n.slice(s,i),l[u]?l[u]+=i:l[++u]=i),(e=e[0])===(r=r[0])?l[u]?l[u]+=r:l[++u]=r:(l[++u]=null,c.push({i:u,x:te(e,r)})),s=ee.lastIndex;return s<n.length&&(i=n.slice(s),l[u]?l[u]+=i:l[++u]=i),l.length<2?c[0]?(a=c[0].x,function(t){return a(t)+""}):(o=n,function(){return o}):(n=c.length,function(t){for(var e,r=0;r<n;++r)l[(e=c[r]).i]=e.x(t);return l.join("")})})(t,n)},de=it.prototype.constructor,ge=0;function ye(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ve(){return++ge}var me=it.prototype;ye.prototype=function(t){return it().transition(t)}.prototype={constructor:ye,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=b(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,u,l=r[a],c=l.length,h=o[a]=new Array(c),f=0;f<c;++f)(s=l[f])&&(u=t.call(s,s.__data__,f,l))&&("__data__"in s&&(u.__data__=s.__data__),h[f]=u,jt(h[f],n,e,f,h,Gt(s,e)));return new ye(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=N(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var u,l=r[s],c=l.length,h=0;h<c;++h)if(u=l[h]){for(var f,p=t.call(u,u.__data__,h,l),d=Gt(u,e),g=0,y=p.length;g<y;++g)(f=p[g])&&jt(f,n,e,g,p,d);o.push(p),a.push(u)}return new ye(o,a,n,e)},filter:function(t){"function"!=typeof t&&(t=k(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],s=a.length,u=r[i]=[],l=0;l<s;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&u.push(o);return new ye(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,l=n[s],c=e[s],h=l.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)a[s]=n[s];return new ye(a,this._parents,this._name,this._id)},selection:function(){return new de(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=ve(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,l=0;l<u;++l)if(a=s[l]){var c=Gt(a,n);jt(a,t,e,l,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new ye(r,this._parents,t,e)},call:me.call,nodes:me.nodes,node:me.node,size:me.size,empty:me.empty,each:me.each,on:function(t,n){var e,r,i,o,a,s,u=this._id;return arguments.length<2?Gt(this.node(),u).on.on(t):this.each((e=u,i=n,s=((r=t)+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return 0<=n&&(t=t.slice(0,n)),!t||"start"===t})?Ct:qt,function(){var t=s(this,e),n=t.on;n!==o&&(a=(o=n).copy()).on(r,i),t.on=a}))},attr:function(t,n){var e=m(t),r="transform"===e?ue:pe;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var a,s=e(this);if(null!=s)return(a=this.getAttributeNS(t.space,t.local))===s?null:a===r&&s===i?o:o=n(r=a,i=s);this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var a,s=e(this);if(null!=s)return(a=this.getAttribute(t))===s?null:a===r&&s===i?o:o=n(r=a,i=s);this.removeAttribute(t)}})(e,r,fe(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}:function(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=m(t);return this.tween(e,(r.local?function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}:function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e})(r,n))},style:function(t,n,e){var r,i,o,a,s,u,l,c,h,f,p,d,g,y,v,m,w,_="transform"==(t+="")?se:pe;return null==n?this.styleTween(t,(g=t,y=_,function(){var t=B(this,g),n=(this.style.removeProperty(g),B(this,g));return t===n?null:t===v&&n===m?w:w=y(v=t,m=n)})).on("end.style."+t,(d=t,function(){this.style.removeProperty(d)})):this.styleTween(t,"function"==typeof n?(l=_,c=fe(this,"style."+(u=t),n),function(){var t=B(this,u),n=c(this);return null==n&&(this.style.removeProperty(u),n=B(this,u)),t===n?null:t===h&&n===f?p:p=l(h=t,f=n)}):(r=t,i=_,o=n+"",function(){var t=B(this,r);return t===o?null:t===a?s:s=i(a=t,o)}),e)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?(e=fe(this,"text",t),function(){var t=e(this);this.textContent=null==t?"":t}):(n=null==t?"":t+"",function(){this.textContent=n}));var n,e},remove:function(){return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}));var t},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Gt(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?function(t,n){var e,r;return function(){var i=qt(this,t),o=i.tween;if(o!==e)for(var a=0,s=(r=e=o).length;a<s;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}:function(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=qt(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:n,value:e},u=0,l=i.length;u<l;++u)if(i[u].name===n){i[u]=s;break}u===l&&i.push(s)}o.tween=i}})(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){Ct(this,t).delay=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){Ct(this,t).delay=n}})(n,t)):Gt(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){qt(this,t).duration=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){qt(this,t).duration=n}})(n,t)):Gt(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){qt(this,t).ease=n}}(n,t)):Gt(this.node(),n).ease}},function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(3),function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(3),function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(3),Math.PI;var we=1.70158,_e=(function t(n){function e(t){return t*t*((n+1)*t-n)}return n=+n,e.overshoot=t,e}(we),function t(n){function e(t){return--t*t*((n+1)*t+n)+1}return n=+n,e.overshoot=t,e}(we),function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(we),2*Math.PI),be=(function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=_e);function i(t){return n*Math.pow(2,10*--t)*Math.sin((r-t)/e)}return i.amplitude=function(n){return t(n,e*_e)},i.period=function(e){return t(n,e)},i}(1,.3),function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=_e);function i(t){return 1-n*Math.pow(2,-10*(t=+t))*Math.sin((t+r)/e)}return i.amplitude=function(n){return t(n,e*_e)},i.period=function(e){return t(n,e)},i}(1,.3),function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=_e);function i(t){return((t=2*t-1)<0?n*Math.pow(2,10*t)*Math.sin((r-t)/e):2-n*Math.pow(2,-10*t)*Math.sin((r+t)/e))/2}return i.amplitude=function(n){return t(n,e*_e)},i.period=function(e){return t(n,e)},i}(1,.3),{time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}});function xe(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return be.time=kt(),be;return e}it.prototype.interrupt=function(t){return this.each(function(){!function(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>Lt&&e.state<5,e.state=6,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)})},it.prototype.transition=function(t){var n,e;t=t instanceof ye?(n=t._id,t._name):(n=ve(),(e=be).time=kt(),null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,l=0;l<u;++l)(a=s[l])&&jt(a,t,n,l,s,e||xe(a,n));return new ye(r,this._parents,t,n)};var Ne=e(1);function Se(t,n,e,r){this.x=t,this.y=n,this.width=e,this.height=r}function Ae(t,n,e){this.graph=t;var r=ot(".xdsm");this.svg=r.append("svg").attr("width",1e3).attr("height",500).attr("class",n),this.grid=[],this.nodes=[],this.edges=[],this.default_config={labelizer:{ellipsis:5,subSupScript:!0,showLinkNbOnly:!1},layout:{origin:{x:100,y:20},cellsize:{w:250,h:75},padding:20},titleTooltip:!1},this.config=this.default_config,e&&e.labelizer&&(this.config.labelizer.ellipsis=e.labelizer.ellipsis,this.config.labelizer.subSupScript=e.labelizer.subSupScript,this.config.labelizer.showLinkNbOnly=e.labelizer.showLinkNbOnly),e&&e.layout&&(this.config.layout.origin.x=e.layout.origin.x,this.config.layout.origin.y=e.layout.origin.y,this.config.layout.cellsize.w=e.layout.cellsize.w,this.config.layout.cellsize.h=e.layout.cellsize.h,this.config.layout.padding=e.layout.padding),this.config.titleTooltip=e.titleTooltip,this.config.titleTooltip||(this.tooltip=ot("body").append("div").attr("class","xdsm-tooltip").style("opacity",0)),this._initialize()}Ae.prototype.addNode=function(t){this.graph.addNode(t),this.draw()},Ae.prototype.removeNode=function(t){this.graph.removeNode(t),this.draw()},Ae.prototype.hasWorkflow=function(){return 0!==this.graph.chains.length},Ae.prototype._initialize=function(){var t=this;t.graph.refname&&t._createTitle(),t.nodeGroup=t.svg.append("g").attr("class","nodes"),t.edgeGroup=t.svg.append("g").attr("class","edges")},Ae.prototype.refresh=function(){var t=this;t.svg.selectAll("g").remove(),t.nodeGroup=t.svg.append("g").attr("class","nodes"),t.edgeGroup=t.svg.append("g").attr("class","edges"),t.draw()},Ae.prototype.draw=function(){var t=this;t.nodes=t._createTextGroup("node",t.nodeGroup,t._customRect),t.edges=t._createTextGroup("edge",t.edgeGroup,t._customTrapz),t._createWorkflow(),t._createDataflow(),t._createBorder();var n=t.config.layout.cellsize.w*(t.graph.nodes.length+1),e=t.config.layout.cellsize.h*(t.graph.nodes.length+1);t.svg.attr("width",n).attr("height",e),t.svg.selectAll(".border").attr("height",e-4).attr("width",n-4)},Ae.prototype._createTextGroup=function(t,n,e){var r=this,i=n.selectAll("."+t).data(this.graph[t+"s"],function(t){return t.id}),o=Ne.a.labelize().labelKind(t).ellipsis(r.config.labelizer.ellipsis).subSupScript(r.config.labelizer.subSupScript).linkNbOnly(r.config.labelizer.showLinkNbOnly),a=i.enter().append("g").attr("class",function(n){var e="node"===t?n.type:"dataInter";return"dataInter"!==e||0!==n.row&&0!==n.col||(e="dataIO"),"id"+n.id+" "+t+" "+e}).each(function(t,n){ot(this).call(o)}).each(function(t,n){var e=r.grid,i=ot(this);void 0===e[n]&&(e[n]=new Array(r.graph.nodes.length)),i.select("text").each(function(t,r){var o=ot(this),a=i.data()[0],s=void 0===a.row?n:a.row,u=void 0===a.col?n:a.col,l=o.nodes()[r].getBBox();e[s][u]=new Se(-l.width/2,0,l.width,l.height),o.attr("width",function(){return e[s][u].width}).attr("height",function(){return e[s][u].height}).attr("x",function(){return e[s][u].x}).attr("y",function(){return e[s][u].y})})}).each(function(t,n){var i=ot(this);i.call(e.bind(r),t,n,0),t.isMulti&&(i.call(e.bind(r),t,n,1*Number(3)),i.call(e.bind(r),t,n,2*Number(3)))}).merge(i);i.exit().remove(),r.tooltip?ut(".ellipsized").on("mouseover",function(t){r.tooltip.transition().duration(200).style("opacity",.9);var n=Ne.a.tooltipize().subSupScript(r.config.labelizer.subSupScript).text(t.name);r.tooltip.call(n).style("width","300px").style("left",J.pageX+"px").style("top",J.pageY-28+"px")}).on("mouseout",function(){r.tooltip.transition().duration(500).style("opacity",0)}):ut(".ellipsized").attr("title",function(t){return t.name.split(",").join(", ")}),r._layoutText(a,e,(i.empty(),0))},Ae.prototype._layoutText=function(t,n,e){var r=this;t.transition().duration(e).attr("transform",function(t,n){var e=void 0===t.col?n:t.col,i=void 0===t.row?n:t.row,o=r.config.layout.cellsize.w*e+r.config.layout.origin.x,a=r.config.layout.cellsize.h*i+r.config.layout.origin.y;return"translate("+(r.config.layout.origin.x+o)+","+(r.config.layout.origin.y+a)+")"})},Ae.prototype._createWorkflow=function(){var t=this;this.svg.selectAll(".workflow").data([t.graph]).enter().insert("g",":first-child").attr("class","workflow").selectAll("g").data(t.graph.chains).enter().insert("g").attr("class","workflow-chain").selectAll("path").data(function(t){return t}).enter().append("path").attr("class",function(t){return"link_"+t[0]+"_"+t[1]}).attr("transform",function(n){var e,r,i=Math.max(n[0],n[1]),o=Math.min(n[0],n[1]);return r=n[0]<n[1]?(e=t.config.layout.cellsize.w*i+t.config.layout.origin.x,t.config.layout.cellsize.h*o+t.config.layout.origin.y):(e=t.config.layout.cellsize.w*o+t.config.layout.origin.x,t.config.layout.cellsize.h*i+t.config.layout.origin.y),"translate("+(t.config.layout.origin.x+e)+","+(t.config.layout.origin.y+r)+")"}).attr("d",function(n){var e=t.config.layout.cellsize.w*Math.abs(n[0]-n[1]),r=t.config.layout.cellsize.h*Math.abs(n[0]-n[1]),i=[];return n[0]<n[1]?(0!==n[0]&&i.push(-e+",0"),i.push("0,0"),0!==n[1]&&i.push("0,"+r)):(0!==n[0]&&i.push(e+",0"),i.push("0,0"),0!==n[1]&&i.push("0,"+-r)),"M"+i.join(" ")})},Ae.prototype._createDataflow=function(){var t=this;t.svg.selectAll(".dataflow").data([t]).enter().insert("g",":first-child").attr("class","dataflow");var n=t.svg.select(".dataflow").selectAll("path").data(t.graph.edges,function(t){return t.id});n.enter().append("path").merge(n).transition().duration((n.empty(),0)).attr("transform",function(n,e){var r=void 0===n.col?e:n.col,i=void 0===n.row?e:n.row,o=t.config.layout.cellsize.w*r+t.config.layout.origin.x,a=t.config.layout.cellsize.h*i+t.config.layout.origin.y;return"translate("+(t.config.layout.origin.x+o)+","+(t.config.layout.origin.y+a)+")"}).attr("d",function(n){var e=t.config.layout.cellsize.w*Math.abs(n.col-n.row),r=t.config.layout.cellsize.h*Math.abs(n.col-n.row),i=[];return"in"===n.iotype?(0!==n.row&&i.push(-e+",0"),i.push("0,0"),0!==n.col&&i.push("0,"+r)):(0!==n.row&&i.push(e+",0"),i.push("0,0"),0!==n.col&&i.push("0,"+-r)),"M"+i.join(" ")}),n.exit().remove()},Ae.prototype._customRect=function(t,n,e,r){var i=this,o=i.grid;t.insert("rect",":first-child").classed("shape",!0).attr("x",function(){return o[e][e].x+r-i.config.layout.padding}).attr("y",function(){return 2*-o[e][e].height/3-i.config.layout.padding-r}).attr("width",function(){return o[e][e].width+2*i.config.layout.padding}).attr("height",function(){return o[e][e].height+2*i.config.layout.padding}).attr("rx",function(){return"driver"===n.type||"optimization"===n.type||"mda"===n.type||"doe"===n.type?(o[e][e].height+2*i.config.layout.padding)/2:0}).attr("ry",function(){return"driver"===n.type||"optimization"===n.type||"mda"===n.type||"doe"===n.type?(o[e][e].height+2*i.config.layout.padding)/2:0})},Ae.prototype._customTrapz=function(t,n,e,r){var i=this.grid;t.insert("polygon",":first-child").classed("shape",!0).attr("points",function(t){var n=i[t.row][t.col].width,e=i[t.row][t.col].height;return[-5-n/2+r+", "+(-5-2*e/3-r),n/2+5+r+5+", "+(-5-2*e/3-r),n/2+5+r-5+5+", "+(5+e/3-r),-5-n/2+r-5+", "+(5+e/3-r)].join(" ")})},Ae.prototype._createTitle=function(){var t=this,n=t.svg.selectAll(".title").data([t.graph.refname]).enter().append("g").classed("title",!0).append("text").text(t.graph.refname),e=n.nodes()[0].getBBox();n.insert("rect","text").attr("x",e.x).attr("y",e.y).attr("width",e.width).attr("height",e.height),n.attr("transform","translate("+t.config.layout.origin.x+","+(t.config.layout.origin.y+e.height)+")")},Ae.prototype._createBorder=function(){this.svg.selectAll(".border").data([this]).enter().append("rect").classed("border",!0).attr("x",4).attr("y",4).style("stroke","black").style("fill","none").style("stroke-width",0)};var Ee=Ae,ke=cn("seagreen"),Me=cn("firebrick"),Oe=cn("darkseagreen"),Te=cn("darkcyan");function Pe(t,n,e){void 0===(this.rootId=n)&&(this.rootId="root"),this.root=t[this.rootId],this.xdsms=t,this.duration=700,this.initialDelay=e||0,this._observers=[],this.reset()}Pe.STATUS={READY:"ready",RUNNING_STEP:"running_step",RUNNING_AUTO:"running_auto",STOPPED:"stopped",DONE:"done",DISABLED:"disabled"},Pe.prototype.reset=function(){this.curStep=0,this.subAnimations={},this._updateStatus(Pe.STATUS.READY)},Pe.prototype.start=function(){this._scheduleAnimation(),this._updateStatus(Pe.STATUS.RUNNING_AUTO)},Pe.prototype.stop=function(){this._reset("all"),this._updateStatus(Pe.STATUS.STOPPED)},Pe.prototype.stepPrev=function(){this._step("prev")},Pe.prototype.stepNext=function(){this._step("next")},Pe.prototype._step=function(t){var n="prev"===t,e=this,r=e.xdsms[e.rootId].graph,i=r.nodesByStep,o=n?-1:1;!n&&e.done()||n&&e.ready()||(e._subAnimationInProgress()||(e.curStep+=o,e._reset(),i[e.curStep].forEach(function(t){e.running()&&i[e.curStep-o].forEach(function(r){n?e._pulseLink(0,t,r):e._pulseLink(0,r,t);var i="g.id"+r;e._pulse(0,i+" > rect","out")});var r="g.id"+t;e._pulse(0,r+" > rect","in")})),i[e.curStep].some(e._isSubScenario,this)&&i[e.curStep].forEach(function(n){if(e._isSubScenario(n)){var i=r.getNode(n).getScenarioId();(e.subAnimations[i]?e.subAnimations[i]:e.subAnimations[i]=new Pe(e.xdsms,i))._step(t)}},this),this.done()?this._updateStatus(Pe.STATUS.DONE):this.ready()?this._updateStatus(Pe.STATUS.READY):this._updateStatus(Pe.STATUS.RUNNING_STEP))},Pe.prototype.running=function(){return!this.ready()&&!this.done()},Pe.prototype.ready=function(){return 0===this.curStep},Pe.prototype.done=function(){return this.curStep===this.root.graph.nodesByStep.length-1},Pe.prototype.isStatus=function(t){return this.status===t},Pe.prototype.addObserver=function(t){t&&this._observers.push(t)},Pe.prototype.renderNodeStatuses=function(){var t=this,n=t.xdsms[t.rootId].graph;n.nodes.forEach(function(e){var r="g."+e.id;switch(e.status){case lt.a.NODE_STATUS.RUNNING:t._pulse(0,r+" > rect","in",ke);break;case lt.a.NODE_STATUS.FAILED:t._pulse(0,r+" > rect","in",Me);break;case lt.a.NODE_STATUS.PENDING:t._pulse(0,r+" > rect","in",Oe);break;case lt.a.NODE_STATUS.DONE:t._pulse(0,r+" > rect","in",Te)}if(t._isSubScenario(e.id)){var i=n.getNode(e.id).getScenarioId();new Pe(t.xdsms,i).renderNodeStatuses()}})},Pe.prototype._updateStatus=function(t){this.status=t,this._notifyObservers(t)},Pe.prototype._notifyObservers=function(){this._observers.map(function(t){t.update(this.status)}.bind(this))},Pe.prototype._pulse=function(t,n,e,r){void 0===r&&(r=ke);var i=ot("svg."+this.rootId).selectAll(n).transition().delay(t);"out"!==e&&(i=i.transition().duration(200).style("stroke-width","8px").style("stroke",r).style("fill",function(t){if(t.id)return r.brighter()})),"in"!==e&&i.transition().duration(2100).style("stroke-width",null).style("stroke",null).style("fill",null)},Pe.prototype._pulseLink=function(t,n,e){var r=this.xdsms[this.rootId].graph,i=r.idxOf(n),o=r.idxOf(e);this._pulse(t,"path.link_"+i+"_"+o)},Pe.prototype._onAnimationStart=function(t){ot("svg."+this.rootId).select("g.title").select("text").transition().delay(t).style("fill",ke),ot("svg."+this.rootId).select("rect.border").transition().delay(t).style("stroke-width","5px").duration(200).transition().duration(1e3).style("stroke","black").style("stroke-width","0px")},Pe.prototype._onAnimationDone=function(t){var n=this;ot("svg."+this.rootId).select("g.title").select("text").transition().delay(t).style("fill",null).on("end",function(){n._updateStatus(Pe.STATUS.DONE)})},Pe.prototype._isSubScenario=function(t){var n="g.id"+t;return ot("svg."+this.rootId).select(n).classed("mdo")},Pe.prototype._scheduleAnimation=function(){var t=this,n=this.initialDelay,e=t.xdsms[t.rootId].graph;return t._onAnimationStart(n),e.nodesByStep.forEach(function(r,i,o){var a=[];r.forEach(function(r){var s=n+700*i;if(0<i){o[i-1].forEach(function(n){t._pulseLink(s,n,r)});var u="g.id"+r;if(t._isSubScenario(r)){t._pulse(s,u+" > rect","in");var l=e.getNode(r).getScenarioId(),c=new Pe(t.xdsms,l,s+200)._scheduleAnimation();a.push(c),t._pulse(c+s+200,u+" > rect","out")}else t._pulse(s,u+" > rect")}},this),0<a.length&&(n+=Math.max.apply(null,a)),n+=200},this),t._onAnimationDone(700*e.nodesByStep.length+n),700*e.nodesByStep.length},Pe.prototype._reset=function(t){var n=ot("svg."+this.rootId);t&&(n=ut("svg")),n.selectAll("rect").transition().duration(0).style("stroke-width",null).style("stroke",null),n.selectAll(".title > text").transition().duration(0).style("fill",null),n.selectAll(".node > rect").transition().duration(0).style("stroke-width",null).style("stroke",null).style("fill",null),n.selectAll("path").transition().duration(0).style("stroke-width",null).style("stroke",null).style("fill",null)},Pe.prototype._resetPreviousStep=function(){this.root.graph.nodesByStep[this.curStep-1].forEach(function(t){var n="g.id"+t;this._pulse(0,n+" > rect","out")},this)},Pe.prototype._subAnimationInProgress=function(){var t=!1;for(var n in this.subAnimations)this.subAnimations.hasOwnProperty(n)&&(t=t||this.subAnimations[n].running());return t};var ze=Pe;function Ie(t){this.animation=t;var n=ot(".xdsm-toolbar").append("div").classed("button_group",!0);n.append("button").attr("id","start").append("i").attr("class","icon-start"),n.append("button").attr("id","stop").append("i").attr("class","icon-stop"),n.append("button").attr("id","step-prev").append("i").attr("class","icon-step-prev"),n.append("button").attr("id","step-next").append("i").attr("class","icon-step-next"),this.startButton=ot("button#start"),this.stopButton=ot("button#stop"),this.stepPrevButton=ot("button#step-prev"),this.stepNextButton=ot("button#step-next"),this.startButton.on("click",function(){this.animation.start()}.bind(this)),this.stopButton.on("click",function(){this.animation.stop()}.bind(this)),this.stepPrevButton.on("click",function(){this.animation.stepPrev()}.bind(this)),this.stepNextButton.on("click",function(){this.animation.stepNext()}.bind(this)),this.animation.addObserver(this),this.update(this.animation.status)}Ie.prototype.update=function(t){switch(t){case ze.STATUS.STOPPED:case ze.STATUS.DONE:this.animation.reset();case ze.STATUS.READY:this._enable(this.startButton),this._disable(this.stopButton),this._enable(this.stepNextButton),this._enable(this.stepPrevButton);break;case ze.STATUS.RUNNING_AUTO:this._disable(this.startButton),this._enable(this.stopButton),this._disable(this.stepNextButton),this._disable(this.stepPrevButton);break;case ze.STATUS.RUNNING_STEP:this._disable(this.startButton),this._enable(this.stopButton),this._enable(this.stepNextButton),this._enable(this.stepPrevButton);break;default:console.log("Unexpected Event: "+t)}},Ie.prototype._enable=function(t){t.attr("disabled",null)},Ie.prototype._disable=function(t){t.attr("disabled",!0)};var Be=Ie;function De(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Ue=new(function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,e;return n=t,(e=[{key:"createXdsm",value:function(t){var n,e=this,r=t.attr("data-mdo");if(r){var i=JSON.parse(r);this._createXdsm(i)}else{(n=t.attr("data-mdo-file")||"xdsm.json",fetch(n,void 0).then(d)).then(function(t){return e._createXdsm(t)})}}},{key:"_createXdsm",value:function(t){var n={labelizer:{ellipsis:5,subSupScript:!0,showLinkNbOnly:!1}},e=Object.keys(t).sort();ot("body").selectAll("optpb").data(e).enter().append("div").filter(function(n){return t[n].optpb}).attr("class",function(t){return"optpb "+t}).style("opacity",0).on("click",function(){ot(this).transition().duration(500).style("opacity",0).style("pointer-events","none")}).append("pre").html(function(n){return t[n].optpb});var r={};if(-1===e.indexOf("root")){var i=new lt.a(t);r.root=new Ee(i,"root",n),r.root.draw()}else e.forEach(function(e){if(t.hasOwnProperty(e)){var i=new lt.a(t[e],e);r[e]=new Ee(i,e,n),r[e].draw(),r[e].svg.select(".optimization").on("click",function(){var t=ot(".optpb."+e);t.style("opacity",.9),t.style("left",J.pageX+"px").style("top",J.pageY-28+"px"),t.style("pointer-events","auto")})}},this);var o=new ze(r);r.root.hasWorkflow()&&new Be(o),o.renderNodeStatuses()}}])&&De(n.prototype,e),t}());document.addEventListener("DOMContentLoaded",function(t){ut(".xdsm").each(function(t,n){var e=ot(this);Ue.createXdsm(e)})})}});
//# sourceMappingURL=xdsm.bundle.js.map
</script>

<div class="xdsm-toolbar"></div>

<div data-mdo="{&quot;nodes&quot;: [{&quot;type&quot;: &quot;optimization&quot;, &quot;id&quot;: &quot;opt&quot;, &quot;name&quot;: &quot;ScipyOptimizeDriver&quot;}, {&quot;type&quot;: &quot;analysis&quot;, &quot;id&quot;: &quot;orbit@phase@time@extents&quot;, &quot;name&quot;: &quot;orbit_phase.time_extents&quot;}, {&quot;type&quot;: &quot;analysis&quot;, &quot;id&quot;: &quot;orbit@phase@time&quot;, &quot;name&quot;: &quot;orbit_phase.time&quot;}, {&quot;type&quot;: &quot;analysis&quot;, &quot;id&quot;: &quot;systems@phase@time@extents&quot;, &quot;name&quot;: &quot;systems_phase.time_extents&quot;}, {&quot;type&quot;: &quot;analysis&quot;, &quot;id&quot;: &quot;systems@phase@time&quot;, &quot;name&quot;: &quot;systems_phase.time&quot;}, {&quot;type&quot;: &quot;analysis&quot;, &quot;id&quot;: &quot;extra@phase@time@extents&quot;, &quot;name&quot;: &quot;extra_phase.time_extents&quot;}, {&quot;type&quot;: &quot;analysis&quot;, &quot;id&quot;: &quot;extra@phase@time&quot;, &quot;name&quot;: &quot;extra_phase.time&quot;}], &quot;edges&quot;: [{&quot;to&quot;: &quot;orbit@phase@time@extents&quot;, &quot;from&quot;: &quot;opt&quot;, &quot;name&quot;: [&quot;t_initial&quot;, &quot;t_duration&quot;]}, {&quot;to&quot;: &quot;_U_&quot;, &quot;from&quot;: &quot;orbit@phase@time@extents&quot;, &quot;name&quot;: [&quot;t_initial^*&quot;, &quot;t_duration^*&quot;]}, {&quot;to&quot;: &quot;_U_&quot;, &quot;from&quot;: &quot;opt&quot;, &quot;name&quot;: [&quot;t_initial^*&quot;, &quot;t_duration^*&quot;]}, {&quot;to&quot;: &quot;opt&quot;, &quot;from&quot;: &quot;_U_&quot;, &quot;name&quot;: [&quot;t_initial^(0)&quot;, &quot;t_duration^(0)&quot;]}, {&quot;to&quot;: &quot;extra@phase@time&quot;, &quot;from&quot;: &quot;extra@phase@time@extents&quot;, &quot;name&quot;: [&quot;t_duration&quot;, &quot;t_initial&quot;]}, {&quot;to&quot;: &quot;systems@phase@time&quot;, &quot;from&quot;: &quot;systems@phase@time@extents&quot;, &quot;name&quot;: [&quot;t_duration&quot;, &quot;t_initial&quot;]}, {&quot;to&quot;: &quot;orbit@phase@time&quot;, &quot;from&quot;: &quot;orbit@phase@time@extents&quot;, &quot;name&quot;: [&quot;t_duration&quot;, &quot;t_initial&quot;]}], &quot;workflow&quot;: [&quot;_U_&quot;, [&quot;opt&quot;, [&quot;orbit@phase@time@extents&quot;, &quot;orbit@phase@time&quot;, &quot;systems@phase@time@extents&quot;, &quot;systems@phase@time&quot;, &quot;extra@phase@time@extents&quot;, &quot;extra@phase@time&quot;]]]}" class="xdsm"></div>
relf commented 5 years ago

Indeed the fontello.css references the fontello.woff file which has to be in the same directory, so the generated html file in OpenMDAO is not standalone. I will fix that in XDSMjs and make a PR to OpenMDAO.

onodip commented 5 years ago

many thanks Rémi!

relf commented 5 years ago

Fixed with OpenMDAO/OpenMDAO#855