Commit 6422accb authored by S Anand's avatar S Anand

BUG: allow zoom to work in iPad, IE11, etc

parent 3fc0c515
(function(e){"use strict";var t=e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype,n=e.Blob&&function(){try{return Boolean(new Blob)}catch(e){return false}}(),i=n&&e.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch(e){return false}}(),r=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,a=(n||r)&&e.atob&&e.ArrayBuffer&&e.Uint8Array&&function(e){var t,a,s,l,o,f;if(e.split(",")[0].indexOf("base64")>=0){t=atob(e.split(",")[1])}else{t=decodeURIComponent(e.split(",")[1])}a=new ArrayBuffer(t.length);s=new Uint8Array(a);for(l=0;l<t.length;l+=1){s[l]=t.charCodeAt(l)}o=e.split(",")[0].split(":")[1].split(";")[0];if(n){return new Blob([i?s:a],{type:o})}f=new r;f.append(a);return f.getBlob(o)};if(e.HTMLCanvasElement&&!t.toBlob){if(t.mozGetAsFile){t.toBlob=function(e,n,i){if(i&&t.toDataURL&&a){e(a(this.toDataURL(n,i)))}else{e(this.mozGetAsFile("blob",n))}}}else if(t.toDataURL&&a){t.toBlob=function(e,t,n){e(a(this.toDataURL(t,n)))}}}if(typeof define==="function"&&define.amd){define(function(){return a})}else{e.dataURLtoBlob=a}})(this);(function(e,t){var n=e.G=typeof exports=="undefined"?{}:exports;n.version="0.0.10";var i=function(e){return decodeURIComponent(e.replace(/\+/g,"%20"))},r=encodeURIComponent,a="http://www.w3.org/2000/xmlns/",s="http://www.w3.org/2000/svg",l="http://www.w3.org/1999/xlink",o=Array.isArray,f=e.URL||e.webkitURL;var c=["href","protocol","origin","userInfo","username","password","hostname","port","relative","pathname","directory","file","search","hash"],u=["searchKey","searchList"],h=/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,d=/(?:^|&)([^&=]*)=?([^&]*)/g,g,p,m,v;g=function(e){var t={toString:p,join:m,update:v},n=h.exec(e||""),r=14;while(r--)t[c[r]]=n[r]||"";var a=t[u[0]]={},s=t[u[1]]={};t[c[12]].replace(d,function(e,t,n){if(t){t=i(t);n=i(n);a[t]=n;s[t]=s[t]||[];s[t].push(n)}});return t};p=function(e){e=e||this;var t=e[c[1]]||"http",n=e[c[4]],i=e[c[5]],a=e[c[6]],s=e[c[7]],l=e[c[9]],o=e[c[12]],f=e[c[13]],h=e[u[0]],d=e[u[1]],g=a?[t,"://"]:[],p=[],m,v,y,b;if(n){g.push(n);if(i)g.push(":",i);g.push("@")}g.push(a);if(s)g.push(":",s);g.push(l||(a?"/":""));if(o){g.push("?",o)}else{if(d){for(m in d){for(y=0,v=d[m],b=v.length;y<b;y++){p.push(r(m)+"="+r(v[y]))}if(!b)p.push(m)}}else if(h){for(m in h){p.push(r(m)+"="+r(h[m]))}}if(p.length)g.push("?",p.join("&"))}if(f)g.push("#",f);return g.join("")};m=function(e,t){t=t||{};var n=this,i=n[c[9]].split("/"),r=i.length-1,a=g(e),s=a.pathname.split("/"),l=s.length,o,f;if(typeof t.query=="undefined")t.query=true;if(typeof t.hash=="undefined")t.hash=true;for(o=0;o<14;o++){if(o==9)continue;if(o==12&&!t.query)continue;if(o==13&&!t.hash)continue;if(a[c[o]])n[c[o]]=a[c[o]]}if(t.query&&a[c[12]]){n[u[0]]=a[u[0]];n[u[1]]=a[u[1]]}for(o=0;o<l;o++){f=s[o];if(f=="."){i[r]=""}else if(f==".."){i[--r]=""}else if(f===""){if(l>1){if(!o){i[0]=f;r=1}if(o==l-1)i[r]=f}}else{i[r]=f;if(o<l-1)r++}}var h=n[c[9]]=i.slice(0,r+1).join("/"),d=h.split(/\//),p=[h];if(n[c[12]])p.push("?",n[c[12]]);if(n[c[13]])p.push("#",n[c[13]]);n[c[8]]=p.join("");n[c[10]]=d.slice(0,d.length-1).join("/")+"/";n[c[11]]=d[d.length-1];return n};v=function(e,t){var n=this,i=n[u[0]],a=n[u[1]],s=[],l={},f,c,h,d,p,m,v;if(t){t=""+t;if(t.match(/[&=]/))l=g("?"+t).searchKey;else for(f in e)l[f]=t}for(f in e){c=e[f];if(c===null){a[f]=[]}else{if(!o(c))c=[c];if(!l[f])a[f]=c;else{if(!(f in a))a[f]=[];for(p={},h=0,d=c.length;h<d;h++)p[c[h].toString()]=1;t=""+l[f];if(t.match(/add/i))a[f]=a[f].concat(c);else if(t.match(/del/i)){for(v=[],m=a[f],h=0,d=m.length;h<d;h++){if(!p[m[h]])v.push(m[h])}a[f]=v}else if(t.match(/toggle/i)){for(v=[],m=a[f],h=0,d=m.length;h<d;h++){if(p[m[h]])p[m[h]]=2;else v.push(m[h])}for(c in p)if(p[c]==1)v.push(c);a[f]=v}}}if(a[f].length===0){delete i[f];delete a[f]}else{i[f]=a[f][a[f].length-1]}}for(f in a){c=a[f];for(h=0,d=c.length;h<d;h++){s.push(r(f)+"="+r(c[h]))}}n.search=s.join("&");return n};n.csv=function(e,t){t=t||{};var n=t.lineterminator||"\n",i=t.delimiter||",",r=0,a=e.length,s,l,f,c,u,h=[],d={},g=0,p=new RegExp('("|'+i+"|\n)","g");if(!a){}else if(o(e[0])){for(;r<a;r++){f=e[r];l=f.length;for(s=0;s<l;s++){c=String(f[s]).replace(/"/g,'""');if(c.search(p)>=0)c='"'+c+'"';if(s>0)c=i+c;h.push(c)}h.push(n)}}else{for(;r<a;r++){f=e[r];u=[];for(s in f){c=String(f[s]).replace(/"/g,'""');if(c.search(p)>=0)c='"'+c+'"';if(!(s in d))d[s]=g++;u[d[s]]=c}h.push(u.join(i));h.push(n)}u=[];for(s in d){c=String(s).replace(/"/g,'""');if(c.search(p)>=0)c='"'+c+'"';u.push(c)}h.unshift(n);h.unshift(u.join(i))}return h.join("")};n.style=function(e){var t=n.styles(e);return t[t.length-1]};n.styles=function(t){var n=e.document.styleSheets,i=[],r=typeof t=="string";for(var a=0,s;s=n[a];a++)for(var l=0,o;o=s.cssRules[l];l++){var f=o.selectorText;if(f&&(r?f==t:f.match(t)))i.push(o)}return i};function y(e,t){var n=-1,i,r;if(!e.cssRules)return;r=e.cssRules.length;while(++n<r){i=e.cssRules[n];if(i.type==3)y(i.styleSheet,t);else if(i.selectorText&&i.selectorText.indexOf(">")==-1)t.push(i.cssText)}}function b(t,n){var i=e.navigator,r,a;if(i.msSaveOrOpenBlob&&i.msSaveOrOpenBlob.bind(i))return i.msSaveOrOpenBlob(t,n.file);r=f.createObjectURL(t);a=w("<a></a>").attr("download",n.file).attr("href",r).css("display","none").appendTo("body").dispatch("click");setTimeout(function(){a.remove();f.revokeObjectURL(r)},10)}function x(e){if(!e.hasAttributeNS(a,"xmlns"))e.setAttributeNS(a,"xmlns",s);if(!e.hasAttributeNS(a,"xmlns:xlink"))e.setAttributeNS(a,"xmlns:xlink",l);return e}n.download=function(t){var i=t.mime,r=t.source,a=-1,s,l,o,c,u,h,d,g,p,m,v;if(t.svg){i=i||"application/svg;charset=utf-8";h=x(w(t.svg).get(0));if(!r){r=(new XMLSerializer).serializeToString(h);if(!t.nostyle){s=e.document.styleSheets||[];o=[];l=s.length;a=-1;while(++a<l)if(s[a])y(s[a],o);if(o.length)r=r.replace(/>/,"><defs><style><![CDATA["+o.join("\n")+"]]></style></defs>")}r='<?xml version="1.0" standalone="no"?>'+r}b(new Blob([r],{type:i}),t)}else if(t.png){i=i||"image/png";h=x(w(t.png).get(0));v=h.getAttribute("width");h.setAttribute("width",h.getBoundingClientRect().width);c=new Image;r=(new XMLSerializer).serializeToString(h);u=new Blob([r],{type:"image/svg+xml;charset=utf-8"});d=f.createObjectURL(u);c.onload=function(){g=h.getBoundingClientRect();p=w("<canvas></canvas>").attr("width",t.width||g.width).attr("height",t.height||g.height).appendTo("body").css("display","none").get(0);m=p.getContext("2d");m.drawImage(c,0,0);p.toBlob(function(e){b(e,t);setTimeout(function(){w(p).remove();f.revokeObjectURL(d)},10)},i)};c.src=d;if(v)h.setAttribute("width",v);else h.removeAttribute("width")}else if(t.csv){i=i||"text/csv;charset-utf-8";r=n.csv(t.csv);b(new Blob([r],{type:i}),t)}else{i=i||"text/html;charset-utf-8";b(new Blob([t.source],{type:i}),t)}};n.wrap=function(t){var n=t.textContent,i=+t.getAttributeNS(null,"width")||t.getComputedTextLength(),r=+t.getAttributeNS(null,"height"),a=t.getAttributeNS(null,"x")||0,l=t.getAttributeNS(null,"y")||0,o=t.getAttributeNS(null,"dx"),f=t.getAttributeNS(null,"dominant-baseline"),c=t.getAttributeNS(null,"dy")||"",u=+t.getAttributeNS(null,"line-height")||1.3,h=n.trim().split(/\s+/).reverse(),d=[],g,p;if(c.match(/em$/))c=parseFloat(c);else if(c.match(/^-?[0-9]+/)){l=+l+ +c;c=0}else c=0;t.textContent="";function m(){var n=e.document.createElementNS(s,"tspan");n.setAttributeNS(null,"x",a);n.setAttributeNS(null,"y",l);if(o)n.setAttributeNS(null,"dx",o);if(f)n.setAttributeNS(null,"dominant-baseline",f);n.setAttributeNS(null,"dy",c+"em");t.appendChild(n);return n}g=m();while(p=h.pop()){d.push(p);g.textContent=d.join(" ");if(g.getComputedTextLength()>i){d.pop();g.textContent=d.join(" ");d=[p];c+=u;g=m();if(r&&t.getBBox().height>=r){t.removeChild(g);break}else g.textContent=p}}return t};n.zoom=function(e){e=e||{};var t=e.selector,n=e.speed||50,i=d3.select(t),r=d3.selectAll(i.node().children),a=d3.behavior.zoom().on("zoom",function(){r.attr("transform","translate("+d3.event.translate+")scale("+d3.event.scale+")");s.translate(d3.event.translate).scale(d3.event.scale)}),s=d3.behavior.zoom().on("zoom",function(){r.transition(n).attr("transform","translate("+d3.event.translate+")scale("+d3.event.scale+")");a.translate(d3.event.translate).scale(d3.event.scale)});if(e.off){i.on(".zoom",null);r.classed("zoom",true).transition().attr("transform","")}else{i.call(a).classed("zoom",false)}return{on:function(e,t){s.on(e,t);a.on(e,t)},to:function(e){var t={},n=0,r,a,l,o;if(!e||!e.length){return s.translate([0,0]).scale(1).event(i)}for(;r=e[n];n++){a=r.getBBox();l=(r.getAttribute("transform")||"").match(/translate\(([\+\-\d\.]+),([\+\-\d\.]+)\)/);if(l){a.x+=+l[1];a.y+=+l[2]}if(!(a.x>=t.x))t.x=a.x;if(!(a.y>=t.y))t.y=a.y;if(!(a.x+a.width<=t.x2))t.x2=a.x+a.width;if(!(a.y+a.height<=t.y2))t.y2=a.y+a.height}t.width=t.x2-t.x;t.height=t.y2-t.y;o=Math.min(width/t.width,height/t.height)*.7;s.translate([(-t.x-t.width/2)*o+width/2,(-t.y-t.height/2)*o+height/2]).scale(o).event(i)}}};var w=e.jQuery,C=w,k=function(e,t){return e.filter(t).add(e.find(t))},A=function(e,t){return e.not(t).add(e.not(t))};getSize=function(e){var t=w(e),n=t.css("display"),i={};if(n!="block")t.css("display","block");i.width=t.width();i.height=t.height();if(n!="block")t.css("display",n);return i};if(w){var N=/[\t\r\n\f]/g,S=/\S+/g;w.fn.addClass=function(e){var t,n,i,r,a,s,l,o=0,f=this.length,c=typeof e==="string"&&e;if(C.isFunction(e)){return this.each(function(t){C(this).addClass(e.call(this,t,typeof this.className=="object"?this.className.baseVal:this.className))})}if(c){t=(e||"").match(S)||[];for(;o<f;o++){n=this[o];s=typeof n.className=="object";l=s?n.className.baseVal:n.className;i=n.nodeType===1&&(l?(" "+l+" ").replace(N," "):" ");if(i){a=0;while(r=t[a++]){if(i.indexOf(" "+r+" ")<0){i+=r+" "}}if(s){n.className.baseVal=C.trim(i)}else{n.className=C.trim(i)}}}}return this};w.fn.removeClass=function(e){var t,n,i,r,a,s,l,o=0,f=this.length,c=arguments.length===0||typeof e==="string"&&e;if(C.isFunction(e)){return this.each(function(t){C(this).removeClass(e.call(this,t,typeof this.className=="object"?this.className.baseVal:this.className))})}if(c){t=(e||"").match(S)||[];for(;o<f;o++){n=this[o];s=typeof n.className=="object";l=s?n.className.baseVal:n.className;i=n.nodeType===1&&(l?(" "+l+" ").replace(N," "):"");if(i){a=0;while(r=t[a++]){while(i.indexOf(" "+r+" ")>=0){i=i.replace(" "+r+" "," ")}}if(s){n.className.baseVal=e?C.trim(i):""}else{n.className=e?C.trim(i):""}}}}return this};w.fn.toggleClass=function(e,t){var n=typeof e;if(typeof t==="boolean"&&n==="string"){return t?this.addClass(e):this.removeClass(e)}if(C.isFunction(e)){return this.each(function(n){C(this).toggleClass(e.call(this,n,typeof this.className=="object"?this.className.baseVal:this.className,t),t)})}return this.each(function(){var t,i;if(n==="string"){var r,a=0,s=C(this),l=e.match(S)||[];while(r=l[a++]){if(s.hasClass(r)){s.removeClass(r)}else{s.addClass(r)}}}else if(n===core_strundefined||n==="boolean"){t=typeof this.className=="object";i=t?this.className.baseVal:this.className;if(i){data_priv.set(this,"__className__",i)}if(t){this.className.baseVal=this.className.baseVal||e===false?"":data_priv.get(this,"__className__")||""}else{this.className=this.className||e===false?"":data_priv.get(this,"__className__")||""}}})};w.fn.hasClass=function(e){var t=" "+e+" ",n,i=0,r=this.length;for(;i<r;i++){n=this[i].className;if(this[i].nodeType===1&&(" "+(typeof n=="object"?n.baseVal:n)+" ").replace(N," ").indexOf(t)>=0){return true}}return false};w.fn.aspect=function(e){e=e||{};var t,n=this,i=e.width,r=e.height,a=n[0].ownerDocument,s=w(a.defaultView||a.parentWindow);if(e.off){s.off(".g.aspect");return n}t=function(){(e.selector?k(n,e.selector):n).each(function(){var e=w(this),t=e.data("width")||i,n=e.data("height")||r,a=getSize(this);if(n)e.css("height",Math.ceil(n*a.width));else if(t)e.css("width",Math.ceil(t*a.height))})};s.on("load.g.aspect",t).on("resize.g.aspect",t).on("orientationchange.g.aspect",t);t();return n};var B;try{new Event("click");B=function(e,t){if(e.match(/click$|^mouse|^menu$/))return new MouseEvent(e,t);else if(e.match(/^key/))return new KeyboardEvent(e,t);else if(e.match(/^focus|^blur$/))return new FocusEvent(e,t);else return new Event(e,t)}}catch(j){B=function(t,n){var i=e.document.createEvent("event");i.initEvent(t,n.bubbles,n.cancelable);return i}}w.fn.dispatch=function(e,t){return this.each(function(){this.dispatchEvent(B(e,w.extend({bubbles:true,cancelable:true},t)))})};w.fn.urlfilter=function(e){e=e||{};var t=this,i=e.attr||"href",r=e.selector||"["+i+"]",a="remove"in e?e.remove:true,s=t[0].ownerDocument,l=(s.defaultView||s.parentWindow).location,o=(s.defaultView||s.parentWindow).history,f=e.toggle,c=e.target;if(e.off)return t.off("click.urlfilter");return t.on("click.urlfilter",r,function(e){e.preventDefault();var t=w(this),r=t.data("toggle")||f,s=t.data("target")||c,h=t.attr(i),d=n.url.parse(h)[u[0]],g={type:"loaded.g.urlfilter",q:d},p,m;if(a)for(m in d)if(d[m]==="")d[m]=null;function v(e){return n.url.parse(e).join(h,{query:false,hash:false}).update(d,r)}if(!s){l.href=v(l.href);t.trigger(g)}else if(s=="#"){l.hash=v(l.href.split("#")[1]||"");t.trigger(g)}else if(s.match(/^pushstate$/i)){o.pushState({},"",v(l.href));t.trigger(g)}else{w(s).each(function(){var e=w(this);p=v(e.data("src"));e.data("src",p).load(p.toString(),function(){e.trigger(g)})})}})};w.fn.highlight=function(e){e=e||{};var t=this,n=e.attr||"data-highlight",i=e.selector||"["+n+"]",r=e.leaveDelay||30,a=e.toggle,s,l=[];if(e.off)return t.off(".g.highlight");function o(r,a){var s=w(a),l=w(s.data("target")||e.target||i),o=s.data("hide-class")||e.hideClass||"fade",f=s.data("show-class")||e.showClass||"",c=w(),u,h=r.length,d=h;if(h){while(d--)c=c.add(k(l,w(r[d]).attr(n)));u=l.not(c);if(f){A(c,"."+f).addClass(f);k(u,"."+f).removeClass(f)}if(o){k(c,"."+o).removeClass(o);A(u,"."+o).addClass(o)}}else{if(f)k(l,"."+f).removeClass(f);if(o)k(l,"."+o).removeClass(o)}t.trigger({type:"shown.g.highlight",selected:w(r),matches:(h?c:l).length,highlighted:c,unhighlighted:u})}t.on("mouseenter.g.highlight",i,function(e){if(s)s=clearTimeout(s);if(!l.length)o([e.target],this)}).on("mouseleave.g.highlight",i,function(){if(s)s=clearTimeout(s);var e=this;if(!l.length)s=setTimeout(function(){o([],e)},r)}).on("click.g.highlight",i,function(e){var t=w(this),n;if(t.data("toggle")||a){n=l.indexOf(e.target);if(n>=0){l.splice(n,1);t.removeClass("active")}else{l.push(e.target);t.addClass("active")}o(l,this)}}).on("clear.g.highlight",function(){w(l).removeClass("active");l.splice(0);o(l,this)});return t};w.fn.panzoom=function(t){t=t||{};var n=this,i=t.attr||"data-zoom",r=t.selector||"["+i+"]",a=t.target,s=t.zoom||4,l="viewBox",o="animated";if(t.off)return n.off("click.panzoom");n.on("click",r,function(t){var n=w(this),r=n.data("target")||a,f=n.attr(i)||s,c=w(r);function u(){c.each(function(){var t=w(this).data(l);if(e.d3)d3.select(this).transition().duration(100).attr(l,t);else this.setAttribute(l,t)})}function h(t){c.each(function(){var n=w(this),i=n.data(l),r=this.getBoundingClientRect(),a=+i[2]||r.width,s=+i[3]||r.height,c=n.offset(),u=t.pageX-c.left,h=t.pageY-c.top,d=[u,h,a/f,s/f].join(" ");if(e.d3&&!t.type.match(/move/)){n.data(o,true);d3.select(this).transition().duration(100).attr(l,d).each("end",function(){n.data(o,false)})}else if(!n.data(o))this.setAttribute(l,d)})}if(n.is(".active")){u();c.off(".panzoom").each(function(){w(this).removeData(l)})}else{c.each(function(){w(this).data(l,(this.getAttribute(l)||"").split(/,|\s+/))}).on("mousemove.panzoom",h);h(t)}n.toggleClass("active")});return n};w.fn.reveal=function(e){e=e||{};var t=this,n=e.attr||"data-reveal",i=e.selector||"["+n+"]",r={};if(e.off)return t.off(".g.reveal");w(i).each(function(){var t=w(this),n=t.data("target")||e.target||i,a,s,l,o,f;if(!r[n]){a=+(t.data("start")||e.start||0);o=t.data("hide-class")||e.hideClass||"fade";l=t.data("type")||e.type||"overlay";f="."+o;s=w(n);if(l=="overlay"){s.eq(a).filter(f).removeClass(o);s.slice(a+1).not(f).addClass(o)}else if(l=="single"){s.eq(a).filter(f).removeClass(o);s.not(s.eq(a)).not(f).addClass(o)}r[n]=1}});return t.on("click.g.reveal",i,function(){var t=w(this),r=w(t.data("target")||e.target||i),a=t.data("hide-class")||e.hideClass||"fade",s=t.data("type")||e.type||"overlay",l=t.data("loop")||e.loop,o="."+a,f=t.attr(n),c,u,h,d,g;if(s=="overlay"){if(f.match(/next/i)){c=r.filter(o);if(!c.length){if(l){r.slice(1).addClass(a);h=r.eq(0)}else{h=r.last()}}else{h=c.first().removeClass(a)}d=r.index(h)}else if(f.match(/prev/i)){u=r.not(o);if(u.length<=1){if(l){r.removeClass(a);h=r.last()}}else{u.last().addClass(a);h=u.eq(-2)}d=r.index(h)}else{d=+f;if(d<0)d=r.length+d;r.slice(0,d+1).filter(o).removeClass(a);r.slice(d+1).not(o).addClass(a)}}else if(s=="single"){g=r.length;u=r.not(o);if(f.match(/next/i)){if(u.length){d=r.index(u.last())+1;if(d>=g)d=l?0:g-1}else d=0}else if(f.match(/prev/i)){if(u.length){d=r.index(u.last())-1;if(d<0)d=l?g-1:0}else d=g-1}else d=+f;h=r.eq(d);h.filter(o).removeClass(a);r.not(h).not(o).addClass(a)}t.trigger({type:"shown.g.reveal",slide:d})})};var z=function(e){return(e||"").toLowerCase().replace(/\s+/g," ").replace(/^ /,"").replace(/ $/,"")},T=function(e){return e.replace(/\s+/g,".*")},E="search-last",R="search-results";w.fn.search=function(e){e=e||{};var t=this,n=e.attr||"data-search",i=e.selector||"["+n+"]",r=e.transform||z,a=e.changeSearch||T,s=e.showClass||"",l=e.hideClass||"",o,f;if(e.off)return t.off(".g.search");o=function(t){var i=w(t.target),a=[],s=e.text||i.attr(n),l=w(i.data("target")||e.target||(typeof s=="string"?"["+s+"]":"*"));l.each(typeof s=="function"?function(){var e=s(this);a.push({el:w(this),original:e,text:r(e),hide:false})}:s=="@text"?function(){var e=this.textContent;a.push({el:w(this),original:e,text:r(e),hide:false})}:function(){var e=this.getAttribute(s);a.push({el:w(this),original:e,text:r(e),hide:false})});i.data(R,a).removeData(E);return a};f=function(e){var t=w(e.target),n=t.val(),i=a(r(n)),f=t.data(E);if(f==i)return;t.data(E,i);var c=new RegExp(i),u=t.data("show-class")||s,h=t.data("hide-class")||l||(u?"":"fade"),d,g,p,m=t.data(R);if(!m)m=o(e);p=m.length;if(!i.length){for(d=0;g=m[d];d++){if(g.hide){if(h)g.el.removeClass(h)}else{if(u)g.el.removeClass(u)}g.hide=false}}else{for(d=0;g=m[d];d++){var v=!g.text.match(c);if(v!==g.hide||!f){if(h)g.el[v?"addClass":"removeClass"](h);if(u)g.el[!v?"addClass":"removeClass"](u);g.hide=v}if(v)p--}}t.trigger({type:"shown.g.search",searchText:n,search:i,matches:p,results:m})};return t.on("keyup.g.search",i,f).on("change.g.search",i,f).on("refresh.g.search",o).on("search.g.search",function(e){o(e);f(e)})};var L="G.template.fn",U="G.template.node";w.fn.template=function(e){var t;this.each(function(){var e=w(this),t;if(!e.data(L)){t=_.template(e.html());e.data(L,function(n){var i=e.data(U);if(i)i.remove();i=w(w.parseHTML(t(n))).insertAfter(e);e.data(U,i);return i})}});if(!e)t=this.map(function(){return w(this).data(L)});else{t=w();this.each(function(){t=t.add(w(this).data(L)(e))})}return t};w.fn.doodle=function(t){t=t||{};if(!("fill"in t))t.fill=true;var n=0,i=1,r=2,a=3,s=4,l=this,o=[],f=0,c=0,u=t.easing||function(e){return e},h=0,d,g,p,m,v,y,b,x,C,k;l.off("stop.g.doodle start.g.doodle").on("stop.g.doodle",function(t,n){if(!C)return;if(typeof n!="undefined"){h=n;d=Date.now();A()}else{h=g}C=e.cancelAnimationFrame(C);if(k)k=e.clearTimeout(k)}).on("start.g.doodle",function(e,l){if(C)return;if(typeof l!="undefined"){h=l;p=u(l);for(y=0;y<b;y++)o[y][n].attr("stroke-dashoffset",p<o[y][r]?o[y][a]:0);if(t.fill)for(y=0;y<b;y++)o[y][n].css("fill",p<o[y][r]?"none":o[y][s])}y=0;x=o[y];m=x[i];d=Date.now();N()}).each(function(){var e=w(this),n=parseFloat(e.data("duration")||"1"),i=this.getTotalLength();c+=n;if(!t.absolute)n*=i;f+=n;o.push([e,n,f,i,e.css("fill")||null]);e.attr({"stroke-dasharray":i+" "+i,"stroke-dashoffset":i});if(t.fill)e.css("fill","none")});for(y=0,b=o.length;y<b;y++){o[y][i]/=f;o[y][r]/=f}v=(t.duration||c||2)*1e3;function A(){g=h+(Date.now()-d)/v;p=u(g);if(y>=b||p>=o[y][r]){while(y<b&&p>=o[y][r]){o[y][n].attr("stroke-dashoffset",0);if(t.fill)o[y][n].css("fill",o[y][s]);y++}if(y>=b){if(typeof t.loop!="undefined")k=setTimeout(function(){l.last().trigger("stop").trigger("start",[0])},t.loop*1e3);l.last().trigger("end.g.doodle");return false}x=o[y];m=x[i]+o[y-1][r]}x[n].attr("stroke-dashoffset",x[a]*(m-p)/x[i]);return true}function N(){if(A())C=e.requestAnimationFrame(N)}if(typeof t.start==="undefined"||t.start)l.last().trigger("start.g.doodle",[0]);return l}}n.unpack=function(){var e,t,i;function r(r){var a=r.data(),s=-1,l=a.length;while(++s<l){a[s].x0=a[s].x;a[s].y0=a[s].y}function o(e){return function(t){t.x+=(t.x0-t.x)*e;t.y+=(t.y0-t.y)*e}}var f=n.network.collide.circle(function(e){return e.r});e.size([t,i]).nodes(a).on("tick",function c(e){r.each(o(e.alpha*.1));var t=d3.geom.quadtree(a),n=0;while(++n<l)t.visit(f(a[n]));r.attr("transform",function(e){return"translate("+e.x+","+e.y+")"})}).start()}r.width=function(e){if(!arguments.length)return t;t=e;return r};r.height=function(e){if(!arguments.length)return i;i=e;return r};r.force=function(t){if(!arguments.length)return e;e=t;return r};return r.force(d3.layout.force().charge(0).gravity(.01))};n.map=function(){var e,t,i,r,a,s,l=function(){return 5},o={};function f(){r.scale(1).translate([0,0]);var n=a.bounds(e),s=.95/Math.max((n[1][0]-n[0][0])/t,(n[1][1]-n[0][1])/i),l=[(t-s*(n[1][0]+n[0][0]))/2,(i-s*(n[1][1]+n[0][1]))/2];r.scale(s).translate(l)}o.map=function(t){f();var n=t.selectAll("path.map").data(e.features);n.transition().attr("transform",null).attr("d",a);n.enter().append("path").attr("class","map").attr("transform",null).attr("d",a);n.exit().remove();return n};o.dorling=function(r){f();var o=function(e){return e.r>0?"M0,0m-{r},0a{r},{r} 0 1,0 {d},0a{r},{r} 0 1,0 -{d},0".replace(/\{r\}/g,e.r).replace(/\{d\}/g,2*e.r):"M0,0"},c=e.features.map(function(e,t){var n=a.centroid(e.geometry);return typeof n==="undefined"?{x:0,y:0}:{x:n[0],y:n[1],r:l(e,t),properties:e.properties}}),u=r.selectAll("path.map").data(c);u.attr("d",o);u.enter().append("path").attr("class","map").attr("d",o);u.exit().remove();if(!s){s=n.unpack().width(t).height(i)}s(u);return u};o.shape=function(t){if(!arguments.length)return e;e=t;return o};o.width=function(e){if(!arguments.length)return t;t=e;return o};o.height=function(e){if(!arguments.length)return i;i=e;return o};o.force=function(e){if(!arguments.length)return force;force=e;return o};o.size=function(e){if(!arguments.length)return l;l=e;return o};o.path=function(e){if(!arguments.length)return a;a=e;return o};o.projection=function(e){if(!arguments.length)return r;r=e;a=d3.geo.path().projection(e);return o};return o.projection(d3.geo.mercator()).force(d3.layout.force().charge(0).gravity(.01))};var q=n.network={};q.kpartite=function(){var e=[],n=[],i={nodes:e,links:n},r,a={},s={},l={},o={},f={};function c(t,i,r){var a=t+" "+i;if(a in f)n[f[a]].rows.push(r);else{f[a]=n.length;n.push({source:e[t],target:e[i],id:a,rows:[r]})}}function u(t){var i=l[t].aggregator,a=l[t].accessor;if(typeof a=="function")e.forEach(function(e){e[t]=i(e.rows.map(function(e){return a(r[e])}))});else if(typeof a=="string")e.forEach(function(e){e[t]=i(e.rows.map(function(e){return r[e][a]}))});else e.forEach(function(e){e[t]=i(e.rows.map(function(e){return r[e]}))});n.forEach(function(e){e[t]=i([e.source[t],e.target[t]])})}function h(){var t,i,f,h,d,g,p,m,v,y,b,x,w,C,k,A;if(typeof r=="undefined"||typeof a=="undefined")return;e.forEach(function(e){e.rows=[]});n.forEach(function(e){e.rows=[]});for(t=0;i=r[t];t++){w={};for(p in a){C=w[p]=[];b=a[p](i);if(!Array.isArray(b))b=[b];for(f=0,h=b.length;f<h;f++){y=b[f];x=p+" "+y;if(x in o)e[o[x]].rows.push(t);else{o[x]=e.length;e.push({key:p,value:y,id:x,rows:[t]})}C.push(o[x])}}for(m in a){k=w[m];h=k.length;for(v in a)if(v>m){A=w[v];g=A.length;for(f=0;f<h;f++)for(d=0;d<g;d++)c(k[f],A[d],t)}}if(s[p])for(p in a){C=w[p];for(f=0,h=C.length;f<h;f++)for(d=0;d<h;d++)if(f<d)c(C[f],C[d],t)}}for(var N in l)u(N)}i.data=function(e){if(!arguments.length)return r;r=e;h();return i};i.key=function(e,n,r){if(!arguments.length)return a;if(arguments.length==1)return a[e];if(!n){delete a[e];delete s[e]}else{r=r||{};a[e]=n;s[e]=r.intralink===t?true:r.intralink}h();return i};i.val=function(e,t,n){if(!arguments.length)return l;if(arguments.length==1)return l[e];if(!t)delete l[e];else l[e]={aggregator:t,accessor:n};h();return i};return i};q.relation=function(){var e=[],t=[],n=0,i={nodes:e,links:t},r={},a={};function s(t){if(typeof t!="object"){if(!(t in r))e.push(r[t]={id:t});return r[t]}if(!("id"in t))t.id=n++;if(!(t.id in r))e.push(r[t.id]=t);return t}i.add=function(e,n){if(!o(e))e=[e];if(!o(n))n=[n];var i=e.length,r=n.length,l,f,c,u,h;for(l=0;l<i;l++)e[l]=s(e[l]);for(f=0;f<r;f++)n[f]=s(n[f]);for(l=0;l<i;l++){c=e[l];for(f=0;f<r;f++){u=n[f];h=c.id+" "+u.id;if(h in a)t[a[h]].count++;else{a[h]=t.length;t.push({source:c,target:u,id:h,count:1})}}}};return i};q.force=function(){var e,t={},n={},i,r,a,s,l=d3.svg.brush(),o=d3.layout.force(),f={force:o,brush:l};function c(e){d3.select(this).classed("fixed",e.fixed=false);d3.event.stopPropagation();o.start()}function u(e){d3.select(this).classed("fixed",e.fixed=true)}function h(e){e.attr("stroke","rgba(0,0,0,.3)")}function d(e){e.attr("r",5).attr("fill","rgba(0,0,0,.5)")}var g;o.on("tick",function(){if(s){var e=d3.geom.quadtree(i),t=0,n=i.length;while(++t<n)e.visit(s(i[t]))}f.lines.attr("x1",function(e){return e.source.x}).attr("y1",function(e){return e.source.y}).attr("x2",function(e){return e.target.x}).attr("y2",function(e){return e.target.y});var r=function(e){return"translate("+e.x+","+e.y+")"};f.circles.attr("transform",r);f.labels.attr("transform",r)});o.drag().on("dragstart",u);f.nodes=function(n,s){if(typeof n!="function"&&n!==null)return t[n];if(n===null)delete t[s];else t[s]=n;i=[];r={};var l,o,c,u;for(l=0;o=e.nodes[l];l++){u=false;for(c in t)if(!t[c](o)){u=true;break}if(!u){i.push(o);r[o.id]=1}}a=p();return f};function p(){var t=[],a=0,s=e.links,l;if(s.length){if(typeof s[0].source=="object"){for(;l=s[a];a++)if(l.source.id in r&&l.target.id in r)t.push(l)}else{for(;l=s[a];a++)if(i[l.source].id in r&&i[l.target].id in r)t.push(l)}for(var o in n)t=t.filter(n[o])}return t}f.links=function(e,t){if(typeof e!="function"&&e!==null)return n[e];if(e===null)delete n[t];else n[t]=e;a=p();return f};f.data=function(t){if(!arguments.length)return e;e=t;i=e.nodes;a=e.links;var n=0;if(i.length&&!i[0].id)i.forEach(function(e){e.id=n++});n=0;if(a.length&&!a[0].id)a.forEach(function(e){e.id=n++});r={};i.forEach(function(e){r[e.id]=e});return f};f.circle=function(e){if(!arguments.length)return d;d=e;return f};f.label=function(e){if(!arguments.length)return g;g=e;return f};f.line=function(e){if(!arguments.length)return h;h=e;return f};f.collide=function(e){if(!arguments.length)return s;s=e;return f};f.draw=function(e){e=d3.select(e);var t=+e.attr("width"),n=+e.attr("height"),r;o.size([t,n]);var s=e.select("g.brush");if(s.empty())s=e.append("g").attr("class","brush");var u=e.select("g.lines");if(u.empty())u=e.append("g").attr("class","lines");var p=e.select("g.circles");if(p.empty())p=e.append("g").attr("class","circles");var m=e.select("g.labels");if(m.empty())m=e.append("g").attr("class","labels");o.nodes(i).links(a);f.lines=u.selectAll("line.link").data(a,function(e){return e.id});f.lines.exit().remove();if(h){r=f.lines.enter().append("line").attr("class","link");h(f.lines)}f.circles=p.selectAll("circle.node").data(i,function(e){return e.id});f.circles.exit().remove();if(d){r=f.circles.enter().append("circle").attr("class","node").on("dblclick.release",c).call(o.drag);d(f.circles)}f.labels=m.selectAll("text.node").data(i,function(e){return e.id});f.labels.exit().remove();if(g){r=f.labels.enter().append("text").attr("class","node").on("dblclick.release",c).call(o.drag);g(f.labels)}if(!e.on("dblclick.release"))e.on("dblclick.release",function(){if(d3.event.target==e.node()){f.circles.filter(function(e){return e.fixed}).classed("fixed",function(e){return e.fixed=false});f.labels.filter(function(e){return e.fixed}).classed("fixed",function(e){return e.fixed=false});o.start()}});l.x(d3.scale.identity().domain([0,t])).y(d3.scale.identity().domain([0,n])).on("brush.select",function(){var e=d3.event.target.extent();f.circles.classed("selected",function(t){return t.selected=e[0][0]<=t.x&&t.x<e[1][0]&&e[0][1]<=t.y&&t.y<e[1][1]});f.labels.classed("selected",function(t){return t.selected=e[0][0]<=t.x&&t.x<e[1][0]&&e[0][1]<=t.y&&t.y<e[1][1]})});l(s);o.start();return f};return f};q.collide={circle:function(e,t){t=t||0;return function(n){var i=e(n)+t,r=n.x-i,a=n.x+i,s=n.y-i,l=n.y+i;return function(i,o,f,c,u){if(i.point&&i.point!==n){var h=n.x-i.point.x,d=n.y-i.point.y,g=Math.sqrt(h*h+d*d),p=e(n)+t+e(i.point);if(g<p){g=(g-p)/g*.5;n.x-=h*=g;n.y-=d*=g;i.point.x+=h;i.point.y+=d}}return o>a||c<r||f>l||u<s}}}};n.url={parse:g,unparse:p}})(this);
\ No newline at end of file
(function(e){"use strict";var t=e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype,n=e.Blob&&function(){try{return Boolean(new Blob)}catch(e){return false}}(),i=n&&e.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch(e){return false}}(),r=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,a=(n||r)&&e.atob&&e.ArrayBuffer&&e.Uint8Array&&function(e){var t,a,s,l,o,f;if(e.split(",")[0].indexOf("base64")>=0){t=atob(e.split(",")[1])}else{t=decodeURIComponent(e.split(",")[1])}a=new ArrayBuffer(t.length);s=new Uint8Array(a);for(l=0;l<t.length;l+=1){s[l]=t.charCodeAt(l)}o=e.split(",")[0].split(":")[1].split(";")[0];if(n){return new Blob([i?s:a],{type:o})}f=new r;f.append(a);return f.getBlob(o)};if(e.HTMLCanvasElement&&!t.toBlob){if(t.mozGetAsFile){t.toBlob=function(e,n,i){if(i&&t.toDataURL&&a){e(a(this.toDataURL(n,i)))}else{e(this.mozGetAsFile("blob",n))}}}else if(t.toDataURL&&a){t.toBlob=function(e,t,n){e(a(this.toDataURL(t,n)))}}}if(typeof define==="function"&&define.amd){define(function(){return a})}else{e.dataURLtoBlob=a}})(this);(function(e,t){var n=e.G=typeof exports=="undefined"?{}:exports;n.version="0.0.10";var i=function(e){return decodeURIComponent(e.replace(/\+/g,"%20"))},r=encodeURIComponent,a="http://www.w3.org/2000/xmlns/",s="http://www.w3.org/2000/svg",l="http://www.w3.org/1999/xlink",o=Array.isArray,f=e.URL||e.webkitURL;var c=["href","protocol","origin","userInfo","username","password","hostname","port","relative","pathname","directory","file","search","hash"],u=["searchKey","searchList"],h=/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,d=/(?:^|&)([^&=]*)=?([^&]*)/g,g,p,m,v;g=function(e){var t={toString:p,join:m,update:v},n=h.exec(e||""),r=14;while(r--)t[c[r]]=n[r]||"";var a=t[u[0]]={},s=t[u[1]]={};t[c[12]].replace(d,function(e,t,n){if(t){t=i(t);n=i(n);a[t]=n;s[t]=s[t]||[];s[t].push(n)}});return t};p=function(e){e=e||this;var t=e[c[1]]||"http",n=e[c[4]],i=e[c[5]],a=e[c[6]],s=e[c[7]],l=e[c[9]],o=e[c[12]],f=e[c[13]],h=e[u[0]],d=e[u[1]],g=a?[t,"://"]:[],p=[],m,v,y,b;if(n){g.push(n);if(i)g.push(":",i);g.push("@")}g.push(a);if(s)g.push(":",s);g.push(l||(a?"/":""));if(o){g.push("?",o)}else{if(d){for(m in d){for(y=0,v=d[m],b=v.length;y<b;y++){p.push(r(m)+"="+r(v[y]))}if(!b)p.push(m)}}else if(h){for(m in h){p.push(r(m)+"="+r(h[m]))}}if(p.length)g.push("?",p.join("&"))}if(f)g.push("#",f);return g.join("")};m=function(e,t){t=t||{};var n=this,i=n[c[9]].split("/"),r=i.length-1,a=g(e),s=a.pathname.split("/"),l=s.length,o,f;if(typeof t.query=="undefined")t.query=true;if(typeof t.hash=="undefined")t.hash=true;for(o=0;o<14;o++){if(o==9)continue;if(o==12&&!t.query)continue;if(o==13&&!t.hash)continue;if(a[c[o]])n[c[o]]=a[c[o]]}if(t.query&&a[c[12]]){n[u[0]]=a[u[0]];n[u[1]]=a[u[1]]}for(o=0;o<l;o++){f=s[o];if(f=="."){i[r]=""}else if(f==".."){i[--r]=""}else if(f===""){if(l>1){if(!o){i[0]=f;r=1}if(o==l-1)i[r]=f}}else{i[r]=f;if(o<l-1)r++}}var h=n[c[9]]=i.slice(0,r+1).join("/"),d=h.split(/\//),p=[h];if(n[c[12]])p.push("?",n[c[12]]);if(n[c[13]])p.push("#",n[c[13]]);n[c[8]]=p.join("");n[c[10]]=d.slice(0,d.length-1).join("/")+"/";n[c[11]]=d[d.length-1];return n};v=function(e,t){var n=this,i=n[u[0]],a=n[u[1]],s=[],l={},f,c,h,d,p,m,v;if(t){t=""+t;if(t.match(/[&=]/))l=g("?"+t).searchKey;else for(f in e)l[f]=t}for(f in e){c=e[f];if(c===null){a[f]=[]}else{if(!o(c))c=[c];if(!l[f])a[f]=c;else{if(!(f in a))a[f]=[];for(p={},h=0,d=c.length;h<d;h++)p[c[h].toString()]=1;t=""+l[f];if(t.match(/add/i))a[f]=a[f].concat(c);else if(t.match(/del/i)){for(v=[],m=a[f],h=0,d=m.length;h<d;h++){if(!p[m[h]])v.push(m[h])}a[f]=v}else if(t.match(/toggle/i)){for(v=[],m=a[f],h=0,d=m.length;h<d;h++){if(p[m[h]])p[m[h]]=2;else v.push(m[h])}for(c in p)if(p[c]==1)v.push(c);a[f]=v}}}if(a[f].length===0){delete i[f];delete a[f]}else{i[f]=a[f][a[f].length-1]}}for(f in a){c=a[f];for(h=0,d=c.length;h<d;h++){s.push(r(f)+"="+r(c[h]))}}n.search=s.join("&");return n};n.csv=function(e,t){t=t||{};var n=t.lineterminator||"\n",i=t.delimiter||",",r=0,a=e.length,s,l,f,c,u,h=[],d={},g=0,p=new RegExp('("|'+i+"|\n)","g");if(!a){}else if(o(e[0])){for(;r<a;r++){f=e[r];l=f.length;for(s=0;s<l;s++){c=String(f[s]).replace(/"/g,'""');if(c.search(p)>=0)c='"'+c+'"';if(s>0)c=i+c;h.push(c)}h.push(n)}}else{for(;r<a;r++){f=e[r];u=[];for(s in f){c=String(f[s]).replace(/"/g,'""');if(c.search(p)>=0)c='"'+c+'"';if(!(s in d))d[s]=g++;u[d[s]]=c}h.push(u.join(i));h.push(n)}u=[];for(s in d){c=String(s).replace(/"/g,'""');if(c.search(p)>=0)c='"'+c+'"';u.push(c)}h.unshift(n);h.unshift(u.join(i))}return h.join("")};n.style=function(e){var t=n.styles(e);return t[t.length-1]};n.styles=function(t){var n=e.document.styleSheets,i=[],r=typeof t=="string";for(var a=0,s;s=n[a];a++)for(var l=0,o;o=s.cssRules[l];l++){var f=o.selectorText;if(f&&(r?f==t:f.match(t)))i.push(o)}return i};function y(e,t){var n=-1,i,r;if(!e.cssRules)return;r=e.cssRules.length;while(++n<r){i=e.cssRules[n];if(i.type==3)y(i.styleSheet,t);else if(i.selectorText&&i.selectorText.indexOf(">")==-1)t.push(i.cssText)}}function b(t,n){var i=e.navigator,r,a;if(i.msSaveOrOpenBlob&&i.msSaveOrOpenBlob.bind(i))return i.msSaveOrOpenBlob(t,n.file);r=f.createObjectURL(t);a=w("<a></a>").attr("download",n.file).attr("href",r).css("display","none").appendTo("body").dispatch("click");setTimeout(function(){a.remove();f.revokeObjectURL(r)},10)}function x(e){if(!e.hasAttributeNS(a,"xmlns"))e.setAttributeNS(a,"xmlns",s);if(!e.hasAttributeNS(a,"xmlns:xlink"))e.setAttributeNS(a,"xmlns:xlink",l);return e}n.download=function(t){var i=t.mime,r=t.source,a=-1,s,l,o,c,u,h,d,g,p,m,v;if(t.svg){i=i||"application/svg;charset=utf-8";h=x(w(t.svg).get(0));if(!r){r=(new XMLSerializer).serializeToString(h);if(!t.nostyle){s=e.document.styleSheets||[];o=[];l=s.length;a=-1;while(++a<l)if(s[a])y(s[a],o);if(o.length)r=r.replace(/>/,"><defs><style><![CDATA["+o.join("\n")+"]]></style></defs>")}r='<?xml version="1.0" standalone="no"?>'+r}b(new Blob([r],{type:i}),t)}else if(t.png){i=i||"image/png";h=x(w(t.png).get(0));v=h.getAttribute("width");h.setAttribute("width",h.getBoundingClientRect().width);c=new Image;r=(new XMLSerializer).serializeToString(h);u=new Blob([r],{type:"image/svg+xml;charset=utf-8"});d=f.createObjectURL(u);c.onload=function(){g=h.getBoundingClientRect();p=w("<canvas></canvas>").attr("width",t.width||g.width).attr("height",t.height||g.height).appendTo("body").css("display","none").get(0);m=p.getContext("2d");m.drawImage(c,0,0);p.toBlob(function(e){b(e,t);setTimeout(function(){w(p).remove();f.revokeObjectURL(d)},10)},i)};c.src=d;if(v)h.setAttribute("width",v);else h.removeAttribute("width")}else if(t.csv){i=i||"text/csv;charset-utf-8";r=n.csv(t.csv);b(new Blob([r],{type:i}),t)}else{i=i||"text/html;charset-utf-8";b(new Blob([t.source],{type:i}),t)}};n.wrap=function(t){var n=t.textContent,i=+t.getAttributeNS(null,"width")||t.getComputedTextLength(),r=+t.getAttributeNS(null,"height"),a=t.getAttributeNS(null,"x")||0,l=t.getAttributeNS(null,"y")||0,o=t.getAttributeNS(null,"dx"),f=t.getAttributeNS(null,"dominant-baseline"),c=t.getAttributeNS(null,"dy")||"",u=+t.getAttributeNS(null,"line-height")||1.3,h=n.trim().split(/\s+/).reverse(),d=[],g,p;if(c.match(/em$/))c=parseFloat(c);else if(c.match(/^-?[0-9]+/)){l=+l+ +c;c=0}else c=0;t.textContent="";function m(){var n=e.document.createElementNS(s,"tspan");n.setAttributeNS(null,"x",a);n.setAttributeNS(null,"y",l);if(o)n.setAttributeNS(null,"dx",o);if(f)n.setAttributeNS(null,"dominant-baseline",f);n.setAttributeNS(null,"dy",c+"em");t.appendChild(n);return n}g=m();while(p=h.pop()){d.push(p);g.textContent=d.join(" ");if(g.getComputedTextLength()>i){d.pop();g.textContent=d.join(" ");d=[p];c+=u;g=m();if(r&&t.getBBox().height>=r){t.removeChild(g);break}else g.textContent=p}}return t};n.zoom=function(e){e=e||{};var t=e.selector,n=e.speed||50,i=d3.select(t),r=d3.selectAll(i.node().childNodes).filter(function(){return this.nodeName!="#text"}),a=d3.behavior.zoom().on("zoom",function(){r.attr("transform","translate("+d3.event.translate+")scale("+d3.event.scale+")");s.translate(d3.event.translate).scale(d3.event.scale)}),s=d3.behavior.zoom().on("zoom",function(){r.transition(n).attr("transform","translate("+d3.event.translate+")scale("+d3.event.scale+")");a.translate(d3.event.translate).scale(d3.event.scale)});if(e.off){i.on(".zoom",null);r.classed("zoom",true).transition().attr("transform","")}else{i.call(a).classed("zoom",false)}return{on:function(e,t){s.on(e,t);a.on(e,t)},to:function(e){var t={},n=0,r,a,l,o;if(!e||!e.length){return s.translate([0,0]).scale(1).event(i)}for(;r=e[n];n++){a=r.getBBox();l=(r.getAttribute("transform")||"").match(/translate\(([\+\-\d\.]+),([\+\-\d\.]+)\)/);if(l){a.x+=+l[1];a.y+=+l[2]}if(!(a.x>=t.x))t.x=a.x;if(!(a.y>=t.y))t.y=a.y;if(!(a.x+a.width<=t.x2))t.x2=a.x+a.width;if(!(a.y+a.height<=t.y2))t.y2=a.y+a.height}t.width=t.x2-t.x;t.height=t.y2-t.y;o=Math.min(width/t.width,height/t.height)*.7;s.translate([(-t.x-t.width/2)*o+width/2,(-t.y-t.height/2)*o+height/2]).scale(o).event(i)}}};var w=e.jQuery,C=w,k=function(e,t){return e.filter(t).add(e.find(t))},A=function(e,t){return e.not(t).add(e.not(t))};getSize=function(e){var t=w(e),n=t.css("display"),i={};if(n!="block")t.css("display","block");i.width=t.width();i.height=t.height();if(n!="block")t.css("display",n);return i};if(w){var N=/[\t\r\n\f]/g,S=/\S+/g;w.fn.addClass=function(e){var t,n,i,r,a,s,l,o=0,f=this.length,c=typeof e==="string"&&e;if(C.isFunction(e)){return this.each(function(t){C(this).addClass(e.call(this,t,typeof this.className=="object"?this.className.baseVal:this.className))})}if(c){t=(e||"").match(S)||[];for(;o<f;o++){n=this[o];s=typeof n.className=="object";l=s?n.className.baseVal:n.className;i=n.nodeType===1&&(l?(" "+l+" ").replace(N," "):" ");if(i){a=0;while(r=t[a++]){if(i.indexOf(" "+r+" ")<0){i+=r+" "}}if(s){n.className.baseVal=C.trim(i)}else{n.className=C.trim(i)}}}}return this};w.fn.removeClass=function(e){var t,n,i,r,a,s,l,o=0,f=this.length,c=arguments.length===0||typeof e==="string"&&e;if(C.isFunction(e)){return this.each(function(t){C(this).removeClass(e.call(this,t,typeof this.className=="object"?this.className.baseVal:this.className))})}if(c){t=(e||"").match(S)||[];for(;o<f;o++){n=this[o];s=typeof n.className=="object";l=s?n.className.baseVal:n.className;i=n.nodeType===1&&(l?(" "+l+" ").replace(N," "):"");if(i){a=0;while(r=t[a++]){while(i.indexOf(" "+r+" ")>=0){i=i.replace(" "+r+" "," ")}}if(s){n.className.baseVal=e?C.trim(i):""}else{n.className=e?C.trim(i):""}}}}return this};w.fn.toggleClass=function(e,t){var n=typeof e;if(typeof t==="boolean"&&n==="string"){return t?this.addClass(e):this.removeClass(e)}if(C.isFunction(e)){return this.each(function(n){C(this).toggleClass(e.call(this,n,typeof this.className=="object"?this.className.baseVal:this.className,t),t)})}return this.each(function(){var t,i;if(n==="string"){var r,a=0,s=C(this),l=e.match(S)||[];while(r=l[a++]){if(s.hasClass(r)){s.removeClass(r)}else{s.addClass(r)}}}else if(n===core_strundefined||n==="boolean"){t=typeof this.className=="object";i=t?this.className.baseVal:this.className;if(i){data_priv.set(this,"__className__",i)}if(t){this.className.baseVal=this.className.baseVal||e===false?"":data_priv.get(this,"__className__")||""}else{this.className=this.className||e===false?"":data_priv.get(this,"__className__")||""}}})};w.fn.hasClass=function(e){var t=" "+e+" ",n,i=0,r=this.length;for(;i<r;i++){n=this[i].className;if(this[i].nodeType===1&&(" "+(typeof n=="object"?n.baseVal:n)+" ").replace(N," ").indexOf(t)>=0){return true}}return false};w.fn.aspect=function(e){e=e||{};var t,n=this,i=e.width,r=e.height,a=n[0].ownerDocument,s=w(a.defaultView||a.parentWindow);if(e.off){s.off(".g.aspect");return n}t=function(){(e.selector?k(n,e.selector):n).each(function(){var e=w(this),t=e.data("width")||i,n=e.data("height")||r,a=getSize(this);if(n)e.css("height",Math.ceil(n*a.width));else if(t)e.css("width",Math.ceil(t*a.height))})};s.on("load.g.aspect",t).on("resize.g.aspect",t).on("orientationchange.g.aspect",t);t();return n};var B;try{new Event("click");B=function(e,t){if(e.match(/click$|^mouse|^menu$/))return new MouseEvent(e,t);else if(e.match(/^key/))return new KeyboardEvent(e,t);else if(e.match(/^focus|^blur$/))return new FocusEvent(e,t);else return new Event(e,t)}}catch(j){B=function(t,n){var i=e.document.createEvent("event");i.initEvent(t,n.bubbles,n.cancelable);return i}}w.fn.dispatch=function(e,t){return this.each(function(){this.dispatchEvent(B(e,w.extend({bubbles:true,cancelable:true},t)))})};w.fn.urlfilter=function(e){e=e||{};var t=this,i=e.attr||"href",r=e.selector||"["+i+"]",a="remove"in e?e.remove:true,s=t[0].ownerDocument,l=(s.defaultView||s.parentWindow).location,o=(s.defaultView||s.parentWindow).history,f=e.toggle,c=e.target;if(e.off)return t.off("click.urlfilter");return t.on("click.urlfilter",r,function(e){e.preventDefault();var t=w(this),r=t.data("toggle")||f,s=t.data("target")||c,h=t.attr(i),d=n.url.parse(h)[u[0]],g={type:"loaded.g.urlfilter",q:d},p,m;if(a)for(m in d)if(d[m]==="")d[m]=null;function v(e){return n.url.parse(e).join(h,{query:false,hash:false}).update(d,r)}if(!s){l.href=v(l.href);t.trigger(g)}else if(s=="#"){l.hash=v(l.href.split("#")[1]||"");t.trigger(g)}else if(s.match(/^pushstate$/i)){o.pushState({},"",v(l.href));t.trigger(g)}else{w(s).each(function(){var e=w(this);p=v(e.data("src"));e.data("src",p).load(p.toString(),function(){e.trigger(g)})})}})};w.fn.highlight=function(e){e=e||{};var t=this,n=e.attr||"data-highlight",i=e.selector||"["+n+"]",r=e.leaveDelay||30,a=e.toggle,s,l=[];if(e.off)return t.off(".g.highlight");function o(r,a){var s=w(a),l=w(s.data("target")||e.target||i),o=s.data("hide-class")||e.hideClass||"fade",f=s.data("show-class")||e.showClass||"",c=w(),u,h=r.length,d=h;if(h){while(d--)c=c.add(k(l,w(r[d]).attr(n)));u=l.not(c);if(f){A(c,"."+f).addClass(f);k(u,"."+f).removeClass(f)}if(o){k(c,"."+o).removeClass(o);A(u,"."+o).addClass(o)}}else{if(f)k(l,"."+f).removeClass(f);if(o)k(l,"."+o).removeClass(o)}t.trigger({type:"shown.g.highlight",selected:w(r),matches:(h?c:l).length,highlighted:c,unhighlighted:u})}t.on("mouseenter.g.highlight",i,function(e){if(s)s=clearTimeout(s);if(!l.length)o([e.target],this)}).on("mouseleave.g.highlight",i,function(){if(s)s=clearTimeout(s);var e=this;if(!l.length)s=setTimeout(function(){o([],e)},r)}).on("click.g.highlight",i,function(e){var t=w(this),n;if(t.data("toggle")||a){n=l.indexOf(e.target);if(n>=0){l.splice(n,1);t.removeClass("active")}else{l.push(e.target);t.addClass("active")}o(l,this)}}).on("clear.g.highlight",function(){w(l).removeClass("active");l.splice(0);o(l,this)});return t};w.fn.panzoom=function(t){t=t||{};var n=this,i=t.attr||"data-zoom",r=t.selector||"["+i+"]",a=t.target,s=t.zoom||4,l="viewBox",o="animated";if(t.off)return n.off("click.panzoom");n.on("click",r,function(t){var n=w(this),r=n.data("target")||a,f=n.attr(i)||s,c=w(r);function u(){c.each(function(){var t=w(this).data(l);if(e.d3)d3.select(this).transition().duration(100).attr(l,t);else this.setAttribute(l,t)})}function h(t){c.each(function(){var n=w(this),i=n.data(l),r=this.getBoundingClientRect(),a=+i[2]||r.width,s=+i[3]||r.height,c=n.offset(),u=t.pageX-c.left,h=t.pageY-c.top,d=[u,h,a/f,s/f].join(" ");if(e.d3&&!t.type.match(/move/)){n.data(o,true);d3.select(this).transition().duration(100).attr(l,d).each("end",function(){n.data(o,false)})}else if(!n.data(o))this.setAttribute(l,d)})}if(n.is(".active")){u();c.off(".panzoom").each(function(){w(this).removeData(l)})}else{c.each(function(){w(this).data(l,(this.getAttribute(l)||"").split(/,|\s+/))}).on("mousemove.panzoom",h);h(t)}n.toggleClass("active")});return n};w.fn.reveal=function(e){e=e||{};var t=this,n=e.attr||"data-reveal",i=e.selector||"["+n+"]",r={};if(e.off)return t.off(".g.reveal");w(i).each(function(){var t=w(this),n=t.data("target")||e.target||i,a,s,l,o,f;if(!r[n]){a=+(t.data("start")||e.start||0);o=t.data("hide-class")||e.hideClass||"fade";l=t.data("type")||e.type||"overlay";f="."+o;s=w(n);if(l=="overlay"){s.eq(a).filter(f).removeClass(o);s.slice(a+1).not(f).addClass(o)}else if(l=="single"){s.eq(a).filter(f).removeClass(o);s.not(s.eq(a)).not(f).addClass(o)}r[n]=1}});return t.on("click.g.reveal",i,function(){var t=w(this),r=w(t.data("target")||e.target||i),a=t.data("hide-class")||e.hideClass||"fade",s=t.data("type")||e.type||"overlay",l=t.data("loop")||e.loop,o="."+a,f=t.attr(n),c,u,h,d,g;if(s=="overlay"){if(f.match(/next/i)){c=r.filter(o);if(!c.length){if(l){r.slice(1).addClass(a);h=r.eq(0)}else{h=r.last()}}else{h=c.first().removeClass(a)}d=r.index(h)}else if(f.match(/prev/i)){u=r.not(o);if(u.length<=1){if(l){r.removeClass(a);h=r.last()}}else{u.last().addClass(a);h=u.eq(-2)}d=r.index(h)}else{d=+f;if(d<0)d=r.length+d;r.slice(0,d+1).filter(o).removeClass(a);r.slice(d+1).not(o).addClass(a)}}else if(s=="single"){g=r.length;u=r.not(o);if(f.match(/next/i)){if(u.length){d=r.index(u.last())+1;if(d>=g)d=l?0:g-1}else d=0}else if(f.match(/prev/i)){if(u.length){d=r.index(u.last())-1;if(d<0)d=l?g-1:0}else d=g-1}else d=+f;h=r.eq(d);h.filter(o).removeClass(a);r.not(h).not(o).addClass(a)}t.trigger({type:"shown.g.reveal",slide:d})})};var z=function(e){return(e||"").toLowerCase().replace(/\s+/g," ").replace(/^ /,"").replace(/ $/,"")},T=function(e){return e.replace(/\s+/g,".*")},E="search-last",R="search-results";w.fn.search=function(e){e=e||{};var t=this,n=e.attr||"data-search",i=e.selector||"["+n+"]",r=e.transform||z,a=e.changeSearch||T,s=e.showClass||"",l=e.hideClass||"",o,f;if(e.off)return t.off(".g.search");o=function(t){var i=w(t.target),a=[],s=e.text||i.attr(n),l=w(i.data("target")||e.target||(typeof s=="string"?"["+s+"]":"*"));l.each(typeof s=="function"?function(){var e=s(this);a.push({el:w(this),original:e,text:r(e),hide:false})}:s=="@text"?function(){var e=this.textContent;a.push({el:w(this),original:e,text:r(e),hide:false})}:function(){var e=this.getAttribute(s);a.push({el:w(this),original:e,text:r(e),hide:false})});i.data(R,a).removeData(E);return a};f=function(e){var t=w(e.target),n=t.val(),i=a(r(n)),f=t.data(E);if(f==i)return;t.data(E,i);var c=new RegExp(i),u=t.data("show-class")||s,h=t.data("hide-class")||l||(u?"":"fade"),d,g,p,m=t.data(R);if(!m)m=o(e);p=m.length;if(!i.length){for(d=0;g=m[d];d++){if(g.hide){if(h)g.el.removeClass(h)}else{if(u)g.el.removeClass(u)}g.hide=false}}else{for(d=0;g=m[d];d++){var v=!g.text.match(c);if(v!==g.hide||!f){if(h)g.el[v?"addClass":"removeClass"](h);if(u)g.el[!v?"addClass":"removeClass"](u);g.hide=v}if(v)p--}}t.trigger({type:"shown.g.search",searchText:n,search:i,matches:p,results:m})};return t.on("keyup.g.search",i,f).on("change.g.search",i,f).on("refresh.g.search",o).on("search.g.search",function(e){o(e);f(e)})};var L="G.template.fn",U="G.template.node";w.fn.template=function(e){var t;this.each(function(){var e=w(this),t;if(!e.data(L)){t=_.template(e.html());e.data(L,function(n){var i=e.data(U);if(i)i.remove();i=w(w.parseHTML(t(n))).insertAfter(e);e.data(U,i);return i})}});if(!e)t=this.map(function(){return w(this).data(L)});else{t=w();this.each(function(){t=t.add(w(this).data(L)(e))})}return t};w.fn.doodle=function(t){t=t||{};if(!("fill"in t))t.fill=true;var n=0,i=1,r=2,a=3,s=4,l=this,o=[],f=0,c=0,u=t.easing||function(e){return e},h=0,d,g,p,m,v,y,b,x,C,k;l.off("stop.g.doodle start.g.doodle").on("stop.g.doodle",function(t,n){if(!C)return;if(typeof n!="undefined"){h=n;d=Date.now();A()}else{h=g}C=e.cancelAnimationFrame(C);if(k)k=e.clearTimeout(k)}).on("start.g.doodle",function(e,l){if(C)return;if(typeof l!="undefined"){h=l;p=u(l);for(y=0;y<b;y++)o[y][n].attr("stroke-dashoffset",p<o[y][r]?o[y][a]:0);if(t.fill)for(y=0;y<b;y++)o[y][n].css("fill",p<o[y][r]?"none":o[y][s])}y=0;x=o[y];m=x[i];d=Date.now();N()}).each(function(){var e=w(this),n=parseFloat(e.data("duration")||"1"),i=this.getTotalLength();c+=n;if(!t.absolute)n*=i;f+=n;o.push([e,n,f,i,e.css("fill")||null]);e.attr({"stroke-dasharray":i+" "+i,"stroke-dashoffset":i});if(t.fill)e.css("fill","none")});for(y=0,b=o.length;y<b;y++){o[y][i]/=f;o[y][r]/=f}v=(t.duration||c||2)*1e3;function A(){g=h+(Date.now()-d)/v;p=u(g);if(y>=b||p>=o[y][r]){while(y<b&&p>=o[y][r]){o[y][n].attr("stroke-dashoffset",0);if(t.fill)o[y][n].css("fill",o[y][s]);y++}if(y>=b){if(typeof t.loop!="undefined")k=setTimeout(function(){l.last().trigger("stop").trigger("start",[0])},t.loop*1e3);l.last().trigger("end.g.doodle");return false}x=o[y];m=x[i]+o[y-1][r]}x[n].attr("stroke-dashoffset",x[a]*(m-p)/x[i]);return true}function N(){if(A())C=e.requestAnimationFrame(N)}if(typeof t.start==="undefined"||t.start)l.last().trigger("start.g.doodle",[0]);return l}}n.unpack=function(){var e,t,i;function r(r){var a=r.data(),s=-1,l=a.length;while(++s<l){a[s].x0=a[s].x;a[s].y0=a[s].y}function o(e){return function(t){t.x+=(t.x0-t.x)*e;t.y+=(t.y0-t.y)*e}}var f=n.network.collide.circle(function(e){return e.r});e.size([t,i]).nodes(a).on("tick",function c(e){r.each(o(e.alpha*.1));var t=d3.geom.quadtree(a),n=0;while(++n<l)t.visit(f(a[n]));r.attr("transform",function(e){return"translate("+e.x+","+e.y+")"})}).start()}r.width=function(e){if(!arguments.length)return t;t=e;return r};r.height=function(e){if(!arguments.length)return i;i=e;return r};r.force=function(t){if(!arguments.length)return e;e=t;return r};return r.force(d3.layout.force().charge(0).gravity(.01))};n.map=function(){var e,t,i,r,a,s,l=function(){return 5},o={};function f(){r.scale(1).translate([0,0]);var n=a.bounds(e),s=.95/Math.max((n[1][0]-n[0][0])/t,(n[1][1]-n[0][1])/i),l=[(t-s*(n[1][0]+n[0][0]))/2,(i-s*(n[1][1]+n[0][1]))/2];r.scale(s).translate(l)}o.map=function(t){f();var n=t.selectAll("path.map").data(e.features);n.transition().attr("transform",null).attr("d",a);n.enter().append("path").attr("class","map").attr("transform",null).attr("d",a);n.exit().remove();return n};o.dorling=function(r){f();var o=function(e){return e.r>0?"M0,0m-{r},0a{r},{r} 0 1,0 {d},0a{r},{r} 0 1,0 -{d},0".replace(/\{r\}/g,e.r).replace(/\{d\}/g,2*e.r):"M0,0"},c=e.features.map(function(e,t){var n=a.centroid(e.geometry);return typeof n==="undefined"?{x:0,y:0}:{x:n[0],y:n[1],r:l(e,t),properties:e.properties}}),u=r.selectAll("path.map").data(c);u.attr("d",o);u.enter().append("path").attr("class","map").attr("d",o);u.exit().remove();if(!s){s=n.unpack().width(t).height(i)}s(u);return u};o.shape=function(t){if(!arguments.length)return e;e=t;return o};o.width=function(e){if(!arguments.length)return t;t=e;return o};o.height=function(e){if(!arguments.length)return i;i=e;return o};o.force=function(e){if(!arguments.length)return force;force=e;return o};o.size=function(e){if(!arguments.length)return l;l=e;return o};o.path=function(e){if(!arguments.length)return a;a=e;return o};o.projection=function(e){if(!arguments.length)return r;r=e;a=d3.geo.path().projection(e);return o};return o.projection(d3.geo.mercator()).force(d3.layout.force().charge(0).gravity(.01))};var q=n.network={};q.kpartite=function(){var e=[],n=[],i={nodes:e,links:n},r,a={},s={},l={},o={},f={};function c(t,i,r){var a=t+" "+i;if(a in f)n[f[a]].rows.push(r);else{f[a]=n.length;n.push({source:e[t],target:e[i],id:a,rows:[r]})}}function u(t){var i=l[t].aggregator,a=l[t].accessor;if(typeof a=="function")e.forEach(function(e){e[t]=i(e.rows.map(function(e){return a(r[e])}))});else if(typeof a=="string")e.forEach(function(e){e[t]=i(e.rows.map(function(e){return r[e][a]}))});else e.forEach(function(e){e[t]=i(e.rows.map(function(e){return r[e]}))});n.forEach(function(e){e[t]=i([e.source[t],e.target[t]])})}function h(){var t,i,f,h,d,g,p,m,v,y,b,x,w,C,k,A;if(typeof r=="undefined"||typeof a=="undefined")return;e.forEach(function(e){e.rows=[]});n.forEach(function(e){e.rows=[]});for(t=0;i=r[t];t++){w={};for(p in a){C=w[p]=[];b=a[p](i);if(!Array.isArray(b))b=[b];for(f=0,h=b.length;f<h;f++){y=b[f];x=p+" "+y;if(x in o)e[o[x]].rows.push(t);else{o[x]=e.length;e.push({key:p,value:y,id:x,rows:[t]})}C.push(o[x])}}for(m in a){k=w[m];h=k.length;for(v in a)if(v>m){A=w[v];g=A.length;for(f=0;f<h;f++)for(d=0;d<g;d++)c(k[f],A[d],t)}}if(s[p])for(p in a){C=w[p];for(f=0,h=C.length;f<h;f++)for(d=0;d<h;d++)if(f<d)c(C[f],C[d],t)}}for(var N in l)u(N)}i.data=function(e){if(!arguments.length)return r;r=e;h();return i};i.key=function(e,n,r){if(!arguments.length)return a;if(arguments.length==1)return a[e];if(!n){delete a[e];delete s[e]}else{r=r||{};a[e]=n;s[e]=r.intralink===t?true:r.intralink}h();return i};i.val=function(e,t,n){if(!arguments.length)return l;if(arguments.length==1)return l[e];if(!t)delete l[e];else l[e]={aggregator:t,accessor:n};h();return i};return i};q.relation=function(){var e=[],t=[],n=0,i={nodes:e,links:t},r={},a={};function s(t){if(typeof t!="object"){if(!(t in r))e.push(r[t]={id:t});return r[t]}if(!("id"in t))t.id=n++;if(!(t.id in r))e.push(r[t.id]=t);return t}i.add=function(e,n){if(!o(e))e=[e];if(!o(n))n=[n];var i=e.length,r=n.length,l,f,c,u,h;for(l=0;l<i;l++)e[l]=s(e[l]);for(f=0;f<r;f++)n[f]=s(n[f]);for(l=0;l<i;l++){c=e[l];for(f=0;f<r;f++){u=n[f];h=c.id+" "+u.id;if(h in a)t[a[h]].count++;else{a[h]=t.length;t.push({source:c,target:u,id:h,count:1})}}}};return i};q.force=function(){var e,t={},n={},i,r,a,s,l=d3.svg.brush(),o=d3.layout.force(),f={force:o,brush:l};function c(e){d3.select(this).classed("fixed",e.fixed=false);d3.event.stopPropagation();o.start()}function u(e){d3.select(this).classed("fixed",e.fixed=true)}function h(e){e.attr("stroke","rgba(0,0,0,.3)")}function d(e){e.attr("r",5).attr("fill","rgba(0,0,0,.5)")}var g;o.on("tick",function(){if(s){var e=d3.geom.quadtree(i),t=0,n=i.length;while(++t<n)e.visit(s(i[t]))}f.lines.attr("x1",function(e){return e.source.x}).attr("y1",function(e){return e.source.y}).attr("x2",function(e){return e.target.x}).attr("y2",function(e){return e.target.y});var r=function(e){return"translate("+e.x+","+e.y+")"};f.circles.attr("transform",r);f.labels.attr("transform",r)});o.drag().on("dragstart",u);f.nodes=function(n,s){if(typeof n!="function"&&n!==null)return t[n];if(n===null)delete t[s];else t[s]=n;i=[];r={};var l,o,c,u;for(l=0;o=e.nodes[l];l++){u=false;for(c in t)if(!t[c](o)){u=true;break}if(!u){i.push(o);r[o.id]=1}}a=p();return f};function p(){var t=[],a=0,s=e.links,l;if(s.length){if(typeof s[0].source=="object"){for(;l=s[a];a++)if(l.source.id in r&&l.target.id in r)t.push(l)}else{for(;l=s[a];a++)if(i[l.source].id in r&&i[l.target].id in r)t.push(l)}for(var o in n)t=t.filter(n[o])}return t}f.links=function(e,t){if(typeof e!="function"&&e!==null)return n[e];if(e===null)delete n[t];else n[t]=e;a=p();return f};f.data=function(t){if(!arguments.length)return e;e=t;i=e.nodes;a=e.links;var n=0;if(i.length&&!i[0].id)i.forEach(function(e){e.id=n++});n=0;if(a.length&&!a[0].id)a.forEach(function(e){e.id=n++});r={};i.forEach(function(e){r[e.id]=e});return f};f.circle=function(e){if(!arguments.length)return d;d=e;return f};f.label=function(e){if(!arguments.length)return g;g=e;return f};f.line=function(e){if(!arguments.length)return h;h=e;return f};f.collide=function(e){if(!arguments.length)return s;s=e;return f};f.draw=function(e){e=d3.select(e);var t=+e.attr("width"),n=+e.attr("height"),r;o.size([t,n]);var s=e.select("g.brush");if(s.empty())s=e.append("g").attr("class","brush");var u=e.select("g.lines");if(u.empty())u=e.append("g").attr("class","lines");var p=e.select("g.circles");if(p.empty())p=e.append("g").attr("class","circles");var m=e.select("g.labels");if(m.empty())m=e.append("g").attr("class","labels");o.nodes(i).links(a);f.lines=u.selectAll("line.link").data(a,function(e){return e.id});f.lines.exit().remove();if(h){r=f.lines.enter().append("line").attr("class","link");h(f.lines)}f.circles=p.selectAll("circle.node").data(i,function(e){return e.id});f.circles.exit().remove();if(d){r=f.circles.enter().append("circle").attr("class","node").on("dblclick.release",c).call(o.drag);d(f.circles)}f.labels=m.selectAll("text.node").data(i,function(e){return e.id});f.labels.exit().remove();if(g){r=f.labels.enter().append("text").attr("class","node").on("dblclick.release",c).call(o.drag);g(f.labels)}if(!e.on("dblclick.release"))e.on("dblclick.release",function(){if(d3.event.target==e.node()){f.circles.filter(function(e){return e.fixed}).classed("fixed",function(e){return e.fixed=false});f.labels.filter(function(e){return e.fixed}).classed("fixed",function(e){return e.fixed=false});o.start()}});l.x(d3.scale.identity().domain([0,t])).y(d3.scale.identity().domain([0,n])).on("brush.select",function(){var e=d3.event.target.extent();f.circles.classed("selected",function(t){return t.selected=e[0][0]<=t.x&&t.x<e[1][0]&&e[0][1]<=t.y&&t.y<e[1][1]});f.labels.classed("selected",function(t){return t.selected=e[0][0]<=t.x&&t.x<e[1][0]&&e[0][1]<=t.y&&t.y<e[1][1]})});l(s);o.start();return f};return f};q.collide={circle:function(e,t){t=t||0;return function(n){var i=e(n)+t,r=n.x-i,a=n.x+i,s=n.y-i,l=n.y+i;return function(i,o,f,c,u){if(i.point&&i.point!==n){var h=n.x-i.point.x,d=n.y-i.point.y,g=Math.sqrt(h*h+d*d),p=e(n)+t+e(i.point);if(g<p){g=(g-p)/g*.5;n.x-=h*=g;n.y-=d*=g;i.point.x+=h;i.point.y+=d}}return o>a||c<r||f>l||u<s}}}};n.url={parse:g,unparse:p}})(this);
\ No newline at end of file
......@@ -3,8 +3,8 @@ G.zoom = function(options) {
var selector = options.selector,
speed = options.speed || 50,
container = d3.select(selector),
// Note: children does not exist on the iPad
children = d3.selectAll(container.node().children),
children = d3.selectAll(container.node().childNodes)
.filter(function() { return this.nodeName != '#text' }),
abruptzoom = d3.behavior.zoom()
.on('zoom', function() {
children.attr('transform', 'translate(' + d3.event.translate + ')scale(' + d3.event.scale + ')')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment