20647599e8822abbe1934036da8ca47de5e44490
[VSoRC/.git] / js / joint.all.min.js
1 /*! Rappid - the diagramming toolkit
2
3 Copyright (c) 2014 client IO
4
5  2014-05-13 
6
7
8 This Source Code Form is subject to the terms of the Rappid Academic License
9 , v. 1.0. If a copy of the Rappid License was not distributed with this
10 file, You can obtain one at http://jointjs.com/license/rappid_academic_v1.txt
11  or from the Rappid archive as was distributed by client IO. See the LICENSE file.*/
12
13
14 function RGBColor(t){this.ok=!1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=t.replace(/ /g,""),t=t.toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var i in e)t==i&&(t=e[i]);for(var n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;n.length>r;r++){var a=n[r].re,s=n[r].process,o=a.exec(t);o&&(channels=s(o),this.r=channels[0],this.g=channels[1],this.b=channels[2],this.ok=!0)}this.r=0>this.r||isNaN(this.r)?0:this.r>255?255:this.r,this.g=0>this.g||isNaN(this.g)?0:this.g>255?255:this.g,this.b=0>this.b||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=[],i=0;n.length>i;i++)for(var r=n[i].example,a=0;r.length>a;a++)t[t.length]=r[a];for(var s in e)t[t.length]=s;var o=document.createElement("ul");o.setAttribute("id","rgbcolor-examples");for(var i=0;t.length>i;i++)try{var l=document.createElement("li"),c=new RGBColor(t[i]),h=document.createElement("div");h.style.cssText="margin: 3px; border: 1px solid black; background:"+c.toHex()+"; "+"color:"+c.toHex(),h.appendChild(document.createTextNode("test"));var u=document.createTextNode(" "+t[i]+" -> "+c.toRGB()+" -> "+c.toHex());l.appendChild(h),l.appendChild(u),o.appendChild(l)}catch(p){}return o}}function stackBlurImage(t,e,i,n){var r=document.getElementById(t),a=r.naturalWidth,s=r.naturalHeight,o=document.getElementById(e);o.style.width=a+"px",o.style.height=s+"px",o.width=a,o.height=s;var l=o.getContext("2d");l.clearRect(0,0,a,s),l.drawImage(r,0,0),isNaN(i)||1>i||(n?stackBlurCanvasRGBA(e,0,0,a,s,i):stackBlurCanvasRGB(e,0,0,a,s,i))}function stackBlurCanvasRGBA(t,e,i,n,r,a){if(!(isNaN(a)||1>a)){a|=0;var s,o=document.getElementById(t),l=o.getContext("2d");try{try{s=l.getImageData(e,i,n,r)}catch(c){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),s=l.getImageData(e,i,n,r)}catch(c){throw alert("Cannot access local image"),Error("unable to access local image data: "+c)}}}catch(c){throw alert("Cannot access image"),Error("unable to access image data: "+c)}var h,u,p,g,d,f,m,I,y,v,C,b,A,w,x,M,j,N,k,D,z,S,T,E,G=s.data,L=a+a+1,B=n-1,Z=r-1,_=a+1,P=_*(_+1)/2,O=new BlurStack,Y=O;for(p=1;L>p;p++)if(Y=Y.next=new BlurStack,p==_)var W=Y;Y.next=O;var V=null,R=null;m=f=0;var X=mul_table[a],U=shg_table[a];for(u=0;r>u;u++){for(M=j=N=k=I=y=v=C=0,b=_*(D=G[f]),A=_*(z=G[f+1]),w=_*(S=G[f+2]),x=_*(T=G[f+3]),I+=P*D,y+=P*z,v+=P*S,C+=P*T,Y=O,p=0;_>p;p++)Y.r=D,Y.g=z,Y.b=S,Y.a=T,Y=Y.next;for(p=1;_>p;p++)g=f+((p>B?B:p)<<2),I+=(Y.r=D=G[g])*(E=_-p),y+=(Y.g=z=G[g+1])*E,v+=(Y.b=S=G[g+2])*E,C+=(Y.a=T=G[g+3])*E,M+=D,j+=z,N+=S,k+=T,Y=Y.next;for(V=O,R=W,h=0;n>h;h++)G[f+3]=T=C*X>>U,0!=T?(T=255/T,G[f]=(I*X>>U)*T,G[f+1]=(y*X>>U)*T,G[f+2]=(v*X>>U)*T):G[f]=G[f+1]=G[f+2]=0,I-=b,y-=A,v-=w,C-=x,b-=V.r,A-=V.g,w-=V.b,x-=V.a,g=m+(B>(g=h+a+1)?g:B)<<2,M+=V.r=G[g],j+=V.g=G[g+1],N+=V.b=G[g+2],k+=V.a=G[g+3],I+=M,y+=j,v+=N,C+=k,V=V.next,b+=D=R.r,A+=z=R.g,w+=S=R.b,x+=T=R.a,M-=D,j-=z,N-=S,k-=T,R=R.next,f+=4;m+=n}for(h=0;n>h;h++){for(j=N=k=M=y=v=C=I=0,f=h<<2,b=_*(D=G[f]),A=_*(z=G[f+1]),w=_*(S=G[f+2]),x=_*(T=G[f+3]),I+=P*D,y+=P*z,v+=P*S,C+=P*T,Y=O,p=0;_>p;p++)Y.r=D,Y.g=z,Y.b=S,Y.a=T,Y=Y.next;for(d=n,p=1;a>=p;p++)f=d+h<<2,I+=(Y.r=D=G[f])*(E=_-p),y+=(Y.g=z=G[f+1])*E,v+=(Y.b=S=G[f+2])*E,C+=(Y.a=T=G[f+3])*E,M+=D,j+=z,N+=S,k+=T,Y=Y.next,Z>p&&(d+=n);for(f=h,V=O,R=W,u=0;r>u;u++)g=f<<2,G[g+3]=T=C*X>>U,T>0?(T=255/T,G[g]=(I*X>>U)*T,G[g+1]=(y*X>>U)*T,G[g+2]=(v*X>>U)*T):G[g]=G[g+1]=G[g+2]=0,I-=b,y-=A,v-=w,C-=x,b-=V.r,A-=V.g,w-=V.b,x-=V.a,g=h+(Z>(g=u+_)?g:Z)*n<<2,I+=M+=V.r=G[g],y+=j+=V.g=G[g+1],v+=N+=V.b=G[g+2],C+=k+=V.a=G[g+3],V=V.next,b+=D=R.r,A+=z=R.g,w+=S=R.b,x+=T=R.a,M-=D,j-=z,N-=S,k-=T,R=R.next,f+=n}l.putImageData(s,e,i)}}function stackBlurCanvasRGB(t,e,i,n,r,a){if(!(isNaN(a)||1>a)){a|=0;var s,o=document.getElementById(t),l=o.getContext("2d");try{try{s=l.getImageData(e,i,n,r)}catch(c){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),s=l.getImageData(e,i,n,r)}catch(c){throw alert("Cannot access local image"),Error("unable to access local image data: "+c)}}}catch(c){throw alert("Cannot access image"),Error("unable to access image data: "+c)}var h,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A,C-=P.r,b-=P.g,A-=P.b,g=h+(E>(g=u+G)?g:E)*n<<2,I+=w+=P.r=z[g],y+=x+=P.g=z[g+1],v+=M+=P.b=z[g+2],P=P.next,C+=j=O.r,b+=N=O.g,A+=k=O.b,w-=j,x-=N,M-=k,O=O.next,f+=n}l.putImageData(s,e,i)}}function BlurStack(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}if(function(t,e){function i(t){var e=t.length,i=ae.type(t);return ae.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===i||"function"!==i&&(0===e||"number"==typeof e&&e>0&&e-1 in t)}function n(t){var e=de[t]={};return ae.each(t.match(oe)||[],function(t,i){e[i]=!0}),e}function r(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ae.expando+Math.random()}function a(t,i,n){var r;if(n===e&&1===t.nodeType)if(r="data-"+i.replace(ye,"-$1").toLowerCase(),n=t.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ie.test(n)?JSON.parse(n):n}catch(a){}fe.set(t,i,n)}else n=e;return n}function s(){return!0}function o(){return!1}function l(){try{return X.activeElement}catch(t){}}function c(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function h(t,e,i){if(ae.isFunction(e))return ae.grep(t,function(t,n){return!!e.call(t,n,t)!==i});if(e.nodeType)return ae.grep(t,function(t){return t===e!==i});if("string"==typeof e){if(ke.test(e))return ae.filter(e,t,i);e=ae.filter(e,t)}return ae.grep(t,function(t){return ee.call(e,t)>=0!==i})}function u(t,e){return ae.nodeName(t,"table")&&ae.nodeName(1===e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function p(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function g(t){var e=Pe.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function d(t,e){for(var i=t.length,n=0;i>n;n++)me.set(t[n],"globalEval",!e||me.get(e[n],"globalEval"))}function f(t,e){var i,n,r,a,s,o,l,c;if(1===e.nodeType){if(me.hasData(t)&&(a=me.access(t),s=me.set(e,a),c=a.events)){delete s.handle,s.events={};for(r in c)for(i=0,n=c[r].length;n>i;i++)ae.event.add(e,r,c[r][i])}fe.hasData(t)&&(o=fe.access(t),l=ae.extend({},o),fe.set(e,l))}}function m(t,i){var n=t.getElementsByTagName?t.getElementsByTagName(i||"*"):t.querySelectorAll?t.querySelectorAll(i||"*"):[];return i===e||i&&ae.nodeName(t,i)?ae.merge([t],n):n}function I(t,e){var i=e.nodeName.toLowerCase();"input"===i&&Be.test(t.type)?e.checked=t.checked:("input"===i||"textarea"===i)&&(e.defaultValue=t.defaultValue)}function y(t,e){if(e in t)return e;for(var i=e.charAt(0).toUpperCase()+e.slice(1),n=e,r=qe.length;r--;)if(e=qe[r]+i,e in t)return e;return n}function v(t,e){return t=e||t,"none"===ae.css(t,"display")||!ae.contains(t.ownerDocument,t)}function C(e){return t.getComputedStyle(e,null)}function b(t,e){for(var i,n,r,a=[],s=0,o=t.length;o>s;s++)n=t[s],n.style&&(a[s]=me.get(n,"olddisplay"),i=n.style.display,e?(a[s]||"none"!==i||(n.style.display=""),""===n.style.display&&v(n)&&(a[s]=me.access(n,"olddisplay",M(n.nodeName)))):a[s]||(r=v(n),(i&&"none"!==i||!r)&&me.set(n,"olddisplay",r?i:ae.css(n,"display"))));for(s=0;o>s;s++)n=t[s],n.style&&(e&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=e?a[s]||"":"none"));return t}function A(t,e,i){var n=Ue.exec(e);return n?Math.max(0,n[1]-(i||0))+(n[2]||"px"):e}function w(t,e,i,n,r){for(var a=i===(n?"border":"content")?4:"width"===e?1:0,s=0;4>a;a+=2)"margin"===i&&(s+=ae.css(t,i+Ke[a],!0,r)),n?("content"===i&&(s-=ae.css(t,"padding"+Ke[a],!0,r)),"margin"!==i&&(s-=ae.css(t,"border"+Ke[a]+"Width",!0,r))):(s+=ae.css(t,"padding"+Ke[a],!0,r),"padding"!==i&&(s+=ae.css(t,"border"+Ke[a]+"Width",!0,r)));return s}function x(t,e,i){var n=!0,r="width"===e?t.offsetWidth:t.offsetHeight,a=C(t),s=ae.support.boxSizing&&"border-box"===ae.css(t,"boxSizing",!1,a);if(0>=r||null==r){if(r=We(t,e,a),(0>r||null==r)&&(r=t.style[e]),He.test(r))return r;n=s&&(ae.support.boxSizingReliable||r===t.style[e]),r=parseFloat(r)||0}return r+w(t,e,i||(s?"border":"content"),n,a)+"px"}function M(t){var e=X,i=Je[t];return i||(i=j(t,e),"none"!==i&&i||(Ve=(Ve||ae("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(e.documentElement),e=(Ve[0].contentWindow||Ve[0].contentDocument).document,e.write("<!doctype html><html><body>"),e.close(),i=j(t,e),Ve.detach()),Je[t]=i),i}function j(t,e){var i=ae(e.createElement(t)).appendTo(e.body),n=ae.css(i[0],"display");return i.remove(),n}function N(t,e,i,n){var r;if(ae.isArray(e))ae.each(e,function(e,r){i||ei.test(t)?n(t,r):N(t+"["+("object"==typeof r?e:"")+"]",r,i,n)});else if(i||"object"!==ae.type(e))n(t,e);else for(r in e)N(t+"["+r+"]",e[r],i,n)}function k(t){return function(e,i){"string"!=typeof e&&(i=e,e="*");var n,r=0,a=e.toLowerCase().match(oe)||[];if(ae.isFunction(i))for(;n=a[r++];)"+"===n[0]?(n=n.slice(1)||"*",(t[n]=t[n]||[]).unshift(i)):(t[n]=t[n]||[]).push(i)}}function D(t,i,n,r){function a(l){var c;return s[l]=!0,ae.each(t[l]||[],function(t,l){var h=l(i,n,r);return"string"!=typeof h||o||s[h]?o?!(c=h):e:(i.dataTypes.unshift(h),a(h),!1)}),c}var s={},o=t===yi;return a(i.dataTypes[0])||!s["*"]&&a("*")}function z(t,i){var n,r,a=ae.ajaxSettings.flatOptions||{};for(n in i)i[n]!==e&&((a[n]?t:r||(r={}))[n]=i[n]);return r&&ae.extend(!0,t,r),t}function S(t,i,n){for(var r,a,s,o,l=t.contents,c=t.dataTypes;"*"===c[0];)c.shift(),r===e&&(r=t.mimeType||i.getResponseHeader("Content-Type"));if(r)for(a in l)if(l[a]&&l[a].test(r)){c.unshift(a);break}if(c[0]in n)s=c[0];else{for(a in n){if(!c[0]||t.converters[a+" "+c[0]]){s=a;break}o||(o=a)}s=s||o}return s?(s!==c[0]&&c.unshift(s),n[s]):e}function T(t,e,i,n){var r,a,s,o,l,c={},h=t.dataTypes.slice();if(h[1])for(s in t.converters)c[s.toLowerCase()]=t.converters[s];for(a=h.shift();a;)if(t.responseFields[a]&&(i[t.responseFields[a]]=e),!l&&n&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=a,a=h.shift())if("*"===a)a=l;else if("*"!==l&&l!==a){if(s=c[l+" "+a]||c["* "+a],!s)for(r in c)if(o=r.split(" "),o[1]===a&&(s=c[l+" "+o[0]]||c["* "+o[0]])){s===!0?s=c[r]:c[r]!==!0&&(a=o[0],h.unshift(o[1]));break}if(s!==!0)if(s&&t["throws"])e=s(e);else try{e=s(e)}catch(u){return{state:"parsererror",error:s?u:"No conversion from "+l+" to "+a}}}return{state:"success",data:e}}function E(){return setTimeout(function(){Ni=e}),Ni=ae.now()}function G(t,e,i){for(var n,r=(Ei[e]||[]).concat(Ei["*"]),a=0,s=r.length;s>a;a++)if(n=r[a].call(i,e,t))return n}function L(t,e,i){var n,r,a=0,s=Ti.length,o=ae.Deferred().always(function(){delete l.elem}),l=function(){if(r)return!1;for(var e=Ni||E(),i=Math.max(0,c.startTime+c.duration-e),n=i/c.duration||0,a=1-n,s=0,l=c.tweens.length;l>s;s++)c.tweens[s].run(a);return o.notifyWith(t,[c,a,i]),1>a&&l?i:(o.resolveWith(t,[c]),!1)},c=o.promise({elem:t,props:ae.extend({},e),opts:ae.extend(!0,{specialEasing:{}},i),originalProperties:e,originalOptions:i,startTime:Ni||E(),duration:i.duration,tweens:[],createTween:function(e,i){var n=ae.Tween(t,c.opts,e,i,c.opts.specialEasing[e]||c.opts.easing);return c.tweens.push(n),n},stop:function(e){var i=0,n=e?c.tweens.length:0;if(r)return this;for(r=!0;n>i;i++)c.tweens[i].run(1);return e?o.resolveWith(t,[c,e]):o.rejectWith(t,[c,e]),this}}),h=c.props;for(B(h,c.opts.specialEasing);s>a;a++)if(n=Ti[a].call(c,t,h,c.opts))return n;return ae.map(h,G,c),ae.isFunction(c.opts.start)&&c.opts.start.call(t,c),ae.fx.timer(ae.extend(l,{elem:t,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function B(t,e){var i,n,r,a,s;for(i in t)if(n=ae.camelCase(i),r=e[n],a=t[i],ae.isArray(a)&&(r=a[1],a=t[i]=a[0]),i!==n&&(t[n]=a,delete t[i]),s=ae.cssHooks[n],s&&"expand"in s){a=s.expand(a),delete t[n];for(i in a)i in t||(t[i]=a[i],e[i]=r)}else e[n]=r}function Z(t,i,n){var r,a,s,o,l,c,h=this,u={},p=t.style,g=t.nodeType&&v(t),d=me.get(t,"fxshow");n.queue||(l=ae._queueHooks(t,"fx"),null==l.unqueued&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,ae.queue(t,"fx").length||l.empty.fire()})})),1===t.nodeType&&("height"in i||"width"in i)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===ae.css(t,"display")&&"none"===ae.css(t,"float")&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",h.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in i)if(a=i[r],Di.exec(a)){if(delete i[r],s=s||"toggle"===a,a===(g?"hide":"show")){if("show"!==a||!d||d[r]===e)continue;g=!0}u[r]=d&&d[r]||ae.style(t,r)}if(!ae.isEmptyObject(u)){d?"hidden"in d&&(g=d.hidden):d=me.access(t,"fxshow",{}),s&&(d.hidden=!g),g?ae(t).show():h.done(function(){ae(t).hide()}),h.done(function(){var e;me.remove(t,"fxshow");for(e in u)ae.style(t,e,u[e])});for(r in u)o=G(g?d[r]:0,r,h),r in d||(d[r]=o.start,g&&(o.end=o.start,o.start="width"===r||"height"===r?1:0))}}function _(t,e,i,n,r){return new _.prototype.init(t,e,i,n,r)}function P(t,e){var i,n={height:t},r=0;for(e=e?1:0;4>r;r+=2-e)i=Ke[r],n["margin"+i]=n["padding"+i]=t;return e&&(n.opacity=n.width=t),n}function O(t){return ae.isWindow(t)?t:9===t.nodeType&&t.defaultView}var Y,W,V=typeof e,R=t.location,X=t.document,U=X.documentElement,H=t.jQuery,F=t.$,J={},Q=[],$="2.0.3",K=Q.concat,q=Q.push,te=Q.slice,ee=Q.indexOf,ie=J.toString,ne=J.hasOwnProperty,re=$.trim,ae=function(t,e){return new ae.fn.init(t,e,Y)},se=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,oe=/\S+/g,le=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ce=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,he=/^-ms-/,ue=/-([\da-z])/gi,pe=function(t,e){return e.toUpperCase()},ge=function(){X.removeEventListener("DOMContentLoaded",ge,!1),t.removeEventListener("load",ge,!1),ae.ready()};ae.fn=ae.prototype={jquery:$,constructor:ae,init:function(t,i,n){var r,a;if(!t)return this;if("string"==typeof t){if(r="<"===t.charAt(0)&&">"===t.charAt(t.length-1)&&t.length>=3?[null,t,null]:le.exec(t),!r||!r[1]&&i)return!i||i.jquery?(i||n).find(t):this.constructor(i).find(t);if(r[1]){if(i=i instanceof ae?i[0]:i,ae.merge(this,ae.parseHTML(r[1],i&&i.nodeType?i.ownerDocument||i:X,!0)),ce.test(r[1])&&ae.isPlainObject(i))for(r in i)ae.isFunction(this[r])?this[r](i[r]):this.attr(r,i[r]);return this}return a=X.getElementById(r[2]),a&&a.parentNode&&(this.length=1,this[0]=a),this.context=X,this.selector=t,this}return t.nodeType?(this.context=this[0]=t,this.length=1,this):ae.isFunction(t)?n.ready(t):(t.selector!==e&&(this.selector=t.selector,this.context=t.context),ae.makeArray(t,this))},selector:"",length:0,toArray:function(){return te.call(this)},get:function(t){return null==t?this.toArray():0>t?this[this.length+t]:this[t]},pushStack:function(t){var e=ae.merge(this.constructor(),t);return e.prevObject=this,e.context=this.context,e},each:function(t,e){return ae.each(this,t,e)},ready:function(t){return ae.ready.promise().done(t),this},slice:function(){return this.pushStack(te.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,i=+t+(0>t?e:0);return this.pushStack(i>=0&&e>i?[this[i]]:[])},map:function(t){return this.pushStack(ae.map(this,function(e,i){return t.call(e,i,e)}))},end:function(){return this.prevObject||this.constructor(null)},push:q,sort:[].sort,splice:[].splice},ae.fn.init.prototype=ae.fn,ae.extend=ae.fn.extend=function(){var t,i,n,r,a,s,o=arguments[0]||{},l=1,c=arguments.length,h=!1;for("boolean"==typeof o&&(h=o,o=arguments[1]||{},l=2),"object"==typeof o||ae.isFunction(o)||(o={}),c===l&&(o=this,--l);c>l;l++)if(null!=(t=arguments[l]))for(i in t)n=o[i],r=t[i],o!==r&&(h&&r&&(ae.isPlainObject(r)||(a=ae.isArray(r)))?(a?(a=!1,s=n&&ae.isArray(n)?n:[]):s=n&&ae.isPlainObject(n)?n:{},o[i]=ae.extend(h,s,r)):r!==e&&(o[i]=r));return o},ae.extend({expando:"jQuery"+($+Math.random()).replace(/\D/g,""),noConflict:function(e){return t.$===ae&&(t.$=F),e&&t.jQuery===ae&&(t.jQuery=H),ae},isReady:!1,readyWait:1,holdReady:function(t){t?ae.readyWait++:ae.ready(!0)},ready:function(t){(t===!0?--ae.readyWait:ae.isReady)||(ae.isReady=!0,t!==!0&&--ae.readyWait>0||(W.resolveWith(X,[ae]),ae.fn.trigger&&ae(X).trigger("ready").off("ready")))},isFunction:function(t){return"function"===ae.type(t)},isArray:Array.isArray,isWindow:function(t){return null!=t&&t===t.window},isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?J[ie.call(t)]||"object":typeof t},isPlainObject:function(t){if("object"!==ae.type(t)||t.nodeType||ae.isWindow(t))return!1;try{if(t.constructor&&!ne.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},error:function(t){throw Error(t)},parseHTML:function(t,e,i){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(i=e,e=!1),e=e||X;var n=ce.exec(t),r=!i&&[];return n?[e.createElement(n[1])]:(n=ae.buildFragment([t],e,r),r&&ae(r).remove(),ae.merge([],n.childNodes))},parseJSON:JSON.parse,parseXML:function(t){var i,n;if(!t||"string"!=typeof t)return null;try{n=new DOMParser,i=n.parseFromString(t,"text/xml")}catch(r){i=e}return(!i||i.getElementsByTagName("parsererror").length)&&ae.error("Invalid XML: "+t),i},noop:function(){},globalEval:function(t){var e,i=eval;t=ae.trim(t),t&&(1===t.indexOf("use strict")?(e=X.createElement("script"),e.text=t,X.head.appendChild(e).parentNode.removeChild(e)):i(t))},camelCase:function(t){return t.replace(he,"ms-").replace(ue,pe)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e,n){var r,a=0,s=t.length,o=i(t);if(n){if(o)for(;s>a&&(r=e.apply(t[a],n),r!==!1);a++);else for(a in t)if(r=e.apply(t[a],n),r===!1)break}else if(o)for(;s>a&&(r=e.call(t[a],a,t[a]),r!==!1);a++);else for(a in t)if(r=e.call(t[a],a,t[a]),r===!1)break;return t},trim:function(t){return null==t?"":re.call(t)},makeArray:function(t,e){var n=e||[];return null!=t&&(i(Object(t))?ae.merge(n,"string"==typeof t?[t]:t):q.call(n,t)),n},inArray:function(t,e,i){return null==e?-1:ee.call(e,t,i)},merge:function(t,i){var n=i.length,r=t.length,a=0;if("number"==typeof n)for(;n>a;a++)t[r++]=i[a];else for(;i[a]!==e;)t[r++]=i[a++];return t.length=r,t},grep:function(t,e,i){var n,r=[],a=0,s=t.length;for(i=!!i;s>a;a++)n=!!e(t[a],a),i!==n&&r.push(t[a]);return r},map:function(t,e,n){var r,a=0,s=t.length,o=i(t),l=[];if(o)for(;s>a;a++)r=e(t[a],a,n),null!=r&&(l[l.length]=r);else for(a in t)r=e(t[a],a,n),null!=r&&(l[l.length]=r);return K.apply([],l)},guid:1,proxy:function(t,i){var n,r,a;return"string"==typeof i&&(n=t[i],i=t,t=n),ae.isFunction(t)?(r=te.call(arguments,2),a=function(){return t.apply(i||this,r.concat(te.call(arguments)))},a.guid=t.guid=t.guid||ae.guid++,a):e},access:function(t,i,n,r,a,s,o){var l=0,c=t.length,h=null==n;if("object"===ae.type(n)){a=!0;for(l in n)ae.access(t,i,l,n[l],!0,s,o)}else if(r!==e&&(a=!0,ae.isFunction(r)||(o=!0),h&&(o?(i.call(t,r),i=null):(h=i,i=function(t,e,i){return h.call(ae(t),i)})),i))for(;c>l;l++)i(t[l],n,o?r:r.call(t[l],l,i(t[l],n)));return a?t:h?i.call(t):c?i(t[0],n):s},now:Date.now,swap:function(t,e,i,n){var r,a,s={};for(a in e)s[a]=t.style[a],t.style[a]=e[a];r=i.apply(t,n||[]);for(a in e)t.style[a]=s[a];return r}}),ae.ready.promise=function(e){return W||(W=ae.Deferred(),"complete"===X.readyState?setTimeout(ae.ready):(X.addEventListener("DOMContentLoaded",ge,!1),t.addEventListener("load",ge,!1))),W.promise(e)},ae.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){J["[object "+e+"]"]=e.toLowerCase()}),Y=ae(X),function(t,e){function i(t,e,i,n){var r,a,s,o,l,c,h,u,d,f;if((e?e.ownerDocument||e:O)!==T&&S(e),e=e||T,i=i||[],!t||"string"!=typeof t)return i;if(1!==(o=e.nodeType)&&9!==o)return[];if(G&&!n){if(r=ve.exec(t))if(s=r[1]){if(9===o){if(a=e.getElementById(s),!a||!a.parentNode)return i;if(a.id===s)return i.push(a),i}else if(e.ownerDocument&&(a=e.ownerDocument.getElementById(s))&&_(e,a)&&a.id===s)return i.push(a),i}else{if(r[2])return te.apply(i,e.getElementsByTagName(t)),i;if((s=r[3])&&w.getElementsByClassName&&e.getElementsByClassName)return te.apply(i,e.getElementsByClassName(s)),i}if(w.qsa&&(!L||!L.test(t))){if(u=h=P,d=e,f=9===o&&t,1===o&&"object"!==e.nodeName.toLowerCase()){for(c=p(t),(h=e.getAttribute("id"))?u=h.replace(Ae,"\\$&"):e.setAttribute("id",u),u="[id='"+u+"'] ",l=c.length;l--;)c[l]=u+g(c[l]);d=ge.test(t)&&e.parentNode||e,f=c.join(",")}if(f)try{return te.apply(i,d.querySelectorAll(f)),i}catch(m){}finally{h||e.removeAttribute("id")}}}return b(t.replace(he,"$1"),e,i,n)}function n(){function t(i,n){return e.push(i+=" ")>M.cacheLength&&delete t[e.shift()],t[i]=n}var e=[];return t}function r(t){return t[P]=!0,t}function a(t){var e=T.createElement("div");try{return!!t(e)}catch(i){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function s(t,e){for(var i=t.split("|"),n=t.length;n--;)M.attrHandle[i[n]]=e}function o(t,e){var i=e&&t,n=i&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||J)-(~t.sourceIndex||J);if(n)return n;if(i)for(;i=i.nextSibling;)if(i===e)return-1;return t?1:-1}function l(t){return function(e){var i=e.nodeName.toLowerCase();return"input"===i&&e.type===t}}function c(t){return function(e){var i=e.nodeName.toLowerCase();return("input"===i||"button"===i)&&e.type===t}}function h(t){return r(function(e){return e=+e,r(function(i,n){for(var r,a=t([],i.length,e),s=a.length;s--;)i[r=a[s]]&&(i[r]=!(n[r]=i[r]))})})}function u(){}function p(t,e){var n,r,a,s,o,l,c,h=R[t+" "];if(h)return e?0:h.slice(0);for(o=t,l=[],c=M.preFilter;o;){(!n||(r=ue.exec(o)))&&(r&&(o=o.slice(r[0].length)||o),l.push(a=[])),n=!1,(r=pe.exec(o))&&(n=r.shift(),a.push({value:n,type:r[0].replace(he," ")}),o=o.slice(n.length));for(s in M.filter)!(r=Ie[s].exec(o))||c[s]&&!(r=c[s](r))||(n=r.shift(),a.push({value:n,type:s,matches:r}),o=o.slice(n.length));if(!n)break}return e?o.length:o?i.error(t):R(t,l).slice(0)}function g(t){for(var e=0,i=t.length,n="";i>e;e++)n+=t[e].value;return n}function d(t,e,i){var n=e.dir,r=i&&"parentNode"===n,a=W++;return e.first?function(e,i,a){for(;e=e[n];)if(1===e.nodeType||r)return t(e,i,a)}:function(e,i,s){var o,l,c,h=Y+" "+a;if(s){for(;e=e[n];)if((1===e.nodeType||r)&&t(e,i,s))return!0}else for(;e=e[n];)if(1===e.nodeType||r)if(c=e[P]||(e[P]={}),(l=c[n])&&l[0]===h){if((o=l[1])===!0||o===x)return o===!0}else if(l=c[n]=[h],l[1]=t(e,i,s)||x,l[1]===!0)return!0}}function f(t){return t.length>1?function(e,i,n){for(var r=t.length;r--;)if(!t[r](e,i,n))return!1;return!0}:t[0]}function m(t,e,i,n,r){for(var a,s=[],o=0,l=t.length,c=null!=e;l>o;o++)(a=t[o])&&(!i||i(a,n,r))&&(s.push(a),c&&e.push(o));return s}function I(t,e,i,n,a,s){return n&&!n[P]&&(n=I(n)),a&&!a[P]&&(a=I(a,s)),r(function(r,s,o,l){var c,h,u,p=[],g=[],d=s.length,f=r||C(e||"*",o.nodeType?[o]:o,[]),I=!t||!r&&e?f:m(f,p,t,o,l),y=i?a||(r?t:d||n)?[]:s:I;if(i&&i(I,y,o,l),n)for(c=m(y,g),n(c,[],o,l),h=c.length;h--;)(u=c[h])&&(y[g[h]]=!(I[g[h]]=u));if(r){if(a||t){if(a){for(c=[],h=y.length;h--;)(u=y[h])&&c.push(I[h]=u);a(null,y=[],c,l)}for(h=y.length;h--;)(u=y[h])&&(c=a?ie.call(r,u):p[h])>-1&&(r[c]=!(s[c]=u))}}else y=m(y===s?y.splice(d,y.length):y),a?a(null,s,y,l):te.apply(s,y)})}function y(t){for(var e,i,n,r=t.length,a=M.relative[t[0].type],s=a||M.relative[" "],o=a?1:0,l=d(function(t){return t===e},s,!0),c=d(function(t){return ie.call(e,t)>-1},s,!0),h=[function(t,i,n){return!a&&(n||i!==D)||((e=i).nodeType?l(t,i,n):c(t,i,n))}];r>o;o++)if(i=M.relative[t[o].type])h=[d(f(h),i)];else{if(i=M.filter[t[o].type].apply(null,t[o].matches),i[P]){for(n=++o;r>n&&!M.relative[t[n].type];n++);return I(o>1&&f(h),o>1&&g(t.slice(0,o-1).concat({value:" "===t[o-2].type?"*":""})).replace(he,"$1"),i,n>o&&y(t.slice(o,n)),r>n&&y(t=t.slice(n)),r>n&&g(t))}h.push(i)}return f(h)}function v(t,e){var n=0,a=e.length>0,s=t.length>0,o=function(r,o,l,c,h){var u,p,g,d=[],f=0,I="0",y=r&&[],v=null!=h,C=D,b=r||s&&M.find.TAG("*",h&&o.parentNode||o),A=Y+=null==C?1:Math.random()||.1;for(v&&(D=o!==T&&o,x=n);null!=(u=b[I]);I++){if(s&&u){for(p=0;g=t[p++];)if(g(u,o,l)){c.push(u);break}v&&(Y=A,x=++n)}a&&((u=!g&&u)&&f--,r&&y.push(u))}if(f+=I,a&&I!==f){for(p=0;g=e[p++];)g(y,d,o,l);if(r){if(f>0)for(;I--;)y[I]||d[I]||(d[I]=K.call(c));d=m(d)}te.apply(c,d),v&&!r&&d.length>0&&f+e.length>1&&i.uniqueSort(c)}return v&&(Y=A,D=C),y};return a?r(o):o}function C(t,e,n){for(var r=0,a=e.length;a>r;r++)i(t,e[r],n);return n}function b(t,e,i,n){var r,a,s,o,l,c=p(t);if(!n&&1===c.length){if(a=c[0]=c[0].slice(0),a.length>2&&"ID"===(s=a[0]).type&&w.getById&&9===e.nodeType&&G&&M.relative[a[1].type]){if(e=(M.find.ID(s.matches[0].replace(we,xe),e)||[])[0],!e)return i;t=t.slice(a.shift().value.length)}for(r=Ie.needsContext.test(t)?0:a.length;r--&&(s=a[r],!M.relative[o=s.type]);)if((l=M.find[o])&&(n=l(s.matches[0].replace(we,xe),ge.test(a[0].type)&&e.parentNode||e))){if(a.splice(r,1),t=n.length&&g(a),!t)return te.apply(i,n),i;break}}return k(t,c)(n,e,!G,i,ge.test(t)),i}var A,w,x,M,j,N,k,D,z,S,T,E,G,L,B,Z,_,P="sizzle"+-new Date,O=t.document,Y=0,W=0,V=n(),R=n(),X=n(),U=!1,H=function(t,e){return t===e?(U=!0,0):0},F=typeof e,J=1<<31,Q={}.hasOwnProperty,$=[],K=$.pop,q=$.push,te=$.push,ee=$.slice,ie=$.indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(this[e]===t)return e;return-1},ne="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",re="[\\x20\\t\\r\\n\\f]",se="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",oe=se.replace("w","w#"),le="\\["+re+"*("+se+")"+re+"*(?:([*^$|!~]?=)"+re+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+oe+")|)|)"+re+"*\\]",ce=":("+se+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+le.replace(3,8)+")*)|.*)\\)|)",he=RegExp("^"+re+"+|((?:^|[^\\\\])(?:\\\\.)*)"+re+"+$","g"),ue=RegExp("^"+re+"*,"+re+"*"),pe=RegExp("^"+re+"*([>+~]|"+re+")"+re+"*"),ge=RegExp(re+"*[+~]"),de=RegExp("="+re+"*([^\\]'\"]*)"+re+"*\\]","g"),fe=RegExp(ce),me=RegExp("^"+oe+"$"),Ie={ID:RegExp("^#("+se+")"),CLASS:RegExp("^\\.("+se+")"),TAG:RegExp("^("+se.replace("w","w*")+")"),ATTR:RegExp("^"+le),PSEUDO:RegExp("^"+ce),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+re+"*(even|odd|(([+-]|)(\\d*)n|)"+re+"*(?:([+-]|)"+re+"*(\\d+)|))"+re+"*\\)|)","i"),bool:RegExp("^(?:"+ne+")$","i"),needsContext:RegExp("^"+re+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+re+"*((?:-\\d)?\\d*)"+re+"*\\)|)(?=[^-]|$)","i")},ye=/^[^{]+\{\s*\[native \w/,ve=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Ce=/^(?:input|select|textarea|button)$/i,be=/^h\d$/i,Ae=/'|\\/g,we=RegExp("\\\\([\\da-f]{1,6}"+re+"?|("+re+")|.)","ig"),xe=function(t,e,i){var n="0x"+e-65536;return n!==n||i?e:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{te.apply($=ee.call(O.childNodes),O.childNodes),$[O.childNodes.length].nodeType}catch(Me){te={apply:$.length?function(t,e){q.apply(t,ee.call(e))}:function(t,e){for(var i=t.length,n=0;t[i++]=e[n++];);t.length=i-1}}}N=i.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1},w=i.support={},S=i.setDocument=function(t){var i=t?t.ownerDocument||t:O,n=i.defaultView;return i!==T&&9===i.nodeType&&i.documentElement?(T=i,E=i.documentElement,G=!N(i),n&&n.attachEvent&&n!==n.top&&n.attachEvent("onbeforeunload",function(){S()}),w.attributes=a(function(t){return t.className="i",!t.getAttribute("className")}),w.getElementsByTagName=a(function(t){return t.appendChild(i.createComment("")),!t.getElementsByTagName("*").length}),w.getElementsByClassName=a(function(t){return t.innerHTML="<div class='a'></div><div class='a i'></div>",t.firstChild.className="i",2===t.getElementsByClassName("i").length
15 }),w.getById=a(function(t){return E.appendChild(t).id=P,!i.getElementsByName||!i.getElementsByName(P).length}),w.getById?(M.find.ID=function(t,e){if(typeof e.getElementById!==F&&G){var i=e.getElementById(t);return i&&i.parentNode?[i]:[]}},M.filter.ID=function(t){var e=t.replace(we,xe);return function(t){return t.getAttribute("id")===e}}):(delete M.find.ID,M.filter.ID=function(t){var e=t.replace(we,xe);return function(t){var i=typeof t.getAttributeNode!==F&&t.getAttributeNode("id");return i&&i.value===e}}),M.find.TAG=w.getElementsByTagName?function(t,i){return typeof i.getElementsByTagName!==F?i.getElementsByTagName(t):e}:function(t,e){var i,n=[],r=0,a=e.getElementsByTagName(t);if("*"===t){for(;i=a[r++];)1===i.nodeType&&n.push(i);return n}return a},M.find.CLASS=w.getElementsByClassName&&function(t,i){return typeof i.getElementsByClassName!==F&&G?i.getElementsByClassName(t):e},B=[],L=[],(w.qsa=ye.test(i.querySelectorAll))&&(a(function(t){t.innerHTML="<select><option selected=''></option></select>",t.querySelectorAll("[selected]").length||L.push("\\["+re+"*(?:value|"+ne+")"),t.querySelectorAll(":checked").length||L.push(":checked")}),a(function(t){var e=i.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("t",""),t.querySelectorAll("[t^='']").length&&L.push("[*^$]="+re+"*(?:''|\"\")"),t.querySelectorAll(":enabled").length||L.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),L.push(",.*:")})),(w.matchesSelector=ye.test(Z=E.webkitMatchesSelector||E.mozMatchesSelector||E.oMatchesSelector||E.msMatchesSelector))&&a(function(t){w.disconnectedMatch=Z.call(t,"div"),Z.call(t,"[s!='']:x"),B.push("!=",ce)}),L=L.length&&RegExp(L.join("|")),B=B.length&&RegExp(B.join("|")),_=ye.test(E.contains)||E.compareDocumentPosition?function(t,e){var i=9===t.nodeType?t.documentElement:t,n=e&&e.parentNode;return t===n||!(!n||1!==n.nodeType||!(i.contains?i.contains(n):t.compareDocumentPosition&&16&t.compareDocumentPosition(n)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},H=E.compareDocumentPosition?function(t,e){if(t===e)return U=!0,0;var n=e.compareDocumentPosition&&t.compareDocumentPosition&&t.compareDocumentPosition(e);return n?1&n||!w.sortDetached&&e.compareDocumentPosition(t)===n?t===i||_(O,t)?-1:e===i||_(O,e)?1:z?ie.call(z,t)-ie.call(z,e):0:4&n?-1:1:t.compareDocumentPosition?-1:1}:function(t,e){var n,r=0,a=t.parentNode,s=e.parentNode,l=[t],c=[e];if(t===e)return U=!0,0;if(!a||!s)return t===i?-1:e===i?1:a?-1:s?1:z?ie.call(z,t)-ie.call(z,e):0;if(a===s)return o(t,e);for(n=t;n=n.parentNode;)l.unshift(n);for(n=e;n=n.parentNode;)c.unshift(n);for(;l[r]===c[r];)r++;return r?o(l[r],c[r]):l[r]===O?-1:c[r]===O?1:0},i):T},i.matches=function(t,e){return i(t,null,null,e)},i.matchesSelector=function(t,e){if((t.ownerDocument||t)!==T&&S(t),e=e.replace(de,"='$1']"),!(!w.matchesSelector||!G||B&&B.test(e)||L&&L.test(e)))try{var n=Z.call(t,e);if(n||w.disconnectedMatch||t.document&&11!==t.document.nodeType)return n}catch(r){}return i(e,T,null,[t]).length>0},i.contains=function(t,e){return(t.ownerDocument||t)!==T&&S(t),_(t,e)},i.attr=function(t,i){(t.ownerDocument||t)!==T&&S(t);var n=M.attrHandle[i.toLowerCase()],r=n&&Q.call(M.attrHandle,i.toLowerCase())?n(t,i,!G):e;return r===e?w.attributes||!G?t.getAttribute(i):(r=t.getAttributeNode(i))&&r.specified?r.value:null:r},i.error=function(t){throw Error("Syntax error, unrecognized expression: "+t)},i.uniqueSort=function(t){var e,i=[],n=0,r=0;if(U=!w.detectDuplicates,z=!w.sortStable&&t.slice(0),t.sort(H),U){for(;e=t[r++];)e===t[r]&&(n=i.push(r));for(;n--;)t.splice(i[n],1)}return t},j=i.getText=function(t){var e,i="",n=0,r=t.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)i+=j(t)}else if(3===r||4===r)return t.nodeValue}else for(;e=t[n];n++)i+=j(e);return i},M=i.selectors={cacheLength:50,createPseudo:r,match:Ie,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(we,xe),t[3]=(t[4]||t[5]||"").replace(we,xe),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||i.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&i.error(t[0]),t},PSEUDO:function(t){var i,n=!t[5]&&t[2];return Ie.CHILD.test(t[0])?null:(t[3]&&t[4]!==e?t[2]=t[4]:n&&fe.test(n)&&(i=p(n,!0))&&(i=n.indexOf(")",n.length-i)-n.length)&&(t[0]=t[0].slice(0,i),t[2]=n.slice(0,i)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(we,xe).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=V[t+" "];return e||(e=RegExp("(^|"+re+")"+t+"("+re+"|$)"))&&V(t,function(t){return e.test("string"==typeof t.className&&t.className||typeof t.getAttribute!==F&&t.getAttribute("class")||"")})},ATTR:function(t,e,n){return function(r){var a=i.attr(r,t);return null==a?"!="===e:e?(a+="","="===e?a===n:"!="===e?a!==n:"^="===e?n&&0===a.indexOf(n):"*="===e?n&&a.indexOf(n)>-1:"$="===e?n&&a.slice(-n.length)===n:"~="===e?(" "+a+" ").indexOf(n)>-1:"|="===e?a===n||a.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(t,e,i,n,r){var a="nth"!==t.slice(0,3),s="last"!==t.slice(-4),o="of-type"===e;return 1===n&&0===r?function(t){return!!t.parentNode}:function(e,i,l){var c,h,u,p,g,d,f=a!==s?"nextSibling":"previousSibling",m=e.parentNode,I=o&&e.nodeName.toLowerCase(),y=!l&&!o;if(m){if(a){for(;f;){for(u=e;u=u[f];)if(o?u.nodeName.toLowerCase()===I:1===u.nodeType)return!1;d=f="only"===t&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&y){for(h=m[P]||(m[P]={}),c=h[t]||[],g=c[0]===Y&&c[1],p=c[0]===Y&&c[2],u=g&&m.childNodes[g];u=++g&&u&&u[f]||(p=g=0)||d.pop();)if(1===u.nodeType&&++p&&u===e){h[t]=[Y,g,p];break}}else if(y&&(c=(e[P]||(e[P]={}))[t])&&c[0]===Y)p=c[1];else for(;(u=++g&&u&&u[f]||(p=g=0)||d.pop())&&((o?u.nodeName.toLowerCase()!==I:1!==u.nodeType)||!++p||(y&&((u[P]||(u[P]={}))[t]=[Y,p]),u!==e)););return p-=r,p===n||0===p%n&&p/n>=0}}},PSEUDO:function(t,e){var n,a=M.pseudos[t]||M.setFilters[t.toLowerCase()]||i.error("unsupported pseudo: "+t);return a[P]?a(e):a.length>1?(n=[t,t,"",e],M.setFilters.hasOwnProperty(t.toLowerCase())?r(function(t,i){for(var n,r=a(t,e),s=r.length;s--;)n=ie.call(t,r[s]),t[n]=!(i[n]=r[s])}):function(t){return a(t,0,n)}):a}},pseudos:{not:r(function(t){var e=[],i=[],n=k(t.replace(he,"$1"));return n[P]?r(function(t,e,i,r){for(var a,s=n(t,null,r,[]),o=t.length;o--;)(a=s[o])&&(t[o]=!(e[o]=a))}):function(t,r,a){return e[0]=t,n(e,null,a,i),!i.pop()}}),has:r(function(t){return function(e){return i(t,e).length>0}}),contains:r(function(t){return function(e){return(e.textContent||e.innerText||j(e)).indexOf(t)>-1}}),lang:r(function(t){return me.test(t||"")||i.error("unsupported lang: "+t),t=t.replace(we,xe).toLowerCase(),function(e){var i;do if(i=G?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return i=i.toLowerCase(),i===t||0===i.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var i=t.location&&t.location.hash;return i&&i.slice(1)===e.id},root:function(t){return t===E},focus:function(t){return t===T.activeElement&&(!T.hasFocus||T.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,t.selected===!0},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeName>"@"||3===t.nodeType||4===t.nodeType)return!1;return!0},parent:function(t){return!M.pseudos.empty(t)},header:function(t){return be.test(t.nodeName)},input:function(t){return Ce.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||e.toLowerCase()===t.type)},first:h(function(){return[0]}),last:h(function(t,e){return[e-1]}),eq:h(function(t,e,i){return[0>i?i+e:i]}),even:h(function(t,e){for(var i=0;e>i;i+=2)t.push(i);return t}),odd:h(function(t,e){for(var i=1;e>i;i+=2)t.push(i);return t}),lt:h(function(t,e,i){for(var n=0>i?i+e:i;--n>=0;)t.push(n);return t}),gt:h(function(t,e,i){for(var n=0>i?i+e:i;e>++n;)t.push(n);return t})}},M.pseudos.nth=M.pseudos.eq;for(A in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})M.pseudos[A]=l(A);for(A in{submit:!0,reset:!0})M.pseudos[A]=c(A);u.prototype=M.filters=M.pseudos,M.setFilters=new u,k=i.compile=function(t,e){var i,n=[],r=[],a=X[t+" "];if(!a){for(e||(e=p(t)),i=e.length;i--;)a=y(e[i]),a[P]?n.push(a):r.push(a);a=X(t,v(r,n))}return a},w.sortStable=P.split("").sort(H).join("")===P,w.detectDuplicates=U,S(),w.sortDetached=a(function(t){return 1&t.compareDocumentPosition(T.createElement("div"))}),a(function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")})||s("type|href|height|width",function(t,i,n){return n?e:t.getAttribute(i,"type"===i.toLowerCase()?1:2)}),w.attributes&&a(function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||s("value",function(t,i,n){return n||"input"!==t.nodeName.toLowerCase()?e:t.defaultValue}),a(function(t){return null==t.getAttribute("disabled")})||s(ne,function(t,i,n){var r;return n?e:(r=t.getAttributeNode(i))&&r.specified?r.value:t[i]===!0?i.toLowerCase():null}),ae.find=i,ae.expr=i.selectors,ae.expr[":"]=ae.expr.pseudos,ae.unique=i.uniqueSort,ae.text=i.getText,ae.isXMLDoc=i.isXML,ae.contains=i.contains}(t);var de={};ae.Callbacks=function(t){t="string"==typeof t?de[t]||n(t):ae.extend({},t);var i,r,a,s,o,l,c=[],h=!t.once&&[],u=function(e){for(i=t.memory&&e,r=!0,l=s||0,s=0,o=c.length,a=!0;c&&o>l;l++)if(c[l].apply(e[0],e[1])===!1&&t.stopOnFalse){i=!1;break}a=!1,c&&(h?h.length&&u(h.shift()):i?c=[]:p.disable())},p={add:function(){if(c){var e=c.length;(function n(e){ae.each(e,function(e,i){var r=ae.type(i);"function"===r?t.unique&&p.has(i)||c.push(i):i&&i.length&&"string"!==r&&n(i)})})(arguments),a?o=c.length:i&&(s=e,u(i))}return this},remove:function(){return c&&ae.each(arguments,function(t,e){for(var i;(i=ae.inArray(e,c,i))>-1;)c.splice(i,1),a&&(o>=i&&o--,l>=i&&l--)}),this},has:function(t){return t?ae.inArray(t,c)>-1:!(!c||!c.length)},empty:function(){return c=[],o=0,this},disable:function(){return c=h=i=e,this},disabled:function(){return!c},lock:function(){return h=e,i||p.disable(),this},locked:function(){return!h},fireWith:function(t,e){return!c||r&&!h||(e=e||[],e=[t,e.slice?e.slice():e],a?h.push(e):u(e)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!r}};return p},ae.extend({Deferred:function(t){var e=[["resolve","done",ae.Callbacks("once memory"),"resolved"],["reject","fail",ae.Callbacks("once memory"),"rejected"],["notify","progress",ae.Callbacks("memory")]],i="pending",n={state:function(){return i},always:function(){return r.done(arguments).fail(arguments),this},then:function(){var t=arguments;return ae.Deferred(function(i){ae.each(e,function(e,a){var s=a[0],o=ae.isFunction(t[e])&&t[e];r[a[1]](function(){var t=o&&o.apply(this,arguments);t&&ae.isFunction(t.promise)?t.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[s+"With"](this===n?i.promise():this,o?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?ae.extend(t,n):n}},r={};return n.pipe=n.then,ae.each(e,function(t,a){var s=a[2],o=a[3];n[a[1]]=s.add,o&&s.add(function(){i=o},e[1^t][2].disable,e[2][2].lock),r[a[0]]=function(){return r[a[0]+"With"](this===r?n:this,arguments),this},r[a[0]+"With"]=s.fireWith}),n.promise(r),t&&t.call(r,r),r},when:function(t){var e,i,n,r=0,a=te.call(arguments),s=a.length,o=1!==s||t&&ae.isFunction(t.promise)?s:0,l=1===o?t:ae.Deferred(),c=function(t,i,n){return function(r){i[t]=this,n[t]=arguments.length>1?te.call(arguments):r,n===e?l.notifyWith(i,n):--o||l.resolveWith(i,n)}};if(s>1)for(e=Array(s),i=Array(s),n=Array(s);s>r;r++)a[r]&&ae.isFunction(a[r].promise)?a[r].promise().done(c(r,n,a)).fail(l.reject).progress(c(r,i,e)):--o;return o||l.resolveWith(n,a),l.promise()}}),ae.support=function(e){var i=X.createElement("input"),n=X.createDocumentFragment(),r=X.createElement("div"),a=X.createElement("select"),s=a.appendChild(X.createElement("option"));return i.type?(i.type="checkbox",e.checkOn=""!==i.value,e.optSelected=s.selected,e.reliableMarginRight=!0,e.boxSizingReliable=!0,e.pixelPosition=!1,i.checked=!0,e.noCloneChecked=i.cloneNode(!0).checked,a.disabled=!0,e.optDisabled=!s.disabled,i=X.createElement("input"),i.value="t",i.type="radio",e.radioValue="t"===i.value,i.setAttribute("checked","t"),i.setAttribute("name","t"),n.appendChild(i),e.checkClone=n.cloneNode(!0).cloneNode(!0).lastChild.checked,e.focusinBubbles="onfocusin"in t,r.style.backgroundClip="content-box",r.cloneNode(!0).style.backgroundClip="",e.clearCloneStyle="content-box"===r.style.backgroundClip,ae(function(){var i,n,a="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",s=X.getElementsByTagName("body")[0];s&&(i=X.createElement("div"),i.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",s.appendChild(i).appendChild(r),r.innerHTML="",r.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",ae.swap(s,null!=s.style.zoom?{zoom:1}:{},function(){e.boxSizing=4===r.offsetWidth}),t.getComputedStyle&&(e.pixelPosition="1%"!==(t.getComputedStyle(r,null)||{}).top,e.boxSizingReliable="4px"===(t.getComputedStyle(r,null)||{width:"4px"}).width,n=r.appendChild(X.createElement("div")),n.style.cssText=r.style.cssText=a,n.style.marginRight=n.style.width="0",r.style.width="1px",e.reliableMarginRight=!parseFloat((t.getComputedStyle(n,null)||{}).marginRight)),s.removeChild(i))}),e):e}({});var fe,me,Ie=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,ye=/([A-Z])/g;r.uid=1,r.accepts=function(t){return t.nodeType?1===t.nodeType||9===t.nodeType:!0},r.prototype={key:function(t){if(!r.accepts(t))return 0;var e={},i=t[this.expando];if(!i){i=r.uid++;try{e[this.expando]={value:i},Object.defineProperties(t,e)}catch(n){e[this.expando]=i,ae.extend(t,e)}}return this.cache[i]||(this.cache[i]={}),i},set:function(t,e,i){var n,r=this.key(t),a=this.cache[r];if("string"==typeof e)a[e]=i;else if(ae.isEmptyObject(a))ae.extend(this.cache[r],e);else for(n in e)a[n]=e[n];return a},get:function(t,i){var n=this.cache[this.key(t)];return i===e?n:n[i]},access:function(t,i,n){var r;return i===e||i&&"string"==typeof i&&n===e?(r=this.get(t,i),r!==e?r:this.get(t,ae.camelCase(i))):(this.set(t,i,n),n!==e?n:i)},remove:function(t,i){var n,r,a,s=this.key(t),o=this.cache[s];if(i===e)this.cache[s]={};else{ae.isArray(i)?r=i.concat(i.map(ae.camelCase)):(a=ae.camelCase(i),i in o?r=[i,a]:(r=a,r=r in o?[r]:r.match(oe)||[])),n=r.length;for(;n--;)delete o[r[n]]}},hasData:function(t){return!ae.isEmptyObject(this.cache[t[this.expando]]||{})},discard:function(t){t[this.expando]&&delete this.cache[t[this.expando]]}},fe=new r,me=new r,ae.extend({acceptData:r.accepts,hasData:function(t){return fe.hasData(t)||me.hasData(t)},data:function(t,e,i){return fe.access(t,e,i)},removeData:function(t,e){fe.remove(t,e)},_data:function(t,e,i){return me.access(t,e,i)},_removeData:function(t,e){me.remove(t,e)}}),ae.fn.extend({data:function(t,i){var n,r,s=this[0],o=0,l=null;if(t===e){if(this.length&&(l=fe.get(s),1===s.nodeType&&!me.get(s,"hasDataAttrs"))){for(n=s.attributes;n.length>o;o++)r=n[o].name,0===r.indexOf("data-")&&(r=ae.camelCase(r.slice(5)),a(s,r,l[r]));me.set(s,"hasDataAttrs",!0)}return l}return"object"==typeof t?this.each(function(){fe.set(this,t)}):ae.access(this,function(i){var n,r=ae.camelCase(t);if(s&&i===e){if(n=fe.get(s,t),n!==e)return n;if(n=fe.get(s,r),n!==e)return n;if(n=a(s,r,e),n!==e)return n}else this.each(function(){var n=fe.get(this,r);fe.set(this,r,i),-1!==t.indexOf("-")&&n!==e&&fe.set(this,t,i)})},null,i,arguments.length>1,null,!0)},removeData:function(t){return this.each(function(){fe.remove(this,t)})}}),ae.extend({queue:function(t,i,n){var r;return t?(i=(i||"fx")+"queue",r=me.get(t,i),n&&(!r||ae.isArray(n)?r=me.access(t,i,ae.makeArray(n)):r.push(n)),r||[]):e},dequeue:function(t,e){e=e||"fx";var i=ae.queue(t,e),n=i.length,r=i.shift(),a=ae._queueHooks(t,e),s=function(){ae.dequeue(t,e)};"inprogress"===r&&(r=i.shift(),n--),r&&("fx"===e&&i.unshift("inprogress"),delete a.stop,r.call(t,s,a)),!n&&a&&a.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return me.get(t,i)||me.access(t,i,{empty:ae.Callbacks("once memory").add(function(){me.remove(t,[e+"queue",i])})})}}),ae.fn.extend({queue:function(t,i){var n=2;return"string"!=typeof t&&(i=t,t="fx",n--),n>arguments.length?ae.queue(this[0],t):i===e?this:this.each(function(){var e=ae.queue(this,t,i);ae._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&ae.dequeue(this,t)})},dequeue:function(t){return this.each(function(){ae.dequeue(this,t)})},delay:function(t,e){return t=ae.fx?ae.fx.speeds[t]||t:t,e=e||"fx",this.queue(e,function(e,i){var n=setTimeout(e,t);i.stop=function(){clearTimeout(n)}})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,i){var n,r=1,a=ae.Deferred(),s=this,o=this.length,l=function(){--r||a.resolveWith(s,[s])};for("string"!=typeof t&&(i=t,t=e),t=t||"fx";o--;)n=me.get(s[o],t+"queueHooks"),n&&n.empty&&(r++,n.empty.add(l));return l(),a.promise(i)}});var ve,Ce,be=/[\t\r\n\f]/g,Ae=/\r/g,we=/^(?:input|select|textarea|button)$/i;ae.fn.extend({attr:function(t,e){return ae.access(this,ae.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){ae.removeAttr(this,t)})},prop:function(t,e){return ae.access(this,ae.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[ae.propFix[t]||t]})},addClass:function(t){var e,i,n,r,a,s=0,o=this.length,l="string"==typeof t&&t;if(ae.isFunction(t))return this.each(function(e){ae(this).addClass(t.call(this,e,this.className))});if(l)for(e=(t||"").match(oe)||[];o>s;s++)if(i=this[s],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(be," "):" ")){for(a=0;r=e[a++];)0>n.indexOf(" "+r+" ")&&(n+=r+" ");i.className=ae.trim(n)}return this},removeClass:function(t){var e,i,n,r,a,s=0,o=this.length,l=0===arguments.length||"string"==typeof t&&t;if(ae.isFunction(t))return this.each(function(e){ae(this).removeClass(t.call(this,e,this.className))});if(l)for(e=(t||"").match(oe)||[];o>s;s++)if(i=this[s],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(be," "):"")){for(a=0;r=e[a++];)for(;n.indexOf(" "+r+" ")>=0;)n=n.replace(" "+r+" "," ");i.className=t?ae.trim(n):""}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):ae.isFunction(t)?this.each(function(i){ae(this).toggleClass(t.call(this,i,this.className,e),e)}):this.each(function(){if("string"===i)for(var e,n=0,r=ae(this),a=t.match(oe)||[];e=a[n++];)r.hasClass(e)?r.removeClass(e):r.addClass(e);else(i===V||"boolean"===i)&&(this.className&&me.set(this,"__className__",this.className),this.className=this.className||t===!1?"":me.get(this,"__className__")||"")})},hasClass:function(t){for(var e=" "+t+" ",i=0,n=this.length;n>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(be," ").indexOf(e)>=0)return!0;return!1},val:function(t){var i,n,r,a=this[0];{if(arguments.length)return r=ae.isFunction(t),this.each(function(n){var a;1===this.nodeType&&(a=r?t.call(this,n,ae(this).val()):t,null==a?a="":"number"==typeof a?a+="":ae.isArray(a)&&(a=ae.map(a,function(t){return null==t?"":t+""})),i=ae.valHooks[this.type]||ae.valHooks[this.nodeName.toLowerCase()],i&&"set"in i&&i.set(this,a,"value")!==e||(this.value=a))});if(a)return i=ae.valHooks[a.type]||ae.valHooks[a.nodeName.toLowerCase()],i&&"get"in i&&(n=i.get(a,"value"))!==e?n:(n=a.value,"string"==typeof n?n.replace(Ae,""):null==n?"":n)}}}),ae.extend({valHooks:{option:{get:function(t){var e=t.attributes.value;return!e||e.specified?t.value:t.text}},select:{get:function(t){for(var e,i,n=t.options,r=t.selectedIndex,a="select-one"===t.type||0>r,s=a?null:[],o=a?r+1:n.length,l=0>r?o:a?r:0;o>l;l++)if(i=n[l],!(!i.selected&&l!==r||(ae.support.optDisabled?i.disabled:null!==i.getAttribute("disabled"))||i.parentNode.disabled&&ae.nodeName(i.parentNode,"optgroup"))){if(e=ae(i).val(),a)return e;s.push(e)}return s},set:function(t,e){for(var i,n,r=t.options,a=ae.makeArray(e),s=r.length;s--;)n=r[s],(n.selected=ae.inArray(ae(n).val(),a)>=0)&&(i=!0);return i||(t.selectedIndex=-1),a}}},attr:function(t,i,n){var r,a,s=t.nodeType;if(t&&3!==s&&8!==s&&2!==s)return typeof t.getAttribute===V?ae.prop(t,i,n):(1===s&&ae.isXMLDoc(t)||(i=i.toLowerCase(),r=ae.attrHooks[i]||(ae.expr.match.bool.test(i)?Ce:ve)),n===e?r&&"get"in r&&null!==(a=r.get(t,i))?a:(a=ae.find.attr(t,i),null==a?e:a):null!==n?r&&"set"in r&&(a=r.set(t,n,i))!==e?a:(t.setAttribute(i,n+""),n):(ae.removeAttr(t,i),e))},removeAttr:function(t,e){var i,n,r=0,a=e&&e.match(oe);if(a&&1===t.nodeType)for(;i=a[r++];)n=ae.propFix[i]||i,ae.expr.match.bool.test(i)&&(t[n]=!1),t.removeAttribute(i)},attrHooks:{type:{set:function(t,e){if(!ae.support.radioValue&&"radio"===e&&ae.nodeName(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(t,i,n){var r,a,s,o=t.nodeType;if(t&&3!==o&&8!==o&&2!==o)return s=1!==o||!ae.isXMLDoc(t),s&&(i=ae.propFix[i]||i,a=ae.propHooks[i]),n!==e?a&&"set"in a&&(r=a.set(t,n,i))!==e?r:t[i]=n:a&&"get"in a&&null!==(r=a.get(t,i))?r:t[i]},propHooks:{tabIndex:{get:function(t){return t.hasAttribute("tabindex")||we.test(t.nodeName)||t.href?t.tabIndex:-1}}}}),Ce={set:function(t,e,i){return e===!1?ae.removeAttr(t,i):t.setAttribute(i,i),i}},ae.each(ae.expr.match.bool.source.match(/\w+/g),function(t,i){var n=ae.expr.attrHandle[i]||ae.find.attr;ae.expr.attrHandle[i]=function(t,i,r){var a=ae.expr.attrHandle[i],s=r?e:(ae.expr.attrHandle[i]=e)!=n(t,i,r)?i.toLowerCase():null;return ae.expr.attrHandle[i]=a,s}}),ae.support.optSelected||(ae.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null}}),ae.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ae.propFix[this.toLowerCase()]=this}),ae.each(["radio","checkbox"],function(){ae.valHooks[this]={set:function(t,i){return ae.isArray(i)?t.checked=ae.inArray(ae(t).val(),i)>=0:e}},ae.support.checkOn||(ae.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var xe=/^key/,Me=/^(?:mouse|contextmenu)|click/,je=/^(?:focusinfocus|focusoutblur)$/,Ne=/^([^.]*)(?:\.(.+)|)$/;ae.event={global:{},add:function(t,i,n,r,a){var s,o,l,c,h,u,p,g,d,f,m,I=me.get(t);if(I){for(n.handler&&(s=n,n=s.handler,a=s.selector),n.guid||(n.guid=ae.guid++),(c=I.events)||(c=I.events={}),(o=I.handle)||(o=I.handle=function(t){return typeof ae===V||t&&ae.event.triggered===t.type?e:ae.event.dispatch.apply(o.elem,arguments)},o.elem=t),i=(i||"").match(oe)||[""],h=i.length;h--;)l=Ne.exec(i[h])||[],d=m=l[1],f=(l[2]||"").split(".").sort(),d&&(p=ae.event.special[d]||{},d=(a?p.delegateType:p.bindType)||d,p=ae.event.special[d]||{},u=ae.extend({type:d,origType:m,data:r,handler:n,guid:n.guid,selector:a,needsContext:a&&ae.expr.match.needsContext.test(a),namespace:f.join(".")},s),(g=c[d])||(g=c[d]=[],g.delegateCount=0,p.setup&&p.setup.call(t,r,f,o)!==!1||t.addEventListener&&t.addEventListener(d,o,!1)),p.add&&(p.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),a?g.splice(g.delegateCount++,0,u):g.push(u),ae.event.global[d]=!0);t=null}},remove:function(t,e,i,n,r){var a,s,o,l,c,h,u,p,g,d,f,m=me.hasData(t)&&me.get(t);if(m&&(l=m.events)){for(e=(e||"").match(oe)||[""],c=e.length;c--;)if(o=Ne.exec(e[c])||[],g=f=o[1],d=(o[2]||"").split(".").sort(),g){for(u=ae.event.special[g]||{},g=(n?u.delegateType:u.bindType)||g,p=l[g]||[],o=o[2]&&RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=a=p.length;a--;)h=p[a],!r&&f!==h.origType||i&&i.guid!==h.guid||o&&!o.test(h.namespace)||n&&n!==h.selector&&("**"!==n||!h.selector)||(p.splice(a,1),h.selector&&p.delegateCount--,u.remove&&u.remove.call(t,h));s&&!p.length&&(u.teardown&&u.teardown.call(t,d,m.handle)!==!1||ae.removeEvent(t,g,m.handle),delete l[g])}else for(g in l)ae.event.remove(t,g+e[c],i,n,!0);ae.isEmptyObject(l)&&(delete m.handle,me.remove(t,"events"))}},trigger:function(i,n,r,a){var s,o,l,c,h,u,p,g=[r||X],d=ne.call(i,"type")?i.type:i,f=ne.call(i,"namespace")?i.namespace.split("."):[];if(o=l=r=r||X,3!==r.nodeType&&8!==r.nodeType&&!je.test(d+ae.event.triggered)&&(d.indexOf(".")>=0&&(f=d.split("."),d=f.shift(),f.sort()),h=0>d.indexOf(":")&&"on"+d,i=i[ae.expando]?i:new ae.Event(d,"object"==typeof i&&i),i.isTrigger=a?2:3,i.namespace=f.join("."),i.namespace_re=i.namespace?RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,i.result=e,i.target||(i.target=r),n=null==n?[i]:ae.makeArray(n,[i]),p=ae.event.special[d]||{},a||!p.trigger||p.trigger.apply(r,n)!==!1)){if(!a&&!p.noBubble&&!ae.isWindow(r)){for(c=p.delegateType||d,je.test(c+d)||(o=o.parentNode);o;o=o.parentNode)g.push(o),l=o;l===(r.ownerDocument||X)&&g.push(l.defaultView||l.parentWindow||t)}for(s=0;(o=g[s++])&&!i.isPropagationStopped();)i.type=s>1?c:p.bindType||d,u=(me.get(o,"events")||{})[i.type]&&me.get(o,"handle"),u&&u.apply(o,n),u=h&&o[h],u&&ae.acceptData(o)&&u.apply&&u.apply(o,n)===!1&&i.preventDefault();return i.type=d,a||i.isDefaultPrevented()||p._default&&p._default.apply(g.pop(),n)!==!1||!ae.acceptData(r)||h&&ae.isFunction(r[d])&&!ae.isWindow(r)&&(l=r[h],l&&(r[h]=null),ae.event.triggered=d,r[d](),ae.event.triggered=e,l&&(r[h]=l)),i.result}},dispatch:function(t){t=ae.event.fix(t);var i,n,r,a,s,o=[],l=te.call(arguments),c=(me.get(this,"events")||{})[t.type]||[],h=ae.event.special[t.type]||{};if(l[0]=t,t.delegateTarget=this,!h.preDispatch||h.preDispatch.call(this,t)!==!1){for(o=ae.event.handlers.call(this,t,c),i=0;(a=o[i++])&&!t.isPropagationStopped();)for(t.currentTarget=a.elem,n=0;(s=a.handlers[n++])&&!t.isImmediatePropagationStopped();)(!t.namespace_re||t.namespace_re.test(s.namespace))&&(t.handleObj=s,t.data=s.data,r=((ae.event.special[s.origType]||{}).handle||s.handler).apply(a.elem,l),r!==e&&(t.result=r)===!1&&(t.preventDefault(),t.stopPropagation()));return h.postDispatch&&h.postDispatch.call(this,t),t.result}},handlers:function(t,i){var n,r,a,s,o=[],l=i.delegateCount,c=t.target;if(l&&c.nodeType&&(!t.button||"click"!==t.type))for(;c!==this;c=c.parentNode||this)if(c.disabled!==!0||"click"!==t.type){for(r=[],n=0;l>n;n++)s=i[n],a=s.selector+" ",r[a]===e&&(r[a]=s.needsContext?ae(a,this).index(c)>=0:ae.find(a,this,null,[c]).length),r[a]&&r.push(s);r.length&&o.push({elem:c,handlers:r})}return i.length>l&&o.push({elem:this,handlers:i.slice(l)}),o},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){return null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode),t}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,i){var n,r,a,s=i.button;return null==t.pageX&&null!=i.clientX&&(n=t.target.ownerDocument||X,r=n.documentElement,a=n.body,t.pageX=i.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),t.pageY=i.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),t.which||s===e||(t.which=1&s?1:2&s?3:4&s?2:0),t}},fix:function(t){if(t[ae.expando])return t;var e,i,n,r=t.type,a=t,s=this.fixHooks[r];for(s||(this.fixHooks[r]=s=Me.test(r)?this.mouseHooks:xe.test(r)?this.keyHooks:{}),n=s.props?this.props.concat(s.props):this.props,t=new ae.Event(a),e=n.length;e--;)i=n[e],t[i]=a[i];return t.target||(t.target=X),3===t.target.nodeType&&(t.target=t.target.parentNode),s.filter?s.filter(t,a):t},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==l()&&this.focus?(this.focus(),!1):e},delegateType:"focusin"},blur:{trigger:function(){return this===l()&&this.blur?(this.blur(),!1):e},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&ae.nodeName(this,"input")?(this.click(),!1):e},_default:function(t){return ae.nodeName(t.target,"a")}},beforeunload:{postDispatch:function(t){t.result!==e&&(t.originalEvent.returnValue=t.result)}}},simulate:function(t,e,i,n){var r=ae.extend(new ae.Event,i,{type:t,isSimulated:!0,originalEvent:{}});n?ae.event.trigger(r,null,e):ae.event.dispatch.call(e,r),r.isDefaultPrevented()&&i.preventDefault()}},ae.removeEvent=function(t,e,i){t.removeEventListener&&t.removeEventListener(e,i,!1)},ae.Event=function(t,i){return this instanceof ae.Event?(t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||t.getPreventDefault&&t.getPreventDefault()?s:o):this.type=t,i&&ae.extend(this,i),this.timeStamp=t&&t.timeStamp||ae.now(),this[ae.expando]=!0,e):new ae.Event(t,i)},ae.Event.prototype={isDefaultPrevented:o,isPropagationStopped:o,isImmediatePropagationStopped:o,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=s,t&&t.preventDefault&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=s,t&&t.stopPropagation&&t.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=s,this.stopPropagation()}},ae.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(t,e){ae.event.special[t]={delegateType:e,bindType:e,handle:function(t){var i,n=this,r=t.relatedTarget,a=t.handleObj;return(!r||r!==n&&!ae.contains(n,r))&&(t.type=a.origType,i=a.handler.apply(this,arguments),t.type=e),i}}}),ae.support.focusinBubbles||ae.each({focus:"focusin",blur:"focusout"},function(t,e){var i=0,n=function(t){ae.event.simulate(e,t.target,ae.event.fix(t),!0)};ae.event.special[e]={setup:function(){0===i++&&X.addEventListener(t,n,!0)},teardown:function(){0===--i&&X.removeEventListener(t,n,!0)}}}),ae.fn.extend({on:function(t,i,n,r,a){var s,l;if("object"==typeof t){"string"!=typeof i&&(n=n||i,i=e);for(l in t)this.on(l,i,n,t[l],a);return this}if(null==n&&null==r?(r=i,n=i=e):null==r&&("string"==typeof i?(r=n,n=e):(r=n,n=i,i=e)),r===!1)r=o;else if(!r)return this;return 1===a&&(s=r,r=function(t){return ae().off(t),s.apply(this,arguments)},r.guid=s.guid||(s.guid=ae.guid++)),this.each(function(){ae.event.add(this,t,r,n,i)})},one:function(t,e,i,n){return this.on(t,e,i,n,1)},off:function(t,i,n){var r,a;if(t&&t.preventDefault&&t.handleObj)return r=t.handleObj,ae(t.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof t){for(a in t)this.off(a,i,t[a]);return this}return(i===!1||"function"==typeof i)&&(n=i,i=e),n===!1&&(n=o),this.each(function(){ae.event.remove(this,t,n,i)})},trigger:function(t,e){return this.each(function(){ae.event.trigger(t,e,this)})},triggerHandler:function(t,i){var n=this[0];return n?ae.event.trigger(t,i,n,!0):e}});var ke=/^.[^:#\[\.,]*$/,De=/^(?:parents|prev(?:Until|All))/,ze=ae.expr.match.needsContext,Se={children:!0,contents:!0,next:!0,prev:!0};ae.fn.extend({find:function(t){var e,i=[],n=this,r=n.length;if("string"!=typeof t)return this.pushStack(ae(t).filter(function(){for(e=0;r>e;e++)if(ae.contains(n[e],this))return!0}));for(e=0;r>e;e++)ae.find(t,n[e],i);return i=this.pushStack(r>1?ae.unique(i):i),i.selector=this.selector?this.selector+" "+t:t,i},has:function(t){var e=ae(t,this),i=e.length;return this.filter(function(){for(var t=0;i>t;t++)if(ae.contains(this,e[t]))return!0
16 })},not:function(t){return this.pushStack(h(this,t||[],!0))},filter:function(t){return this.pushStack(h(this,t||[],!1))},is:function(t){return!!h(this,"string"==typeof t&&ze.test(t)?ae(t):t||[],!1).length},closest:function(t,e){for(var i,n=0,r=this.length,a=[],s=ze.test(t)||"string"!=typeof t?ae(t,e||this.context):0;r>n;n++)for(i=this[n];i&&i!==e;i=i.parentNode)if(11>i.nodeType&&(s?s.index(i)>-1:1===i.nodeType&&ae.find.matchesSelector(i,t))){i=a.push(i);break}return this.pushStack(a.length>1?ae.unique(a):a)},index:function(t){return t?"string"==typeof t?ee.call(ae(t),this[0]):ee.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){var i="string"==typeof t?ae(t,e):ae.makeArray(t&&t.nodeType?[t]:t),n=ae.merge(this.get(),i);return this.pushStack(ae.unique(n))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),ae.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return ae.dir(t,"parentNode")},parentsUntil:function(t,e,i){return ae.dir(t,"parentNode",i)},next:function(t){return c(t,"nextSibling")},prev:function(t){return c(t,"previousSibling")},nextAll:function(t){return ae.dir(t,"nextSibling")},prevAll:function(t){return ae.dir(t,"previousSibling")},nextUntil:function(t,e,i){return ae.dir(t,"nextSibling",i)},prevUntil:function(t,e,i){return ae.dir(t,"previousSibling",i)},siblings:function(t){return ae.sibling((t.parentNode||{}).firstChild,t)},children:function(t){return ae.sibling(t.firstChild)},contents:function(t){return t.contentDocument||ae.merge([],t.childNodes)}},function(t,e){ae.fn[t]=function(i,n){var r=ae.map(this,e,i);return"Until"!==t.slice(-5)&&(n=i),n&&"string"==typeof n&&(r=ae.filter(n,r)),this.length>1&&(Se[t]||ae.unique(r),De.test(t)&&r.reverse()),this.pushStack(r)}}),ae.extend({filter:function(t,e,i){var n=e[0];return i&&(t=":not("+t+")"),1===e.length&&1===n.nodeType?ae.find.matchesSelector(n,t)?[n]:[]:ae.find.matches(t,ae.grep(e,function(t){return 1===t.nodeType}))},dir:function(t,i,n){for(var r=[],a=n!==e;(t=t[i])&&9!==t.nodeType;)if(1===t.nodeType){if(a&&ae(t).is(n))break;r.push(t)}return r},sibling:function(t,e){for(var i=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&i.push(t);return i}});var Te=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Ee=/<([\w:]+)/,Ge=/<|&#?\w+;/,Le=/<(?:script|style|link)/i,Be=/^(?:checkbox|radio)$/i,Ze=/checked\s*(?:[^=]|=\s*.checked.)/i,_e=/^$|\/(?:java|ecma)script/i,Pe=/^true\/(.*)/,Oe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ye={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ye.optgroup=Ye.option,Ye.tbody=Ye.tfoot=Ye.colgroup=Ye.caption=Ye.thead,Ye.th=Ye.td,ae.fn.extend({text:function(t){return ae.access(this,function(t){return t===e?ae.text(this):this.empty().append((this[0]&&this[0].ownerDocument||X).createTextNode(t))},null,t,arguments.length)},append:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=u(this,t);e.appendChild(t)}})},prepend:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=u(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},remove:function(t,e){for(var i,n=t?ae.filter(t,this):this,r=0;null!=(i=n[r]);r++)e||1!==i.nodeType||ae.cleanData(m(i)),i.parentNode&&(e&&ae.contains(i.ownerDocument,i)&&d(m(i,"script")),i.parentNode.removeChild(i));return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(ae.cleanData(m(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null==t?!1:t,e=null==e?t:e,this.map(function(){return ae.clone(this,t,e)})},html:function(t){return ae.access(this,function(t){var i=this[0]||{},n=0,r=this.length;if(t===e&&1===i.nodeType)return i.innerHTML;if("string"==typeof t&&!Le.test(t)&&!Ye[(Ee.exec(t)||["",""])[1].toLowerCase()]){t=t.replace(Te,"<$1></$2>");try{for(;r>n;n++)i=this[n]||{},1===i.nodeType&&(ae.cleanData(m(i,!1)),i.innerHTML=t);i=0}catch(a){}}i&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=ae.map(this,function(t){return[t.nextSibling,t.parentNode]}),e=0;return this.domManip(arguments,function(i){var n=t[e++],r=t[e++];r&&(n&&n.parentNode!==r&&(n=this.nextSibling),ae(this).remove(),r.insertBefore(i,n))},!0),e?this:this.remove()},detach:function(t){return this.remove(t,!0)},domManip:function(t,e,i){t=K.apply([],t);var n,r,a,s,o,l,c=0,h=this.length,u=this,d=h-1,f=t[0],I=ae.isFunction(f);if(I||!(1>=h||"string"!=typeof f||ae.support.checkClone)&&Ze.test(f))return this.each(function(n){var r=u.eq(n);I&&(t[0]=f.call(this,n,r.html())),r.domManip(t,e,i)});if(h&&(n=ae.buildFragment(t,this[0].ownerDocument,!1,!i&&this),r=n.firstChild,1===n.childNodes.length&&(n=r),r)){for(a=ae.map(m(n,"script"),p),s=a.length;h>c;c++)o=n,c!==d&&(o=ae.clone(o,!0,!0),s&&ae.merge(a,m(o,"script"))),e.call(this[c],o,c);if(s)for(l=a[a.length-1].ownerDocument,ae.map(a,g),c=0;s>c;c++)o=a[c],_e.test(o.type||"")&&!me.access(o,"globalEval")&&ae.contains(l,o)&&(o.src?ae._evalUrl(o.src):ae.globalEval(o.textContent.replace(Oe,"")))}return this}}),ae.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){ae.fn[t]=function(t){for(var i,n=[],r=ae(t),a=r.length-1,s=0;a>=s;s++)i=s===a?this:this.clone(!0),ae(r[s])[e](i),q.apply(n,i.get());return this.pushStack(n)}}),ae.extend({clone:function(t,e,i){var n,r,a,s,o=t.cloneNode(!0),l=ae.contains(t.ownerDocument,t);if(!(ae.support.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||ae.isXMLDoc(t)))for(s=m(o),a=m(t),n=0,r=a.length;r>n;n++)I(a[n],s[n]);if(e)if(i)for(a=a||m(t),s=s||m(o),n=0,r=a.length;r>n;n++)f(a[n],s[n]);else f(t,o);return s=m(o,"script"),s.length>0&&d(s,!l&&m(t,"script")),o},buildFragment:function(t,e,i,n){for(var r,a,s,o,l,c,h=0,u=t.length,p=e.createDocumentFragment(),g=[];u>h;h++)if(r=t[h],r||0===r)if("object"===ae.type(r))ae.merge(g,r.nodeType?[r]:r);else if(Ge.test(r)){for(a=a||p.appendChild(e.createElement("div")),s=(Ee.exec(r)||["",""])[1].toLowerCase(),o=Ye[s]||Ye._default,a.innerHTML=o[1]+r.replace(Te,"<$1></$2>")+o[2],c=o[0];c--;)a=a.lastChild;ae.merge(g,a.childNodes),a=p.firstChild,a.textContent=""}else g.push(e.createTextNode(r));for(p.textContent="",h=0;r=g[h++];)if((!n||-1===ae.inArray(r,n))&&(l=ae.contains(r.ownerDocument,r),a=m(p.appendChild(r),"script"),l&&d(a),i))for(c=0;r=a[c++];)_e.test(r.type||"")&&i.push(r);return p},cleanData:function(t){for(var i,n,a,s,o,l,c=ae.event.special,h=0;(n=t[h])!==e;h++){if(r.accepts(n)&&(o=n[me.expando],o&&(i=me.cache[o]))){if(a=Object.keys(i.events||{}),a.length)for(l=0;(s=a[l])!==e;l++)c[s]?ae.event.remove(n,s):ae.removeEvent(n,s,i.handle);me.cache[o]&&delete me.cache[o]}delete fe.cache[n[fe.expando]]}},_evalUrl:function(t){return ae.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),ae.fn.extend({wrapAll:function(t){var e;return ae.isFunction(t)?this.each(function(e){ae(this).wrapAll(t.call(this,e))}):(this[0]&&(e=ae(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this)},wrapInner:function(t){return ae.isFunction(t)?this.each(function(e){ae(this).wrapInner(t.call(this,e))}):this.each(function(){var e=ae(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=ae.isFunction(t);return this.each(function(i){ae(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(){return this.parent().each(function(){ae.nodeName(this,"body")||ae(this).replaceWith(this.childNodes)}).end()}});var We,Ve,Re=/^(none|table(?!-c[ea]).+)/,Xe=/^margin/,Ue=RegExp("^("+se+")(.*)$","i"),He=RegExp("^("+se+")(?!px)[a-z%]+$","i"),Fe=RegExp("^([+-])=("+se+")","i"),Je={BODY:"block"},Qe={position:"absolute",visibility:"hidden",display:"block"},$e={letterSpacing:0,fontWeight:400},Ke=["Top","Right","Bottom","Left"],qe=["Webkit","O","Moz","ms"];ae.fn.extend({css:function(t,i){return ae.access(this,function(t,i,n){var r,a,s={},o=0;if(ae.isArray(i)){for(r=C(t),a=i.length;a>o;o++)s[i[o]]=ae.css(t,i[o],!1,r);return s}return n!==e?ae.style(t,i,n):ae.css(t,i)},t,i,arguments.length>1)},show:function(){return b(this,!0)},hide:function(){return b(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){v(this)?ae(this).show():ae(this).hide()})}}),ae.extend({cssHooks:{opacity:{get:function(t,e){if(e){var i=We(t,"opacity");return""===i?"1":i}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(t,i,n,r){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var a,s,o,l=ae.camelCase(i),c=t.style;return i=ae.cssProps[l]||(ae.cssProps[l]=y(c,l)),o=ae.cssHooks[i]||ae.cssHooks[l],n===e?o&&"get"in o&&(a=o.get(t,!1,r))!==e?a:c[i]:(s=typeof n,"string"===s&&(a=Fe.exec(n))&&(n=(a[1]+1)*a[2]+parseFloat(ae.css(t,i)),s="number"),null==n||"number"===s&&isNaN(n)||("number"!==s||ae.cssNumber[l]||(n+="px"),ae.support.clearCloneStyle||""!==n||0!==i.indexOf("background")||(c[i]="inherit"),o&&"set"in o&&(n=o.set(t,n,r))===e||(c[i]=n)),e)}},css:function(t,i,n,r){var a,s,o,l=ae.camelCase(i);return i=ae.cssProps[l]||(ae.cssProps[l]=y(t.style,l)),o=ae.cssHooks[i]||ae.cssHooks[l],o&&"get"in o&&(a=o.get(t,!0,n)),a===e&&(a=We(t,i,r)),"normal"===a&&i in $e&&(a=$e[i]),""===n||n?(s=parseFloat(a),n===!0||ae.isNumeric(s)?s||0:a):a}}),We=function(t,i,n){var r,a,s,o=n||C(t),l=o?o.getPropertyValue(i)||o[i]:e,c=t.style;return o&&(""!==l||ae.contains(t.ownerDocument,t)||(l=ae.style(t,i)),He.test(l)&&Xe.test(i)&&(r=c.width,a=c.minWidth,s=c.maxWidth,c.minWidth=c.maxWidth=c.width=l,l=o.width,c.width=r,c.minWidth=a,c.maxWidth=s)),l},ae.each(["height","width"],function(t,i){ae.cssHooks[i]={get:function(t,n,r){return n?0===t.offsetWidth&&Re.test(ae.css(t,"display"))?ae.swap(t,Qe,function(){return x(t,i,r)}):x(t,i,r):e},set:function(t,e,n){var r=n&&C(t);return A(t,e,n?w(t,i,n,ae.support.boxSizing&&"border-box"===ae.css(t,"boxSizing",!1,r),r):0)}}}),ae(function(){ae.support.reliableMarginRight||(ae.cssHooks.marginRight={get:function(t,i){return i?ae.swap(t,{display:"inline-block"},We,[t,"marginRight"]):e}}),!ae.support.pixelPosition&&ae.fn.position&&ae.each(["top","left"],function(t,i){ae.cssHooks[i]={get:function(t,n){return n?(n=We(t,i),He.test(n)?ae(t).position()[i]+"px":n):e}}})}),ae.expr&&ae.expr.filters&&(ae.expr.filters.hidden=function(t){return 0>=t.offsetWidth&&0>=t.offsetHeight},ae.expr.filters.visible=function(t){return!ae.expr.filters.hidden(t)}),ae.each({margin:"",padding:"",border:"Width"},function(t,e){ae.cssHooks[t+e]={expand:function(i){for(var n=0,r={},a="string"==typeof i?i.split(" "):[i];4>n;n++)r[t+Ke[n]+e]=a[n]||a[n-2]||a[0];return r}},Xe.test(t)||(ae.cssHooks[t+e].set=A)});var ti=/%20/g,ei=/\[\]$/,ii=/\r?\n/g,ni=/^(?:submit|button|image|reset|file)$/i,ri=/^(?:input|select|textarea|keygen)/i;ae.fn.extend({serialize:function(){return ae.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ae.prop(this,"elements");return t?ae.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ae(this).is(":disabled")&&ri.test(this.nodeName)&&!ni.test(t)&&(this.checked||!Be.test(t))}).map(function(t,e){var i=ae(this).val();return null==i?null:ae.isArray(i)?ae.map(i,function(t){return{name:e.name,value:t.replace(ii,"\r\n")}}):{name:e.name,value:i.replace(ii,"\r\n")}}).get()}}),ae.param=function(t,i){var n,r=[],a=function(t,e){e=ae.isFunction(e)?e():null==e?"":e,r[r.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(i===e&&(i=ae.ajaxSettings&&ae.ajaxSettings.traditional),ae.isArray(t)||t.jquery&&!ae.isPlainObject(t))ae.each(t,function(){a(this.name,this.value)});else for(n in t)N(n,t[n],i,a);return r.join("&").replace(ti,"+")},ae.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){ae.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),ae.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)},bind:function(t,e,i){return this.on(t,null,e,i)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,i,n){return this.on(e,t,i,n)},undelegate:function(t,e,i){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",i)}});var ai,si,oi=ae.now(),li=/\?/,ci=/#.*$/,hi=/([?&])_=[^&]*/,ui=/^(.*?):[ \t]*([^\r\n]*)$/gm,pi=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,gi=/^(?:GET|HEAD)$/,di=/^\/\//,fi=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,mi=ae.fn.load,Ii={},yi={},vi="*/".concat("*");try{si=R.href}catch(Ci){si=X.createElement("a"),si.href="",si=si.href}ai=fi.exec(si.toLowerCase())||[],ae.fn.load=function(t,i,n){if("string"!=typeof t&&mi)return mi.apply(this,arguments);var r,a,s,o=this,l=t.indexOf(" ");return l>=0&&(r=t.slice(l),t=t.slice(0,l)),ae.isFunction(i)?(n=i,i=e):i&&"object"==typeof i&&(a="POST"),o.length>0&&ae.ajax({url:t,type:a,dataType:"html",data:i}).done(function(t){s=arguments,o.html(r?ae("<div>").append(ae.parseHTML(t)).find(r):t)}).complete(n&&function(t,e){o.each(n,s||[t.responseText,e,t])}),this},ae.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){ae.fn[e]=function(t){return this.on(e,t)}}),ae.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:si,type:"GET",isLocal:pi.test(ai[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":vi,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":ae.parseJSON,"text xml":ae.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?z(z(t,ae.ajaxSettings),e):z(ae.ajaxSettings,t)},ajaxPrefilter:k(Ii),ajaxTransport:k(yi),ajax:function(t,i){function n(t,i,n,o){var c,u,y,v,b,w=i;2!==C&&(C=2,l&&clearTimeout(l),r=e,s=o||"",A.readyState=t>0?4:0,c=t>=200&&300>t||304===t,n&&(v=S(p,A,n)),v=T(p,v,A,c),c?(p.ifModified&&(b=A.getResponseHeader("Last-Modified"),b&&(ae.lastModified[a]=b),b=A.getResponseHeader("etag"),b&&(ae.etag[a]=b)),204===t||"HEAD"===p.type?w="nocontent":304===t?w="notmodified":(w=v.state,u=v.data,y=v.error,c=!y)):(y=w,(t||!w)&&(w="error",0>t&&(t=0))),A.status=t,A.statusText=(i||w)+"",c?f.resolveWith(g,[u,w,A]):f.rejectWith(g,[A,w,y]),A.statusCode(I),I=e,h&&d.trigger(c?"ajaxSuccess":"ajaxError",[A,p,c?u:y]),m.fireWith(g,[A,w]),h&&(d.trigger("ajaxComplete",[A,p]),--ae.active||ae.event.trigger("ajaxStop")))}"object"==typeof t&&(i=t,t=e),i=i||{};var r,a,s,o,l,c,h,u,p=ae.ajaxSetup({},i),g=p.context||p,d=p.context&&(g.nodeType||g.jquery)?ae(g):ae.event,f=ae.Deferred(),m=ae.Callbacks("once memory"),I=p.statusCode||{},y={},v={},C=0,b="canceled",A={readyState:0,getResponseHeader:function(t){var e;if(2===C){if(!o)for(o={};e=ui.exec(s);)o[e[1].toLowerCase()]=e[2];e=o[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===C?s:null},setRequestHeader:function(t,e){var i=t.toLowerCase();return C||(t=v[i]=v[i]||t,y[t]=e),this},overrideMimeType:function(t){return C||(p.mimeType=t),this},statusCode:function(t){var e;if(t)if(2>C)for(e in t)I[e]=[I[e],t[e]];else A.always(t[A.status]);return this},abort:function(t){var e=t||b;return r&&r.abort(e),n(0,e),this}};if(f.promise(A).complete=m.add,A.success=A.done,A.error=A.fail,p.url=((t||p.url||si)+"").replace(ci,"").replace(di,ai[1]+"//"),p.type=i.method||i.type||p.method||p.type,p.dataTypes=ae.trim(p.dataType||"*").toLowerCase().match(oe)||[""],null==p.crossDomain&&(c=fi.exec(p.url.toLowerCase()),p.crossDomain=!(!c||c[1]===ai[1]&&c[2]===ai[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(ai[3]||("http:"===ai[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=ae.param(p.data,p.traditional)),D(Ii,p,i,A),2===C)return A;h=p.global,h&&0===ae.active++&&ae.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!gi.test(p.type),a=p.url,p.hasContent||(p.data&&(a=p.url+=(li.test(a)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=hi.test(a)?a.replace(hi,"$1_="+oi++):a+(li.test(a)?"&":"?")+"_="+oi++)),p.ifModified&&(ae.lastModified[a]&&A.setRequestHeader("If-Modified-Since",ae.lastModified[a]),ae.etag[a]&&A.setRequestHeader("If-None-Match",ae.etag[a])),(p.data&&p.hasContent&&p.contentType!==!1||i.contentType)&&A.setRequestHeader("Content-Type",p.contentType),A.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+vi+"; q=0.01":""):p.accepts["*"]);for(u in p.headers)A.setRequestHeader(u,p.headers[u]);if(p.beforeSend&&(p.beforeSend.call(g,A,p)===!1||2===C))return A.abort();b="abort";for(u in{success:1,error:1,complete:1})A[u](p[u]);if(r=D(yi,p,i,A)){A.readyState=1,h&&d.trigger("ajaxSend",[A,p]),p.async&&p.timeout>0&&(l=setTimeout(function(){A.abort("timeout")},p.timeout));try{C=1,r.send(y,n)}catch(w){if(!(2>C))throw w;n(-1,w)}}else n(-1,"No Transport");return A},getJSON:function(t,e,i){return ae.get(t,e,i,"json")},getScript:function(t,i){return ae.get(t,e,i,"script")}}),ae.each(["get","post"],function(t,i){ae[i]=function(t,n,r,a){return ae.isFunction(n)&&(a=a||r,r=n,n=e),ae.ajax({url:t,type:i,dataType:a,data:n,success:r})}}),ae.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(t){return ae.globalEval(t),t}}}),ae.ajaxPrefilter("script",function(t){t.cache===e&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),ae.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,r){e=ae("<script>").prop({async:!0,charset:t.scriptCharset,src:t.url}).on("load error",i=function(t){e.remove(),i=null,t&&r("error"===t.type?404:200,t.type)}),X.head.appendChild(e[0])},abort:function(){i&&i()}}}});var bi=[],Ai=/(=)\?(?=&|$)|\?\?/;ae.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=bi.pop()||ae.expando+"_"+oi++;return this[t]=!0,t}}),ae.ajaxPrefilter("json jsonp",function(i,n,r){var a,s,o,l=i.jsonp!==!1&&(Ai.test(i.url)?"url":"string"==typeof i.data&&!(i.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ai.test(i.data)&&"data");return l||"jsonp"===i.dataTypes[0]?(a=i.jsonpCallback=ae.isFunction(i.jsonpCallback)?i.jsonpCallback():i.jsonpCallback,l?i[l]=i[l].replace(Ai,"$1"+a):i.jsonp!==!1&&(i.url+=(li.test(i.url)?"&":"?")+i.jsonp+"="+a),i.converters["script json"]=function(){return o||ae.error(a+" was not called"),o[0]},i.dataTypes[0]="json",s=t[a],t[a]=function(){o=arguments},r.always(function(){t[a]=s,i[a]&&(i.jsonpCallback=n.jsonpCallback,bi.push(a)),o&&ae.isFunction(s)&&s(o[0]),o=s=e}),"script"):e}),ae.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(t){}};var wi=ae.ajaxSettings.xhr(),xi={0:200,1223:204},Mi=0,ji={};t.ActiveXObject&&ae(t).on("unload",function(){for(var t in ji)ji[t]();ji=e}),ae.support.cors=!!wi&&"withCredentials"in wi,ae.support.ajax=wi=!!wi,ae.ajaxTransport(function(t){var i;return ae.support.cors||wi&&!t.crossDomain?{send:function(n,r){var a,s,o=t.xhr();if(o.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)o[a]=t.xhrFields[a];t.mimeType&&o.overrideMimeType&&o.overrideMimeType(t.mimeType),t.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(a in n)o.setRequestHeader(a,n[a]);i=function(t){return function(){i&&(delete ji[s],i=o.onload=o.onerror=null,"abort"===t?o.abort():"error"===t?r(o.status||404,o.statusText):r(xi[o.status]||o.status,o.statusText,"string"==typeof o.responseText?{text:o.responseText}:e,o.getAllResponseHeaders()))}},o.onload=i(),o.onerror=i("error"),i=ji[s=Mi++]=i("abort"),o.send(t.hasContent&&t.data||null)},abort:function(){i&&i()}}:e});var Ni,ki,Di=/^(?:toggle|show|hide)$/,zi=RegExp("^(?:([+-])=|)("+se+")([a-z%]*)$","i"),Si=/queueHooks$/,Ti=[Z],Ei={"*":[function(t,e){var i=this.createTween(t,e),n=i.cur(),r=zi.exec(e),a=r&&r[3]||(ae.cssNumber[t]?"":"px"),s=(ae.cssNumber[t]||"px"!==a&&+n)&&zi.exec(ae.css(i.elem,t)),o=1,l=20;if(s&&s[3]!==a){a=a||s[3],r=r||[],s=+n||1;do o=o||".5",s/=o,ae.style(i.elem,t,s+a);while(o!==(o=i.cur()/n)&&1!==o&&--l)}return r&&(s=i.start=+s||+n||0,i.unit=a,i.end=r[1]?s+(r[1]+1)*r[2]:+r[2]),i}]};ae.Animation=ae.extend(L,{tweener:function(t,e){ae.isFunction(t)?(e=t,t=["*"]):t=t.split(" ");for(var i,n=0,r=t.length;r>n;n++)i=t[n],Ei[i]=Ei[i]||[],Ei[i].unshift(e)},prefilter:function(t,e){e?Ti.unshift(t):Ti.push(t)}}),ae.Tween=_,_.prototype={constructor:_,init:function(t,e,i,n,r,a){this.elem=t,this.prop=i,this.easing=r||"swing",this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=a||(ae.cssNumber[i]?"":"px")},cur:function(){var t=_.propHooks[this.prop];return t&&t.get?t.get(this):_.propHooks._default.get(this)},run:function(t){var e,i=_.propHooks[this.prop];return this.pos=e=this.options.duration?ae.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):_.propHooks._default.set(this),this}},_.prototype.init.prototype=_.prototype,_.propHooks={_default:{get:function(t){var e;return null==t.elem[t.prop]||t.elem.style&&null!=t.elem.style[t.prop]?(e=ae.css(t.elem,t.prop,""),e&&"auto"!==e?e:0):t.elem[t.prop]},set:function(t){ae.fx.step[t.prop]?ae.fx.step[t.prop](t):t.elem.style&&(null!=t.elem.style[ae.cssProps[t.prop]]||ae.cssHooks[t.prop])?ae.style(t.elem,t.prop,t.now+t.unit):t.elem[t.prop]=t.now}}},_.propHooks.scrollTop=_.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},ae.each(["toggle","show","hide"],function(t,e){var i=ae.fn[e];ae.fn[e]=function(t,n,r){return null==t||"boolean"==typeof t?i.apply(this,arguments):this.animate(P(e,!0),t,n,r)}}),ae.fn.extend({fadeTo:function(t,e,i,n){return this.filter(v).css("opacity",0).show().end().animate({opacity:e},t,i,n)},animate:function(t,e,i,n){var r=ae.isEmptyObject(t),a=ae.speed(e,i,n),s=function(){var e=L(this,ae.extend({},t),a);(r||me.get(this,"finish"))&&e.stop(!0)};return s.finish=s,r||a.queue===!1?this.each(s):this.queue(a.queue,s)},stop:function(t,i,n){var r=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=i,i=t,t=e),i&&t!==!1&&this.queue(t||"fx",[]),this.each(function(){var e=!0,i=null!=t&&t+"queueHooks",a=ae.timers,s=me.get(this);if(i)s[i]&&s[i].stop&&r(s[i]);else for(i in s)s[i]&&s[i].stop&&Si.test(i)&&r(s[i]);for(i=a.length;i--;)a[i].elem!==this||null!=t&&a[i].queue!==t||(a[i].anim.stop(n),e=!1,a.splice(i,1));(e||!n)&&ae.dequeue(this,t)})},finish:function(t){return t!==!1&&(t=t||"fx"),this.each(function(){var e,i=me.get(this),n=i[t+"queue"],r=i[t+"queueHooks"],a=ae.timers,s=n?n.length:0;for(i.finish=!0,ae.queue(this,t,[]),r&&r.stop&&r.stop.call(this,!0),e=a.length;e--;)a[e].elem===this&&a[e].queue===t&&(a[e].anim.stop(!0),a.splice(e,1));for(e=0;s>e;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete i.finish})}}),ae.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){ae.fn[t]=function(t,i,n){return this.animate(e,t,i,n)}}),ae.speed=function(t,e,i){var n=t&&"object"==typeof t?ae.extend({},t):{complete:i||!i&&e||ae.isFunction(t)&&t,duration:t,easing:i&&e||e&&!ae.isFunction(e)&&e};return n.duration=ae.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in ae.fx.speeds?ae.fx.speeds[n.duration]:ae.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(){ae.isFunction(n.old)&&n.old.call(this),n.queue&&ae.dequeue(this,n.queue)},n},ae.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2}},ae.timers=[],ae.fx=_.prototype.init,ae.fx.tick=function(){var t,i=ae.timers,n=0;for(Ni=ae.now();i.length>n;n++)t=i[n],t()||i[n]!==t||i.splice(n--,1);i.length||ae.fx.stop(),Ni=e},ae.fx.timer=function(t){t()&&ae.timers.push(t)&&ae.fx.start()},ae.fx.interval=13,ae.fx.start=function(){ki||(ki=setInterval(ae.fx.tick,ae.fx.interval))},ae.fx.stop=function(){clearInterval(ki),ki=null},ae.fx.speeds={slow:600,fast:200,_default:400},ae.fx.step={},ae.expr&&ae.expr.filters&&(ae.expr.filters.animated=function(t){return ae.grep(ae.timers,function(e){return t===e.elem}).length}),ae.fn.offset=function(t){if(arguments.length)return t===e?this:this.each(function(e){ae.offset.setOffset(this,t,e)});var i,n,r=this[0],a={top:0,left:0},s=r&&r.ownerDocument;if(s)return i=s.documentElement,ae.contains(i,r)?(typeof r.getBoundingClientRect!==V&&(a=r.getBoundingClientRect()),n=O(s),{top:a.top+n.pageYOffset-i.clientTop,left:a.left+n.pageXOffset-i.clientLeft}):a},ae.offset={setOffset:function(t,e,i){var n,r,a,s,o,l,c,h=ae.css(t,"position"),u=ae(t),p={};"static"===h&&(t.style.position="relative"),o=u.offset(),a=ae.css(t,"top"),l=ae.css(t,"left"),c=("absolute"===h||"fixed"===h)&&(a+l).indexOf("auto")>-1,c?(n=u.position(),s=n.top,r=n.left):(s=parseFloat(a)||0,r=parseFloat(l)||0),ae.isFunction(e)&&(e=e.call(t,i,o)),null!=e.top&&(p.top=e.top-o.top+s),null!=e.left&&(p.left=e.left-o.left+r),"using"in e?e.using.call(t,p):u.css(p)}},ae.fn.extend({position:function(){if(this[0]){var t,e,i=this[0],n={top:0,left:0};return"fixed"===ae.css(i,"position")?e=i.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),ae.nodeName(t[0],"html")||(n=t.offset()),n.top+=ae.css(t[0],"borderTopWidth",!0),n.left+=ae.css(t[0],"borderLeftWidth",!0)),{top:e.top-n.top-ae.css(i,"marginTop",!0),left:e.left-n.left-ae.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||U;t&&!ae.nodeName(t,"html")&&"static"===ae.css(t,"position");)t=t.offsetParent;return t||U})}}),ae.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(i,n){var r="pageYOffset"===n;ae.fn[i]=function(a){return ae.access(this,function(i,a,s){var o=O(i);return s===e?o?o[n]:i[a]:(o?o.scrollTo(r?t.pageXOffset:s,r?s:t.pageYOffset):i[a]=s,e)},i,a,arguments.length,null)}}),ae.each({Height:"height",Width:"width"},function(t,i){ae.each({padding:"inner"+t,content:i,"":"outer"+t},function(n,r){ae.fn[r]=function(r,a){var s=arguments.length&&(n||"boolean"!=typeof r),o=n||(r===!0||a===!0?"margin":"border");return ae.access(this,function(i,n,r){var a;return ae.isWindow(i)?i.document.documentElement["client"+t]:9===i.nodeType?(a=i.documentElement,Math.max(i.body["scroll"+t],a["scroll"+t],i.body["offset"+t],a["offset"+t],a["client"+t])):r===e?ae.css(i,n,o):ae.style(i,n,r,o)},i,s?r:e,s,null)}})}),ae.fn.size=function(){return this.length},ae.fn.andSelf=ae.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=ae:"function"==typeof define&&define.amd&&define("jquery",[],function(){return ae}),"object"==typeof t&&"object"==typeof t.document&&(t.jQuery=t.$=ae)}(window),function(){function t(t,e,i){for(var n=(i||0)-1,r=t?t.length:0;r>++n;)if(t[n]===e)return n;return-1}function e(e,i){var n=typeof i;if(e=e.cache,"boolean"==n||null==i)return e[i]?0:-1;"number"!=n&&"string"!=n&&(n="object");var r="number"==n?i:y+i;return e=(e=e[n])&&e[r],"object"==n?e&&t(e,i)>-1?0:-1:e?0:-1}function i(t){var e=this.cache,i=typeof t;if("boolean"==i||null==t)e[t]=!0;else{"number"!=i&&"string"!=i&&(i="object");var n="number"==i?t:y+t,r=e[i]||(e[i]={});"object"==i?(r[n]||(r[n]=[])).push(t):r[n]=!0}}function n(t){return t.charCodeAt(0)}function r(t,e){var i=t.criteria,n=e.criteria;if(i!==n){if(i>n||i===d)return 1;if(n>i||n===d)return-1}return t.index-e.index}function a(t){var e=-1,n=t.length,r=t[0],a=t[0|n/2],s=t[n-1];if(r&&"object"==typeof r&&a&&"object"==typeof a&&s&&"object"==typeof s)return!1;var o=l();o["false"]=o["null"]=o["true"]=o.undefined=!1;var c=l();for(c.array=t,c.cache=o,c.push=i;n>++e;)c.push(t[e]);return c}function s(t){return"\\"+F[t]}function o(){return f.pop()||[]}function l(){return m.pop()||{array:null,cache:null,criteria:null,"false":!1,index:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,value:null}}function c(){}function h(t){t.length=0,C>f.length&&f.push(t)}function u(t){var e=t.cache;e&&u(e),t.array=t.cache=t.criteria=t.object=t.number=t.string=t.value=null,C>m.length&&m.push(t)}function p(t,e,i){e||(e=0),i===d&&(i=t?t.length:0);for(var n=-1,r=i-e||0,a=Array(0>r?0:r);r>++n;)a[n]=t[e+n];return a}function g(i){function f(t){return t&&"object"==typeof t&&!Qn(t)&&Mn.call(t,"__wrapped__")?t:new m(t)}function m(t,e){this.__chain__=!!e,this.__wrapped__=t}function C(t,e,i,n,r){if(i){var a=i(t);if(a!==d)return a}var s=je(t);if(!s)return t;var l=Sn.call(t);if(!R[l])return t;var c=Hn[l];switch(l){case Z:case _:return new c(+t);case O:case V:return new c(t);case W:return a=c(t.source,j.exec(t)),a.lastIndex=t.lastIndex,a}var u=Qn(t);if(e){var g=!n;n||(n=o()),r||(r=o());for(var f=n.length;f--;)if(n[f]==t)return r[f];a=u?c(t.length):{}}else a=u?p(t):nr({},t);return u&&(Mn.call(t,"index")&&(a.index=t.index),Mn.call(t,"input")&&(a.input=t.input)),e?(n.push(t),r.push(a),(u?Xe:sr)(t,function(t,s){a[s]=C(t,e,i,n,r)}),g&&(h(n),h(r)),a):a}function F(t,e,i){if("function"!=typeof t)return Xi;if(e===d)return t;var n=t.__bindData__||Fn.funcNames&&!t.name;if(n===d){var r=S&&wn.call(t);Fn.funcNames||!r||N.test(r)||(n=!0),(Fn.funcNames||!n)&&(n=!Fn.funcDecomp||S.test(r),Jn(t,n))}if(n!==!0&&n&&1&n[1])return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,r){return t.call(e,i,n,r)};case 4:return function(i,n,r,a){return t.call(e,i,n,r,a)}}return Di(t,e)}function Q(t,e,i,n){for(var r=(n||0)-1,a=t?t.length:0,s=[];a>++r;){var o=t[r];if(o&&"object"==typeof o&&"number"==typeof o.length&&(Qn(o)||ce(o))){e||(o=Q(o,e,i));var l=-1,c=o.length,h=s.length;for(s.length+=c;c>++l;)s[h++]=o[l]}else i||s.push(o)}return s}function $(t,e,i,n,r,a){if(i){var s=i(t,e);if(s!==d)return!!s}if(t===e)return 0!==t||1/t==1/e;var l=typeof t,c=typeof e;if(!(t!==t||t&&H[l]||e&&H[c]))return!1;if(null==t||null==e)return t===e;var u=Sn.call(t),p=Sn.call(e);if(u==L&&(u=Y),p==L&&(p=Y),u!=p)return!1;switch(u){case Z:case _:return+t==+e;case O:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case W:case V:return t==dn(e)}var g=u==B;if(!g){if(Mn.call(t,"__wrapped__ ")||Mn.call(e,"__wrapped__"))return $(t.__wrapped__||t,e.__wrapped__||e,i,n,r,a);if(u!=Y)return!1;var f=t.constructor,m=e.constructor;if(f!=m&&!(Me(f)&&f instanceof f&&Me(m)&&m instanceof m))return!1}var I=!r;r||(r=o()),a||(a=o());for(var y=r.length;y--;)if(r[y]==t)return a[y]==e;var v=0;if(s=!0,r.push(t),a.push(e),g){if(y=t.length,v=e.length,s=v==t.length,!s&&!n)return s;for(;v--;){var C=y,b=e[v];if(n)for(;C--&&!(s=$(t[C],b,i,n,r,a)););else if(!(s=$(t[v],b,i,n,r,a)))break}return s}return ar(e,function(e,o,l){return Mn.call(l,o)?(v++,s=Mn.call(t,o)&&$(t[o],e,i,n,r,a)):d}),s&&!n&&ar(t,function(t,e,i){return Mn.call(i,e)?s=--v>-1:d}),I&&(h(r),h(a)),s}function q(t,e,i,n,r){(Qn(e)?Xe:sr)(e,function(e,a){var s,o,l=e,c=t[a];if(e&&((o=Qn(e))||or(e))){for(var h=n.length;h--;)if(s=n[h]==e){c=r[h];break}if(!s){var u;
17 i&&(l=i(c,e),(u=l!==d)&&(c=l)),u||(c=o?Qn(c)?c:[]:or(c)?c:{}),n.push(e),r.push(c),u||q(c,e,i,n,r)}}else i&&(l=i(c,e),l===d&&(l=e)),l!==d&&(c=l);t[a]=c})}function ee(i,n,r){var s=-1,l=se(),c=i?i.length:0,p=[],g=!n&&c>=v&&l===t,d=r||g?o():p;if(g){var f=a(d);f?(l=e,d=f):(g=!1,d=r?d:(h(d),p))}for(;c>++s;){var m=i[s],I=r?r(m,s,i):m;(n?!s||d[d.length-1]!==I:0>l(d,I))&&((r||g)&&d.push(I),p.push(m))}return g?(h(d.array),u(d)):r&&h(d),p}function ie(t){return function(e,i,n){var r={};i=f.createCallback(i,n,3);var a=-1,s=e?e.length:0;if("number"==typeof s)for(;s>++a;){var o=e[a];t(r,o,i(o,a,e),e)}else sr(e,function(e,n,a){t(r,e,i(e,n,a),a)});return r}}function ne(t,e,i,n,r,a){var s=1&e,o=2&e,l=4&e,c=8&e,h=16&e,u=32&e,p=t;if(!o&&!Me(t))throw new fn;h&&!i.length&&(e&=-17,h=i=!1),u&&!n.length&&(e&=-33,u=n=!1);var g=t&&t.__bindData__;if(g)return!s||1&g[1]||(g[4]=r),!s&&1&g[1]&&(e|=8),!l||4&g[1]||(g[5]=a),h&&Nn.apply(g[2]||(g[2]=[]),i),u&&Nn.apply(g[3]||(g[3]=[]),n),g[1]|=e,ne.apply(null,g);if(!s||o||l||u||!(Fn.fastBind||Gn&&h))f=function(){var g=arguments,d=s?r:this;if((l||h||u)&&(g=Rn.call(g),h&&Tn.apply(g,i),u&&Nn.apply(g,n),l&&a>g.length))return e|=16,ne(t,c?e:-4&e,g,null,r,a);if(o&&(t=d[p]),this instanceof f){d=re(t.prototype);var m=t.apply(d,g);return je(m)?m:d}return t.apply(d,g)};else{if(h){var d=[r];Nn.apply(d,i)}var f=h?Gn.apply(t,d):Gn.call(t,r)}return Jn(f,Rn.call(arguments)),f}function re(t){return je(t)?Ln(t):{}}function ae(t){return qn[t]}function se(){var e=(e=f.indexOf)===gi?t:e;return e}function oe(t){var e,i;return t&&Sn.call(t)==Y&&(e=t.constructor,!Me(e)||e instanceof e)?(ar(t,function(t,e){i=e}),i===d||Mn.call(t,i)):!1}function le(t){return tr[t]}function ce(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Sn.call(t)==L||!1}function he(t,e,i,n){return"boolean"!=typeof e&&null!=e&&(n=i,i=e,e=!1),C(t,e,"function"==typeof i&&F(i,n,1))}function ue(t,e,i){return C(t,!0,"function"==typeof e&&F(e,i,1))}function pe(t,e,i){var n;return e=f.createCallback(e,i,3),sr(t,function(t,i,r){return e(t,i,r)?(n=i,!1):d}),n}function ge(t,e,i){var n;return e=f.createCallback(e,i,3),fe(t,function(t,i,r){return e(t,i,r)?(n=i,!1):d}),n}function de(t,e,i){var n=[];ar(t,function(t,e){n.push(e,t)});var r=n.length;for(e=F(e,i,3);r--&&e(n[r--],n[r],t)!==!1;);return t}function fe(t,e,i){var n=Kn(t),r=n.length;for(e=F(e,i,3);r--;){var a=n[r];if(e(t[a],a,t)===!1)break}return t}function me(t){var e=[];return ar(t,function(t,i){Me(t)&&e.push(i)}),e.sort()}function Ie(t,e){return t?Mn.call(t,e):!1}function ye(t){for(var e=-1,i=Kn(t),n=i.length,r={};n>++e;){var a=i[e];r[t[a]]=a}return r}function ve(t){return t===!0||t===!1||Sn.call(t)==Z}function Ce(t){return t?"object"==typeof t&&Sn.call(t)==_:!1}function be(t){return t?1===t.nodeType:!1}function Ae(t){var e=!0;if(!t)return e;var i=Sn.call(t),n=t.length;return i==B||i==V||i==L||i==Y&&"number"==typeof n&&Me(t.splice)?!n:(sr(t,function(){return e=!1}),e)}function we(t,e,i,n){return $(t,e,"function"==typeof i&&F(i,n,2))}function xe(t){return Zn(t)&&!_n(parseFloat(t))}function Me(t){return"function"==typeof t}function je(t){return!(!t||!H[typeof t])}function Ne(t){return De(t)&&t!=+t}function ke(t){return null===t}function De(t){return"number"==typeof t||Sn.call(t)==O}function ze(t){return t?"object"==typeof t&&Sn.call(t)==W:!1}function Se(t){return"string"==typeof t||Sn.call(t)==V}function Te(t){return t===d}function Ee(t){var e=arguments,i=2;if(!je(t))return t;if("number"!=typeof e[2]&&(i=e.length),i>3&&"function"==typeof e[i-2])var n=F(e[--i-1],e[i--],2);else i>2&&"function"==typeof e[i-1]&&(n=e[--i]);for(var r=Rn.call(arguments,1,i),a=-1,s=o(),l=o();i>++a;)q(t,r[a],n,s,l);return h(s),h(l),t}function Ge(t,e,i){var n=se(),r="function"==typeof e,a={};if(r)e=f.createCallback(e,i,3);else var s=Q(arguments,!0,!1,1);return ar(t,function(t,i,o){(r?!e(t,i,o):0>n(s,i))&&(a[i]=t)}),a}function Le(t){for(var e=-1,i=Kn(t),n=i.length,r=sn(n);n>++e;){var a=i[e];r[e]=[a,t[a]]}return r}function Be(t,e,i){var n={};if("function"!=typeof e)for(var r=-1,a=Q(arguments,!0,!1,1),s=je(t)?a.length:0;s>++r;){var o=a[r];o in t&&(n[o]=t[o])}else e=f.createCallback(e,i,3),ar(t,function(t,i,r){e(t,i,r)&&(n[i]=t)});return n}function Ze(t,e,i,n){var r=Qn(t);if(e=F(e,n,4),null==i)if(r)i=[];else{var a=t&&t.constructor,s=a&&a.prototype;i=re(s)}return(r?Xe:sr)(t,function(t,n,r){return e(i,t,n,r)}),i}function _e(t){for(var e=-1,i=Kn(t),n=i.length,r=sn(n);n>++e;)r[e]=t[i[e]];return r}function Pe(t){for(var e=arguments,i=-1,n=Q(e,!0,!1,1),r=e[2]&&e[2][e[1]]===t?1:n.length,a=sn(r);r>++i;)a[i]=t[n[i]];return a}function Oe(t,e,i){var n=-1,r=se(),a=t?t.length:0,s=!1;return i=(0>i?On(0,a+i):i)||0,Qn(t)?s=r(t,e,i)>-1:"number"==typeof a?s=(Se(t)?t.indexOf(e,i):r(t,e,i))>-1:sr(t,function(t){return++n>=i?!(s=t===e):d}),s}function Ye(t,e,i){var n=!0;e=f.createCallback(e,i,3);var r=-1,a=t?t.length:0;if("number"==typeof a)for(;a>++r&&(n=!!e(t[r],r,t)););else sr(t,function(t,i,r){return n=!!e(t,i,r)});return n}function We(t,e,i){var n=[];e=f.createCallback(e,i,3);var r=-1,a=t?t.length:0;if("number"==typeof a)for(;a>++r;){var s=t[r];e(s,r,t)&&n.push(s)}else sr(t,function(t,i,r){e(t,i,r)&&n.push(t)});return n}function Ve(t,e,i){e=f.createCallback(e,i,3);var n=-1,r=t?t.length:0;if("number"!=typeof r){var a;return sr(t,function(t,i,n){return e(t,i,n)?(a=t,!1):d}),a}for(;r>++n;){var s=t[n];if(e(s,n,t))return s}}function Re(t,e,i){var n;return e=f.createCallback(e,i,3),Ue(t,function(t,i,r){return e(t,i,r)?(n=t,!1):d}),n}function Xe(t,e,i){var n=-1,r=t?t.length:0;if(e=e&&i===d?e:F(e,i,3),"number"==typeof r)for(;r>++n&&e(t[n],n,t)!==!1;);else sr(t,e);return t}function Ue(t,e,i){var n=t?t.length:0;if(e=e&&i===d?e:F(e,i,3),"number"==typeof n)for(;n--&&e(t[n],n,t)!==!1;);else{var r=Kn(t);n=r.length,sr(t,function(t,i,a){return i=r?r[--n]:--n,e(a[i],i,a)})}return t}function He(t,e){var i=Rn.call(arguments,2),n=-1,r="function"==typeof e,a=t?t.length:0,s=sn("number"==typeof a?a:0);return Xe(t,function(t){s[++n]=(r?e:t[e]).apply(t,i)}),s}function Fe(t,e,i){var n=-1,r=t?t.length:0;if(e=f.createCallback(e,i,3),"number"==typeof r)for(var a=sn(r);r>++n;)a[n]=e(t[n],n,t);else a=[],sr(t,function(t,i,r){a[++n]=e(t,i,r)});return a}function Je(t,e,i){var r=-1/0,a=r;if(!e&&Qn(t))for(var s=-1,o=t.length;o>++s;){var l=t[s];l>a&&(a=l)}else e=!e&&Se(t)?n:f.createCallback(e,i,3),Xe(t,function(t,i,n){var s=e(t,i,n);s>r&&(r=s,a=t)});return a}function Qe(t,e,i){var r=1/0,a=r;if(!e&&Qn(t))for(var s=-1,o=t.length;o>++s;){var l=t[s];a>l&&(a=l)}else e=!e&&Se(t)?n:f.createCallback(e,i,3),Xe(t,function(t,i,n){var s=e(t,i,n);r>s&&(r=s,a=t)});return a}function $e(t,e){var i=-1,n=t?t.length:0;if("number"==typeof n)for(var r=sn(n);n>++i;)r[i]=t[i][e];return r||Fe(t,e)}function Ke(t,e,i,n){if(!t)return i;var r=3>arguments.length;e=F(e,n,4);var a=-1,s=t.length;if("number"==typeof s)for(r&&(i=t[++a]);s>++a;)i=e(i,t[a],a,t);else sr(t,function(t,n,a){i=r?(r=!1,t):e(i,t,n,a)});return i}function qe(t,e,i,n){var r=3>arguments.length;return e=F(e,n,4),Ue(t,function(t,n,a){i=r?(r=!1,t):e(i,t,n,a)}),i}function ti(t,e,i){return e=f.createCallback(e,i,3),We(t,function(t,i,n){return!e(t,i,n)})}function ei(t,e,i){var n=t?t.length:0;if("number"!=typeof n&&(t=_e(t)),null==e||i)return t?t[Fi(n-1)]:d;var r=ii(t);return r.length=Yn(On(0,e),r.length),r}function ii(t){var e=-1,i=t?t.length:0,n=sn("number"==typeof i?i:0);return Xe(t,function(t){var i=Fi(++e);n[e]=n[i],n[i]=t}),n}function ni(t){var e=t?t.length:0;return"number"==typeof e?e:Kn(t).length}function ri(t,e,i){var n;e=f.createCallback(e,i,3);var r=-1,a=t?t.length:0;if("number"==typeof a)for(;a>++r&&!(n=e(t[r],r,t)););else sr(t,function(t,i,r){return!(n=e(t,i,r))});return!!n}function ai(t,e,i){var n=-1,a=t?t.length:0,s=sn("number"==typeof a?a:0);for(e=f.createCallback(e,i,3),Xe(t,function(t,i,r){var a=s[++n]=l();a.criteria=e(t,i,r),a.index=n,a.value=t}),a=s.length,s.sort(r);a--;){var o=s[a];s[a]=o.value,u(o)}return s}function si(t){return t&&"number"==typeof t.length?p(t):_e(t)}function oi(t){for(var e=-1,i=t?t.length:0,n=[];i>++e;){var r=t[e];r&&n.push(r)}return n}function li(i){var n=-1,r=se(),s=i?i.length:0,o=Q(arguments,!0,!0,1),l=[],c=s>=v&&r===t;if(c){var h=a(o);h?(r=e,o=h):c=!1}for(;s>++n;){var p=i[n];0>r(o,p)&&l.push(p)}return c&&u(o),l}function ci(t,e,i){var n=-1,r=t?t.length:0;for(e=f.createCallback(e,i,3);r>++n;)if(e(t[n],n,t))return n;return-1}function hi(t,e,i){var n=t?t.length:0;for(e=f.createCallback(e,i,3);n--;)if(e(t[n],n,t))return n;return-1}function ui(t,e,i){var n=0,r=t?t.length:0;if("number"!=typeof e&&null!=e){var a=-1;for(e=f.createCallback(e,i,3);r>++a&&e(t[a],a,t);)n++}else if(n=e,null==n||i)return t?t[0]:d;return p(t,0,Yn(On(0,n),r))}function pi(t,e,i,n){return"boolean"!=typeof e&&null!=e&&(n=i,i=n&&n[e]===t?null:e,e=!1),null!=i&&(t=Fe(t,i,n)),Q(t,e)}function gi(e,i,n){if("number"==typeof n){var r=e?e.length:0;n=0>n?On(0,r+n):n||0}else if(n){var a=Ai(e,i);return e[a]===i?a:-1}return t(e,i,n)}function di(t,e,i){var n=0,r=t?t.length:0;if("number"!=typeof e&&null!=e){var a=r;for(e=f.createCallback(e,i,3);a--&&e(t[a],a,t);)n++}else n=null==e||i?1:e||n;return p(t,0,Yn(On(0,r-n),r))}function fi(i){for(var n=arguments,r=n.length,s=-1,l=o(),c=-1,p=se(),g=i?i.length:0,d=[],f=o();r>++s;){var m=n[s];l[s]=p===t&&(m?m.length:0)>=v&&a(s?n[s]:f)}t:for(;g>++c;){var I=l[0];if(m=i[c],0>(I?e(I,m):p(f,m))){for(s=r,(I||f).push(m);--s;)if(I=l[s],0>(I?e(I,m):p(n[s],m)))continue t;d.push(m)}}for(;r--;)I=l[r],I&&u(I);return h(l),h(f),d}function mi(t,e,i){var n=0,r=t?t.length:0;if("number"!=typeof e&&null!=e){var a=r;for(e=f.createCallback(e,i,3);a--&&e(t[a],a,t);)n++}else if(n=e,null==n||i)return t?t[r-1]:d;return p(t,On(0,r-n))}function Ii(t,e,i){var n=t?t.length:0;for("number"==typeof i&&(n=(0>i?On(0,n+i):Yn(i,n-1))+1);n--;)if(t[n]===e)return n;return-1}function yi(t){for(var e=arguments,i=0,n=e.length,r=t?t.length:0;n>++i;)for(var a=-1,s=e[i];r>++a;)t[a]===s&&(zn.call(t,a--,1),r--);return t}function vi(t,e,i){t=+t||0,i="number"==typeof i?i:+i||1,null==e&&(e=t,t=0);for(var n=-1,r=On(0,Cn((e-t)/(i||1))),a=sn(r);r>++n;)a[n]=t,t+=i;return a}function Ci(t,e,i){var n=-1,r=t?t.length:0,a=[];for(e=f.createCallback(e,i,3);r>++n;){var s=t[n];e(s,n,t)&&(a.push(s),zn.call(t,n--,1),r--)}return a}function bi(t,e,i){if("number"!=typeof e&&null!=e){var n=0,r=-1,a=t?t.length:0;for(e=f.createCallback(e,i,3);a>++r&&e(t[r],r,t);)n++}else n=null==e||i?1:On(0,e);return p(t,n)}function Ai(t,e,i,n){var r=0,a=t?t.length:r;for(i=i?f.createCallback(i,n,1):Xi,e=i(e);a>r;){var s=r+a>>>1;e>i(t[s])?r=s+1:a=s}return r}function wi(){return ee(Q(arguments,!0,!0))}function xi(t,e,i,n){return"boolean"!=typeof e&&null!=e&&(n=i,i=n&&n[e]===t?null:e,e=!1),null!=i&&(i=f.createCallback(i,n,3)),ee(t,e,i)}function Mi(t){return li(t,Rn.call(arguments,1))}function ji(){for(var t=arguments.length>1?arguments:arguments[0],e=-1,i=t?Je($e(t,"length")):0,n=sn(0>i?0:i);i>++e;)n[e]=$e(t,e);return n}function Ni(t,e){for(var i=-1,n=t?t.length:0,r={};n>++i;){var a=t[i];e?r[a]=e[i]:a&&(r[a[0]]=a[1])}return r}function ki(t,e){if(!Me(e))throw new fn;return function(){return 1>--t?e.apply(this,arguments):d}}function Di(t,e){return arguments.length>2?ne(t,17,Rn.call(arguments,2),null,e):ne(t,1,null,null,e)}function zi(t){for(var e=arguments.length>1?Q(arguments,!0,!1,1):me(t),i=-1,n=e.length;n>++i;){var r=e[i];t[r]=ne(t[r],1,null,null,t)}return t}function Si(t,e){return arguments.length>2?ne(e,19,Rn.call(arguments,2),null,t):ne(e,3,null,null,t)}function Ti(){for(var t=arguments,e=t.length;e--;)if(!Me(t[e]))throw new fn;return function(){for(var e=arguments,i=t.length;i--;)e=[t[i].apply(this,e)];return e[0]}}function Ei(t,e,i){var n=typeof t;if(null==t||"function"==n)return F(t,e,i);if("object"!=n)return function(e){return e[t]};var r=Kn(t),a=r[0],s=t[a];return 1!=r.length||s!==s||je(s)?function(e){for(var i=r.length,n=!1;i--&&(n=$(e[r[i]],t[r[i]],null,!0)););return n}:function(t){var e=t[a];return s===e&&(0!==s||1/s==1/e)}}function Gi(t,e){return e="number"==typeof e?e:+e||t.length,ne(t,4,null,null,null,e)}function Li(t,e,i){var n,r,a,s,o,l,c,h=0,u=!1,p=!0;if(!Me(t))throw new fn;if(e=On(0,e)||0,i===!0){var g=!0;p=!1}else je(i)&&(g=i.leading,u="maxWait"in i&&(On(e,i.maxWait)||0),p="trailing"in i?i.trailing:p);var f=function(){var i=e-(jn()-s);if(0>=i){r&&bn(r);var u=c;r=l=c=d,u&&(h=jn(),a=t.apply(o,n))}else l=Dn(f,i)},m=function(){l&&bn(l),r=l=c=d,(p||u!==e)&&(h=jn(),a=t.apply(o,n))};return function(){if(n=arguments,s=jn(),o=this,c=p&&(l||!g),u===!1)var i=g&&!l;else{r||g||(h=s);var d=u-(s-h);0>=d?(r&&(r=bn(r)),h=s,a=t.apply(o,n)):r||(r=Dn(m,d))}return l||e===u||(l=Dn(f,e)),i&&(a=t.apply(o,n)),a}}function Bi(t){if(!Me(t))throw new fn;var e=Rn.call(arguments,1);return Dn(function(){t.apply(d,e)},1)}function Zi(t,e){if(!Me(t))throw new fn;var i=Rn.call(arguments,2);return Dn(function(){t.apply(d,i)},e)}function _i(t,e){if(!Me(t))throw new fn;var i=function(){var n=i.cache,r=e?e.apply(this,arguments):y+arguments[0];return Mn.call(n,r)?n[r]:n[r]=t.apply(this,arguments)};return i.cache={},i}function Pi(t){var e,i;if(!Me(t))throw new fn;return function(){return e?i:(e=!0,i=t.apply(this,arguments),t=null,i)}}function Oi(t){return ne(t,16,Rn.call(arguments,1))}function Yi(t){return ne(t,32,null,Rn.call(arguments,1))}function Wi(t,e,i){var n=!0,r=!0;if(!Me(t))throw new fn;i===!1?n=!1:je(i)&&(n="leading"in i?i.leading:n,r="trailing"in i?i.trailing:r),X.leading=n,X.maxWait=e,X.trailing=r;var a=Li(t,e,X);return a}function Vi(t,e){if(!Me(e))throw new fn;return function(){var i=[t];return Nn.apply(i,arguments),e.apply(this,i)}}function Ri(t){return null==t?"":dn(t).replace(ir,ae)}function Xi(t){return t}function Ui(t,e){var i=t,n=!e||Me(i);e||(i=m,e=t,t=f),Xe(me(e),function(r){var a=t[r]=e[r];n&&(i.prototype[r]=function(){var e=this.__wrapped__,n=[e];Nn.apply(n,arguments);var r=a.apply(t,n);return e&&"object"==typeof e&&e===r?this:(r=new i(r),r.__chain__=this.__chain__,r)})})}function Hi(){return i._=yn,this}function Fi(t,e,i){var n=null==t,r=null==e;null==i&&("boolean"==typeof t&&r?(i=t,t=1):r||"boolean"!=typeof e||(i=e,r=!0)),n&&r&&(e=1),t=+t||0,r?(e=t,t=0):e=+e||0;var a=Vn();return i||t%1||e%1?Yn(t+a*(e-t+parseFloat("1e-"+((a+"").length-1))),e):t+An(a*(e-t+1))}function Ji(t,e){if(t){var i=t[e];return Me(i)?t[e]():i}}function Qi(t,e,i){var n=f.templateSettings;t||(t=""),i=rr({},i,n);var r,a=rr({},i.imports,n.imports),o=Kn(a),l=_e(a),c=0,h=i.interpolate||z,u="__p += '",p=gn((i.escape||z).source+"|"+h.source+"|"+(h===k?M:z).source+"|"+(i.evaluate||z).source+"|$","g");t.replace(p,function(e,i,n,a,o,l){return n||(n=a),u+=t.slice(c,l).replace(T,s),i&&(u+="' +\n__e("+i+") +\n'"),o&&(r=!0,u+="';\n"+o+";\n__p += '"),n&&(u+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=l+e.length,e}),u+="';\n";var g=i.variable,m=g;m||(g="obj",u="with ("+g+") {\n"+u+"\n}\n"),u=(r?u.replace(A,""):u).replace(w,"$1").replace(x,"$1;"),u="function("+g+") {\n"+(m?"":g+" || ("+g+" = {});\n")+"var __t, __p = '', __e = _.escape"+(r?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+u+"return __p\n}";var I="\n/*\n//# sourceURL="+(i.sourceURL||"/lodash/template/source["+G++ +"]")+"\n*/";try{var y=cn(o,"return "+u+I).apply(d,l)}catch(v){throw v.source=u,v}return e?y(e):(y.source=u,y)}function $i(t,e,i){t=(t=+t)>-1?t:0;var n=-1,r=sn(t);for(e=F(e,i,1);t>++n;)r[n]=e(n);return r}function Ki(t){return null==t?"":dn(t).replace(er,le)}function qi(t){var e=++I;return dn(null==t?"":t)+e}function tn(t){return t=new m(t),t.__chain__=!0,t}function en(t,e){return e(t),t}function nn(){return this.__chain__=!0,this}function rn(){return dn(this.__wrapped__)}function an(){return this.__wrapped__}i=i?te.defaults(J.Object(),i,te.pick(J,E)):J;var sn=i.Array,on=i.Boolean,ln=i.Date,cn=i.Function,hn=i.Math,un=i.Number,pn=i.Object,gn=i.RegExp,dn=i.String,fn=i.TypeError,mn=[],In=pn.prototype,yn=i._,vn=gn("^"+dn(In.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Cn=hn.ceil,bn=i.clearTimeout,An=hn.floor,wn=cn.prototype.toString,xn=vn.test(xn=pn.getPrototypeOf)&&xn,Mn=In.hasOwnProperty,jn=vn.test(jn=ln.now)&&jn||function(){return+new ln},Nn=mn.push,kn=i.setImmediate,Dn=i.setTimeout,zn=mn.splice,Sn=In.toString,Tn=mn.unshift,En=function(){try{var t={},e=vn.test(e=pn.defineProperty)&&e,i=e(t,t,t)&&e}catch(n){}return i}(),Gn=vn.test(Gn=Sn.bind)&&Gn,Ln=vn.test(Ln=pn.create)&&Ln,Bn=vn.test(Bn=sn.isArray)&&Bn,Zn=i.isFinite,_n=i.isNaN,Pn=vn.test(Pn=pn.keys)&&Pn,On=hn.max,Yn=hn.min,Wn=i.parseInt,Vn=hn.random,Rn=mn.slice,Xn=vn.test(i.attachEvent),Un=Gn&&!/\n|true/.test(Gn+Xn),Hn={};Hn[B]=sn,Hn[Z]=on,Hn[_]=ln,Hn[P]=cn,Hn[Y]=pn,Hn[O]=un,Hn[W]=gn,Hn[V]=dn,m.prototype=f.prototype;var Fn=f.support={};Fn.fastBind=Gn&&!Un,Fn.funcDecomp=!vn.test(i.WinRTError)&&S.test(g),Fn.funcNames="string"==typeof cn.name,f.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:k,variable:"",imports:{_:f}},Ln||(re=function(t){if(je(t)){c.prototype=t;var e=new c;c.prototype=null}return e||{}});var Jn=En?function(t,e){U.value=e,En(t,"__bindData__",U)}:c,Qn=Bn||function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Sn.call(t)==B||!1},$n=function(t){var e,i=t,n=[];if(!i)return n;if(!H[typeof t])return n;for(e in i)Mn.call(i,e)&&n.push(e);return n},Kn=Pn?function(t){return je(t)?Pn(t):[]}:$n,qn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},tr=ye(qn),er=gn("("+Kn(tr).join("|")+")","g"),ir=gn("["+Kn(qn).join("")+"]","g"),nr=function(t,e,i){var n,r=t,a=r;if(!r)return a;var s=arguments,o=0,l="number"==typeof i?2:s.length;if(l>3&&"function"==typeof s[l-2])var c=F(s[--l-1],s[l--],2);else l>2&&"function"==typeof s[l-1]&&(c=s[--l]);for(;l>++o;)if(r=s[o],r&&H[typeof r])for(var h=-1,u=H[typeof r]&&Kn(r),p=u?u.length:0;p>++h;)n=u[h],a[n]=c?c(a[n],r[n]):r[n];return a},rr=function(t,e,i){var n,r=t,a=r;if(!r)return a;for(var s=arguments,o=0,l="number"==typeof i?2:s.length;l>++o;)if(r=s[o],r&&H[typeof r])for(var c=-1,h=H[typeof r]&&Kn(r),u=h?h.length:0;u>++c;)n=h[c],a[n]===d&&(a[n]=r[n]);return a},ar=function(t,e,i){var n,r=t,a=r;if(!r)return a;if(!H[typeof r])return a;e=e&&i===d?e:F(e,i,3);for(n in r)if(e(r[n],n,t)===!1)return a;return a},sr=function(t,e,i){var n,r=t,a=r;if(!r)return a;if(!H[typeof r])return a;e=e&&i===d?e:F(e,i,3);for(var s=-1,o=H[typeof r]&&Kn(r),l=o?o.length:0;l>++s;)if(n=o[s],e(r[n],n,t)===!1)return a;return a},or=function(t){if(!t||Sn.call(t)!=Y)return!1;var e=t.valueOf,i="function"==typeof e&&(i=xn(e))&&xn(i);return i?t==i||xn(t)==i:oe(t)},lr=ie(function(t,e,i){Mn.call(t,i)?t[i]++:t[i]=1}),cr=ie(function(t,e,i){(Mn.call(t,i)?t[i]:t[i]=[]).push(e)}),hr=ie(function(t,e,i){t[i]=e}),ur=We;Un&&K&&"function"==typeof kn&&(Bi=function(t){if(!Me(t))throw new fn;return kn.apply(i,arguments)});var pr=8==Wn(b+"08")?Wn:function(t,e){return Wn(Se(t)?t.replace(D,""):t,e||0)};return f.after=ki,f.assign=nr,f.at=Pe,f.bind=Di,f.bindAll=zi,f.bindKey=Si,f.chain=tn,f.compact=oi,f.compose=Ti,f.countBy=lr,f.createCallback=Ei,f.curry=Gi,f.debounce=Li,f.defaults=rr,f.defer=Bi,f.delay=Zi,f.difference=li,f.filter=We,f.flatten=pi,f.forEach=Xe,f.forEachRight=Ue,f.forIn=ar,f.forInRight=de,f.forOwn=sr,f.forOwnRight=fe,f.functions=me,f.groupBy=cr,f.indexBy=hr,f.initial=di,f.intersection=fi,f.invert=ye,f.invoke=He,f.keys=Kn,f.map=Fe,f.max=Je,f.memoize=_i,f.merge=Ee,f.min=Qe,f.omit=Ge,f.once=Pi,f.pairs=Le,f.partial=Oi,f.partialRight=Yi,f.pick=Be,f.pluck=$e,f.pull=yi,f.range=vi,f.reject=ti,f.remove=Ci,f.rest=bi,f.shuffle=ii,f.sortBy=ai,f.tap=en,f.throttle=Wi,f.times=$i,f.toArray=si,f.transform=Ze,f.union=wi,f.uniq=xi,f.values=_e,f.where=ur,f.without=Mi,f.wrap=Vi,f.zip=ji,f.zipObject=Ni,f.collect=Fe,f.drop=bi,f.each=Xe,f.eachRight=Ue,f.extend=nr,f.methods=me,f.object=Ni,f.select=We,f.tail=bi,f.unique=xi,f.unzip=ji,Ui(f),f.clone=he,f.cloneDeep=ue,f.contains=Oe,f.escape=Ri,f.every=Ye,f.find=Ve,f.findIndex=ci,f.findKey=pe,f.findLast=Re,f.findLastIndex=hi,f.findLastKey=ge,f.has=Ie,f.identity=Xi,f.indexOf=gi,f.isArguments=ce,f.isArray=Qn,f.isBoolean=ve,f.isDate=Ce,f.isElement=be,f.isEmpty=Ae,f.isEqual=we,f.isFinite=xe,f.isFunction=Me,f.isNaN=Ne,f.isNull=ke,f.isNumber=De,f.isObject=je,f.isPlainObject=or,f.isRegExp=ze,f.isString=Se,f.isUndefined=Te,f.lastIndexOf=Ii,f.mixin=Ui,f.noConflict=Hi,f.parseInt=pr,f.random=Fi,f.reduce=Ke,f.reduceRight=qe,f.result=Ji,f.runInContext=g,f.size=ni,f.some=ri,f.sortedIndex=Ai,f.template=Qi,f.unescape=Ki,f.uniqueId=qi,f.all=Ye,f.any=ri,f.detect=Ve,f.findWhere=Ve,f.foldl=Ke,f.foldr=qe,f.include=Oe,f.inject=Ke,sr(f,function(t,e){f.prototype[e]||(f.prototype[e]=function(){var e=[this.__wrapped__],i=this.__chain__;Nn.apply(e,arguments);var n=t.apply(f,e);return i?new m(n,i):n})}),f.first=ui,f.last=mi,f.sample=ei,f.take=ui,f.head=ui,sr(f,function(t,e){var i="sample"!==e;f.prototype[e]||(f.prototype[e]=function(e,n){var r=this.__chain__,a=t(this.__wrapped__,e,n);return r||null!=e&&(!n||i&&"function"==typeof e)?new m(a,r):a})}),f.VERSION="2.2.1",f.prototype.chain=nn,f.prototype.toString=rn,f.prototype.value=an,f.prototype.valueOf=an,Xe(["join","pop","shift"],function(t){var e=mn[t];f.prototype[t]=function(){var t=this.__chain__,i=e.apply(this.__wrapped__,arguments);return t?new m(i,t):i}}),Xe(["push","reverse","sort","unshift"],function(t){var e=mn[t];f.prototype[t]=function(){return e.apply(this.__wrapped__,arguments),this}}),Xe(["concat","slice","splice"],function(t){var e=mn[t];f.prototype[t]=function(){return new m(e.apply(this.__wrapped__,arguments),this.__chain__)}}),f}var d,f=[],m=[],I=0,y=+new Date+"",v=75,C=40,b="       \v\f \n\r\u2028\u2029 ᠎              ",A=/\b__p \+= '';/g,w=/\b(__p \+=) '' \+/g,x=/(__e\(.*?\)|\b__t\)) \+\n'';/g,M=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,j=/\w*$/,N=/^function[ \n\r\t]+\w/,k=/<%=([\s\S]+?)%>/g,D=RegExp("^["+b+"]*0+(?=.$)"),z=/($^)/,S=/\bthis\b/,T=/['\n\r\t\u2028\u2029\\]/g,E=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setImmediate","setTimeout"],G=0,L="[object Arguments]",B="[object Array]",Z="[object Boolean]",_="[object Date]",P="[object Function]",O="[object Number]",Y="[object Object]",W="[object RegExp]",V="[object String]",R={};R[P]=!1,R[L]=R[B]=R[Z]=R[_]=R[O]=R[Y]=R[W]=R[V]=!0;var X={leading:!1,maxWait:0,trailing:!1},U={configurable:!1,enumerable:!1,value:null,writable:!1},H={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},F={"\\":"\\","'":"'","\n":"n","\r":"r","        ":"t","\u2028":"u2028","\u2029":"u2029"},J=H[typeof window]&&window||this,Q=H[typeof exports]&&exports&&!exports.nodeType&&exports,$=H[typeof module]&&module&&!module.nodeType&&module,K=$&&$.exports===Q&&Q,q=H[typeof global]&&global;!q||q.global!==q&&q.window!==q||(J=q);var te=g();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(J._=te,define(function(){return te})):Q&&$?K?($.exports=te)._=te:Q._=te:J._=te}.call(this),function(){var t,e=this,i=e.Backbone,n=[],r=n.push,a=n.slice,s=n.splice;t="undefined"!=typeof exports?exports:e.Backbone={},t.VERSION="1.0.0";var o=e._;o||"undefined"==typeof require||(o=require("underscore")),t.$=e.jQuery||e.Zepto||e.ender||e.$,t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var l=t.Events={on:function(t,e,i){if(!h(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var n=this._events[t]||(this._events[t]=[]);return n.push({callback:e,context:i,ctx:i||this}),this},once:function(t,e,i){if(!h(this,"once",t,[e,i])||!e)return this;var n=this,r=o.once(function(){n.off(t,r),e.apply(this,arguments)});return r._callback=e,this.on(t,r,i)},off:function(t,e,i){var n,r,a,s,l,c,u,p;if(!this._events||!h(this,"off",t,[e,i]))return this;if(!t&&!e&&!i)return this._events={},this;for(s=t?[t]:o.keys(this._events),l=0,c=s.length;c>l;l++)if(t=s[l],a=this._events[t]){if(this._events[t]=n=[],e||i)for(u=0,p=a.length;p>u;u++)r=a[u],(e&&e!==r.callback&&e!==r.callback._callback||i&&i!==r.context)&&n.push(r);n.length||delete this._events[t]}return this},trigger:function(t){if(!this._events)return this;var e=a.call(arguments,1);if(!h(this,"trigger",t,e))return this;var i=this._events[t],n=this._events.all;return i&&u(i,e),n&&u(n,arguments),this},stopListening:function(t,e,i){var n=this._listeners;if(!n)return this;var r=!e&&!i;"object"==typeof e&&(i=this),t&&((n={})[t._listenerId]=t);for(var a in n)n[a].off(e,i,this),r&&delete this._listeners[a];return this}},c=/\s+/,h=function(t,e,i,n){if(!i)return!0;if("object"==typeof i){for(var r in i)t[e].apply(t,[r,i[r]].concat(n));return!1}if(c.test(i)){for(var a=i.split(c),s=0,o=a.length;o>s;s++)t[e].apply(t,[a[s]].concat(n));return!1}return!0},u=function(t,e){var i,n=-1,r=t.length,a=e[0],s=e[1],o=e[2];switch(e.length){case 0:for(;r>++n;)(i=t[n]).callback.call(i.ctx);return;case 1:for(;r>++n;)(i=t[n]).callback.call(i.ctx,a);return;case 2:for(;r>++n;)(i=t[n]).callback.call(i.ctx,a,s);return;case 3:for(;r>++n;)(i=t[n]).callback.call(i.ctx,a,s,o);return;default:for(;r>++n;)(i=t[n]).callback.apply(i.ctx,e)}},p={listenTo:"on",listenToOnce:"once"};o.each(p,function(t,e){l[e]=function(e,i,n){var r=this._listeners||(this._listeners={}),a=e._listenerId||(e._listenerId=o.uniqueId("l"));return r[a]=e,"object"==typeof i&&(n=this),e[t](i,n,this),this}}),l.bind=l.on,l.unbind=l.off,o.extend(t,l);var g=t.Model=function(t,e){var i,n=t||{};e||(e={}),this.cid=o.uniqueId("c"),this.attributes={},o.extend(this,o.pick(e,d)),e.parse&&(n=this.parse(n,e)||{}),(i=o.result(this,"defaults"))&&(n=o.defaults({},n,i)),this.set(n,e),this.changed={},this.initialize.apply(this,arguments)},d=["url","urlRoot","collection"];o.extend(g.prototype,l,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(){return o.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return o.escape(this.get(t))},has:function(t){return null!=this.get(t)},set:function(t,e,i){var n,r,a,s,l,c,h,u;if(null==t)return this;if("object"==typeof t?(r=t,i=e):(r={})[t]=e,i||(i={}),!this._validate(r,i))return!1;a=i.unset,l=i.silent,s=[],c=this._changing,this._changing=!0,c||(this._previousAttributes=o.clone(this.attributes),this.changed={}),u=this.attributes,h=this._previousAttributes,this.idAttribute in r&&(this.id=r[this.idAttribute]);for(n in r)e=r[n],o.isEqual(u[n],e)||s.push(n),o.isEqual(h[n],e)?delete this.changed[n]:this.changed[n]=e,a?delete u[n]:u[n]=e;if(!l){s.length&&(this._pending=!0);for(var p=0,g=s.length;g>p;p++)this.trigger("change:"+s[p],this,u[s[p]],i)}if(c)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(t,e){return this.set(t,void 0,o.extend({},e,{unset:!0}))},clear:function(t){var e={};for(var i in this.attributes)e[i]=void 0;return this.set(e,o.extend({},t,{unset:!0}))},hasChanged:function(t){return null==t?!o.isEmpty(this.changed):o.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?o.clone(this.changed):!1;var e,i=!1,n=this._changing?this._previousAttributes:this.attributes;for(var r in t)o.isEqual(n[r],e=t[r])||((i||(i={}))[r]=e);return i},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return o.clone(this._previousAttributes)},fetch:function(t){t=t?o.clone(t):{},void 0===t.parse&&(t.parse=!0);var e=this,i=t.success;return t.success=function(n){return e.set(e.parse(n,t),t)?(i&&i(e,n,t),e.trigger("sync",e,n,t),void 0):!1},Z(this,t),this.sync("read",this,t)},save:function(t,e,i){var n,r,a,s=this.attributes;if(null==t||"object"==typeof t?(n=t,i=e):(n={})[t]=e,!(!n||i&&i.wait||this.set(n,i)))return!1;if(i=o.extend({validate:!0},i),!this._validate(n,i))return!1;n&&i.wait&&(this.attributes=o.extend({},s,n)),void 0===i.parse&&(i.parse=!0);var l=this,c=i.success;return i.success=function(t){l.attributes=s;var e=l.parse(t,i);return i.wait&&(e=o.extend(n||{},e)),o.isObject(e)&&!l.set(e,i)?!1:(c&&c(l,t,i),l.trigger("sync",l,t,i),void 0)},Z(this,i),r=this.isNew()?"create":i.patch?"patch":"update","patch"===r&&(i.attrs=n),a=this.sync(r,this,i),n&&i.wait&&(this.attributes=s),a},destroy:function(t){t=t?o.clone(t):{};var e=this,i=t.success,n=function(){e.trigger("destroy",e,e.collection,t)};if(t.success=function(r){(t.wait||e.isNew())&&n(),i&&i(e,r,t),e.isNew()||e.trigger("sync",e,r,t)},this.isNew())return t.success(),!1;Z(this,t);var r=this.sync("delete",this,t);return t.wait||n(),r},url:function(){var t=o.result(this,"urlRoot")||o.result(this.collection,"url")||B();return this.isNew()?t:t+("/"===t.charAt(t.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(t){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(t){return this._validate({},o.extend(t||{},{validate:!0}))},_validate:function(t,e){if(!e.validate||!this.validate)return!0;t=o.extend({},this.attributes,t);var i=this.validationError=this.validate(t,e)||null;return i?(this.trigger("invalid",this,i,o.extend(e||{},{validationError:i})),!1):!0}});var f=["keys","values","pairs","invert","pick","omit"];o.each(f,function(t){g.prototype[t]=function(){var e=a.call(arguments);return e.unshift(this.attributes),o[t].apply(o,e)}});var m=t.Collection=function(t,e){e||(e={}),e.url&&(this.url=e.url),e.model&&(this.model=e.model),void 0!==e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,o.extend({silent:!0},e))},I={add:!0,remove:!0,merge:!0},y={add:!0,merge:!1,remove:!1};o.extend(m.prototype,l,{model:g,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return t.sync.apply(this,arguments)},add:function(t,e){return this.set(t,o.defaults(e||{},y))},remove:function(t,e){t=o.isArray(t)?t.slice():[t],e||(e={});var i,n,r,a;for(i=0,n=t.length;n>i;i++)a=this.get(t[i]),a&&(delete this._byId[a.id],delete this._byId[a.cid],r=this.indexOf(a),this.models.splice(r,1),this.length--,e.silent||(e.index=r,a.trigger("remove",a,this,e)),this._removeReference(a));return this},set:function(t,e){e=o.defaults(e||{},I),e.parse&&(t=this.parse(t,e)),o.isArray(t)||(t=t?[t]:[]);var i,n,a,l,c,h=e.at,u=this.comparator&&null==h&&e.sort!==!1,p=o.isString(this.comparator)?this.comparator:null,g=[],d=[],f={};for(i=0,n=t.length;n>i;i++)(a=this._prepareModel(t[i],e))&&((l=this.get(a))?(e.remove&&(f[l.cid]=!0),e.merge&&(l.set(a.attributes,e),u&&!c&&l.hasChanged(p)&&(c=!0))):e.add&&(g.push(a),a.on("all",this._onModelEvent,this),this._byId[a.cid]=a,null!=a.id&&(this._byId[a.id]=a)));if(e.remove){for(i=0,n=this.length;n>i;++i)f[(a=this.models[i]).cid]||d.push(a);d.length&&this.remove(d,e)}if(g.length&&(u&&(c=!0),this.length+=g.length,null!=h?s.apply(this.models,[h,0].concat(g)):r.apply(this.models,g)),c&&this.sort({silent:!0}),e.silent)return this;for(i=0,n=g.length;n>i;i++)(a=g[i]).trigger("add",a,this,e);return c&&this.trigger("sort",this,e),this},reset:function(t,e){e||(e={});for(var i=0,n=this.models.length;n>i;i++)this._removeReference(this.models[i]);return e.previousModels=this.models,this._reset(),this.add(t,o.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),this},push:function(t,e){return t=this._prepareModel(t,e),this.add(t,o.extend({at:this.length},e)),t},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t),e},unshift:function(t,e){return t=this._prepareModel(t,e),this.add(t,o.extend({at:0},e)),t},shift:function(t){var e=this.at(0);return this.remove(e,t),e},slice:function(t,e){return this.models.slice(t,e)},get:function(t){return null==t?void 0:this._byId[null!=t.id?t.id:t.cid||t]},at:function(t){return this.models[t]},where:function(t,e){return o.isEmpty(t)?e?void 0:[]:this[e?"find":"filter"](function(e){for(var i in t)if(t[i]!==e.get(i))return!1;return!0})},findWhere:function(t){return this.where(t,!0)
18 },sort:function(t){if(!this.comparator)throw Error("Cannot sort a set without a comparator");return t||(t={}),o.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(o.bind(this.comparator,this)),t.silent||this.trigger("sort",this,t),this},sortedIndex:function(t,e,i){e||(e=this.comparator);var n=o.isFunction(e)?e:function(t){return t.get(e)};return o.sortedIndex(this.models,t,n,i)},pluck:function(t){return o.invoke(this.models,"get",t)},fetch:function(t){t=t?o.clone(t):{},void 0===t.parse&&(t.parse=!0);var e=t.success,i=this;return t.success=function(n){var r=t.reset?"reset":"set";i[r](n,t),e&&e(i,n,t),i.trigger("sync",i,n,t)},Z(this,t),this.sync("read",this,t)},create:function(t,e){if(e=e?o.clone(e):{},!(t=this._prepareModel(t,e)))return!1;e.wait||this.add(t,e);var i=this,n=e.success;return e.success=function(r){e.wait&&i.add(t,e),n&&n(t,r,e)},t.save(null,e),t},parse:function(t){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(t instanceof g)return t.collection||(t.collection=this),t;e||(e={}),e.collection=this;var i=new this.model(t,e);return i._validate(t,e)?i:(this.trigger("invalid",this,t,e),!1)},_removeReference:function(t){this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,n){("add"!==t&&"remove"!==t||i===this)&&("destroy"===t&&this.remove(e,n),e&&t==="change:"+e.idAttribute&&(delete this._byId[e.previous(e.idAttribute)],null!=e.id&&(this._byId[e.id]=e)),this.trigger.apply(this,arguments))}});var v=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];o.each(v,function(t){m.prototype[t]=function(){var e=a.call(arguments);return e.unshift(this.models),o[t].apply(o,e)}});var C=["groupBy","countBy","sortBy"];o.each(C,function(t){m.prototype[t]=function(e,i){var n=o.isFunction(e)?e:function(t){return t.get(e)};return o[t](this.models,n,i)}});var b=t.View=function(t){this.cid=o.uniqueId("view"),this._configure(t||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},A=/^(\S+)\s*(.*)$/,w=["model","collection","el","id","attributes","className","tagName","events"];o.extend(b.prototype,l,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,i){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],i!==!1&&this.delegateEvents(),this},delegateEvents:function(t){if(!t&&!(t=o.result(this,"events")))return this;this.undelegateEvents();for(var e in t){var i=t[e];if(o.isFunction(i)||(i=this[t[e]]),i){var n=e.match(A),r=n[1],a=n[2];i=o.bind(i,this),r+=".delegateEvents"+this.cid,""===a?this.$el.on(r,i):this.$el.on(r,a,i)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(t){this.options&&(t=o.extend({},o.result(this,"options"),t)),o.extend(this,o.pick(t,w)),this.options=t},_ensureElement:function(){if(this.el)this.setElement(o.result(this,"el"),!1);else{var e=o.extend({},o.result(this,"attributes"));this.id&&(e.id=o.result(this,"id")),this.className&&(e["class"]=o.result(this,"className"));var i=t.$("<"+o.result(this,"tagName")+">").attr(e);this.setElement(i,!1)}}}),t.sync=function(e,i,n){var r=x[e];o.defaults(n||(n={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var a={type:r,dataType:"json"};if(n.url||(a.url=o.result(i,"url")||B()),null!=n.data||!i||"create"!==e&&"update"!==e&&"patch"!==e||(a.contentType="application/json",a.data=JSON.stringify(n.attrs||i.toJSON(n))),n.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),n.emulateHTTP&&("PUT"===r||"DELETE"===r||"PATCH"===r)){a.type="POST",n.emulateJSON&&(a.data._method=r);var s=n.beforeSend;n.beforeSend=function(t){return t.setRequestHeader("X-HTTP-Method-Override",r),s?s.apply(this,arguments):void 0}}"GET"===a.type||n.emulateJSON||(a.processData=!1),"PATCH"!==a.type||!window.ActiveXObject||window.external&&window.external.msActiveXFilteringEnabled||(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=n.xhr=t.ajax(o.extend(a,n));return i.trigger("request",i,l,n),l};var x={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var M=t.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},j=/\((.*?)\)/g,N=/(\(\?)?:\w+/g,k=/\*\w+/g,D=/[\-{}\[\]+?.,\\\^$|#\s]/g;o.extend(M.prototype,l,{initialize:function(){},route:function(e,i,n){o.isRegExp(e)||(e=this._routeToRegExp(e)),o.isFunction(i)&&(n=i,i=""),n||(n=this[i]);var r=this;return t.history.route(e,function(a){var s=r._extractParameters(e,a);n&&n.apply(r,s),r.trigger.apply(r,["route:"+i].concat(s)),r.trigger("route",i,s),t.history.trigger("route",r,i,s)}),this},navigate:function(e,i){return t.history.navigate(e,i),this},_bindRoutes:function(){if(this.routes){this.routes=o.result(this,"routes");for(var t,e=o.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(D,"\\$&").replace(j,"(?:$1)?").replace(N,function(t,e){return e?t:"([^/]+)"}).replace(k,"(.*?)"),RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return o.map(i,function(t){return t?decodeURIComponent(t):null})}});var z=t.History=function(){this.handlers=[],o.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},S=/^[#\/]|\s+$/g,T=/^\/+|\/+$/g,E=/msie [\w.]+/,G=/\/$/;z.started=!1,o.extend(z.prototype,l,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(null==t)if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(G,"");t.indexOf(i)||(t=t.substr(i.length))}else t=this.getHash();return t.replace(S,"")},start:function(e){if(z.started)throw Error("Backbone.history has already been started");z.started=!0,this.options=o.extend({},{root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var i=this.getFragment(),n=document.documentMode,r=E.exec(navigator.userAgent.toLowerCase())&&(!n||7>=n);this.root=("/"+this.root+"/").replace(T,"/"),r&&this._wantsHashChange&&(this.iframe=t.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(i)),this._hasPushState?t.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?t.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=i;var a=this.location,s=a.pathname.replace(/[^\/]$/,"$&/")===this.root;return this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!s?(this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0):(this._wantsPushState&&this._hasPushState&&s&&a.hash&&(this.fragment=this.getHash().replace(S,""),this.history.replaceState({},document.title,this.root+this.fragment+a.search)),this.options.silent?void 0:this.loadUrl())},stop:function(){t.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),z.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(){var t=this.getFragment();return t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe))),t===this.fragment?!1:(this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash()),void 0)},loadUrl:function(t){var e=this.fragment=this.getFragment(t),i=o.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0});return i},navigate:function(t,e){if(!z.started)return!1;if(e&&e!==!0||(e={trigger:e}),t=this.getFragment(t||""),this.fragment!==t){this.fragment=t;var i=this.root+t;if(this._hasPushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getFragment(this.getHash(this.iframe))&&(e.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,t,e.replace))}e.trigger&&this.loadUrl(t)}},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else t.hash="#"+e}}),t.history=new z;var L=function(t,e){var i,n=this;i=t&&o.has(t,"constructor")?t.constructor:function(){return n.apply(this,arguments)},o.extend(i,n,e);var r=function(){this.constructor=i};return r.prototype=n.prototype,i.prototype=new r,t&&o.extend(i.prototype,t),i.__super__=n.prototype,i};g.extend=m.extend=M.extend=b.extend=z.extend=L;var B=function(){throw Error('A "url" property or function must be specified')},Z=function(t,e){var i=e.error;e.error=function(n){i&&i(t,n,e),t.trigger("error",t,n,e)}}}.call(this),function(t,e){"function"==typeof define&&define.amd?define([],e):t.Vectorizer=t.V=e()}(this,function(){function t(){var t=++h+"";return"v-"+t}function e(t,e,n){if(!t)return void 0;if("object"==typeof t)return new s(t);if(e=e||{},"svg"===t.toLowerCase())e.xmlns=l.xmlns,e["xmlns:xlink"]=l.xlink,e.version=c;else if("<"===t[0]){var r='<svg xmlns="'+l.xmlns+'" xmlns:xlink="'+l.xlink+'" version="'+c+'">'+t+"</svg>",a=new DOMParser;a.async=!1;var o=a.parseFromString(r,"text/xml").documentElement;if(o.childNodes.length>1){for(var h=[],u=0,p=o.childNodes.length;p>u;u++){var g=o.childNodes[u];h.push(new s(document.importNode(g,!0)))}return h}return new s(document.importNode(o.firstChild,!0))}t=document.createElementNS(l.xmlns,t);for(var d in e)i(t,d,e[d]);"[object Array]"!=Object.prototype.toString.call(n)&&(n=[n]);for(var f,u=0,p=n[0]&&n.length||0;p>u;u++)f=n[u],t.appendChild(f instanceof s?f.node:f);return new s(t)}function i(t,e,i){if(e.indexOf(":")>-1){var n=e.split(":");t.setAttributeNS(l[n[0]],n[1],i)}else"id"===e?t.id=i:t.setAttribute(e,i)}function n(t){var e,i,n;if(t){var r=t.match(/translate\((.*)\)/);r&&(e=r[1].split(","));var a=t.match(/rotate\((.*)\)/);a&&(i=a[1].split(","));var s=t.match(/scale\((.*)\)/);s&&(n=s[1].split(","))}var o=n&&n[0]?parseFloat(n[0]):1;return{translate:{tx:e&&e[0]?parseInt(e[0],10):0,ty:e&&e[1]?parseInt(e[1],10):0},rotate:{angle:i&&i[0]?parseInt(i[0],10):0,cx:i&&i[1]?parseInt(i[1],10):void 0,cy:i&&i[2]?parseInt(i[2],10):void 0},scale:{sx:o,sy:n&&n[1]?parseFloat(n[1]):o}}}function r(t,e){var i=e.x*t.a+e.y*t.c+0,n=e.x*t.b+e.y*t.d+0;return{x:i,y:n}}function a(t){var e=r(t,{x:0,y:1}),i=r(t,{x:1,y:0}),n=180/Math.PI*Math.atan2(e.y,e.x)-90,a=180/Math.PI*Math.atan2(i.y,i.x);return{translateX:t.e,translateY:t.f,scaleX:Math.sqrt(t.a*t.a+t.b*t.b),scaleY:Math.sqrt(t.c*t.c+t.d*t.d),skewX:n,skewY:a,rotation:n}}function s(e){this.node=e,this.node.id||(this.node.id=t())}function o(t){var e=t.rx||t["top-rx"]||0,i=t.rx||t["bottom-rx"]||0,n=t.ry||t["top-ry"]||0,r=t.ry||t["bottom-ry"]||0;return["M",t.x,t.y+n,"v",t.height-n-r,"a",i,r,0,0,0,i,r,"h",t.width-2*i,"a",i,r,0,0,0,i,-r,"v",-(t.height-r-n),"a",e,n,0,0,0,-e,-n,"h",-(t.width-2*e),"a",e,n,0,0,0,-e,n].join(" ")}!(!window.SVGAngle&&!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"));var l={xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"},c="1.1",h=0;s.prototype={translate:function(t,e){e=e||0;var i=this.attr("transform")||"",r=n(i);if(t===void 0)return r.translate;i=i.replace(/translate\([^\)]*\)/g,"").trim();var a=r.translate.tx+t,s=r.translate.ty+e,j="translate("+a+","+s+")";return this.attr("transform",(j+" "+i).trim()),this},rotate:function(t,e,i){var r=this.attr("transform")||"",a=n(r);if(t===void 0)return a.rotate;r=r.replace(/rotate\([^\)]*\)/g,"").trim();var s=a.rotate.angle+t%360,o=void 0!==e&&void 0!==i?","+e+","+i:"";return this.attr("transform",r+" rotate("+s+o+")"),this},scale:function(t,e){e=e===void 0?t:e;var i=this.attr("transform")||"",r=n(i);return t===void 0?r.scale:(i=i.replace(/scale\([^\)]*\)/g,"").trim(),this.attr("transform",i+" scale("+t+","+e+")"),this)},bbox:function(t,e){if(!this.node.ownerSVGElement)return{x:0,y:0,width:0,height:0};var i;try{i=this.node.getBBox(),i={x:0|i.x,y:0|i.y,width:0|i.width,height:0|i.height}}catch(n){i={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}if(t)return i;var r=this.node.getTransformToElement(e||this.node.ownerSVGElement),a=[],s=this.node.ownerSVGElement.createSVGPoint();s.x=i.x,s.y=i.y,a.push(s.matrixTransform(r)),s.x=i.x+i.width,s.y=i.y,a.push(s.matrixTransform(r)),s.x=i.x+i.width,s.y=i.y+i.height,a.push(s.matrixTransform(r)),s.x=i.x,s.y=i.y+i.height,a.push(s.matrixTransform(r));for(var o=a[0].x,l=o,c=a[0].y,h=c,u=1,p=a.length;p>u;u++){var g=a[u].x,d=a[u].y;o>g?o=g:g>l&&(l=g),c>d?c=d:d>h&&(h=d)}return{x:o,y:c,width:l-o,height:h-c}},text:function(t){var e,i=t.split("\n"),n=0;if(this.attr("y","0.8em"),this.attr("display",t?null:"none"),1===i.length)return this.node.textContent=t,this;for(this.node.textContent="";i.length>n;n++)e=u("tspan",{dy:0==n?"0em":"1em",x:this.attr("x")||0}),e.node.textContent=i[n],this.append(e);return this},attr:function(t,e){if("string"==typeof t&&e===void 0)return this.node.getAttribute(t);if("object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&i(this.node,n,t[n]);else i(this.node,t,e);return this},remove:function(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)},append:function(t){var e=t;"[object Array]"!==Object.prototype.toString.call(t)&&(e=[t]);for(var i=0,n=e.length;n>i;i++)t=e[i],this.node.appendChild(t instanceof s?t.node:t);return this},prepend:function(t){this.node.insertBefore(t instanceof s?t.node:t,this.node.firstChild)},svg:function(){return this.node instanceof window.SVGSVGElement?this:u(this.node.ownerSVGElement)},defs:function(){var t=this.svg().node.getElementsByTagName("defs");return t&&t.length?u(t[0]):void 0},clone:function(){var e=u(this.node.cloneNode(!0));return e.node.id=t(),e},findOne:function(t){var e=this.node.querySelector(t);return e?u(e):void 0},find:function(t){for(var e=this.node.querySelectorAll(t),i=0,n=e.length;n>i;i++)e[i]=u(e[i]);return e},toLocalPoint:function(t,e){var i=this.svg().node,n=i.createSVGPoint();n.x=t,n.y=e;try{var r=n.matrixTransform(i.getScreenCTM().inverse()),a=this.node.getTransformToElement(i).inverse()}catch(s){return n}return r.matrixTransform(a)},translateCenterToPoint:function(t){var e=this.bbox(),i=g.rect(e).center();this.translate(t.x-i.x,t.y-i.y)},translateAndAutoOrient:function(t,e,i){var n=this.scale();this.attr("transform",""),this.scale(n.sx,n.sy);var r=this.svg().node,s=this.bbox(!1,i),o=r.createSVGTransform();o.setTranslate(-s.x-s.width/2,-s.y-s.height/2);var l=r.createSVGTransform(),c=g.point(t).changeInAngle(t.x-e.x,t.y-e.y,e);l.setRotate(c,0,0);var h=r.createSVGTransform(),u=g.point(t).move(e,s.width/2);h.setTranslate(t.x+(t.x-u.x),t.y+(t.y-u.y));var p=this.node.getTransformToElement(i),d=r.createSVGTransform();d.setMatrix(h.matrix.multiply(l.matrix.multiply(o.matrix.multiply(p))));var f=a(d.matrix);return this.translate(f.translateX,f.translateY),this.rotate(f.rotation),this},animateAlongPath:function(t,e){var i=u("animateMotion",t),n=u("mpath",{"xlink:href":"#"+u(e).node.id});i.append(n),this.append(i);try{i.node.beginElement()}catch(r){if("fake"===document.documentElement.getAttribute("smiling")){var a=i.node;a.animators=[];var s=a.getAttribute("id");s&&(id2anim[s]=a);for(var o=getTargets(a),l=0,c=o.length;c>l;l++){var h=o[l],p=new Animator(a,h,l);animators.push(p),a.animators[l]=p,p.register()}}}},hasClass:function(t){return RegExp("(\\s|^)"+t+"(\\s|$)").test(this.node.getAttribute("class"))},addClass:function(t){return this.hasClass(t)||this.node.setAttribute("class",this.node.getAttribute("class")+" "+t),this},removeClass:function(t){var e=this.node.getAttribute("class").replace(RegExp("(\\s|^)"+t+"(\\s|$)","g"),"$2");return this.hasClass(t)&&this.node.setAttribute("class",e),this},toggleClass:function(t,e){var i=e===void 0?this.hasClass(t):!e;return i?this.removeClass(t):this.addClass(t),this}};var u=e;u.decomposeMatrix=a,u.rectToPath=o;var p=u("svg").node;return u.createSVGMatrix=function(t){var e=p.createSVGMatrix();for(var i in t)e[i]=t[i];return e},u.createSVGTransform=function(){return p.createSVGTransform()},u.createSVGPoint=function(t,e){var i=p.createSVGPoint();return i.x=t,i.y=e,i},u}),function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.g=e()}(this,function(){function t(e,i){if(!(this instanceof t))return new t(e,i);var n;void 0===i&&Object(e)!==e?(n=e.split(-1===e.indexOf("@")?" ":"@"),this.x=parseInt(n[0],10),this.y=parseInt(n[1],10)):Object(e)===e?(this.x=e.x,this.y=e.y):(this.x=e,this.y=i)}function e(i,n){return this instanceof e?(this.start=t(i),this.end=t(n),void 0):new e(i,n)}function i(t,e,n,r){return this instanceof i?(void 0===e&&(e=t.y,n=t.width,r=t.height,t=t.x),this.x=t,this.y=e,this.width=n,this.height=r,void 0):new i(t,e,n,r)}function n(e,i,r){return this instanceof n?(e=t(e),this.x=e.x,this.y=e.y,this.a=i,this.b=r,void 0):new n(e,i,r)}var r=Math,a=r.abs,s=r.cos,o=r.sin,l=r.sqrt,c=r.min,h=r.max;r.atan;var u=r.atan2;r.acos;var p=r.round,g=r.floor,d=r.PI,f=r.random,m=function(t){return 180*t/d%360},I=function(t){return t%360*d/180},y=function(t,e){return e*Math.round(t/e)},v=function(t){return t%360+(0>t?360:0)};t.prototype={toString:function(){return this.x+"@"+this.y},adhereToRect:function(t){return t.containsPoint(this)?this:(this.x=c(h(this.x,t.x),t.x+t.width),this.y=c(h(this.y,t.y),t.y+t.height),this)},theta:function(e){e=t(e);var i=-(e.y-this.y),n=e.x-this.x,r=10,a=0==i.toFixed(r)&&0==n.toFixed(r)?0:u(i,n);return 0>a&&(a=2*d+a),180*a/d},distance:function(t){return e(this,t).length()},manhattanDistance:function(t){return a(t.x-this.x)+a(t.y-this.y)},offset:function(t,e){return this.x+=t||0,this.y+=e||0,this},magnitude:function(){return l(this.x*this.x+this.y*this.y)||.01},update:function(t,e){return this.x=t||0,this.y=e||0,this},round:function(t){return this.x=t?this.x.toFixed(t):p(this.x),this.y=t?this.y.toFixed(t):p(this.y),this},normalize:function(t){var e=(t||1)/this.magnitude();return this.x=e*this.x,this.y=e*this.y,this},difference:function(e){return t(this.x-e.x,this.y-e.y)},bearing:function(t){return e(this,t).bearing()},toPolar:function(e){e=e&&t(e)||t(0,0);var i=this.x,n=this.y;return this.x=l((i-e.x)*(i-e.x)+(n-e.y)*(n-e.y)),this.y=I(e.theta(t(i,n))),this},rotate:function(e,i){i=(i+360)%360,this.toPolar(e),this.y+=I(i);var n=t.fromPolar(this.x,this.y,e);return this.x=n.x,this.y=n.y,this},move:function(e,i){var n=I(t(e).theta(this));return this.offset(s(n)*i,-o(n)*i)},changeInAngle:function(e,i,n){return t(this).offset(-e,-i).theta(n)-this.theta(n)},equals:function(t){return this.x===t.x&&this.y===t.y},snapToGrid:function(t,e){return this.x=y(this.x,t),this.y=y(this.y,e||t),this}},t.fromPolar=function(e,i,n){n=n&&t(n)||t(0,0);var r=a(e*s(i)),l=a(e*o(i)),c=v(m(i));return 90>c?l=-l:180>c?(r=-r,l=-l):270>c&&(r=-r),t(n.x+r,n.y+l)},t.random=function(e,i,n,r){return t(g(f()*(i-e+1)+e),g(f()*(r-n+1)+n))},e.prototype={toString:function(){return""+this.start+" "+(""+this.end)},length:function(){return l(this.squaredLength())},squaredLength:function(){var t=this.start.x,e=this.start.y,i=this.end.x,n=this.end.y;return(t-=i)*t+(e-=n)*e},midpoint:function(){return t((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)},intersection:function(e){var i=t(this.end.x-this.start.x,this.end.y-this.start.y),n=t(e.end.x-e.start.x,e.end.y-e.start.y),r=i.x*n.y-i.y*n.x,a=t(e.start.x-this.start.x,e.start.y-this.start.y),s=a.x*n.y-a.y*n.x,o=a.x*i.y-a.y*i.x;if(0===r||0>s*r||0>o*r)return null;if(r>0){if(s>r||o>r)return null}else if(r>s||r>o)return null;return t(this.start.x+s*i.x/r,this.start.y+s*i.y/r)},bearing:function(){var t=I(this.start.y),e=I(this.end.y),i=this.start.x,n=this.end.x,r=I(n-i),a=o(r)*s(e),l=s(t)*o(e)-o(t)*s(e)*s(r),c=m(u(a,l)),h=["NE","E","SE","S","SW","W","NW","N"],p=c-22.5;return 0>p&&(p+=360),p=parseInt(p/45),h[p]}},i.prototype={toString:function(){return""+this.origin()+" "+(""+this.corner())},origin:function(){return t(this.x,this.y)},corner:function(){return t(this.x+this.width,this.y+this.height)},topRight:function(){return t(this.x+this.width,this.y)},bottomLeft:function(){return t(this.x,this.y+this.height)},center:function(){return t(this.x+this.width/2,this.y+this.height/2)},intersect:function(t){var e=this.origin(),i=this.corner(),n=t.origin(),r=t.corner();return r.x<=e.x||r.y<=e.y||n.x>=i.x||n.y>=i.y?!1:!0},sideNearestToPoint:function(e){e=t(e);var i=e.x-this.x,n=this.x+this.width-e.x,r=e.y-this.y,a=this.y+this.height-e.y,s=i,o="left";return s>n&&(s=n,o="right"),s>r&&(s=r,o="top"),s>a&&(s=a,o="bottom"),o},containsPoint:function(e){return e=t(e),e.x>=this.x&&e.x<=this.x+this.width&&e.y>=this.y&&e.y<=this.y+this.height?!0:!1},containsRect:function(t){var e=i(t).normalize(),n=e.width,r=e.height,a=e.x,s=e.y,o=this.width,l=this.height;if(0>(o|l|n|r))return!1;var c=this.x,h=this.y;if(c>a||h>s)return!1;if(o+=c,n+=a,a>=n){if(o>=c||n>o)return!1}else if(o>=c&&n>o)return!1;if(l+=h,r+=s,s>=r){if(l>=h||r>l)return!1}else if(l>=h&&r>l)return!1;return!0},pointNearestToPoint:function(e){if(e=t(e),this.containsPoint(e)){var i=this.sideNearestToPoint(e);switch(i){case"right":return t(this.x+this.width,e.y);case"left":return t(this.x,e.y);case"bottom":return t(e.x,this.y+this.height);case"top":return t(e.x,this.y)}}return e.adhereToRect(this)},intersectionWithLineFromCenterToPoint:function(i,n){i=t(i);var r,a=t(this.x+this.width/2,this.y+this.height/2);n&&i.rotate(a,n);for(var s=[e(this.origin(),this.topRight()),e(this.topRight(),this.corner()),e(this.corner(),this.bottomLeft()),e(this.bottomLeft(),this.origin())],o=e(a,i),l=s.length-1;l>=0;--l){var c=s[l].intersection(o);if(null!==c){r=c;break}}return r&&n&&r.rotate(a,-n),r},moveAndExpand:function(t){return this.x+=t.x,this.y+=t.y,this.width+=t.width,this.height+=t.height,this},round:function(t){return this.x=t?this.x.toFixed(t):p(this.x),this.y=t?this.y.toFixed(t):p(this.y),this.width=t?this.width.toFixed(t):p(this.width),this.height=t?this.height.toFixed(t):p(this.height),this},normalize:function(){var t=this.x,e=this.y,i=this.width,n=this.height;return 0>this.width&&(t=this.x+this.width,i=-this.width),0>this.height&&(e=this.y+this.height,n=-this.height),this.x=t,this.y=e,this.width=i,this.height=n,this}},n.prototype={toString:function(){return""+t(this.x,this.y)+" "+this.a+" "+this.b},bbox:function(){return i(this.x-this.a,this.y-this.b,2*this.a,2*this.b)},intersectionWithLineFromCenterToPoint:function(e,i){e=t(e),i&&e.rotate(t(this.x,this.y),i);var n,r=e.x-this.x,a=e.y-this.y;if(0===r)return n=this.bbox().pointNearestToPoint(e),i?n.rotate(t(this.x,this.y),-i):n;var s=a/r,o=s*s,c=this.a*this.a,h=this.b*this.b,u=l(1/(1/c+o/h));u=0>r?-u:u;var p=s*u;return n=t(this.x+u,this.y+p),i?n.rotate(t(this.x,this.y),-i):n}};var C={curveThroughPoints:function(t){for(var e=this.getCurveControlPoints(t),i=["M",t[0].x,t[0].y],n=0;e[0].length>n;n++)i.push("C",e[0][n].x,e[0][n].y,e[1][n].x,e[1][n].y,t[n+1].x,t[n+1].y);return i},getCurveControlPoints:function(e){var i,n=[],r=[],a=e.length-1;if(1==a)return n[0]=t((2*e[0].x+e[1].x)/3,(2*e[0].y+e[1].y)/3),r[0]=t(2*n[0].x-e[0].x,2*n[0].y-e[0].y),[n,r];var s=[];for(i=1;a-1>i;i++)s[i]=4*e[i].x+2*e[i+1].x;s[0]=e[0].x+2*e[1].x,s[a-1]=(8*e[a-1].x+e[a].x)/2;var o=this.getFirstControlPoints(s);for(i=1;a-1>i;++i)s[i]=4*e[i].y+2*e[i+1].y;s[0]=e[0].y+2*e[1].y,s[a-1]=(8*e[a-1].y+e[a].y)/2;var l=this.getFirstControlPoints(s);for(i=0;a>i;i++)n.push(t(o[i],l[i])),a-1>i?r.push(t(2*e[i+1].x-o[i+1],2*e[i+1].y-l[i+1])):r.push(t((e[a].x+o[a-1])/2,(e[a].y+l[a-1])/2));return[n,r]},getFirstControlPoints:function(t){var e=t.length,i=[],n=[],r=2;i[0]=t[0]/r;for(var a=1;e>a;a++)n[a]=1/r,r=(e-1>a?4:3.5)-n[a],i[a]=(t[a]-i[a-1])/r;for(a=1;e>a;a++)i[e-a-1]-=n[e-a]*i[e-a];return i}},b={linear:function(t,e,i){var n=t[1]-t[0],r=e[1]-e[0];return(i-t[0])/n*r+e[0]||0}};return{toDeg:m,toRad:I,snapToGrid:y,normalizeAngle:v,point:t,line:e,rect:i,ellipse:n,bezier:C,scale:b}}),"object"==typeof exports)var _=require("lodash");var joint={dia:{},ui:{},layout:{},shapes:{},format:{},connectors:{},routers:{},util:{hashCode:function(t){var e=0;if(0==t.length)return e;for(var i=0;t.length>i;i++){var n=t.charCodeAt(i);e=(e<<5)-e+n,e&=e}return e},getByPath:function(t,e,i){i=i||".";for(var n,r=e.split(i);r.length;){if(n=r.shift(),!(n in t))return void 0;t=t[n]}return t},setByPath:function(t,e,i,n){n=n||".";var r=e.split(n),a=t,s=0;if(e.indexOf(n)>-1){for(var o=r.length;o-1>s;s++)a=a[r[s]]||(a[r[s]]={});a[r[o-1]]=i}else t[e]=i;return t},unsetByPath:function(t,e,i){i=i||".";var n=e.lastIndexOf(i);if(n>-1){var r=joint.util.getByPath(t,e.substr(0,n),i);r&&delete r[e.slice(n+1)]}else delete t[e];return t},flattenObject:function(t,e,i){e=e||".";var n={};for(var r in t)if(t.hasOwnProperty(r)){var a="object"==typeof t[r];if(a&&i&&i(t[r])&&(a=!1),a){var s=this.flattenObject(t[r],e,i);for(var o in s)s.hasOwnProperty(o)&&(n[r+e+o]=s[o])}else n[r]=t[r]}return n},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=0|16*Math.random(),i="x"==t?e:8|3&e;return i.toString(16)})},guid:function(t){return this.guid.id=this.guid.id||1,t.id=void 0===t.id?"j_"+this.guid.id++:t.id,t.id},mixin:function(){for(var t=arguments[0],e=1,i=arguments.length;i>e;e++){var n=arguments[e];(Object(n)===n||_.isFunction(n)||null!==n&&void 0!==n)&&_.each(n,function(e,i){return this.mixin.deep&&Object(e)===e?(t[i]||(t[i]=_.isArray(e)?[]:{}),this.mixin(t[i],e),void 0):(t[i]!==e&&(this.mixin.supplement&&t.hasOwnProperty(i)||(t[i]=e)),void 0)},this)}return t},supplement:function(){this.mixin.supplement=!0;var t=this.mixin.apply(this,arguments);return this.mixin.supplement=!1,t},deepMixin:function(){this.mixin.deep=!0;var t=this.mixin.apply(this,arguments);return this.mixin.deep=!1,t},deepSupplement:function(){this.mixin.deep=this.mixin.supplement=!0;var t=this.mixin.apply(this,arguments);return this.mixin.deep=this.mixin.supplement=!1,t},normalizeEvent:function(t){return t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches.length?t.originalEvent.changedTouches[0]:t},nextFrame:function(){var t,e="undefined"!=typeof window;if(e&&(t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame),!t){var i=0;t=function(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-i)),r=setTimeout(function(){t(e+n)},n);return i=e+n,r}}return e?_.bind(t,window):t}(),cancelFrame:function(){var t,e="undefined"!=typeof window;return e&&(t=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame||window.oCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.mozCancelRequestAnimationFrame),t=t||clearTimeout,e?_.bind(t,window):t}(),breakText:function(t,e,i,n){n=n||{};var r=e.width,a=e.height,s=n.svgDocument||V("svg").node,o=V("<text><tspan></tspan></text>").attr(i||{}).node,l=o.firstChild,c=document.createTextNode("");l.appendChild(c),s.appendChild(o),n.svgDocument||document.body.appendChild(s);for(var h,u=t.split(" "),p=[],g=[],d=0,f=0,m=u.length;m>d;d++){var I=u[d];if(c.data=g[f]?g[f]+" "+I:I,r>=l.getComputedTextLength())g[f]=c.data,h&&(p[f++]=!0,h=0);else{if(!g[f]||h){var y=!!h;if(h=I.length-1,y||!h){if(!h){if(!g[f]){g=[];break}u.splice(d,2,I+u[d+1]),m--,p[f++]=!0,d--;continue}u[d]=I.substring(0,h),u[d+1]=I.substring(h)+u[d+1]}else u.splice(d,1,I.substring(0,h),I.substring(h)),m++,f&&!p[f-1]&&f--;d--;continue}f++,d--}if(a!==void 0){var v=v||1.25*o.getBBox().height;if(v*g.length>a){g.splice(Math.floor(a/v));break}}}return n.svgDocument?s.removeChild(o):document.body.removeChild(s),g.join("\n")},timing:{linear:function(t){return t},quad:function(t){return t*t},cubic:function(t){return t*t*t},inout:function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,i=e*t;return 4*(.5>t?i:3*(t-e)+i-.75)},exponential:function(t){return Math.pow(2,10*(t-1))},bounce:function(t){for(var e=0,i=1;1;e+=i,i/=2)if(t>=(7-4*e)/11){var n=(11-6*e-11*t)/4;return-n*n+i*i}},reverse:function(t){return function(e){return 1-t(1-e)}},reflect:function(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}},clamp:function(t,e,i){return e=e||0,i=i||1,function(n){var r=t(n);return e>r?e:r>i?i:r}},back:function(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}},elastic:function(t){return t||(t=1.5),function(e){return Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*t/3*e)}}},interpolate:{number:function(t,e){var i=e-t;return function(e){return t+i*e}},object:function(t,e){var i=_.keys(t);return function(n){var r,a,s={};for(r=i.length-1;-1!=r;r--)a=i[r],s[a]=t[a]+(e[a]-t[a])*n;return s}},hexColor:function(t,e){var i=parseInt(t.slice(1),16),n=parseInt(e.slice(1),16),r=255&i,a=(255&n)-r,s=65280&i,o=(65280&n)-s,l=16711680&i,c=(16711680&n)-l;return function(t){var e=255&r+a*t,i=65280&s+o*t,n=16711680&l+c*t;return"#"+(1<<24|e|i|n).toString(16).slice(1)}},unit:function(t,e){var i=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,n=i.exec(t),r=i.exec(e),a=r[1].indexOf("."),s=a>0?r[1].length-a-1:0,t=+n[1],o=+r[1]-t,l=n[2];return function(e){return(t+o*e).toFixed(s)+l}}},filter:{blur:function(t){var e=_.isFinite(t.x)?t.x:2;return _.template('<filter><feGaussianBlur stdDeviation="${stdDeviation}"/></filter>',{stdDeviation:_.isFinite(t.y)?[e,t.y]:e})},dropShadow:function(t){var e="SVGFEDropShadowElement"in window?'<filter><feDropShadow stdDeviation="${blur}" dx="${dx}" dy="${dy}" flood-color="${color}" flood-opacity="${opacity}"/></filter>':'<filter><feGaussianBlur in="SourceAlpha" stdDeviation="${blur}"/><feOffset dx="${dx}" dy="${dy}" result="offsetblur"/><feFlood flood-color="${color}"/><feComposite in2="offsetblur" operator="in"/><feComponentTransfer><feFuncA type="linear" slope="${opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';return _.template(e,{dx:t.dx||0,dy:t.dy||0,opacity:_.isFinite(t.opacity)?t.opacity:1,color:t.color||"black",blur:_.isFinite(t.blur)?t.blur:4})},grayscale:function(t){var e=_.isFinite(t.amount)?t.amount:1;return _.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${b} ${h} 0 0 0 0 0 1 0"/></filter>',{a:.2126+.7874*(1-e),b:.7152-.7152*(1-e),c:.0722-.0722*(1-e),d:.2126-.2126*(1-e),e:.7152+.2848*(1-e),f:.0722-.0722*(1-e),g:.2126-.2126*(1-e),h:.0722+.9278*(1-e)})},sepia:function(t){var e=_.isFinite(t.amount)?t.amount:1;return _.template('<filter><feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${h} ${i} 0 0 0 0 0 1 0"/></filter>',{a:.393+.607*(1-e),b:.769-.769*(1-e),c:.189-.189*(1-e),d:.349-.349*(1-e),e:.686+.314*(1-e),f:.168-.168*(1-e),g:.272-.272*(1-e),h:.534-.534*(1-e),i:.131+.869*(1-e)})},saturate:function(t){var e=_.isFinite(t.amount)?t.amount:1;return _.template('<filter><feColorMatrix type="saturate" values="${amount}"/></filter>',{amount:1-e})},hueRotate:function(t){return _.template('<filter><feColorMatrix type="hueRotate" values="${angle}"/></filter>',{angle:t.angle||0})
19 },invert:function(t){var e=_.isFinite(t.amount)?t.amount:1;return _.template('<filter><feComponentTransfer><feFuncR type="table" tableValues="${amount} ${amount2}"/><feFuncG type="table" tableValues="${amount} ${amount2}"/><feFuncB type="table" tableValues="${amount} ${amount2}"/></feComponentTransfer></filter>',{amount:e,amount2:1-e})},brightness:function(t){return _.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}"/><feFuncG type="linear" slope="${amount}"/><feFuncB type="linear" slope="${amount}"/></feComponentTransfer></filter>',{amount:_.isFinite(t.amount)?t.amount:1})},contrast:function(t){var e=_.isFinite(t.amount)?t.amount:1;return _.template('<filter><feComponentTransfer><feFuncR type="linear" slope="${amount}" intercept="${amount2}"/><feFuncG type="linear" slope="${amount}" intercept="${amount2}"/><feFuncB type="linear" slope="${amount}" intercept="${amount2}"/></feComponentTransfer></filter>',{amount:e,amount2:.5-e/2})}},format:{number:function(t,e,i){function n(t){for(var e=t.length,n=[],r=0,a=i.grouping[0];e>0&&a>0;)n.push(t.substring(e-=a,e+a)),a=i.grouping[r=(r+1)%i.grouping.length];return n.reverse().join(i.thousands)}i=i||{currency:["$",""],decimal:".",thousands:",",grouping:[3]};var r=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,a=r.exec(t),s=a[1]||" ",o=a[2]||">",l=a[3]||"",c=a[4]||"",h=a[5],u=+a[6],p=a[7],g=a[8],d=a[9],f=1,m="",I="",y=!1;switch(g&&(g=+g.substring(1)),(h||"0"===s&&"="===o)&&(h=s="0",o="=",p&&(u-=Math.floor((u-1)/4))),d){case"n":p=!0,d="g";break;case"%":f=100,I="%",d="f";break;case"p":f=100,I="%",d="r";break;case"b":case"o":case"x":case"X":"#"===c&&(m="0"+d.toLowerCase());case"c":case"d":y=!0,g=0;break;case"s":f=-1,d="r"}"$"===c&&(m=i.currency[0],I=i.currency[1]),"r"!=d||g||(d="g"),null!=g&&("g"==d?g=Math.max(1,Math.min(21,g)):("e"==d||"f"==d)&&(g=Math.max(0,Math.min(20,g))));var v=h&&p;if(y&&e%1)return"";var C=0>e||0===e&&0>1/e?(e=-e,"-"):l,b=I;if(0>f){var A=this.prefix(e,g);e=A.scale(e),b=A.symbol+I}else e*=f;e=this.convert(d,e,g);var w=e.lastIndexOf("."),x=0>w?e:e.substring(0,w),M=0>w?"":i.decimal+e.substring(w+1);!h&&p&&i.grouping&&(x=n(x));var j=m.length+x.length+M.length+(v?0:C.length),N=u>j?Array(j=u-j+1).join(s):"";return v&&(x=n(N+x)),C+=m,e=x+M,("<"===o?C+e+N:">"===o?N+C+e:"^"===o?N.substring(0,j>>=1)+C+e+N.substring(j):C+(v?e:N+e))+b},convert:function(t,e,i){switch(t){case"b":return e.toString(2);case"c":return String.fromCharCode(e);case"o":return e.toString(8);case"x":return e.toString(16);case"X":return e.toString(16).toUpperCase();case"g":return e.toPrecision(i);case"e":return e.toExponential(i);case"f":return e.toFixed(i);case"r":return(e=this.round(e,this.precision(e,i))).toFixed(Math.max(0,Math.min(20,this.precision(e*(1+1e-15),i))));default:return e+""}},round:function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)},precision:function(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)},prefix:function(t,e){var i=_.map(["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],function(t,e){var i=Math.pow(10,3*abs(8-e));return{scale:e>8?function(t){return t/i}:function(t){return t*i},symbol:t}}),n=0;return t&&(0>t&&(t*=-1),e&&(t=d3.round(t,this.precision(t,e))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((0>=n?n+1:n-1)/3)))),i[8+n/3]}}}};if("object"==typeof exports&&(module.exports=joint),"object"==typeof exports)var joint={dia:{Link:require("./joint.dia.link").Link,Element:require("./joint.dia.element").Element},shapes:require("../plugins/shapes")},Backbone=require("backbone"),_=require("lodash"),g=require("./geometry");if(joint.dia.GraphCells=Backbone.Collection.extend({initialize:function(){this.on("change:z",this.sort,this)},model:function(t,e){if("link"===t.type)return new joint.dia.Link(t,e);var i=t.type.split(".")[0],n=t.type.split(".")[1];return joint.shapes[i]&&joint.shapes[i][n]?new joint.shapes[i][n](t,e):new joint.dia.Element(t,e)},comparator:function(t){return t.get("z")||0},getConnectedLinks:function(t,e){e=e||{},_.isUndefined(e.inbound)&&_.isUndefined(e.outbound)&&(e.inbound=e.outbound=!0);var i=[];return this.each(function(n){var r=n.get("source"),a=n.get("target");r&&r.id===t.id&&e.outbound&&i.push(n),a&&a.id===t.id&&e.inbound&&i.push(n)}),i}}),joint.dia.Graph=Backbone.Model.extend({initialize:function(){this.set("cells",new joint.dia.GraphCells),this.get("cells").on("all",this.trigger,this),this.get("cells").on("remove",this.removeCell,this)},toJSON:function(){var t=Backbone.Model.prototype.toJSON.apply(this,arguments);return t.cells=this.get("cells").toJSON(),t},fromJSON:function(t){if(!t.cells)throw Error("Graph JSON must contain cells array.");var e=t,i=t.cells;delete e.cells,this.set(e),this.resetCells(i)},clear:function(){this.trigger("batch:start"),this.get("cells").remove(this.get("cells").models),this.trigger("batch:stop")},_prepareCell:function(t){return t instanceof Backbone.Model&&_.isUndefined(t.get("z"))?t.set("z",this.maxZIndex()+1,{silent:!0}):_.isUndefined(t.z)&&(t.z=this.maxZIndex()+1),t},maxZIndex:function(){var t=this.get("cells").last();return t?t.get("z")||0:0},addCell:function(t,e){return _.isArray(t)?this.addCells(t,e):(this.get("cells").add(this._prepareCell(t),e||{}),this)},addCells:function(t,e){return _.each(t,function(t){this.addCell(t,e)},this),this},resetCells:function(t){return this.get("cells").reset(_.map(t,this._prepareCell,this)),this},removeCell:function(t,e,i){i&&i.disconnectLinks?this.disconnectLinks(t):this.removeLinks(t),this.get("cells").remove(t,{silent:!0})},getCell:function(t){return this.get("cells").get(t)},getElements:function(){return this.get("cells").filter(function(t){return t instanceof joint.dia.Element})},getLinks:function(){return this.get("cells").filter(function(t){return t instanceof joint.dia.Link})},getConnectedLinks:function(t,e){return this.get("cells").getConnectedLinks(t,e)},getNeighbors:function(t){var e=this.getConnectedLinks(t),i=[],n=this.get("cells");return _.each(e,function(e){var r=e.get("source"),a=e.get("target");if(!r.x){var s=n.get(r.id);s!==t&&i.push(s)}if(!a.x){var o=n.get(a.id);o!==t&&i.push(o)}}),i},disconnectLinks:function(t){_.each(this.getConnectedLinks(t),function(e){e.set(e.get("source").id===t.id?"source":"target",g.point(0,0))})},removeLinks:function(t){_.invoke(this.getConnectedLinks(t),"remove")},findModelsFromPoint:function(t){return _.filter(this.getElements(),function(e){return e.getBBox().containsPoint(t)})},findModelsInArea:function(t){return _.filter(this.getElements(),function(e){return e.getBBox().intersect(t)})}}),"object"==typeof exports&&(module.exports.Graph=joint.dia.Graph),"object"==typeof exports)var joint={util:require("./core").util,dia:{Link:require("./joint.dia.link").Link}},Backbone=require("backbone"),_=require("lodash");if(joint.dia.Cell=Backbone.Model.extend({constructor:function(t,e){var i,n=t||{};this.cid=_.uniqueId("c"),this.attributes={},e&&e.collection&&(this.collection=e.collection),e&&e.parse&&(n=this.parse(n,e)||{}),(i=_.result(this,"defaults"))&&(n=_.merge({},i,n)),this.set(n,e),this.changed={},this.initialize.apply(this,arguments)},toJSON:function(){var t=this.constructor.prototype.defaults.attrs||{},e=this.attributes.attrs,i={};_.each(e,function(e,n){var r=t[n];_.each(e,function(t,e){_.isObject(t)&&!_.isArray(t)?_.each(t,function(t,a){r&&r[e]&&_.isEqual(r[e][a],t)||(i[n]=i[n]||{},(i[n][e]||(i[n][e]={}))[a]=t)}):r&&_.isEqual(r[e],t)||(i[n]=i[n]||{},i[n][e]=t)})});var n=_.cloneDeep(_.omit(this.attributes,"attrs"));return n.attrs=i,n},initialize:function(t){t&&t.id||this.set("id",joint.util.uuid(),{silent:!0}),this._transitionIds={},this.processPorts(),this.on("change:attrs",this.processPorts,this)},processPorts:function(){var t=this.ports,e={};_.each(this.get("attrs"),function(t){t&&t.port&&(_.isUndefined(t.port.id)?e[t.port]={id:t.port}:e[t.port.id]=t.port)});var i={};if(_.each(t,function(t,n){e[n]||(i[n]=!0)}),this.collection&&!_.isEmpty(i)){var n=this.collection.getConnectedLinks(this,{inbound:!0});_.each(n,function(t){i[t.get("target").port]&&t.remove()});var r=this.collection.getConnectedLinks(this,{outbound:!0});_.each(r,function(t){i[t.get("source").port]&&t.remove()})}this.ports=e},remove:function(t){var e=this.collection;e&&e.trigger("batch:start");var i=this.get("parent");if(i){var n=this.collection&&this.collection.get(i);n.unembed(this)}_.invoke(this.getEmbeddedCells(),"remove",t),this.trigger("remove",this,this.collection,t),e&&e.trigger("batch:stop")},toFront:function(){this.collection&&this.set("z",(this.collection.last().get("z")||0)+1)},toBack:function(){this.collection&&this.set("z",(this.collection.first().get("z")||0)-1)},embed:function(t){if(this.get("parent")==t.id)throw Error("Recursive embedding not allowed.");this.trigger("batch:start"),t.set("parent",this.id),this.set("embeds",_.uniq((this.get("embeds")||[]).concat([t.id]))),this.trigger("batch:stop")},unembed:function(t){this.trigger("batch:start");var e=t.id;t.unset("parent"),this.set("embeds",_.without(this.get("embeds"),e)),this.trigger("batch:stop")},getEmbeddedCells:function(){return this.collection?_.map(this.get("embeds")||[],function(t){return this.collection.get(t)},this):[]},clone:function(t){t=t||{};var e=Backbone.Model.prototype.clone.apply(this,arguments);if(e.set("id",joint.util.uuid(),{silent:!0}),e.set("embeds",""),!t.deep)return e;var i=this.getEmbeddedCells(),n=[e],r={};return _.each(i,function(t){var i=t.clone({deep:!0});e.embed(i[0]),_.each(i,function(e){if(n.push(e),!(e instanceof joint.dia.Link)){var i=this.collection.getConnectedLinks(t,{inbound:!0});_.each(i,function(t){var i=r[t.id]||t.clone();r[t.id]=i;var n=_.clone(i.get("target"));n.id=e.id,i.set("target",n)});var a=this.collection.getConnectedLinks(t,{outbound:!0});_.each(a,function(t){var i=r[t.id]||t.clone();r[t.id]=i;var n=_.clone(i.get("source"));n.id=e.id,i.set("source",n)})}},this)},this),n=n.concat(_.values(r))},attr:function(t,e,i){var n=this.get("attrs"),r="/";if(_.isString(t)){if(e!==void 0){var a={};return joint.util.setByPath(a,t,e,r),this.set("attrs",_.merge({},n,a),i)}return joint.util.getByPath(n,t,r)}return this.set("attrs",_.merge({},n,t),e,i)},removeAttr:function(t,e){if(_.isArray(t))return _.each(t,function(t){this.removeAttr(t,e)},this),this;var i=joint.util.unsetByPath(_.merge({},this.get("attrs")),t,"/");return this.set("attrs",i,_.extend({dirty:!0},e))},transition:function(t,e,i,n){n=n||"/";var r={duration:100,delay:10,timingFunction:joint.util.timing.linear,valueFunction:joint.util.interpolate.number};i=_.extend(r,i);var a,s=t.split(n),o=s[0],l=s.length>1,c=0,h=_.bind(function(e){var r,s,u;if(c=c||e,e-=c,s=e/i.duration,1>s?this._transitionIds[t]=r=joint.util.nextFrame(h):(s=1,delete this._transitionIds[t]),u=a(i.timingFunction(s)),l){var p=joint.util.setByPath({},t,u,n)[o];u=_.merge({},this.get(o),p)}i.transitionId=r,this.set(o,u,i),r||this.trigger("transition:end",this,t)},this),u=_.bind(function(r){this.stopTransitions(t),a=i.valueFunction(joint.util.getByPath(this.attributes,t,n),e),this._transitionIds[t]=joint.util.nextFrame(r),this.trigger("transition:start",this,t)},this);return _.delay(u,i.delay,h)},getTransitions:function(){return _.keys(this._transitionIds)},stopTransitions:function(t,e){e=e||"/";var i=t&&t.split(e);_(this._transitionIds).keys().filter(i&&function(t){return _.isEqual(i,t.split(e).slice(0,i.length))}).each(function(t){joint.util.cancelFrame(this._transitionIds[t]),delete this._transitionIds[t],this.trigger("transition:end",this,t)},this)}}),joint.dia.CellView=Backbone.View.extend({tagName:"g",attributes:function(){return{"model-id":this.model.id}},initialize:function(){_.bindAll(this,"remove","update"),this.$el.data("view",this),this.listenTo(this.model,"remove",this.remove),this.listenTo(this.model,"change:attrs",this.onChangeAttrs)},onChangeAttrs:function(t,e,i){return i.dirty?this.render():this.update()},_configure:function(t){t.id=t.id||joint.util.guid(this),Backbone.View.prototype._configure.apply(this,arguments)},_ensureElement:function(){var t;if(this.el)t=_.result(this,"el");else{var e=_.extend({id:this.id},_.result(this,"attributes"));this.className&&(e["class"]=_.result(this,"className")),t=V(_.result(this,"tagName"),e).node}this.setElement(t,!1)},findBySelector:function(t){var e="."===t?this.$el:this.$el.find(t);return e},notify:function(t){if(this.paper){var e=Array.prototype.slice.call(arguments,1);this.trigger.apply(this,[t].concat(e)),this.paper.trigger.apply(this.paper,[t,this].concat(e))}},getStrokeBBox:function(t){var e=!!t;t=t||this.el;var i,n=V(t).bbox(!1,this.paper.viewport);return i=e?V(t).attr("stroke-width"):this.model.attr("rect/stroke-width")||this.model.attr("circle/stroke-width")||this.model.attr("ellipse/stroke-width")||this.model.attr("path/stroke-width"),i=parseFloat(i)||0,g.rect(n).moveAndExpand({x:-i/2,y:-i/2,width:i,height:i})},getBBox:function(){return V(this.el).bbox()},highlight:function(t){t=t?this.$(t)[0]||this.el:this.el,V(t).addClass("highlighted")},unhighlight:function(t){t=t?this.$(t)[0]||this.el:this.el,V(t).removeClass("highlighted")},findMagnet:function(t){var e=this.$(t);if(0===e.length||e[0]===this.el){var i=this.model.get("attrs")||{};return i["."]&&i["."].magnet===!1?void 0:this.el}return e.attr("magnet")?e[0]:this.findMagnet(e.parent())},applyFilter:function(t,e){var i=this.findBySelector(t),n=e.name+this.paper.svg.id+joint.util.hashCode(JSON.stringify(e));if(!this.paper.svg.getElementById(n)){var r=joint.util.filter[e.name]&&joint.util.filter[e.name](e.args||{});if(!r)throw Error("Non-existing filter "+e.name);var a=V(r);a.attr("filterUnits","userSpaceOnUse"),e.attrs&&a.attr(e.attrs),a.node.id=n,V(this.paper.svg).defs().append(a)}i.each(function(){V(this).attr("filter","url(#"+n+")")})},applyGradient:function(t,e,i){var n=this.findBySelector(t),r=i.type+this.paper.svg.id+joint.util.hashCode(JSON.stringify(i));if(!this.paper.svg.getElementById(r)){var a=["<"+i.type+">",_.map(i.stops,function(t){return'<stop offset="'+t.offset+'" stop-color="'+t.color+'" stop-opacity="'+(_.isFinite(t.opacity)?t.opacity:1)+'" />'}).join(""),"</"+i.type+">"].join(""),s=V(a);i.attrs&&s.attr(i.attrs),s.node.id=r,V(this.paper.svg).defs().append(s)}n.each(function(){V(this).attr(e,"url(#"+r+")")})},getSelector:function(t,e){if(t===this.el)return e;var i=$(t).index();return e=t.tagName+":nth-child("+(i+1)+")"+" "+(e||""),this.getSelector($(t).parent()[0],e+" ")},pointerdblclick:function(t,e,i){this.notify("cell:pointerdblclick",t,e,i)},pointerclick:function(t,e,i){this.notify("cell:pointerclick",t,e,i)},pointerdown:function(t,e,i){this.model.collection&&(this.model.trigger("batch:start"),this._collection=this.model.collection),this.notify("cell:pointerdown",t,e,i)},pointermove:function(t,e,i){this.notify("cell:pointermove",t,e,i)},pointerup:function(t,e,i){this.notify("cell:pointerup",t,e,i),this._collection&&(this._collection.trigger("batch:stop"),delete this._collection)}}),"object"==typeof exports&&(module.exports.Cell=joint.dia.Cell,module.exports.CellView=joint.dia.CellView),"object"==typeof exports)var joint={util:require("./core").util,dia:{Cell:require("./joint.dia.cell").Cell,CellView:require("./joint.dia.cell").CellView}},Backbone=require("backbone"),_=require("lodash");if(joint.dia.Element=joint.dia.Cell.extend({defaults:{position:{x:0,y:0},size:{width:1,height:1},angle:0},position:function(t,e){this.set("position",{x:t,y:e})},translate:function(t,e,i){if(e=e||0,0===t&&0===e)return this;var n=this.get("position")||{x:0,y:0},r={x:n.x+t||0,y:n.y+e||0};return i&&i.transition?(_.isObject(i.transition)||(i.transition={}),this.transition("position",r,_.extend({},i.transition,{valueFunction:joint.util.interpolate.object}))):(this.set("position",r,i),_.invoke(this.getEmbeddedCells(),"translate",t,e,i)),this},resize:function(t,e){return this.trigger("batch:start"),this.set("size",{width:t,height:e}),this.trigger("batch:stop"),this},rotate:function(t,e){return this.set("angle",e?t:((this.get("angle")||0)+t)%360)},getBBox:function(){var t=this.get("position"),e=this.get("size");return g.rect(t.x,t.y,e.width,e.height)}}),joint.dia.ElementView=joint.dia.CellView.extend({className:function(){return"element "+this.model.get("type").split(".").join(" ")},initialize:function(){_.bindAll(this,"translate","resize","rotate"),joint.dia.CellView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:position",this.translate),this.listenTo(this.model,"change:size",this.resize),this.listenTo(this.model,"change:angle",this.rotate)},update:function(t,e){var i=this.model.get("attrs"),n=V(this.$(".rotatable")[0]);if(n){var r=n.attr("transform");n.attr("transform","")}var a=[];_.each(e||i,function(t,e){var i=this.findBySelector(e);if(0!==i.length){var n=["style","text","html","ref-x","ref-y","ref-dx","ref-dy","ref-width","ref-height","ref","x-alignment","y-alignment","port"];_.isObject(t.filter)&&(n.push("filter"),this.applyFilter(e,t.filter)),_.isObject(t.fill)&&(n.push("fill"),this.applyGradient(e,"fill",t.fill)),_.isObject(t.stroke)&&(n.push("stroke"),this.applyGradient(e,"stroke",t.stroke)),_.isUndefined(t.text)||i.each(function(){V(this).text(t.text+"")});var r=_.omit(t,n);i.each(function(){V(this).attr(r)}),t.port&&i.attr("port",_.isUndefined(t.port.id)?t.port:t.port.id),t.style&&i.css(t.style),_.isUndefined(t.html)||i.each(function(){$(this).html(t.html+"")}),_.isUndefined(t["ref-x"])&&_.isUndefined(t["ref-y"])&&_.isUndefined(t["ref-dx"])&&_.isUndefined(t["ref-dy"])&&_.isUndefined(t["x-alignment"])&&_.isUndefined(t["y-alignment"])&&_.isUndefined(t["ref-width"])&&_.isUndefined(t["ref-height"])||_.each(i,function(t,e,i){var n=$(t);n.selector=i.selector,a.push(n)})}},this);var s=this.el.getBBox();e=e||{},_.each(a,function(t){var n=e[t.selector],r=n?_.merge({},i[t.selector],n):i[t.selector];this.positionRelative(t,s,r)},this),n&&n.attr("transform",r||"")},positionRelative:function(t,e,i){function n(t){return _.isNumber(t)&&!_.isNaN(t)}var r=i.ref,a=parseFloat(i["ref-x"]),s=parseFloat(i["ref-y"]),o=parseFloat(i["ref-dx"]),l=parseFloat(i["ref-dy"]),c=i["y-alignment"],h=i["x-alignment"],u=parseFloat(i["ref-width"]),p=parseFloat(i["ref-height"]),g=_.contains(_.pluck(_.pluck(t.parents("g"),"className"),"baseVal"),"scalable");r&&(e=V(this.findBySelector(r)[0]).bbox(!1,this.el));var d=V(t[0]);d.attr("transform")&&d.attr("transform",d.attr("transform").replace(/translate\([^)]*\)/g,"")||"");var f=0,m=0;if(n(u)&&(u>=0&&1>=u?d.attr("width",u*e.width):d.attr("width",Math.max(u+e.width,0))),n(p)&&(p>=0&&1>=p?d.attr("height",p*e.height):d.attr("height",Math.max(p+e.height,0))),n(o))if(g){var I=V(this.$(".scalable")[0]).scale();f=e.x+e.width+o/I.sx}else f=e.x+e.width+o;if(n(l))if(g){var I=V(this.$(".scalable")[0]).scale();m=e.y+e.height+l/I.sy}else m=e.y+e.height+l;if(n(a))if(a>0&&1>a)f=e.x+e.width*a;else if(g){var I=V(this.$(".scalable")[0]).scale();f=e.x+a/I.sx}else f=e.x+a;if(n(s))if(s>0&&1>s)m=e.y+e.height*s;else if(g){var I=V(this.$(".scalable")[0]).scale();m=e.y+s/I.sy}else m=e.y+s;var y=d.bbox(!1,this.paper.viewport);"middle"===c?m-=y.height/2:n(c)&&(m+=c>-1&&1>c?y.height*c:c),"middle"===h?f-=y.width/2:n(h)&&(f+=h>-1&&1>h?y.width*h:h),d.translate(f,m)},renderMarkup:function(){var t=this.model.markup||this.model.get("markup");if(!t)throw Error("properties.markup is missing while the default render() implementation is used.");var e=V(t);V(this.el).append(e)},render:function(){return this.$el.empty(),this.renderMarkup(),this.update(),this.resize(),this.rotate(),this.translate(),this},scale:function(t,e){V(this.el).scale(t,e)},resize:function(){var t=this.model.get("size")||{width:1,height:1},e=this.model.get("angle")||0,i=V(this.$(".scalable")[0]);if(i){var n=i.bbox(!0);i.attr("transform","scale("+t.width/n.width+","+t.height/n.height+")");var r=V(this.$(".rotatable")[0]),a=r&&r.attr("transform");if(a&&"null"!==a){r.attr("transform",a+" rotate("+-e+","+t.width/2+","+t.height/2+")");var s=i.bbox(!1,this.paper.viewport);this.model.set("position",{x:s.x,y:s.y}),this.rotate()}this.update()}},translate:function(){var t=this.model.get("position")||{x:0,y:0};V(this.el).attr("transform","translate("+t.x+","+t.y+")")},rotate:function(){var t=V(this.$(".rotatable")[0]);if(t){var e=this.model.get("angle")||0,i=this.model.get("size")||{width:1,height:1},n=i.width/2,r=i.height/2;t.attr("transform","rotate("+e+","+n+","+r+")")}},pointerdown:function(t,e,i){if(t.target.getAttribute("magnet")&&this.paper.options.validateMagnet.call(this.paper,this,t.target)){this.model.trigger("batch:start");var n=this.paper.getDefaultLink(this,t.target);n.set({source:{id:this.model.id,selector:this.getSelector(t.target),port:$(t.target).attr("port")},target:{x:e,y:i}}),this.paper.model.addCell(n),this._linkView=this.paper.findViewByModel(n),this._linkView.startArrowheadMove("target")}else this._dx=e,this._dy=i,joint.dia.CellView.prototype.pointerdown.apply(this,arguments)},pointermove:function(t,e,i){if(this._linkView)this._linkView.pointermove(t,e,i);else{var n=this.paper.options.gridSize;if(this.options.interactive!==!1){var r=this.model.get("position");this.model.translate(g.snapToGrid(r.x,n)-r.x+g.snapToGrid(e-this._dx,n),g.snapToGrid(r.y,n)-r.y+g.snapToGrid(i-this._dy,n))}this._dx=g.snapToGrid(e,n),this._dy=g.snapToGrid(i,n),joint.dia.CellView.prototype.pointermove.apply(this,arguments)}},pointerup:function(t,e,i){this._linkView?(this._linkView.pointerup(t,e,i),delete this._linkView,this.model.trigger("batch:stop")):joint.dia.CellView.prototype.pointerup.apply(this,arguments)}}),"object"==typeof exports&&(module.exports.Element=joint.dia.Element,module.exports.ElementView=joint.dia.ElementView),"object"==typeof exports)var joint={dia:{Cell:require("./joint.dia.cell").Cell,CellView:require("./joint.dia.cell").CellView}},Backbone=require("backbone"),_=require("lodash"),g=require("./geometry");if(joint.dia.Link=joint.dia.Cell.extend({markup:['<path class="connection" stroke="black"/>','<path class="marker-source" fill="black" stroke="black" />','<path class="marker-target" fill="black" stroke="black" />','<path class="connection-wrap"/>','<g class="labels"/>','<g class="marker-vertices"/>','<g class="marker-arrowheads"/>','<g class="link-tools"/>'].join(""),labelMarkup:['<g class="label">',"<rect />","<text />","</g>"].join(""),toolMarkup:['<g class="link-tool">','<g class="tool-remove" event="remove">','<circle r="11" />','<path transform="scale(.8) translate(-16, -16)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z"/>',"<title>Remove link.</title>","</g>",'<g class="tool-options" event="link:options">','<circle r="11" transform="translate(25)"/>','<path fill="white" transform="scale(.55) translate(29, -16)" d="M31.229,17.736c0.064-0.571,0.104-1.148,0.104-1.736s-0.04-1.166-0.104-1.737l-4.377-1.557c-0.218-0.716-0.504-1.401-0.851-2.05l1.993-4.192c-0.725-0.91-1.549-1.734-2.458-2.459l-4.193,1.994c-0.647-0.347-1.334-0.632-2.049-0.849l-1.558-4.378C17.165,0.708,16.588,0.667,16,0.667s-1.166,0.041-1.737,0.105L12.707,5.15c-0.716,0.217-1.401,0.502-2.05,0.849L6.464,4.005C5.554,4.73,4.73,5.554,4.005,6.464l1.994,4.192c-0.347,0.648-0.632,1.334-0.849,2.05l-4.378,1.557C0.708,14.834,0.667,15.412,0.667,16s0.041,1.165,0.105,1.736l4.378,1.558c0.217,0.715,0.502,1.401,0.849,2.049l-1.994,4.193c0.725,0.909,1.549,1.733,2.459,2.458l4.192-1.993c0.648,0.347,1.334,0.633,2.05,0.851l1.557,4.377c0.571,0.064,1.148,0.104,1.737,0.104c0.588,0,1.165-0.04,1.736-0.104l1.558-4.377c0.715-0.218,1.399-0.504,2.049-0.851l4.193,1.993c0.909-0.725,1.733-1.549,2.458-2.458l-1.993-4.193c0.347-0.647,0.633-1.334,0.851-2.049L31.229,17.736zM16,20.871c-2.69,0-4.872-2.182-4.872-4.871c0-2.69,2.182-4.872,4.872-4.872c2.689,0,4.871,2.182,4.871,4.872C20.871,18.689,18.689,20.871,16,20.871z"/>',"<title>Link options.</title>","</g>","</g>"].join(""),vertexMarkup:['<g class="marker-vertex-group" transform="translate(<%= x %>, <%= y %>)">','<circle class="marker-vertex" idx="<%= idx %>" r="10" />','<path class="marker-vertex-remove-area" idx="<%= idx %>" d="M16,5.333c-7.732,0-14,4.701-14,10.5c0,1.982,0.741,3.833,2.016,5.414L2,25.667l5.613-1.441c2.339,1.317,5.237,2.107,8.387,2.107c7.732,0,14-4.701,14-10.5C30,10.034,23.732,5.333,16,5.333z" transform="translate(5, -33)"/>','<path class="marker-vertex-remove" idx="<%= idx %>" transform="scale(.8) translate(9.5, -37)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z">',"<title>Remove vertex.</title>","</path>","</g>"].join(""),arrowheadMarkup:['<g class="marker-arrowhead-group marker-arrowhead-group-<%= end %>">','<path class="marker-arrowhead" end="<%= end %>" d="M 26 0 L 0 13 L 26 26 z" />',"</g>"].join(""),defaults:{type:"link"},disconnect:function(){return this.set({source:g.point(0,0),target:g.point(0,0)})},label:function(t,e){t=t||0;var i=this.get("labels")||[];if(0===arguments.length||1===arguments.length)return i[t];var n=_.merge({},i[t],e),r=i.slice();return r[t]=n,this.set({labels:r})}}),joint.dia.LinkView=joint.dia.CellView.extend({className:function(){return _.unique(this.model.get("type").split(".").concat("link")).join(" ")},options:{shortLinkLength:100},initialize:function(){joint.dia.CellView.prototype.initialize.apply(this,arguments),"function"!=typeof this.constructor.prototype.watchSource&&(this.constructor.prototype.watchSource=this._createWatcher("source"),this.constructor.prototype.watchTarget=this._createWatcher("target")),this._labelCache={},this._markerCache={},this.startListening()},startListening:function(){this.listenTo(this.model,"change:markup",this.render),this.listenTo(this.model,"change:smooth change:manhattan change:router change:connector",this.update),this.listenTo(this.model,"change:toolMarkup",function(){this.renderTools().updateToolsPosition()}),this.listenTo(this.model,"change:labels change:labelMarkup",function(){this.renderLabels().updateLabelPositions()}),this.listenTo(this.model,"change:vertices change:vertexMarkup",function(){this.renderVertexMarkers().update()}),this.listenTo(this.model,"change:source",function(t,e){this.watchSource(t,e).update()}),this.listenTo(this.model,"change:target",function(t,e){this.watchTarget(t,e).update()})},render:function(){this.$el.empty();var t=V(this.model.get("markup")||this.model.markup);if(_.isArray(t)||(t=[t]),this._V={},_.each(t,function(t){var e=t.attr("class");e&&(this._V[$.camelCase(e)]=t)},this),!this._V.connection)throw Error("link: no connection path in the markup");return this.renderTools(),this.renderVertexMarkers(),this.renderArrowheadMarkers(),V(this.el).append(t),this.renderLabels(),this.watchSource(this.model,this.model.get("source")).watchTarget(this.model,this.model.get("target")).update(),this},renderLabels:function(){if(!this._V.labels)return this;this._labelCache={};var t=$(this._V.labels.node).empty(),e=this.model.get("labels")||[];if(!e.length)return this;var i=_.template(this.model.get("labelMarkup")||this.model.labelMarkup),n=V(i());return _.each(e,function(e,i){var r=n.clone().node;this._labelCache[i]=V(r);var a=$(r).find("text"),s=$(r).find("rect"),o=_.extend({"text-anchor":"middle","font-size":14},joint.util.getByPath(e,"attrs/text","/"));a.attr(_.omit(o,"text")),_.isUndefined(o.text)||V(a[0]).text(o.text+""),t.append(r);var l=V(a[0]).bbox(!0,t[0]);V(a[0]).translate(0,-l.height/2);var c=_.extend({fill:"white",rx:3,ry:3},joint.util.getByPath(e,"attrs/rect","/"));s.attr(_.extend(c,{x:l.x,y:l.y-l.height/2,width:l.width,height:l.height}))},this),this},renderTools:function(){if(!this._V.linkTools)return this;var t=$(this._V.linkTools.node).empty(),e=_.template(this.model.get("toolMarkup")||this.model.toolMarkup),i=V(e());return t.append(i.node),this._toolCache=i,this},renderVertexMarkers:function(){if(!this._V.markerVertices)return this;var t=$(this._V.markerVertices.node).empty(),e=_.template(this.model.get("vertexMarkup")||this.model.vertexMarkup);return _.each(this.model.get("vertices"),function(i,n){t.append(V(e(_.extend({idx:n},i))).node)}),this},renderArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;var t=$(this._V.markerArrowheads.node);t.empty();var e=_.template(this.model.get("arrowheadMarkup")||this.model.arrowheadMarkup);return this._V.sourceArrowhead=V(e({end:"source"})),this._V.targetArrowhead=V(e({end:"target"})),t.append(this._V.sourceArrowhead.node,this._V.targetArrowhead.node),this},update:function(){_.each(this.model.get("attrs"),function(t,e){_.isObject(t.filter)?(this.findBySelector(e).attr(_.omit(t,"filter")),this.applyFilter(e,t.filter)):this.findBySelector(e).attr(t)},this);var t=this.route=this.findRoute(this.model.get("vertices")||[]);this._findConnectionPoints(t);var e=this.getPathData(t);return this._V.connection.attr("d",e),this._V.connectionWrap&&this._V.connectionWrap.attr("d",e),this._translateAndAutoOrientArrows(this._V.markerSource,this._V.markerTarget),this.updateLabelPositions(),this.updateToolsPosition(),this.updateArrowheadMarkers(),delete this.options.perpendicular,this},_findConnectionPoints:function(t){var e,i,n,r,a=_.first(t);e=this.getConnectionPoint("source",this.model.get("source"),a||this.model.get("target")).round();var s=_.last(t);i=this.getConnectionPoint("target",this.model.get("target"),s||e).round();var o=this._markerCache;this._V.markerSource&&(o.sourceBBox=o.sourceBBox||this._V.markerSource.bbox(!0),n=g.point(e).move(a||i,-1*o.sourceBBox.width*this._V.markerSource.scale().sx).round()),this._V.markerTarget&&(o.targetBBox=o.targetBBox||this._V.markerTarget.bbox(!0),r=g.point(i).move(s||e,-1*o.targetBBox.width*this._V.markerTarget.scale().sx).round()),o.sourcePoint=n||e,o.targetPoint=r||i,this.sourcePoint=e,this.targetPoint=i},updateLabelPositions:function(){if(!this._V.labels)return this;var t=this.model.get("labels")||[];if(!t.length)return this;var e=this._V.connection.node,i=e.getTotalLength();return _.each(t,function(t,n){var r=t.position;r=r>i?i:r,r=0>r?i+r:r,r=r>1?r:i*r;var a=e.getPointAtLength(r);this._labelCache[n].attr("transform","translate("+a.x+", "+a.y+")")},this),this},updateToolsPosition:function(){if(!this._V.linkTools)return this;var t="",e=40;this.getConnectionLength()<this.options.shortLinkLength&&(t="scale(.5)",e/=2);var i=this.getPointAtLength(e);return this._toolCache.attr("transform","translate("+i.x+", "+i.y+") "+t),this},updateArrowheadMarkers:function(){if(!this._V.markerArrowheads)return this;if("none"===$.css(this._V.markerArrowheads.node,"display"))return this;var t=this.getConnectionLength()<this.options.shortLinkLength?.5:1;return this._V.sourceArrowhead.scale(t),this._V.targetArrowhead.scale(t),this._translateAndAutoOrientArrows(this._V.sourceArrowhead,this._V.targetArrowhead),this},_createWatcher:function(t){function e(e,i){i=i||{};var n=e.previous(t)||{},r=this["_"+t+"BBoxUpdate"];return this._isModel(n)&&this.stopListening(this.paper.getModelById(n.id),"change",r),this._isModel(i)&&this.listenTo(this.paper.getModelById(i.id),"change",r),_.bind(r,this)({cacheOnly:!0}),this}return e},_sourceBBoxUpdate:function(t){this.lastEndChange="source",t=t||{};var e=this.model.get("source");if(this._isModel(e)){var i=this._makeSelector(e),n=this.paper.findViewByModel(e.id),r=this.paper.viewport.querySelector(i);this.sourceBBox=n.getStrokeBBox(r)}else this.sourceBBox=g.rect(e.x,e.y,1,1);t.cacheOnly||this.update()},_targetBBoxUpdate:function(t){this.lastEndChange="target",t=t||{};var e=this.model.get("target");if(this._isModel(e)){var i=this._makeSelector(e),n=this.paper.findViewByModel(e.id),r=this.paper.viewport.querySelector(i);this.targetBBox=n.getStrokeBBox(r)}else this.targetBBox=g.rect(e.x,e.y,1,1);t.cacheOnly||this.update()},_translateAndAutoOrientArrows:function(t,e){t&&t.translateAndAutoOrient(this.sourcePoint,_.first(this.route)||this.targetPoint,this.paper.viewport),e&&e.translateAndAutoOrient(this.targetPoint,_.last(this.route)||this.sourcePoint,this.paper.viewport)
20 },removeVertex:function(t){var e=_.clone(this.model.get("vertices"));return e&&e.length&&(e.splice(t,1),this.model.set("vertices",e)),this},addVertex:function(t){this.model.set("attrs",this.model.get("attrs")||{}),this.model.get("attrs");for(var e,i=(this.model.get("vertices")||[]).slice(),n=i.slice(),r=this._V.connection.node.cloneNode(!1),a=r.getTotalLength(),s=20,o=i.length+1;o--&&(i.splice(o,0,t),V(r).attr("d",this.getPathData(this.findRoute(i))),e=r.getTotalLength(),e-a>s);)i=n.slice();return this.model.set("vertices",i),Math.max(o,0)},findRoute:function(t){var e=this.model.get("router");if(!e){if(!this.model.get("manhattan"))return t;e={name:"orthogonal"}}var i=joint.routers[e.name];if(!_.isFunction(i))throw"unknown router: "+e.name;var n=i.call(this,t||[],e.args||{},this);return n},getPathData:function(t){var e=this.model.get("connector");if(e||(e=this.model.get("smooth")?{name:"smooth"}:{name:"normal"}),!_.isFunction(joint.connectors[e.name]))throw"unknown connector: "+e.name;var i=joint.connectors[e.name].call(this,this._markerCache.sourcePoint,this._markerCache.targetPoint,t||this.model.get("vertices")||{},e.args||{},this);return i},getConnectionPoint:function(t,e,i){var n;if(this._isPoint(e))n=g.point(e);else{var r,a="source"===t?this.sourceBBox:this.targetBBox;if(this._isPoint(i))r=g.point(i);else{var s="source"===t?this.targetBBox:this.sourceBBox;r=g.rect(s).intersectionWithLineFromCenterToPoint(g.rect(a).center()),r=r||g.rect(s).center()}if(this.paper.options.perpendicularLinks||this.options.perpendicular){var o,l=g.rect(0,r.y,this.paper.options.width,1),c=g.rect(r.x,0,1,this.paper.options.height);if(l.intersect(g.rect(a)))switch(o=g.rect(a).sideNearestToPoint(r)){case"left":n=g.point(a.x,r.y);break;case"right":n=g.point(a.x+a.width,r.y);break;default:n=g.rect(a).center()}else if(c.intersect(g.rect(a)))switch(o=g.rect(a).sideNearestToPoint(r)){case"top":n=g.point(r.x,a.y);break;case"bottom":n=g.point(r.x,a.y+a.height);break;default:n=g.rect(a).center()}else n=g.rect(a).intersectionWithLineFromCenterToPoint(r),n=n||g.rect(a).center()}else n=g.rect(a).intersectionWithLineFromCenterToPoint(r),n=n||g.rect(a).center()}return n},_isModel:function(t){return t&&t.id},_isPoint:function(t){return!this._isModel(t)},_makeSelector:function(t){var e='[model-id="'+t.id+'"]';return t.port?e+=' [port="'+t.port+'"]':t.selector&&(e+=" "+t.selector),e},getConnectionLength:function(){return this._V.connection.node.getTotalLength()},getPointAtLength:function(t){return this._V.connection.node.getPointAtLength(t)},_beforeArrowheadMove:function(){this.model.trigger("batch:start"),this._z=this.model.get("z"),this.model.set("z",Number.MAX_VALUE),this.el.style.pointerEvents="none"},_afterArrowheadMove:function(){this._z&&(this.model.set("z",this._z),delete this._z),this.el.style.pointerEvents="visiblePainted",this.model.trigger("batch:stop")},_createValidateConnectionArgs:function(t){function e(t,e){return i[a]=t,i[a+1]=t.el===e?void 0:e,i}var i=[];i[4]=t,i[5]=this;var n,r=0,a=0;"source"===t?(r=2,n="target"):(a=2,n="source");var s=this.model.get(n);return s.id&&(i[r]=this.paper.findViewByModel(s.id),i[r+1]=s.selector&&i[r].el.querySelector(s.selector)),e},startArrowheadMove:function(t){this._action="arrowhead-move",this._arrowhead=t,this._beforeArrowheadMove(),this._validateConnectionArgs=this._createValidateConnectionArgs(this._arrowhead)},pointerdown:function(t,e,i){if(joint.dia.CellView.prototype.pointerdown.apply(this,arguments),this._dx=e,this._dy=i,this.options.interactive!==!1){var n=t.target.getAttribute("class");switch(n){case"marker-vertex":this._action="vertex-move",this._vertexIdx=t.target.getAttribute("idx");break;case"marker-vertex-remove":case"marker-vertex-remove-area":this.removeVertex(t.target.getAttribute("idx"));break;case"marker-arrowhead":this.startArrowheadMove(t.target.getAttribute("end"));break;default:var r=t.target.parentNode.getAttribute("event");r?"remove"===r?this.model.remove():this.paper.trigger(r,t,this,e,i):(this._vertexIdx=this.addVertex({x:e,y:i}),this._action="vertex-move")}}},pointermove:function(t,e,i){switch(joint.dia.CellView.prototype.pointermove.apply(this,arguments),this._action){case"vertex-move":var n=_.clone(this.model.get("vertices"));n[this._vertexIdx]={x:e,y:i},this.model.set("vertices",n);break;case"arrowhead-move":if(this.paper.options.snapLinks){var r=this.paper.options.snapLinks.radius||50,a=this.paper.findViewsInArea({x:e-r,y:i-r,width:2*r,height:2*r});this._closestView&&this._closestView.unhighlight(this._closestEnd.selector),this._closestView=this._closestEnd=null;var s,o=g.point(e,i),l=Number.MAX_VALUE;_.each(a,function(t){"false"!==t.el.getAttribute("magnet")&&(s=t.model.getBBox().center().distance(o),r>s&&l>s&&this.paper.options.validateConnection.apply(this.paper,this._validateConnectionArgs(t,null))&&(l=s,this._closestView=t,this._closestEnd={id:t.model.id})),t.$("[magnet]").each(_.bind(function(e,i){var n=V(i).bbox(!1,this.paper.viewport);s=o.distance({x:n.x+n.width/2,y:n.y+n.height/2}),r>s&&l>s&&this.paper.options.validateConnection.apply(this.paper,this._validateConnectionArgs(t,i))&&(l=s,this._closestView=t,this._closestEnd={id:t.model.id,selector:t.getSelector(i),port:i.getAttribute("port")})},this))},this),this._closestView&&this._closestView.highlight(this._closestEnd.selector),this.model.set(this._arrowhead,this._closestEnd||{x:e,y:i})}else{var c="mousemove"===t.type?t.target:document.elementFromPoint(t.clientX,t.clientY);this._targetEvent!==c&&(this._magnetUnderPointer&&this._viewUnderPointer.unhighlight(this._magnetUnderPointer),this._viewUnderPointer=this.paper.findView(c),this._viewUnderPointer?(this._magnetUnderPointer=this._viewUnderPointer.findMagnet(c),this._magnetUnderPointer&&this.paper.options.validateConnection.apply(this.paper,this._validateConnectionArgs(this._viewUnderPointer,this._magnetUnderPointer))?this._magnetUnderPointer&&this._viewUnderPointer.highlight(this._magnetUnderPointer):this._magnetUnderPointer=null):this._magnetUnderPointer=null),this._targetEvent=c,this.model.set(this._arrowhead,{x:e,y:i})}}this._dx=e,this._dy=i},pointerup:function(){joint.dia.CellView.prototype.pointerup.apply(this,arguments),"arrowhead-move"===this._action&&(this.paper.options.snapLinks?(this._closestView&&this._closestView.unhighlight(this._closestEnd.selector),this._closestView=this._closestEnd=null):(this._magnetUnderPointer&&(this._viewUnderPointer.unhighlight(this._magnetUnderPointer),this.model.set(this._arrowhead,{id:this._viewUnderPointer.model.id,selector:this._viewUnderPointer.getSelector(this._magnetUnderPointer),port:$(this._magnetUnderPointer).attr("port")})),delete this._viewUnderPointer,delete this._magnetUnderPointer,delete this._staticView,delete this._staticMagnet),this._afterArrowheadMove()),delete this._action}}),"object"==typeof exports&&(module.exports.Link=joint.dia.Link,module.exports.LinkView=joint.dia.LinkView),joint.dia.Paper=Backbone.View.extend({options:{width:800,height:600,gridSize:50,perpendicularLinks:!1,elementView:joint.dia.ElementView,linkView:joint.dia.LinkView,snapLinks:!1,defaultLink:new joint.dia.Link,validateMagnet:function(t,e){return"passive"!==e.getAttribute("magnet")},validateConnection:function(t,e,i,n,r){return("target"===r?i:t)instanceof joint.dia.ElementView}},events:{mousedown:"pointerdown",dblclick:"mousedblclick",click:"mouseclick",touchstart:"pointerdown",mousemove:"pointermove",touchmove:"pointermove"},initialize:function(){_.bindAll(this,"addCell","sortCells","resetCells","pointerup"),this.svg=V("svg").node,this.viewport=V("g").node,V(this.svg).append(V("defs").node),V(this.viewport).attr({"class":"viewport"}),V(this.svg).append(this.viewport),this.$el.append(this.svg),this.setDimensions(),this.listenTo(this.model,"add",this.addCell),this.listenTo(this.model,"reset",this.resetCells),this.listenTo(this.model,"sort",this.sortCells),$(document).on("mouseup touchend",this.pointerup),this._mousemoved=!1},remove:function(){$(document).off("mouseup touchend",this.pointerup),Backbone.View.prototype.remove.call(this)},setDimensions:function(t,e){t&&(this.options.width=t),e&&(this.options.height=e),V(this.svg).attr("width",this.options.width),V(this.svg).attr("height",this.options.height),this.trigger("resize")},fitToContent:function(t,e,i){t=t||1,e=e||1,i=i||0;var n=V(this.viewport).bbox(!0,this.svg),r=Math.ceil((n.width+n.x)/t)*t,a=Math.ceil((n.height+n.y)/e)*e;r+=i,a+=i,(r!=this.options.width||a!=this.options.height)&&this.setDimensions(r||this.options.width,a||this.options.height)},getContentBBox:function(){var t=this.viewport.getBoundingClientRect(),e=this.viewport.getScreenCTM(),i=g.rect(Math.abs(t.left-e.e),Math.abs(t.top-e.f),t.width,t.height);return i},createViewForModel:function(t){var e,i=t.get("type"),n=i.split(".")[0],r=i.split(".")[1];return e=joint.shapes[n]&&joint.shapes[n][r+"View"]?new joint.shapes[n][r+"View"]({model:t,interactive:this.options.interactive}):t instanceof joint.dia.Element?new this.options.elementView({model:t,interactive:this.options.interactive}):new this.options.linkView({model:t,interactive:this.options.interactive})},addCell:function(t){var e=this.createViewForModel(t);V(this.viewport).append(e.el),e.paper=this,e.render(),$(e.el).find("image").on("dragstart",function(){return!1})},resetCells:function(t){$(this.viewport).empty();var e=t.models.slice();e.sort(function(t){return t instanceof joint.dia.Link?1:-1}),_.each(e,this.addCell,this),this.sortCells()},sortCells:function(){var t=$(this.viewport).children("[model-id]"),e=this.model.get("cells");this.sortElements(t,function(t,i){var n=e.get($(t).attr("model-id")),r=e.get($(i).attr("model-id"));return(n.get("z")||0)>(r.get("z")||0)?1:-1})},sortElements:function(t,e){var i=$(t),n=i.map(function(){var t=this,e=t.parentNode,i=e.insertBefore(document.createTextNode(""),t.nextSibling);return function(){if(e===this)throw Error("You can't sort elements if any one is a descendant of another.");e.insertBefore(this,i),e.removeChild(i)}});return Array.prototype.sort.call(i,e).each(function(t){n[t].call(this)})},scale:function(t,e,i,n){return i||(i=0,n=0),V(this.viewport).attr("transform",""),(i||n)&&V(this.viewport).translate(-i*(t-1),-n*(e-1)),V(this.viewport).scale(t,e),this.trigger("scale",i,n),this},rotate:function(t,e,i){if(_.isUndefined(e)){var n=this.viewport.getBBox();e=n.width/2,i=n.height/2}V(this.viewport).rotate(t,e,i)},findView:function(t){var e=this.$(t);return 0===e.length||e[0]===this.el?void 0:e.data("view")?e.data("view"):this.findView(e.parent())},findViewByModel:function(t){var e=_.isString(t)?t:t.id,i=this.$('[model-id="'+e+'"]');return i.length?i.data("view"):void 0},findViewsFromPoint:function(t){t=g.point(t);var e=_.map(this.model.getElements(),this.findViewByModel);return _.filter(e,function(e){return g.rect(V(e.el).bbox(!1,this.viewport)).containsPoint(t)},this)},findViewsInArea:function(t){t=g.rect(t);var e=_.map(this.model.getElements(),this.findViewByModel);return _.filter(e,function(e){return t.intersect(g.rect(V(e.el).bbox(!1,this.viewport)))},this)},getModelById:function(t){return this.model.getCell(t)},snapToGrid:function(t){var e=V(this.viewport).toLocalPoint(t.x,t.y);return{x:g.snapToGrid(e.x,this.options.gridSize),y:g.snapToGrid(e.y,this.options.gridSize)}},getDefaultLink:function(t,e){return _.isFunction(this.options.defaultLink)?this.options.defaultLink.call(this,t,e):this.options.defaultLink.clone()},mousedblclick:function(t){t.preventDefault(),t=joint.util.normalizeEvent(t);var e=this.findView(t.target),i=this.snapToGrid({x:t.clientX,y:t.clientY});e?e.pointerdblclick(t,i.x,i.y):this.trigger("blank:pointerdblclick",t,i.x,i.y)},mouseclick:function(t){if(!this._mousemoved){t.preventDefault(),t=joint.util.normalizeEvent(t);var e=this.findView(t.target),i=this.snapToGrid({x:t.clientX,y:t.clientY});e?e.pointerclick(t,i.x,i.y):this.trigger("blank:pointerclick",t,i.x,i.y)}this._mousemoved=!1},pointerdown:function(t){t.preventDefault(),t=joint.util.normalizeEvent(t);var e=this.findView(t.target),i=this.snapToGrid({x:t.clientX,y:t.clientY});e?(this.sourceView=e,e.pointerdown(t,i.x,i.y)):this.trigger("blank:pointerdown",t,i.x,i.y)},pointermove:function(t){if(t.preventDefault(),t=joint.util.normalizeEvent(t),this.sourceView){this._mousemoved=!0;var e=this.snapToGrid({x:t.clientX,y:t.clientY});this.sourceView.pointermove(t,e.x,e.y)}},pointerup:function(t){t=joint.util.normalizeEvent(t);var e=this.snapToGrid({x:t.clientX,y:t.clientY});this.sourceView?(this.sourceView.pointerup(t,e.x,e.y),this.sourceView=null):this.trigger("blank:pointerup",t,e.x,e.y)}}),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{},dia:{Element:require("../src/joint.dia.element").Element,ElementView:require("../src/joint.dia.element").ElementView}},_=require("lodash");if(joint.shapes.basic={},joint.shapes.basic.Generic=joint.dia.Element.extend({defaults:joint.util.deepSupplement({type:"basic.Generic",attrs:{".":{fill:"#FFFFFF",stroke:"none"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.basic.Rect=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><rect/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Rect",attrs:{rect:{fill:"#FFFFFF",stroke:"black",width:100,height:60},text:{"font-size":14,text:"","ref-x":.5,"ref-y":.5,ref:"rect","y-alignment":"middle","x-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Text=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><text/></g></g>',defaults:joint.util.deepSupplement({type:"basic.Text",attrs:{text:{"font-size":18,fill:"black"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Circle=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><circle/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Circle",size:{width:60,height:60},attrs:{circle:{fill:"#FFFFFF",stroke:"black",r:30,transform:"translate(30, 30)"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-y":.5,ref:"circle","y-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Image=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><image/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Image",attrs:{text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,ref:"image","y-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.Path=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><path/></g><text/></g>',defaults:joint.util.deepSupplement({type:"basic.Path",size:{width:60,height:60},attrs:{path:{fill:"#FFFFFF",stroke:"black"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,ref:"path","y-alignment":"middle",fill:"black","font-family":"Arial, helvetica, sans-serif"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.basic.PortsModelInterface={initialize:function(){this.updatePortsAttrs(),this.on("change:inPorts change:outPorts",this.updatePortsAttrs,this),this.constructor.__super__.constructor.__super__.initialize.apply(this,arguments)},updatePortsAttrs:function(){var t=this.get("attrs");_.each(this._portSelectors,function(e){t[e]&&delete t[e]}),this._portSelectors=[];var e={};_.each(this.get("inPorts"),function(t,i,n){var r=this.getPortAttrs(t,i,n.length,".inPorts","in");this._portSelectors=this._portSelectors.concat(_.keys(r)),_.extend(e,r)},this),_.each(this.get("outPorts"),function(t,i,n){var r=this.getPortAttrs(t,i,n.length,".outPorts","out");this._portSelectors=this._portSelectors.concat(_.keys(r)),_.extend(e,r)},this),this.attr(e,{silent:!0}),this.processPorts(),this.trigger("process:ports")},getPortSelector:function(t){var e=".inPorts",i=this.get("inPorts").indexOf(t);if(0>i&&(e=".outPorts",i=this.get("outPorts").indexOf(t),0>i))throw Error("getPortSelector(): Port doesn't exist.");return e+">g:nth-child("+(i+1)+")>circle"}},joint.shapes.basic.PortsViewInterface={initialize:function(){this.listenTo(this.model,"process:ports",this.update),joint.dia.ElementView.prototype.initialize.apply(this,arguments)},update:function(){this.renderPorts(),joint.dia.ElementView.prototype.update.apply(this,arguments)},renderPorts:function(){var t=this.$(".inPorts").empty(),e=this.$(".outPorts").empty(),i=_.template(this.model.portMarkup);_.each(_.filter(this.model.ports,function(t){return"in"===t.type}),function(e,n){t.append(V(i({id:n,port:e})).node)}),_.each(_.filter(this.model.ports,function(t){return"out"===t.type}),function(t,n){e.append(V(i({id:n,port:t})).node)})}},joint.shapes.basic.TextBlock=joint.shapes.basic.Generic.extend({markup:['<g class="rotatable"><g class="scalable"><rect/></g><switch>','<foreignObject requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" class="fobj">','<body xmlns="http://www.w3.org/1999/xhtml"><div/></body>',"</foreignObject>",'<text class="content"/>',"</switch></g>"].join(""),defaults:joint.util.deepSupplement({type:"basic.TextBlock",attrs:{rect:{fill:"#ffffff",stroke:"#000000",width:80,height:100},text:{fill:"#000000","font-size":14,"font-family":"Arial, helvetica, sans-serif"},".content":{text:"",ref:"rect","ref-x":.5,"ref-y":.5,"y-alignment":"middle","x-alignment":"middle"}},content:""},joint.shapes.basic.Generic.prototype.defaults),initialize:function(){"undefined"!=typeof SVGForeignObjectElement&&(this.setForeignObjectSize(this,this.get("size")),this.setDivContent(this,this.get("content")),this.listenTo(this,"change:size",this.setForeignObjectSize),this.listenTo(this,"change:content",this.setDivContent)),joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments)},setForeignObjectSize:function(t,e){t.attr({".fobj":_.clone(e),div:{style:_.clone(e)}})},setDivContent:function(t,e){t.attr({div:{html:e}})}}),joint.shapes.basic.TextBlockView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),"undefined"==typeof SVGForeignObjectElement&&(this.noSVGForeignObjectElement=!0,this.listenTo(this.model,"change:content",function(t){this.updateContent(t)}))},update:function(t,e){if(this.noSVGForeignObjectElement){var i=this.model,n=_.omit(e||i.get("attrs"),".content");joint.dia.ElementView.prototype.update.call(this,i,n),(!e||_.has(e,".content"))&&this.updateContent(i,e)}else joint.dia.ElementView.prototype.update.call(this,i,e)},updateContent:function(t,e){var i=_.merge({},(e||t.get("attrs"))[".content"]);delete i.text;var n=joint.util.breakText(t.get("content"),t.get("size"),i,{svgDocument:this.paper.svg}),r=joint.util.setByPath({},".content",i,"/");r[".content"].text=n,joint.dia.ElementView.prototype.update.call(this,t,r)}}),"object"==typeof exports&&(module.exports=joint.shapes.basic),joint.routers.orthogonal=function(){function t(t,e){return t.y<e.y&&t.x===e.x?"down":t.y>e.y&&t.x===e.x?"up":t.x<e.x&&t.y===e.y?"right":"left"}function e(t,e,i){var n;if(n=t.x<e.x?t.y>e.y?["up","right"]:t.y<e.y?["down","right"]:["right"]:t.x>e.x?t.y>e.y?["up","left"]:t.y<e.y?["down","left"]:["left"]:t.y>e.y?["up"]:["down"],_.contains(n,i))return i;var r=_.first(n);switch(i){case"down":if("up"===r)return _.last(n);break;case"up":if("down"===r)return _.last(n);break;case"left":if("right"===r)return _.last(n);break;case"right":if("left"===r)return _.last(n)}return r}function i(t,i,n){var r=e(t,i,n);return"down"===r||"up"===r?{x:t.x,y:i.y,d:r}:{x:i.x,y:t.y,d:r}}function n(e){e=(e||[]).slice();var n=[],s=r.center(),o=a.center();e.length||(Math.abs(s.x-o.x)<r.width/2||Math.abs(s.y-o.y)<r.height/2)&&(e=[{x:Math.min(s.x,o.x)+Math.abs(s.x-o.x)/2,y:Math.min(s.y,o.y)+Math.abs(s.y-o.y)/2}]),e.unshift(s),e.push(o);for(var l,c,h,u,p=0;e.length-1>p;p++){h=e[p],u=e[p+1],c=_.last(n),p>0&&(l=h,l.d=c?t(c,h):"top",n.push(l),c=l);var d=c&&c.d;l=i(h,u,d),g.point(l).equals(g.point(h))||g.point(l).equals(g.point(u))||n.push(l)}return n}var r,a;return function(t){return r=this.sourceBBox,a=this.targetBBox,n(t)}}(),joint.routers.manhattan=function(){"use strict";function t(t,e){for(var i,n=[],r={x:0,y:0},a=e;i=t[a];){var s=i.difference(a);s.equals(r)||(n.unshift(a),r=s),a=i}return n.unshift(a),n}function e(t,e,i){var n=i.step,r=t.center(),a=_.chain(i.directionMap).pick(e).map(function(e){var i=e.x*t.width/2,a=e.y*t.height/2,s=g.point(r).offset(i,a).snapToGrid(n);return t.containsPoint(s)&&s.offset(e.x*n,e.y*n),s}).value();return a}function i(t,e,i){var n=360/i,r=Math.floor(t.theta(e)/n);return i-r}function n(n,r,a,s){var o=s.reversed?s.endDirections:s.startDirections,l=s.reversed?s.startDirections:s.endDirections,c=n instanceof g.rect?e(n,o,s):[n],h=r instanceof g.rect?e(r,l,s):[r],u=c.length>1?n.center():c[0],p=h.length>1?r.center():h[0],d=_.filter(h,function(t){var e=""+g.point(t).snapToGrid(s.mapGridSize),i=_.every(a[e],function(e){return!e.containsPoint(t)});return i});if(d.length)for(var f=s.step,m=s.penalties,I=_.chain(d).invoke("snapToGrid",f).min(function(t){return s.estimateCost(u,t)}).value(),y={},v={},C={},b=s.directions,A=b.length,w=A/2,x=s.previousDirIndexes||{},M={},j={},N=_.chain(c).invoke("snapToGrid",f).each(function(t){var e=""+t;v[e]=0,C[e]=s.estimateCost(t,I),x[e]=x[e]||i(u,t,A),j[e]=!0}).map(function(t){return""+t}).sortBy(function(t){return C[t]}).value(),k=s.maximumLoops,D=s.maxAllowedDirectionChange;N.length&&k--;){var z=N[0],S=g.point(z);if(I.equals(S))return s.previousDirIndexes=_.pick(x,z),t(y,S);N.splice(0,1),j[P]=null,M[P]=!0;for(var T=x[z],E=v[z],G=0;A>G;G++){var L=Math.abs(G-T);if(L>w&&(L=A-L),!(L>D)){var B=b[G],Z=g.point(S).offset(B.offsetX,B.offsetY),P=""+Z;if(!M[P]){var O=""+g.point(Z).snapToGrid(s.mapGridSize),Y=_.every(a[O],function(t){return!t.containsPoint(Z)});if(Y){var W=_.has(j,P),V=E+B.cost;if((!W||v[P]>V)&&(y[P]=S,x[P]=G,v[P]=V,C[P]=V+s.estimateCost(Z,I)+m[L],!W)){var R=_.sortedIndex(N,P,function(t){return C[t]});N.splice(R,0,P),j[P]=!0}}}}}}return s.fallbackRoute(u,p,s)}function r(t,e){e.directions=_.result(e,"directions"),e.penalties=_.result(e,"penalties"),e.paddingBox=_.result(e,"paddingBox"),this.options.perpendicular=!!e.perpendicular;var i=e.reversed="source"===this.lastEndChange,r=i?g.rect(this.targetBBox):g.rect(this.sourceBBox),a=i?g.rect(this.sourceBBox):g.rect(this.targetBBox);r.moveAndExpand(e.paddingBox),a.moveAndExpand(e.paddingBox);for(var s=this.model,o=this.paper.model,l=_.chain(e.excludeEnds).map(s.get,s).pluck("id").map(o.getCell,o).value(),c=e.mapGridSize,h=_.chain(o.getElements()).difference(l).reject(function(t){return _.contains(e.excludeTypes,t.get("type"))}).invoke("getBBox").invoke("moveAndExpand",e.paddingBox).foldl(function(t,e){for(var i=e.origin().snapToGrid(c),n=e.corner().snapToGrid(c),r=i.x;n.x>=r;r+=c)for(var a=i.y;n.y>=a;a+=c){var s=r+"@"+a;t[s]=t[s]||[],t[s].push(e)}return t},{}).value(),u=[],p=_.map(t,g.point),d=r.center(),f=0,m=p.length;m>=f;f++){var I=null,y=v||r,v=p[f];if(!v){v=a;var C=!this.model.get("source").id||!this.model.get("target").id;if(C&&_.isFunction(e.draggingRoute)){var b=y instanceof g.rect?y.center():y;I=e.draggingRoute(b,v.origin(),e)}}I=I||n(y,v,h,e);var A=_.first(I);A&&A.equals(d)&&I.shift(),d=_.last(I)||d,u=u.concat(I)}return i?u.reverse():u}var a={step:10,perpendicular:!0,mapGridSize:100,excludeEnds:[],excludeTypes:["basic.Text"],maximumLoops:500,startDirections:["left","right","top","bottom"],endDirections:["left","right","top","bottom"],directionMap:{right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0},top:{x:0,y:-1}},maxAllowedDirectionChange:1,paddingBox:function(){var t=this.step;return{x:-t,y:-t,width:2*t,height:2*t}},directions:function(){var t=this.step;return[{offsetX:t,offsetY:0,cost:t},{offsetX:0,offsetY:t,cost:t},{offsetX:-t,offsetY:0,cost:t},{offsetX:0,offsetY:-t,cost:t}]},penalties:function(){return[0,this.step/2,this.step]},estimateCost:function(t,e){return t.manhattanDistance(e)},fallbackRoute:function(t,e,i){var n=i.prevDirIndexes||{},r=(n[t]||0)%2?g.point(t.x,e.y):g.point(e.x,t.y);return[r,e]},draggingRoute:null};return function(t,e,i){return r.call(i,t,_.extend({},a,e))}}(),joint.routers.metro=function(){if(!_.isFunction(joint.routers.manhattan))throw"Metro requires the manhattan router.";var t={diagonalCost:null,directions:function(){var t=this.step,e=this.diagonalCost||Math.ceil(Math.sqrt(t*t<<1));return[{offsetX:t,offsetY:0,cost:t},{offsetX:t,offsetY:t,cost:e},{offsetX:0,offsetY:t,cost:t},{offsetX:-t,offsetY:t,cost:e},{offsetX:-t,offsetY:0,cost:t},{offsetX:-t,offsetY:-t,cost:e},{offsetX:0,offsetY:-t,cost:t},{offsetX:t,offsetY:-t,cost:e}]},fallbackRoute:function(t,e){var i=t.theta(e),n={x:e.x,y:t.y},r={x:t.x,y:e.y};if(i%180>90){var a=n;n=r,r=a}var s=45>i%90?n:r,o=g.line(t,s),l=90*Math.ceil(i/90),c=g.point.fromPolar(o.squaredLength(),g.toRad(l+135),s),h=g.line(e,c),u=o.intersection(h);return u?[u.round(),e]:[e]}};return function(e,i,n){return joint.routers.manhattan(e,_.extend({},t,i),n)}}(),joint.connectors.normal=function(t,e,i){var n=["M",t.x,t.y];return _.each(i,function(t){n.push(t.x,t.y)}),n.push(e.x,e.y),n.join(" ")},joint.connectors.rounded=function(t,e,i,n){var r,a,s,o,l,c,h=n.radius||10,u=["M",t.x,t.y];return _.each(i,function(n,p){l=i[p-1]||t,c=i[p+1]||e,s=o||g.point(n).distance(l)/2,o=g.point(n).distance(c)/2,r=g.point(n).move(l,-Math.min(h,s)).round(),a=g.point(n).move(c,-Math.min(h,o)).round(),u.push(r.x,r.y,"S",n.x,n.y,a.x,a.y,"L")}),u.push(e.x,e.y),u.join(" ")},joint.connectors.smooth=function(t,e,i){var n;if(i.length)n=g.bezier.curveThroughPoints([t].concat(i).concat([e]));else{var r=t.x<e.x?e.x-(e.x-t.x)/2:t.x-(t.x-e.x)/2;n=["M",t.x,t.y,"C",r,t.y,r,e.y,e.x,e.y]}return n.join(" ")},"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{},dia:{Element:require("../src/joint.dia.element").Element,Link:require("../src/joint.dia.link").Link}};if(joint.shapes.erd={},joint.shapes.erd.Entity=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="outer"/><polygon class="inner"/></g><text/></g>',defaults:joint.util.deepSupplement({type:"erd.Entity",size:{width:150,height:60},attrs:{".outer":{fill:"#2ECC71",stroke:"#27AE60","stroke-width":2,points:"100,0 100,60 0,60 0,0"},".inner":{fill:"#2ECC71",stroke:"#27AE60","stroke-width":2,points:"95,5 95,55 5,55 5,5",display:"none"},text:{text:"Entity","font-family":"Arial","font-size":14,ref:".outer","ref-x":.5,"ref-y":.5,"x-alignment":"middle","y-alignment":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.erd.WeakEntity=joint.shapes.erd.Entity.extend({defaults:joint.util.deepSupplement({type:"erd.WeakEntity",attrs:{".inner":{display:"auto"},text:{text:"Weak Entity"}}},joint.shapes.erd.Entity.prototype.defaults)}),joint.shapes.erd.Relationship=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="outer"/><polygon class="inner"/></g><text/></g>',defaults:joint.util.deepSupplement({type:"erd.Relationship",size:{width:80,height:80},attrs:{".outer":{fill:"#3498DB",stroke:"#2980B9","stroke-width":2,points:"40,0 80,40 40,80 0,40"},".inner":{fill:"#3498DB",stroke:"#2980B9","stroke-width":2,points:"40,5 75,40 40,75 5,40",display:"none"},text:{text:"Relationship","font-family":"Arial","font-size":12,ref:".","ref-x":.5,"ref-y":.5,"x-alignment":"middle","y-alignment":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.erd.IdentifyingRelationship=joint.shapes.erd.Relationship.extend({defaults:joint.util.deepSupplement({type:"erd.IdentifyingRelationship",attrs:{".inner":{display:"auto"},text:{text:"Identifying"}}},joint.shapes.erd.Relationship.prototype.defaults)}),joint.shapes.erd.Attribute=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><ellipse class="outer"/><ellipse class="inner"/></g><text/></g>',defaults:joint.util.deepSupplement({type:"erd.Attribute",size:{width:100,height:50},attrs:{ellipse:{transform:"translate(50, 25)"},".outer":{stroke:"#D35400","stroke-width":2,cx:0,cy:0,rx:50,ry:25,fill:"#E67E22"},".inner":{stroke:"#D35400","stroke-width":2,cx:0,cy:0,rx:45,ry:20,fill:"transparent",display:"none"},text:{"font-family":"Arial","font-size":14,ref:".","ref-x":.5,"ref-y":.5,"x-alignment":"middle","y-alignment":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.erd.Multivalued=joint.shapes.erd.Attribute.extend({defaults:joint.util.deepSupplement({type:"erd.Multivalued",attrs:{".inner":{display:"block"},text:{text:"multivalued"}}},joint.shapes.erd.Attribute.prototype.defaults)}),joint.shapes.erd.Derived=joint.shapes.erd.Attribute.extend({defaults:joint.util.deepSupplement({type:"erd.Derived",attrs:{".outer":{"stroke-dasharray":"3,5"},text:{text:"derived"}}},joint.shapes.erd.Attribute.prototype.defaults)}),joint.shapes.erd.Key=joint.shapes.erd.Attribute.extend({defaults:joint.util.deepSupplement({type:"erd.Key",attrs:{ellipse:{"stroke-width":4},text:{text:"key","font-weight":"bold","text-decoration":"underline"}}},joint.shapes.erd.Attribute.prototype.defaults)}),joint.shapes.erd.Normal=joint.shapes.erd.Attribute.extend({defaults:joint.util.deepSupplement({type:"erd.Normal",attrs:{text:{text:"Normal"}}},joint.shapes.erd.Attribute.prototype.defaults)}),joint.shapes.erd.ISA=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon/></g><text/></g>',defaults:joint.util.deepSupplement({type:"erd.ISA",size:{width:100,height:50},attrs:{polygon:{points:"0,0 50,50 100,0",fill:"#F1C40F",stroke:"#F39C12","stroke-width":2},text:{text:"ISA",ref:".","ref-x":.5,"ref-y":.3,"x-alignment":"middle","y-alignment":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.erd.Line=joint.dia.Link.extend({defaults:{type:"erd.Line"},cardinality:function(t){this.set("labels",[{position:-20,attrs:{text:{dy:-8,text:t}}}])}}),"object"==typeof exports&&(module.exports=joint.shapes.erd),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{basic:require("./joint.shapes.basic")},dia:{Element:require("../src/joint.dia.element").Element,Link:require("../src/joint.dia.link").Link}};if(joint.shapes.fsa={},joint.shapes.fsa.State=joint.shapes.basic.Circle.extend({defaults:joint.util.deepSupplement({type:"fsa.State",attrs:{circle:{"stroke-width":3},text:{"font-weight":"bold"}}},joint.shapes.basic.Circle.prototype.defaults)}),joint.shapes.fsa.StartState=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><circle/></g></g>',defaults:joint.util.deepSupplement({type:"fsa.StartState",size:{width:20,height:20},attrs:{circle:{transform:"translate(10, 10)",r:10,fill:"black"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.fsa.EndState=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><circle class="outer"/><circle class="inner"/></g></g>',defaults:joint.util.deepSupplement({type:"fsa.EndState",size:{width:20,height:20},attrs:{".outer":{transform:"translate(10, 10)",r:10,fill:"#FFFFFF",stroke:"black"},".inner":{transform:"translate(10, 10)",r:6,fill:"#000000"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.fsa.Arrow=joint.dia.Link.extend({defaults:joint.util.deepSupplement({type:"fsa.Arrow",attrs:{".marker-target":{d:"M 10 0 L 0 5 L 10 10 z"}},smooth:!0},joint.dia.Link.prototype.defaults)}),"object"==typeof exports&&(module.exports=joint.shapes.fsa),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{},dia:{Element:require("../src/joint.dia.element").Element,Link:require("../src/joint.dia.link").Link}};if(joint.shapes.org={},joint.shapes.org.Member=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><rect class="card"/><image/></g><text class="rank"/><text class="name"/></g>',defaults:joint.util.deepSupplement({type:"org.Member",size:{width:180,height:70},attrs:{rect:{width:170,height:60},".card":{fill:"#FFFFFF",stroke:"#000000","stroke-width":2,"pointer-events":"visiblePainted",rx:10,ry:10},image:{width:48,height:48,ref:".card","ref-x":10,"ref-y":5},".rank":{"text-decoration":"underline",ref:".card","ref-x":.9,"ref-y":.2,"font-family":"Courier New","font-size":14,"text-anchor":"end"},".name":{"font-weight":"bold",ref:".card","ref-x":.9,"ref-y":.6,"font-family":"Courier New","font-size":14,"text-anchor":"end"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.org.Arrow=joint.dia.Link.extend({defaults:{type:"org.Arrow",source:{selector:".card"},target:{selector:".card"},attrs:{".connection":{stroke:"#585858","stroke-width":3}},z:-1}}),"object"==typeof exports&&(module.exports=joint.shapes.org),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{basic:require("./joint.shapes.basic")},dia:{}};
21 if(joint.shapes.chess={},joint.shapes.chess.KingWhite=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;"><path      d="M 22.5,11.63 L 22.5,6"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />    <path      d="M 20,8 L 25,8"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />    <path      d="M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25"      style="fill:#ffffff; stroke:#000000; stroke-linecap:butt; stroke-linejoin:miter;" />    <path      d="M 11.5,37 C 17,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 19,16 9.5,13 6.5,19.5 C 3.5,25.5 11.5,29.5 11.5,29.5 L 11.5,37 z "      style="fill:#ffffff; stroke:#000000;" />    <path      d="M 11.5,30 C 17,27 27,27 32.5,30"      style="fill:none; stroke:#000000;" />    <path      d="M 11.5,33.5 C 17,30.5 27,30.5 32.5,33.5"      style="fill:none; stroke:#000000;" />    <path      d="M 11.5,37 C 17,34 27,34 32.5,37"      style="fill:none; stroke:#000000;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.KingWhite",size:{width:42,height:38}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.KingBlack=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path       d="M 22.5,11.63 L 22.5,6"       style="fill:none; stroke:#000000; stroke-linejoin:miter;"       id="path6570" />    <path       d="M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25"       style="fill:#000000;fill-opacity:1; stroke-linecap:butt; stroke-linejoin:miter;" />    <path       d="M 11.5,37 C 17,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 19,16 9.5,13 6.5,19.5 C 3.5,25.5 11.5,29.5 11.5,29.5 L 11.5,37 z "       style="fill:#000000; stroke:#000000;" />    <path       d="M 20,8 L 25,8"       style="fill:none; stroke:#000000; stroke-linejoin:miter;" />    <path       d="M 32,29.5 C 32,29.5 40.5,25.5 38.03,19.85 C 34.15,14 25,18 22.5,24.5 L 22.51,26.6 L 22.5,24.5 C 20,18 9.906,14 6.997,19.85 C 4.5,25.5 11.85,28.85 11.85,28.85"       style="fill:none; stroke:#ffffff;" />    <path       d="M 11.5,30 C 17,27 27,27 32.5,30 M 11.5,33.5 C 17,30.5 27,30.5 32.5,33.5 M 11.5,37 C 17,34 27,34 32.5,37"       style="fill:none; stroke:#ffffff;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.KingBlack",size:{width:42,height:38}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.QueenWhite=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(-1,-1)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(15.5,-5.5)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(32,-1)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(7,-4.5)" />    <path      d="M 9 13 A 2 2 0 1 1  5,13 A 2 2 0 1 1  9 13 z"      transform="translate(24,-4)" />    <path      d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38,14 L 31,25 L 31,11 L 25.5,24.5 L 22.5,9.5 L 19.5,24.5 L 14,10.5 L 14,25 L 7,14 L 9,26 z "      style="stroke-linecap:butt;" />    <path      d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 10.5,36 10.5,36 C 9,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z "      style="stroke-linecap:butt;" />    <path      d="M 11.5,30 C 15,29 30,29 33.5,30"      style="fill:none;" />    <path      d="M 12,33.5 C 18,32.5 27,32.5 33,33.5"      style="fill:none;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.QueenWhite",size:{width:42,height:38}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.QueenBlack=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <g style="fill:#000000; stroke:none;">      <circle cx="6"    cy="12" r="2.75" />      <circle cx="14"   cy="9"  r="2.75" />      <circle cx="22.5" cy="8"  r="2.75" />      <circle cx="31"   cy="9"  r="2.75" />      <circle cx="39"   cy="12" r="2.75" />    </g>    <path       d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"       style="stroke-linecap:butt; stroke:#000000;" />    <path       d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 10.5,36 10.5,36 C 9,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"       style="stroke-linecap:butt;" />    <path       d="M 11,38.5 A 35,35 1 0 0 34,38.5"       style="fill:none; stroke:#000000; stroke-linecap:butt;" />    <path       d="M 11,29 A 35,35 1 0 1 34,29"       style="fill:none; stroke:#ffffff;" />    <path       d="M 12.5,31.5 L 32.5,31.5"       style="fill:none; stroke:#ffffff;" />    <path       d="M 11.5,34.5 A 35,35 1 0 0 33.5,34.5"       style="fill:none; stroke:#ffffff;" />    <path       d="M 10.5,37.5 A 35,35 1 0 0 34.5,37.5"       style="fill:none; stroke:#ffffff;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.QueenBlack",size:{width:42,height:38}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.RookWhite=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "      style="stroke-linecap:butt;" />    <path      d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "      style="stroke-linecap:butt;" />    <path      d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14"      style="stroke-linecap:butt;" />    <path      d="M 34,14 L 31,17 L 14,17 L 11,14" />    <path      d="M 31,17 L 31,29.5 L 14,29.5 L 14,17"      style="stroke-linecap:butt; stroke-linejoin:miter;" />    <path      d="M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5" />    <path      d="M 11,14 L 34,14"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.RookWhite",size:{width:32,height:34}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.RookBlack=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "      style="stroke-linecap:butt;" />    <path      d="M 12.5,32 L 14,29.5 L 31,29.5 L 32.5,32 L 12.5,32 z "      style="stroke-linecap:butt;" />    <path      d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "      style="stroke-linecap:butt;" />    <path      d="M 14,29.5 L 14,16.5 L 31,16.5 L 31,29.5 L 14,29.5 z "      style="stroke-linecap:butt;stroke-linejoin:miter;" />    <path      d="M 14,16.5 L 11,14 L 34,14 L 31,16.5 L 14,16.5 z "      style="stroke-linecap:butt;" />    <path      d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14 L 11,14 z "      style="stroke-linecap:butt;" />    <path      d="M 12,35.5 L 33,35.5 L 33,35.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 13,31.5 L 32,31.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 14,29.5 L 31,29.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 14,16.5 L 31,16.5"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />    <path      d="M 11,14 L 34,14"      style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.RookBlack",size:{width:32,height:34}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.BishopWhite=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <g style="fill:#ffffff; stroke:#000000; stroke-linecap:butt;">       <path        d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.646,38.99 6.677,38.97 6,38 C 7.354,36.06 9,36 9,36 z" />      <path        d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z" />      <path        d="M 25 8 A 2.5 2.5 0 1 1  20,8 A 2.5 2.5 0 1 1  25 8 z" />    </g>    <path      d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18"      style="fill:none; stroke:#000000; stroke-linejoin:miter;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.BishopWhite",size:{width:38,height:38}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.BishopBlack=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <g style="fill:#000000; stroke:#000000; stroke-linecap:butt;">       <path        d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.646,38.99 6.677,38.97 6,38 C 7.354,36.06 9,36 9,36 z" />      <path        d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z" />      <path        d="M 25 8 A 2.5 2.5 0 1 1  20,8 A 2.5 2.5 0 1 1  25 8 z" />    </g>    <path       d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18"       style="fill:none; stroke:#ffffff; stroke-linejoin:miter;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.BishopBlack",size:{width:38,height:38}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.KnightWhite=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18"      style="fill:#ffffff; stroke:#000000;" />    <path      d="M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10"      style="fill:#ffffff; stroke:#000000;" />    <path      d="M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z"      style="fill:#000000; stroke:#000000;" />    <path      d="M 15 15.5 A 0.5 1.5 0 1 1  14,15.5 A 0.5 1.5 0 1 1  15 15.5 z"      transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"      style="fill:#000000; stroke:#000000;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.KnightWhite",size:{width:38,height:37}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.KnightBlack=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><g style="opacity:1; fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">    <path      d="M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18"      style="fill:#000000; stroke:#000000;" />    <path      d="M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10"      style="fill:#000000; stroke:#000000;" />    <path      d="M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z"      style="fill:#ffffff; stroke:#ffffff;" />    <path      d="M 15 15.5 A 0.5 1.5 0 1 1  14,15.5 A 0.5 1.5 0 1 1  15 15.5 z"      transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"      style="fill:#ffffff; stroke:#ffffff;" />    <path      d="M 24.55,10.4 L 24.1,11.85 L 24.6,12 C 27.75,13 30.25,14.49 32.5,18.75 C 34.75,23.01 35.75,29.06 35.25,39 L 35.2,39.5 L 37.45,39.5 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 C 31.88,13.17 28.46,11.02 25.06,10.5 L 24.55,10.4 z "      style="fill:#ffffff; stroke:none;" />  </g></g></g>',defaults:joint.util.deepSupplement({type:"chess.KnightBlack",size:{width:38,height:37}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.PawnWhite=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><path d="M 22,9 C 19.79,9 18,10.79 18,13 C 18,13.89 18.29,14.71 18.78,15.38 C 16.83,16.5 15.5,18.59 15.5,21 C 15.5,23.03 16.44,24.84 17.91,26.03 C 14.91,27.09 10.5,31.58 10.5,39.5 L 33.5,39.5 C 33.5,31.58 29.09,27.09 26.09,26.03 C 27.56,24.84 28.5,23.03 28.5,21 C 28.5,18.59 27.17,16.5 25.22,15.38 C 25.71,14.71 26,13.89 26,13 C 26,10.79 24.21,9 22,9 z "  style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" /></g></g>',defaults:joint.util.deepSupplement({type:"chess.PawnWhite",size:{width:28,height:33}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.chess.PawnBlack=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><path d="M 22,9 C 19.79,9 18,10.79 18,13 C 18,13.89 18.29,14.71 18.78,15.38 C 16.83,16.5 15.5,18.59 15.5,21 C 15.5,23.03 16.44,24.84 17.91,26.03 C 14.91,27.09 10.5,31.58 10.5,39.5 L 33.5,39.5 C 33.5,31.58 29.09,27.09 26.09,26.03 C 27.56,24.84 28.5,23.03 28.5,21 C 28.5,18.59 27.17,16.5 25.22,15.38 C 25.71,14.71 26,13.89 26,13 C 26,10.79 24.21,9 22,9 z "  style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" /></g></g>',defaults:joint.util.deepSupplement({type:"chess.PawnBlack",size:{width:28,height:33}},joint.shapes.basic.Generic.prototype.defaults)}),"object"==typeof exports&&(module.exports=joint.shapes.chess),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{basic:require("./joint.shapes.basic")},dia:{ElementView:require("../src/joint.dia.element").ElementView,Link:require("../src/joint.dia.link").Link}};if(joint.shapes.pn={},joint.shapes.pn.Place=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><circle class="root"/><g class="tokens" /></g><text class="label"/></g>',defaults:joint.util.deepSupplement({type:"pn.Place",size:{width:50,height:50},attrs:{".root":{r:25,fill:"white",stroke:"black",transform:"translate(25, 25)"},".label":{"text-anchor":"middle","ref-x":.5,"ref-y":-20,ref:".root",fill:"black","font-size":12},".tokens > circle":{fill:"black",r:5},".tokens.one > circle":{transform:"translate(25, 25)"},".tokens.two > circle:nth-child(1)":{transform:"translate(19, 25)"},".tokens.two > circle:nth-child(2)":{transform:"translate(31, 25)"},".tokens.three > circle:nth-child(1)":{transform:"translate(18, 29)"},".tokens.three > circle:nth-child(2)":{transform:"translate(25, 19)"},".tokens.three > circle:nth-child(3)":{transform:"translate(32, 29)"},".tokens.alot > text":{transform:"translate(25, 18)","text-anchor":"middle",fill:"black"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.pn.PlaceView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.model.on("change:tokens",function(){this.renderTokens(),this.update()},this)},render:function(){joint.dia.ElementView.prototype.render.apply(this,arguments),this.renderTokens(),this.update()},renderTokens:function(){var t=this.$(".tokens").empty();t[0].className.baseVal="tokens";var e=this.model.get("tokens");if(e)switch(e){case 1:t[0].className.baseVal+=" one",t.append(V("<circle/>").node);break;case 2:t[0].className.baseVal+=" two",t.append(V("<circle/>").node,V("<circle/>").node);break;case 3:t[0].className.baseVal+=" three",t.append(V("<circle/>").node,V("<circle/>").node,V("<circle/>").node);break;default:t[0].className.baseVal+=" alot",t.append(V("<text/>").text(e+"").node)}}}),joint.shapes.pn.Transition=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><rect class="root"/></g></g><text class="label"/>',defaults:joint.util.deepSupplement({type:"pn.Transition",size:{width:12,height:50},attrs:{rect:{width:12,height:50,fill:"black",stroke:"black"},".label":{"text-anchor":"middle","ref-x":.5,"ref-y":-20,ref:"rect",fill:"black","font-size":12}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.pn.Link=joint.dia.Link.extend({defaults:joint.util.deepSupplement({attrs:{".marker-target":{d:"M 10 0 L 0 5 L 10 10 z"}}},joint.dia.Link.prototype.defaults)}),"object"==typeof exports&&(module.exports=joint.shapes.pn),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{basic:require("./joint.shapes.basic")},dia:{ElementView:require("../src/joint.dia.element").ElementView,Link:require("../src/joint.dia.link").Link}},_=require("lodash");if(joint.shapes.devs={},joint.shapes.devs.Model=joint.shapes.basic.Generic.extend(_.extend({},joint.shapes.basic.PortsModelInterface,{markup:'<g class="rotatable"><g class="scalable"><rect/></g><text class="label"/><g class="inPorts"/><g class="outPorts"/></g>',portMarkup:'<g class="port<%= id %>"><circle/><text/></g>',defaults:joint.util.deepSupplement({type:"devs.Model",size:{width:1,height:1},inPorts:[],outPorts:[],attrs:{".":{magnet:!1},rect:{width:150,height:250,stroke:"black"},circle:{r:10,magnet:!0,stroke:"black"},text:{fill:"black","pointer-events":"none"},".label":{text:"Model","ref-x":.3,"ref-y":.2},".inPorts text":{x:-15,dy:4,"text-anchor":"end"},".outPorts text":{x:15,dy:4}}},joint.shapes.basic.Generic.prototype.defaults),getPortAttrs:function(t,e,i,n,r){var a={},s="port"+e,o=n+">."+s,l=o+">text",c=o+">circle";return a[l]={text:t},a[c]={port:{id:t||_.uniqueId(r),type:r}},a[o]={ref:"rect","ref-y":(e+.5)*(1/i)},".outPorts"===n&&(a[o]["ref-dx"]=0),a}})),joint.shapes.devs.Atomic=joint.shapes.devs.Model.extend({defaults:joint.util.deepSupplement({type:"devs.Atomic",size:{width:80,height:80},attrs:{rect:{fill:"salmon"},".label":{text:"Atomic"},".inPorts circle":{fill:"PaleGreen"},".outPorts circle":{fill:"Tomato"}}},joint.shapes.devs.Model.prototype.defaults)}),joint.shapes.devs.Coupled=joint.shapes.devs.Model.extend({defaults:joint.util.deepSupplement({type:"devs.Coupled",size:{width:200,height:300},attrs:{rect:{fill:"seaGreen"},".label":{text:"Coupled"},".inPorts circle":{fill:"PaleGreen"},".outPorts circle":{fill:"Tomato"}}},joint.shapes.devs.Model.prototype.defaults)}),joint.shapes.devs.Link=joint.dia.Link.extend({defaults:{type:"devs.Link",attrs:{".connection":{"stroke-width":2}}}}),joint.shapes.devs.ModelView=joint.dia.ElementView.extend(joint.shapes.basic.PortsViewInterface),joint.shapes.devs.AtomicView=joint.shapes.devs.ModelView,joint.shapes.devs.CoupledView=joint.shapes.devs.ModelView,"object"==typeof exports&&(module.exports=joint.shapes.devs),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{basic:require("./joint.shapes.basic")},dia:{ElementView:require("../src/joint.dia.element").ElementView,Link:require("../src/joint.dia.link").Link}},_=require("lodash");if(joint.shapes.uml={},joint.shapes.uml.Class=joint.shapes.basic.Generic.extend({markup:['<g class="rotatable">','<g class="scalable">','<rect class="uml-class-name-rect"/><rect class="uml-class-attrs-rect"/><rect class="uml-class-methods-rect"/>',"</g>",'<text class="uml-class-name-text"/><text class="uml-class-attrs-text"/><text class="uml-class-methods-text"/>',"</g>"].join(""),defaults:joint.util.deepSupplement({type:"uml.Class",attrs:{rect:{width:200},".uml-class-name-rect":{stroke:"black","stroke-width":2,fill:"#3498db"},".uml-class-attrs-rect":{stroke:"black","stroke-width":2,fill:"#2980b9"},".uml-class-methods-rect":{stroke:"black","stroke-width":2,fill:"#2980b9"},".uml-class-name-text":{ref:".uml-class-name-rect","ref-y":.5,"ref-x":.5,"text-anchor":"middle","y-alignment":"middle","font-weight":"bold",fill:"black","font-size":12,"font-family":"Times New Roman"},".uml-class-attrs-text":{ref:".uml-class-attrs-rect","ref-y":5,"ref-x":5,fill:"black","font-size":12,"font-family":"Times New Roman"},".uml-class-methods-text":{ref:".uml-class-methods-rect","ref-y":5,"ref-x":5,fill:"black","font-size":12,"font-family":"Times New Roman"}},name:[],attributes:[],methods:[]},joint.shapes.basic.Generic.prototype.defaults),initialize:function(){_.bindAll(this,"updateRectangles"),this.on("change:name change:attributes change:methods",function(){this.updateRectangles(),this.trigger("uml-update")}),this.updateRectangles(),joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments)},getClassName:function(){return this.get("name")},updateRectangles:function(){var t=this.get("attrs"),e=[{type:"name",text:this.getClassName()},{type:"attrs",text:this.get("attributes")},{type:"methods",text:this.get("methods")}],i=0;_.each(e,function(e){var n=_.isArray(e.text)?e.text:[e.text],r=20*n.length+20;t[".uml-class-"+e.type+"-text"].text=n.join("\n"),t[".uml-class-"+e.type+"-rect"].height=r,t[".uml-class-"+e.type+"-rect"].transform="translate(0,"+i+")",i+=r})}}),joint.shapes.uml.ClassView=joint.dia.ElementView.extend({initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.model.on("uml-update",_.bind(function(){this.update(),this.resize()},this))}}),joint.shapes.uml.Abstract=joint.shapes.uml.Class.extend({defaults:joint.util.deepSupplement({type:"uml.Abstract",attrs:{".uml-class-name-rect":{fill:"#e74c3c"},".uml-class-attrs-rect":{fill:"#c0392b"},".uml-class-methods-rect":{fill:"#c0392b"}}},joint.shapes.uml.Class.prototype.defaults),getClassName:function(){return["<<Abstract>>",this.get("name")]}}),joint.shapes.uml.AbstractView=joint.shapes.uml.ClassView,joint.shapes.uml.Interface=joint.shapes.uml.Class.extend({defaults:joint.util.deepSupplement({type:"uml.Interface",attrs:{".uml-class-name-rect":{fill:"#f1c40f"},".uml-class-attrs-rect":{fill:"#f39c12"},".uml-class-methods-rect":{fill:"#f39c12"}}},joint.shapes.uml.Class.prototype.defaults),getClassName:function(){return["<<Interface>>",this.get("name")]}}),joint.shapes.uml.InterfaceView=joint.shapes.uml.ClassView,joint.shapes.uml.Generalization=joint.dia.Link.extend({defaults:{type:"uml.Generalization",attrs:{".marker-target":{d:"M 20 0 L 0 10 L 20 20 z",fill:"white"}}}}),joint.shapes.uml.Implementation=joint.dia.Link.extend({defaults:{type:"uml.Implementation",attrs:{".marker-target":{d:"M 20 0 L 0 10 L 20 20 z",fill:"white"},".connection":{"stroke-dasharray":"3,3"}}}}),joint.shapes.uml.Aggregation=joint.dia.Link.extend({defaults:{type:"uml.Aggregation",attrs:{".marker-target":{d:"M 40 10 L 20 20 L 0 10 L 20 0 z",fill:"white"}}}}),joint.shapes.uml.Composition=joint.dia.Link.extend({defaults:{type:"uml.Composition",attrs:{".marker-target":{d:"M 40 10 L 20 20 L 0 10 L 20 0 z",fill:"black"}}}}),joint.shapes.uml.Association=joint.dia.Link.extend({defaults:{type:"uml.Association"}}),joint.shapes.uml.State=joint.shapes.basic.Generic.extend({markup:['<g class="rotatable">','<g class="scalable">',"<rect/>","</g>",'<path/><text class="uml-state-name"/><text class="uml-state-events"/>',"</g>"].join(""),defaults:joint.util.deepSupplement({type:"uml.State",attrs:{rect:{width:200,height:200,fill:"#ecf0f1",stroke:"#bdc3c7","stroke-width":3,rx:10,ry:10},path:{d:"M 0 20 L 200 20",stroke:"#bdc3c7","stroke-width":2},".uml-state-name":{ref:"rect","ref-x":.5,"ref-y":5,"text-anchor":"middle","font-family":"Courier New","font-size":14,fill:"#000000"},".uml-state-events":{ref:"path","ref-x":5,"ref-y":5,"font-family":"Courier New","font-size":14,fill:"#000000"}},name:"State",events:[]},joint.shapes.basic.Generic.prototype.defaults),initialize:function(){_.bindAll(this,"updateEvents","updatePath"),this.on({"change:name":function(){this.updateName(),this.trigger("change:attrs")},"change:events":function(){this.updateEvents(),this.trigger("change:attrs")},"change:size":this.updatePath}),this.updateName(),this.updateEvents(),this.updatePath(),joint.shapes.basic.Generic.prototype.initialize.apply(this,arguments)},updateName:function(){this.get("attrs")[".uml-state-name"].text=this.get("name")},updateEvents:function(){this.get("attrs")[".uml-state-events"].text=this.get("events").join("\n")},updatePath:function(){this.get("attrs").path.d="M 0 20 L "+this.get("size").width+" 20"}}),joint.shapes.uml.StartState=joint.shapes.basic.Circle.extend({defaults:joint.util.deepSupplement({type:"uml.StartState",attrs:{circle:{fill:"#34495e",stroke:"#2c3e50","stroke-width":2,rx:1}}},joint.shapes.basic.Circle.prototype.defaults)}),joint.shapes.uml.EndState=joint.shapes.basic.Generic.extend({markup:'<g class="rotatable"><g class="scalable"><circle class="outer"/><circle class="inner"/></g></g>',defaults:joint.util.deepSupplement({type:"uml.EndState",size:{width:20,height:20},attrs:{"circle.outer":{transform:"translate(10, 10)",r:10,fill:"white",stroke:"#2c3e50"},"circle.inner":{transform:"translate(10, 10)",r:6,fill:"#34495e"}}},joint.shapes.basic.Generic.prototype.defaults)}),joint.shapes.uml.Transition=joint.dia.Link.extend({defaults:{type:"uml.Transition",attrs:{".marker-target":{d:"M 10 0 L 0 5 L 10 10 z",fill:"#34495e",stroke:"#2c3e50"},".connection":{stroke:"#2c3e50"}}}}),"object"==typeof exports&&(module.exports=joint.shapes.uml),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{basic:require("./joint.shapes.basic")},dia:{Link:require("../src/joint.dia.link").Link}};if(joint.shapes.logic={},joint.shapes.logic.Gate=joint.shapes.basic.Generic.extend({defaults:joint.util.deepSupplement({type:"logic.Gate",size:{width:80,height:40},attrs:{".":{magnet:!1},".body":{width:100,height:50},circle:{r:7,stroke:"black",fill:"transparent","stroke-width":2}}},joint.shapes.basic.Generic.prototype.defaults),operation:function(){return!0}}),joint.shapes.logic.IO=joint.shapes.logic.Gate.extend({markup:'<g class="rotatable"><g class="scalable"><rect class="body"/></g><path class="wire"/><circle/><text/></g>',defaults:joint.util.deepSupplement({type:"logic.IO",size:{width:60,height:30},attrs:{".body":{fill:"white",stroke:"black","stroke-width":2},".wire":{ref:".body","ref-y":.5,stroke:"black"},text:{fill:"black",ref:".body","ref-x":.5,"ref-y":.5,"y-alignment":"middle","text-anchor":"middle","font-weight":"bold","font-variant":"small-caps","text-transform":"capitalize","font-size":"14px"}}},joint.shapes.logic.Gate.prototype.defaults)}),joint.shapes.logic.Input=joint.shapes.logic.IO.extend({defaults:joint.util.deepSupplement({type:"logic.Input",attrs:{".wire":{"ref-dx":0,d:"M 0 0 L 23 0"},circle:{ref:".body","ref-dx":30,"ref-y":.5,magnet:!0,"class":"output",port:"out"},text:{text:"input"}}},joint.shapes.logic.IO.prototype.defaults)}),joint.shapes.logic.Output=joint.shapes.logic.IO.extend({defaults:joint.util.deepSupplement({type:"logic.Output",attrs:{".wire":{"ref-x":0,d:"M 0 0 L -23 0"},circle:{ref:".body","ref-x":-30,"ref-y":.5,magnet:"passive","class":"input",port:"in"},text:{text:"output"}}},joint.shapes.logic.IO.prototype.defaults)}),joint.shapes.logic.Gate11=joint.shapes.logic.Gate.extend({markup:'<g class="rotatable"><g class="scalable"><image class="body"/></g><circle class="input"/><circle class="output"/></g>',defaults:joint.util.deepSupplement({type:"logic.Gate11",attrs:{".input":{ref:".body","ref-x":-2,"ref-y":.5,magnet:"passive",port:"in"},".output":{ref:".body","ref-dx":2,"ref-y":.5,magnet:!0,port:"out"}}},joint.shapes.logic.Gate.prototype.defaults)}),joint.shapes.logic.Gate21=joint.shapes.logic.Gate.extend({markup:'<g class="rotatable"><g class="scalable"><image class="body"/></g><circle class="input input1"/><circle  class="input input2"/><circle class="output"/></g>',defaults:joint.util.deepSupplement({type:"logic.Gate21",attrs:{".input1":{ref:".body","ref-x":-2,"ref-y":.3,magnet:"passive",port:"in1"},".input2":{ref:".body","ref-x":-2,"ref-y":.7,magnet:"passive",port:"in2"},".output":{ref:".body","ref-dx":2,"ref-y":.5,magnet:!0,port:"out"}}},joint.shapes.logic.Gate.prototype.defaults)}),joint.shapes.logic.Repeater=joint.shapes.logic.Gate11.extend({defaults:joint.util.deepSupplement({type:"logic.Repeater",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyI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Jva2Utd2lkdGg6MztzdHJva2UtbGluZWpvaW46bWl0ZXI7bWFya2VyOm5vbmU7c3Ryb2tlLW9wYWNpdHk6MTt2aXNpYmlsaXR5OnZpc2libGU7ZGlzcGxheTppbmxpbmU7b3ZlcmZsb3c6dmlzaWJsZTtlbmFibGUtYmFja2dyb3VuZDphY2N1bXVsYXRlIgogICAgICAgZD0iTSAyOC45Njg3NSwyLjU5Mzc1IEwgMjguOTY4NzUsNSBMIDI4Ljk2ODc1LDQ1IEwgMjguOTY4NzUsNDcuNDA2MjUgTCAzMS4xMjUsNDYuMzQzNzUgTCA3Mi4xNTYyNSwyNi4zNDM3NSBMIDcyLjE1NjI1LDIzLjY1NjI1IEwgMzEuMTI1LDMuNjU2MjUgTCAyOC45Njg3NSwyLjU5Mzc1IHogTSAzMS45Njg3NSw3LjQwNjI1IEwgNjguMDkzNzUsMjUgTCAzMS45Njg3NSw0Mi41OTM3NSBMIDMxLjk2ODc1LDcuNDA2MjUgeiIKICAgICAgIGlkPSJwYXRoMjYzOCIKICAgICAgIHNvZGlwb2RpOm5vZGV0eXBlcz0iY2NjY2NjY2NjY2NjYyIgLz4KICA8L2c+Cjwvc3ZnPgo="}}},joint.shapes.logic.Gate11.prototype.defaults),operation:function(t){return t
22 }}),joint.shapes.logic.Not=joint.shapes.logic.Gate11.extend({defaults:joint.util.deepSupplement({type:"logic.Not",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cm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ICAgZD0iTSA4MCwyNSBBIDQsNCAwIDEgMSA3MiwyNSBBIDQsNCAwIDEgMSA4MCwyNSB6IgogICAgICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEsMCkiIC8+CiAgPC9nPgo8L3N2Zz4K"}}},joint.shapes.logic.Gate11.prototype.defaults),operation:function(t){return!t}}),joint.shapes.logic.Or=joint.shapes.logic.Gate21.extend({defaults:joint.util.deepSupplement({type:"logic.Or",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHdpZHRoPSIxMDAiCiAgIGhlaWdodD0iNTAiCiAgIGlkPSJzdmcyIgogICBzb2RpcG9kaTp2ZXJzaW9uPSIwLjMyIgogICBpbmtzY2FwZTp2ZXJzaW9uPSIwLjQ2IgogICB2ZXJzaW9uPSIxL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shapes.logic.Gate21.prototype.defaults),operation:function(t,e){return t||e}}),joint.shapes.logic.And=joint.shapes.logic.Gate21.extend({defaults:joint.util.deepSupplement({type:"logic.And",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHdpZHRoPSIxMDAiCiAgIGhlaWdodD0iNTAiCiAgIGlkPSJzdmcyIgogICBzb2RpcG9kaTp2ZXJzaW9uPSIwLjMyIgogICBpbmtzY2FwZTp2ZXJzaW9uPSIwLjQ2IgogICB2ZXJzaW9uPSIxLjAiCiAgIHNvZGlwb2RpOmRvY25hbWU9IkFORCBBTlNJLnN2ZyIKICAgaW5rc2NhcGU6b3V0cHV0X2V4dGVuc2lvbj0ib3JnLmlua3NjYXBlLm91dHB1dC5zdmcuaW5rc2NhcGUiPgogIDxkZWZzCi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ljk5OTk1NSA3MC40NzYxOSwyNSBDIDcwLjQ3NjE5LDE0LjAwMDA0NSA2MS43NDQwOTksNS4wMDAwMDAyIDUwLjQ3NjE5LDUgQyA1MC40NzYxOSw1IDUwLjQ3NjE5LDUgMzEuNDI4NTcxLDUgTCAzMCw1IHogTSAzMi44NTcxNDMsNy44NTcxNDI5IEMgNDAuODM0MjY0LDcuODU3MTQyOSA0NS45MTgzNjgsNy44NTcxNDI5IDQ4LjA5NTIzOCw3Ljg1NzE0MjkgQyA0OS4yODU3MTQsNy44NTcxNDI5IDQ5Ljg4MDk1Miw3Ljg1NzE0MjkgNTAuMTc4NTcxLDcuODU3MTQyOSBDIDUwLjMyNzM4MSw3Ljg1NzE0MjkgNTAuNDA5MjI3LDcuODU3MTQyOSA1MC40NDY0MjksNy44NTcxNDI5IEMgNTAuNDY1MDI5LDcuODU3MTQyOSA1MC40NzE1NDMsNy44NTcxNDI5IDUwLjQ3NjE5LDcuODU3MTQyOSBDIDYwLjIzNjg1Myw3Ljg1NzE0MyA2Ny4xNDI4NTcsMTUuNDk3MDk4IDY3LjE0Mjg1NywyNSBDIDY3LjE0Mjg1NywzNC41MDI5MDIgNTkuNzYwNjYyLDQyLjE0Mjg1NyA1MCw0Mi4xNDI4NTcgTCAzMi44NTcxNDMsNDIuMTQyODU3IEwgMzIuODU3MTQzLDcuODU3MTQyOSB6IgogICAgICAgaWQ9InBhdGgyODg0IgogICAgICAgc29kaXBvZGk6bm9kZXR5cGVzPSJjY2NjY2NzY2NjY3Nzc3NzY2NjIiAvPgogIDwvZz4KPC9zdmc+Cg=="}}},joint.shapes.logic.Gate21.prototype.defaults),operation:function(t,e){return t&&e}}),joint.shapes.logic.Nor=joint.shapes.logic.Gate21.extend({defaults:joint.util.deepSupplement({type:"logic.Nor",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhL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I1IgogICAgICAgICBzb2RpcG9kaTpyeD0iNCIKICAgICAgICAgc29kaXBvZGk6cnk9IjQiCiAgICAgICAgIGQ9Ik0gNzksMjUgQSA0LDQgMCAxIDEgNzEsMjUgQSA0LDQgMCAxIDEgNzksMjUgeiIKICAgICAgICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI2LjUsMzkuNSkiIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"}}},joint.shapes.logic.Gate21.prototype.defaults),operation:function(t,e){return!(t||e)}}),joint.shapes.logic.Nand=joint.shapes.logic.Gate21.extend({defaults:joint.util.deepSupplement({type:"logic.Nand",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHdpZHRoPSIxMDAiCiAgIGhlaWdodD0iNTAiCiAgIGl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ICAgIHNvZGlwb2RpOm5vZGV0eXBlcz0iY2NjY2Njc2NjY2Nzc3Nzc2NjYyIgLz4KICAgIDxwYXRoCiAgICAgICBzb2RpcG9kaTp0eXBlPSJhcmMiCiAgICAgICBzdHlsZT0iZmlsbDpub25lO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDozO3N0cm9rZS1saW5lam9pbjptaXRlcjttYXJrZXI6bm9uZTtzdHJva2Utb3BhY2l0eToxO3Zpc2liaWxpdHk6dmlzaWJsZTtkaXNwbGF5OmlubGluZTtvdmVyZmxvdzp2aXNpYmxlO2VuYWJsZS1iYWNrZ3JvdW5kOmFjY3VtdWxhdGUiCiAgICAgICBpZD0icGF0aDQwMDgiCiAgICAgICBzb2RpcG9kaTpjeD0iNzUiCiAgICAgICBzb2RpcG9kaTpjeT0iMjUiCiAgICAgICBzb2RpcG9kaTpyeD0iNCIKICAgICAgIHNvZGlwb2RpOnJ5PSI0IgogICAgICAgZD0iTSA3OSwyNSBBIDQsNCAwIDEgMSA3MSwyNSBBIDQsNCAwIDEgMSA3OSwyNSB6IiAvPgogIDwvZz4KPC9zdmc+Cg=="}}},joint.shapes.logic.Gate21.prototype.defaults),operation:function(t,e){return!(t&&e)
23 }}),joint.shapes.logic.Xor=joint.shapes.logic.Gate21.extend({defaults:joint.util.deepSupplement({type:"logic.Xor",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sb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YWNpdHk9IjAuMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOnpvb209IjUuNjU2ODU0MiIKICAgICBpbmtzY2FwZTpjeD0iMjUuOTM4MTE2IgogICAgIGlua3NjYXBlOmN5PSIxNy4yMzAwNSIKICAgICBpbmtzY2FwZTpkb2N1bWVudC11bml0cz0icHgiCiAgICAgaW5rc2NhcGU6Y3VycmVudC1sYXllcj0ibGF5ZXIxIgogICAgIHNob3dncmlkPSJ0cnVlIgogICAgIGlua3NjYXBlOmdyaWQtYmJveD0idHJ1ZSIKICAgICBpbmtzY2FwZTpncmlkLXBvaW50cz0idHJ1ZSIKICAgICBncmlkdG9sZXJhbmNlPSIxMDAwMCIKICAgICBpbmtzY2FwZTp3aW5kb3ctd2lkdGg9IjEzOTkiCiAgICAgaW5rc2NhcGU6d2luZG93LWhlaWdodD0iODc0IgogICAgIGlua3NjYXBlOndpbmRvdy14PSIzMyIKICAgICBpbmtzY2FwZTp3aW5kb3cteT0iMCIKICAgICBpbmtzY2FwZTpzbmFwLWJib3g9InRydWUiPgogICAgPGlua3NjYXBlOmdyaWQKICAgICAgIGlkPSJHcmlkRnJvbVByZTA0NlNldHRpbmdzIgogICAgICAgdHlwZT0ieHlncmlkIgogICAgICAgb3JpZ2lueD0iMHB4IgogICAgICAgb3JpZ2lueT0iMHB4IgogICAgICAgc3BhY2luZ3g9IjFweCIKICAgICAgIHNwYWNpbmd5PSIxcHgiCiAgICAgICBjb2xvcj0iIzAwMDBmZiIKICAgICAgIGVtcGNvbG9yPSIjMDAwMGZmIgogICAgICAgb3BhY2l0eT0iMC4yIgogICAgICAgZW1wb3BhY2l0eT0iMC40IgogICAgICAgZW1wc3BhY2luZz0iNSIKICAgICAgIHZpc2libGU9InRydWUiCiAgICAgICBlbmFibGVkPSJ0cnVlIiAvPgogIDwvc29kaXBvZGk6bmFtZWR2aWV3PgogIDxtZXRhZGF0YQogICAgIGlkPSJtZXRhZGF0YTciP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U4MDc1LDgxLjUwMDAwMSAxNC43NSw4MS41IEwgMy41LDgxLjUgQyA1LjM3MzU4ODQsNzguMzkxNTY2IDguMjUsNzIuNDUwNjUgOC4yNSw2NC41IEMgOC4yNSw1Ni41MjY2NDYgNS4zNDE0Njg2LDUwLjU5OTgxNSAzLjQ2ODc1LDQ3LjUgeiIKICAgICAgICAgaWQ9InBhdGg0OTczIgogICAgICAgICBzb2RpcG9kaTpub2RldHlwZXM9ImNjc2NjY2NzY2NjY2NjY2Njc2Njc2MiIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"}}},joint.shapes.logic.Gate21.prototype.defaults),operation:function(t,e){return!(t&&!e||!t&&e)}}),joint.shapes.logic.Xnor=joint.shapes.logic.Gate21.extend({defaults:joint.util.deepSupplement({type:"logic.Xnor",attrs:{image:{"xlink:href":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIKICAgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5r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oCiAgICAgICBzb2RpcG9kaTp0eXBlPSJhcmMiCiAgICAgICBzdHlsZT0iZmlsbDpub25lO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDozO3N0cm9rZS1saW5lam9pbjptaXRlcjttYXJrZXI6bm9uZTtzdHJva2Utb3BhY2l0eToxO3Zpc2liaWxpdHk6dmlzaWJsZTtkaXNwbGF5OmlubGluZTtvdmVyZmxvdzp2aXNpYmxlO2VuYWJsZS1iYWNrZ3JvdW5kOmFjY3VtdWxhdGUiCiAgICAgICBpZD0icGF0aDM1NTEiCiAgICAgICBzb2RpcG9kaTpjeD0iNzUiCiAgICAgICBzb2RpcG9kaTpjeT0iMjUiCiAgICAgICBzb2RpcG9kaTpyeD0iNCIKICAgICAgIHNvZGlwb2RpOnJ5PSI0IgogICAgICAgZD0iTSA3OSwyNSBBIDQsNCAwIDEgMSA3MSwyNSBBIDQsNCAwIDEgMSA3OSwyNSB6IiAvPgogIDwvZz4KPC9zdmc+Cg=="}}},joint.shapes.logic.Gate21.prototype.defaults),operation:function(t,e){return!(t&&e||!t&&!e)}}),joint.shapes.logic.Wire=joint.dia.Link.extend({arrowheadMarkup:['<g class="marker-arrowhead-group marker-arrowhead-group-<%= end %>">','<circle class="marker-arrowhead" end="<%= end %>" r="7"/>',"</g>"].join(""),vertexMarkup:['<g class="marker-vertex-group" transform="translate(<%= x %>, <%= y %>)">','<circle class="marker-vertex" idx="<%= idx %>" r="10" />','<g class="marker-vertex-remove-group">','<path class="marker-vertex-remove-area" idx="<%= idx %>" d="M16,5.333c-7.732,0-14,4.701-14,10.5c0,1.982,0.741,3.833,2.016,5.414L2,25.667l5.613-1.441c2.339,1.317,5.237,2.107,8.387,2.107c7.732,0,14-4.701,14-10.5C30,10.034,23.732,5.333,16,5.333z" transform="translate(5, -33)"/>','<path class="marker-vertex-remove" idx="<%= idx %>" transform="scale(.8) translate(9.5, -37)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z">',"<title>Remove vertex.</title>","</path>","</g>","</g>"].join(""),defaults:joint.util.deepSupplement({type:"logic.Wire",attrs:{".connection":{"stroke-width":2},".marker-vertex":{r:7}},router:{name:"orthogonal"},connector:{name:"rounded",args:{radius:10}}},joint.dia.Link.prototype.defaults)}),"object"==typeof exports&&(module.exports=joint.shapes.logic),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{},dia:{Element:require("../src/joint.dia.element").Element}},_=require("lodash");if(joint.shapes.chart={},joint.shapes.chart.Plot=joint.shapes.basic.Generic.extend({markup:['<clipPath class="clip"><rect/></clipPath>','<g class="rotatable">','<g class="scalable"></g>','<g class="background"><rect/><text/></g>','<g class="axis">','<g class="y-axis"><path/><g class="ticks"></g></g>','<g class="x-axis"><path/><g class="ticks"></g></g>','<g class="markings"></g>',"</g>",'<g class="data"><g class="series"></g></g>','<g class="foreground">','<rect/><text class="caption"/><text class="subcaption"/>','<g class="legend"><g class="legend-items"></g></g>','<line class="guideline x-guideline" /><line class="guideline y-guideline" />',"</g>","</g>"].join(""),tickMarkup:'<g class="tick"><line/><text/></g>',pointMarkup:'<g class="point"><circle/><text/></g>',barMarkup:'<path class="bar"/>',markingMarkup:'<g class="marking"><rect/><text/></g>',serieMarkup:'<g><clipPath class="serie-clip"><rect/></clipPath><path/><g class="bars"></g><g class="points"></g></g>',legendItemMarkup:'<g class="legend-item"><circle/><text/></g>',defaults:joint.util.deepSupplement({type:"chart.Plot",attrs:{".data path":{fill:"none",stroke:"black"},".data .bars rect":{fill:"none",stroke:"black"},".background rect":{fill:"white",stroke:"#e5e5e5",opacity:1},".background text":{fill:"black",text:"No data available.",ref:".","ref-x":.5,"ref-y":.5,"text-anchor":"middle","y-alignment":"middle",display:"none"},".foreground > rect":{fill:"white",stroke:"#e5e5e5",opacity:0,"pointer-events":"none"},".foreground .caption":{fill:"black",text:"",ref:".foreground > rect","ref-x":.5,"ref-y":10,"text-anchor":"middle","y-alignment":"middle","font-size":14},".foreground .subcaption":{fill:"black",text:"",ref:".foreground > rect","ref-x":.5,"ref-y":23,"text-anchor":"middle","y-alignment":"middle","font-size":10},".point":{display:"inline-block"},".point circle":{r:2,stroke:"black",fill:"black",opacity:.3},".point text":{fill:"black","font-size":8,"text-anchor":"middle",display:"none"},".axis path":{fill:"none",stroke:"black"},".axis .tick":{fill:"none",stroke:"black"},".y-axis .tick line":{fill:"none",stroke:"black",x2:2,y2:0,opacity:1},".x-axis .tick line":{fill:"none",stroke:"black",x2:0,y2:-3,opacity:1},".y-axis .tick text":{fill:"black",stroke:"none","font-size":10,dy:"-.5em",x:-5,"text-anchor":"end"},".x-axis .tick text":{fill:"black",stroke:"none","font-size":10,dy:".5em",x:0,"text-anchor":"middle"},".axis .markings":{fill:"black",stroke:"none","fill-opacity":1},".axis .markings text":{fill:"black","text-anchor":"end","font-size":10,dy:-5,dx:-5},".guideline":{"pointer-events":"none",display:"none"},".x-guideline":{stroke:"black",visibility:"hidden"},".y-guideline":{stroke:"black",visibility:"hidden"},".legend":{ref:".background","ref-x":10,"ref-y":10},".legend-item text":{fill:"black",transform:"translate(14, 0)","font-size":11},".legend-item circle":{r:5,transform:"translate(5,5)"},".legend-item":{cursor:"pointer"},".legend-item.disabled circle":{fill:"gray"},".legend-item.disabled text":{opacity:.5}}},joint.shapes.basic.Generic.prototype.defaults),legendPosition:function(t,e){e=e||{},this.trigger("batch:start"),this.removeAttr([".legend/ref-x",".legend/ref-y",".legend/ref-dx",".legend/ref-dy",".legend/x-alignment",".legend/y-alignment"],{silent:!0});var i=e.padding||10,n={n:{".legend":{"ref-x":.5,"x-alignment":-.5,"ref-y":i}},ne:{".legend":{"ref-dx":-i,"x-alignment":-.999,"ref-y":i}},e:{".legend":{"ref-dx":-i,"x-alignment":-.999,"ref-y":.5,"y-alignment":-.5}},se:{".legend":{"ref-dx":-i,"ref-dy":-i,"x-alignment":-.999,"y-alignment":-.999}},s:{".legend":{"ref-x":.5,"ref-dy":-i,"x-alignment":-.5,"y-alignment":-.999}},sw:{".legend":{"ref-x":i,"ref-dy":-i,"y-alignment":-.999}},w:{".legend":{"ref-x":i,"ref-y":.5,"y-alignment":-.5}},nw:{".legend":{"ref-x":i,"ref-y":i}},nnw:{".legend":{"ref-x":i,"ref-y":-i,"y-alignment":-.999}},nn:{".legend":{"ref-x":.5,"ref-y":-i,"x-alignment":-.5,"y-alignment":-.999}},nne:{".legend":{"ref-dx":-i,"ref-y":-i,"x-alignment":-.999,"y-alignment":-.999}},nnee:{".legend":{"ref-dx":i,"ref-y":-i,"y-alignment":-.999}},nee:{".legend":{"ref-y":i,"ref-dx":i}},ee:{".legend":{"ref-dx":i,"ref-y":.5,"y-alignment":-.5}},see:{".legend":{"ref-dx":i,"ref-dy":-i,"y-alignment":-.999}},ssee:{".legend":{"ref-dx":i,"ref-dy":i}},sse:{".legend":{"ref-dx":-i,"ref-dy":i,"x-alignment":-.999}},ss:{".legend":{"ref-x":.5,"ref-dy":i,"x-alignment":-.5}},ssw:{".legend":{"ref-x":i,"ref-dy":i}},ssww:{".legend":{"ref-x":-i,"ref-dy":i,"x-alignment":-.999}},sww:{".legend":{"ref-x":-i,"ref-dy":-i,"x-alignment":-.999,"y-alignment":-.999}},ww:{".legend":{"ref-x":-i,"ref-y":.5,"x-alignment":-.999,"y-alignment":-.5}},nww:{".legend":{"ref-x":-i,"ref-y":i,"x-alignment":-.999}},nnww:{".legend":{"ref-x":-i,"ref-y":-i,"x-alignment":-.999,"y-alignment":-.999}}};n[t]&&this.attr(n[t]),this.trigger("batch:stop")},addPoint:function(t,e,i){i=i||{};var n=this.get("series"),r=_.findIndex(n,{name:e});if(-1===r)throw Error("Serie "+e+" was not found.");var a=_.cloneDeep(n[r]);a.data.push(t),_.isFinite(i.maxLen)&&a.data.length>i.maxLen&&a.data.shift(),n=n.slice(),n[r]=a,this.set("series",n,i)},lastPoint:function(t){return _.last(_.findWhere(this.get("series"),{name:t}).data)},firstPoint:function(t){return _.first(_.findWhere(this.get("series"),{name:t}).data)}}),joint.shapes.chart.PlotView=joint.dia.ElementView.extend({events:{mousemove:"onMouseMove",mouseout:"onMouseOut"},initialize:function(){joint.dia.ElementView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:series change:interpolate change:padding change:canvas change:markings change:axis",_.bind(function(){this.update()},this)),this.on("cell:pointerdown",this.onPointerDown,this),this._disabledSeries=[]},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.elDataClipPath=this.$(".clip")[0],this.elDataClipPathRect=this.elDataClipPath.firstChild,this.elBackgroundRect=this.$(".background rect")[0],this.elBackgroundText=this.$(".background text")[0],this.elForeground=this.$(".foreground")[0],this.elForegroundRect=this.$(".foreground rect")[0],this.elDataSeries=this.$(".data .series")[0],this.elYAxisPath=this.$(".y-axis path")[0],this.elYAxisTicks=this.$(".y-axis .ticks")[0],this.elXAxisPath=this.$(".x-axis path")[0],this.elXAxisTicks=this.$(".x-axis .ticks")[0],this.elMarkings=this.$(".axis .markings")[0],this.elXGuideline=this.$(".x-guideline")[0],this.elYGuideline=this.$(".y-guideline")[0],this.elLegend=this.$(".legend")[0],this.elLegendItems=this.$(".legend-items")[0],this.elTick=V(this.model.tickMarkup),this.elMarking=V(this.model.markingMarkup),this.elLegendItem=V(this.model.legendItemMarkup),this.elPoint=V(this.model.pointMarkup),this.elBar=V(this.model.barMarkup),this.elSerie=V(this.model.serieMarkup),this.elDataClipPath.id="clip_"+this.cid,V(this.$(".data")[0]).attr("clip-path","url(#"+this.elDataClipPath.id+")"),V(this.elMarkings).attr("clip-path","url(#"+this.elDataClipPath.id+")")},update:function(t){t=this.filterSeries(t),this.calculateStats(t);var e=this.model.get("size"),i=e.width,n=e.height;this.canvas=_.extend({x:0,y:0,width:i,height:n},this.model.get("canvas"));var r,a={top:0,right:0,bottom:0,left:0},s=this.model.get("padding");r=_.isObject(s)?_.extend({},a,s):_.isUndefined(s)?a:{top:s,right:2*s,bottom:2*s,left:s},this.canvas=g.rect(this.canvas).moveAndExpand(g.rect(r.left,r.top,-r.right,-r.bottom));var o={x:0,y:0,width:i,height:n};V(this.elDataClipPathRect).attr(o),V(this.elBackgroundRect).attr(o),V(this.elForegroundRect).attr(o),this.updateAxis(),this.updateMarkings(),this.isEmpty()?$(this.elBackgroundText).show():$(this.elBackgroundText).hide(),this.updateSeries(t),this.updateLegend(),joint.dia.ElementView.prototype.update.apply(this,arguments)},calculateStats:function(t){t=t||this.model.get("series");var e=[],i=[],n={},r={},a={};_.each(t,function(t,s){var o=a[t.name||s]||(a[t.name||s]={});o.decreasingX=!0,o.decreasingY=!0,o.nonDecreasingX=!0,o.nonDecreasingY=!0;var l;_.each(t.data,function(a){o.minX=_.isUndefined(o.minX)?a.x:Math.min(o.minX,a.x),o.maxX=_.isUndefined(o.maxX)?a.x:Math.max(o.maxX,a.x),o.minY=_.isUndefined(o.minY)?a.y:Math.min(o.minY,a.y),o.maxY=_.isUndefined(o.maxY)?a.y:Math.max(o.maxY,a.y),l&&(o.decreasingX=o.decreasingX&&a.x<l.x,o.decreasingY=o.decreasingY&&a.y<l.y,o.nonDecreasingX=o.nonDecreasingX&&a.x>=l.x,o.nonDecreasingY=o.nonDecreasingY&&a.y>=l.y),_.contains(e,a.x)||e.push(a.x),_.contains(i,a.y)||i.push(a.y),(n[a.x]||(n[a.x]=[])).push({serie:t,x:a.x,y:a.y}),(r[a.y]||(r[a.y]=[])).push({serie:t,x:a.x,y:a.y}),l=a})});var s=this.model.get("axis")||{},o=s["x-axis"]||{},l=s["y-axis"]||{};this.stats={minX:_.isUndefined(o.min)?_.min(e):o.min,maxX:_.isUndefined(o.max)?_.max(e):o.max,minY:_.isUndefined(l.min)?_.min(i):l.min,maxY:_.isUndefined(l.max)?_.max(i):l.max,bySerie:a,xValues:e,yValues:i,xMap:n,yMap:r}},isEmpty:function(){return!this.stats.xValues.length},updateSeries:function(t){if(t=t||this.model.get("series"),this.elDataSeries.textContent="",!this.isEmpty()){var e=[this.stats.minX,this.stats.maxX],i=[this.stats.minY,this.stats.maxY],n=[this.canvas.x,this.canvas.x+this.canvas.width],r=[this.canvas.y+this.canvas.height,this.canvas.y],a=this.model.get("attrs");_.each(t,function(t,s){var o=t.data,l=[],c=this.elSerie.clone().attr("class",t.name||"serie-"+s);V(this.elDataSeries).append(c),_.each(o,function(s){var o=g.scale.linear(e,n,s.x),c=g.scale.linear(i,r,s.y);l.push({x:o,y:c}),a[".point"]&&"none"!==a[".point"].display&&this.renderPoint(s,t),t.bars&&this.renderBar(s,t)},this);var h=c.findOne(".serie-clip"),u=this.model.get("size"),p=this.stats.bySerie[t.name||s],d=g.scale.linear(e,n,p.minX),f=g.scale.linear(e,n,p.maxX),m=h.findOne("rect");if(m.attr(g.rect(d,0,f-d,u.height)),!t.bars){var I=c.findOne("path");I.attr({d:this.seriePathData(l,t,s),"clip-path":"url(#"+h.node.id+")"})}},this)}},seriePathClipData:function(t){var e=10,i=this.model.get("size"),n=_.first(t);_.last(t);var r=["M",n.x,n.y,"V",i.height+e];return r.join(" ")},renderBar:function(t,e){var i=[this.stats.minX,this.stats.maxX],n=[this.stats.minY,this.stats.maxY],r=[this.canvas.x,this.canvas.x+this.canvas.width],a=[this.canvas.y+this.canvas.height,this.canvas.y],s=g.scale.linear(i,r,t.x),o=g.scale.linear(n,a,t.y),l=e.bars.barWidth||.8,c=l>1?l:this.canvas.width/(this.stats.maxX-this.stats.minX)*l,h=g.scale.linear(n,a,0)-o,u=t["top-rx"]||e.bars["top-rx"],p=t["top-ry"]||e.bars["top-ry"],d=t["bottom-rx"]||e.bars["bottom-rx"],f=t["bottom-ry"]||e.bars["bottom-ry"],m={left:s,middle:s-c/2,right:s-c}[e.bars.align||"middle"],I=this.elBar.clone();I.attr({"data-serie":e.name,"data-x":t.x,"data-y":t.y,d:V.rectToPath({x:m,y:o,width:c,height:h,"top-rx":u,"top-ry":p,"bottom-rx":d,"bottom-ry":f})});var y=e.name||"serie-"+this.model.get("series").indexOf(e);return V(this.elDataSeries).findOne("."+y+" .bars").append(I),I.node},renderPoint:function(t,e){var i=[this.stats.minX,this.stats.maxX],n=[this.stats.minY,this.stats.maxY],r=[this.canvas.x,this.canvas.x+this.canvas.width],a=[this.canvas.y+this.canvas.height,this.canvas.y],s=g.scale.linear(i,r,t.x),o=g.scale.linear(n,a,t.y),l=this.elPoint.clone();l.attr({"data-serie":e.name,"data-x":t.x,"data-y":t.y}),l.findOne("circle").attr({cx:s,cy:o}),l.findOne("text").attr({x:s,dy:o}).text(this.pointLabel(t,e));var c=e.name||"serie-"+this.model.get("series").indexOf(e);return V(this.elDataSeries).findOne("."+c+" .points").append(l),l.node},seriePathData:function(t,e,i){var n,r,a,s=_.isUndefined(e.interpolate)?this.model.get("interpolate"):e.interpolate,o=t.length;switch(s){case"bezier":n=g.bezier.curveThroughPoints(t);break;case"step":for(a=t[0],n=["M",a.x,a.y],r=1;o>r;r++)n.push("H",(a.x+t[r].x)/2,"V",t[r].y),a=t[r];break;case"stepBefore":for(n=["M",t[0].x,t[0].y],r=1;o>r;r++)n.push("V",t[r].y,"H",t[r].x);break;case"stepAfter":for(n=["M",t[0].x,t[0].y],r=1;o>r;r++)n.push("H",t[r].x,"V",t[r].y);break;default:for(n=["M"],r=0;o>r;r++)n.push(t[r].x,t[r].y)}return n=this.fixPathForFill(n,t,e,i),n.join(" ")},fixPathForFill:function(t,e,i,n){if(0===e.length)return t;var r=this.stats.bySerie[i.name||n];if(!r.nonDecreasingX)return t;var a=10,s=this.model.get("size"),o=_.first(e),l=_.last(e),c=["M",l.x,s.height+a,"H",o.x-a,"V",o.y];return t[0]="L",c.concat(t)},updateAxis:function(){var t=this.model.get("size"),e=t.width,i=t.height,n=this.model.get("axis"),r=this.canvas.height/i;if(this.canvas.width/e,V(this.elYAxisPath).attr("d",["M",0,0,"L",0,i].join(" ")),V(this.elXAxisPath).attr("d",["M",0,i,"L",e,i].join(" ")),this.elXAxisTicks.textContent="",this.elYAxisTicks.textContent="",!this.isEmpty()){var a=[this.stats.minX,this.stats.maxX],s=[this.stats.minY,this.stats.maxY],o=[this.canvas.x,this.canvas.x+this.canvas.width],l=[0,this.canvas.height];a[1]-a[0];var c=s[1]-s[0],h=n&&n["y-axis"]||{},u=n&&n["x-axis"]||{},p=c>0?h.ticks-1||10:0,d=c/p/r,f=s[0];_.each(_.range(p+1),function(){var t=g.scale.linear(s,l,f),e=this.elTick.clone();e.translate(0,t),V(this.elYAxisTicks).append(e);var i=s[1]-(f-s[0]);i+=g.scale.linear(l,s,this.canvas.y)-s[0],e.findOne("text").text(this.tickLabel(i,h)),f+=d
24 },this),_.each(this.stats.xValues,function(t,n){if(0===n%(u.tickStep||1)){var r=g.scale.linear(a,o,t);if(!(r>e)){var s=this.elTick.clone();s.translate(r,i),V(this.elXAxisTicks).append(s),s.findOne("text").text(this.tickLabel(t,u))}}},this)}},tickLabel:function(t,e){if(_.isFunction(e.tickFormat))return e.tickFormat(t);var i=e.tickFormat||".1f",n=joint.util.format.number(i,t);return n+(_.isFunction(e.tickSuffix)?e.tickSuffix(t):e.tickSuffix||"")},pointLabel:function(t,e){if(_.isFunction(e.pointFormat))return e.pointFormat(t);var i=e.pointFormat||".1f",n=joint.util.format.number(i,t.y);return n+(e.pointSuffix||"")},updateMarkings:function(){function t(t,e){return _.isUndefined(t)?e:t}this.elMarkings.textContent="";var e=this.model.get("markings");if(e&&0!==e.length){var i=this.model.get("size"),n=i.width,r=i.height,a=[this.stats.minX,this.stats.maxX],s=[this.stats.minY,this.stats.maxY],o=[this.canvas.x,this.canvas.x+this.canvas.width],l=[this.canvas.y,this.canvas.y+this.canvas.height];_.each(e,function(e,i){var c=e.start||e.end,h=e.end||e.start,u=Math.min(t(c.x,this.stats.minX),t(h.x,this.stats.minX)),p=Math.max(t(c.x,this.stats.maxX),t(h.x,this.stats.maxX)),d=Math.min(t(c.y,this.stats.minY),t(h.y,this.stats.minY)),f=Math.max(t(c.y,this.stats.maxY),t(h.y,this.stats.maxY)),m=_.isUndefined(c.x)||_.isUndefined(h.x),I=_.isUndefined(c.y)||_.isUndefined(h.y);m&&(o=[0,n]),I&&(l=[0,r]);var y=g.scale.linear(a,o,u),v=g.scale.linear(a,o,p),C=g.scale.linear(s,l,d),b=g.scale.linear(s,l,f),A=y,w=l[1]-b+l[0],x=v-y,M=b-C;x=Math.max(x,1),M=Math.max(M,1);var j=this.elMarking.clone();j.findOne("rect").attr({x:A,y:w,width:x,height:M}),j.findOne("text").text(e.label||"").attr({x:A+x,y:w});var N=j.attr("class")+" "+(e.name||"marking-"+i);j.attr(_.extend({"class":N},e.attrs)),V(this.elMarkings).append(j)},this)}},updateLegend:function(){var t=this.model.get("series");this.elLegendItems.textContent="",_.each(t,function(t,e){var i=this.elLegendItem.clone();_.contains(this._disabledSeries,t.name)&&i.addClass("disabled"),i.attr("data-serie",t.name),i.findOne("circle").attr({fill:this.getSerieColor(t.name)}),i.findOne("text").text(t.label||t.name),i.translate(0,16*e),V(this.elLegendItems).append(i)},this)},getSerieColor:function(t){var e=this.model.get("attrs"),i=_.find(e,function(e,i){return _.contains(i,t)?!0:void 0});return i?i.stroke||i.fill:"black"},hideSerie:function(t){_.contains(this._disabledSeries,t)||this._disabledSeries.push(t);var e=this.filterSeries();this.update(e)},showSerie:function(t){this._disabledSeries=_.without(this._disabledSeries,t);var e=this.filterSeries();this.update(e)},filterSeries:function(t){return t=t||this.model.get("series"),t=_.reject(t,function(t){return _.contains(this._disabledSeries,t.name)},this)},onPointerDown:function(t){var e=$(t.target).closest(".legend-item")[0];e&&(V(e).toggleClass("disabled"),V(e).hasClass("disabled")?this.hideSerie(V(e).attr("data-serie")):this.showSerie(V(e).attr("data-serie")))},onMouseMove:function(t){this.showGuidelines(t.clientX,t.clientY,t)},onMouseOut:function(t){this.hideGuidelines(),this.trigger("mouseout",t)},showGuidelines:function(t,e,i){var n=this.model.get("angle"),r=this.model.getBBox();this.model.get("series");var a=g.point(V(this.paper.viewport).toLocalPoint(t,e)).rotate(r.center(),n);if(g.rect(r).containsPoint(a)){var s=this.model.get("size"),o=a.x-r.x,l=a.y-r.y;V(this.elXGuideline).attr({x1:o,y1:0,x2:o,y2:s.height,visibility:"visible"}),V(this.elYGuideline).attr({x1:0,y1:l,x2:s.width,y2:l,visibility:"visible"});var c=g.scale.linear([this.canvas.x,this.canvas.x+this.canvas.width],[this.stats.minX,this.stats.maxX],o),h=g.scale.linear([this.canvas.y,this.canvas.y+this.canvas.height],[this.stats.minY,this.stats.maxY],l),u={x:c,y:this.stats.minY+this.stats.maxY-h},p={x:t,y:e},d=this.closestPoints(c);this.trigger("mouseover",u,p,d,i)}},closestPoints:function(t){var e=_.sortedIndex(this.stats.xValues,t),i=this.stats.xValues[e],n=this.stats.xValues[e-1],r=_.isUndefined(n)?i:Math.abs(t-i)<Math.abs(t-n)?i:n;return this.stats.xMap[r]},hideGuidelines:function(){V(this.elXGuideline).attr("visibility","hidden"),V(this.elYGuideline).attr("visibility","hidden")}}),"object"==typeof exports&&(module.exports=joint.shapes.chart),"object"==typeof exports)var joint={util:require("../src/core").util,shapes:{},dia:{Element:require("../src/joint.dia.element").Element,Link:require("../src/joint.dia.link").Link}};joint.shapes.bpmn={},joint.shapes.bpmn.icons={none:"",message:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUxMiA1MTIiIGhlaWdodD0iNTEycHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB3aWR0aD0iNTEycHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJod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zXOeJh0Ak8M484B+TAlK4BPBiU3gWSMoTqpw6g0fgFYblJww9D5dojT25IEcMeA47rUsdsQLp9FmPmURSNSOqpJS2lzUKd+ocN3IBNx5mz+oXXADwHTXX/jjMFxjy1iwtgrYJoF1lY27BMafozZaaMspYKA7XRlw7f1xt4Y5biA7bXXIGv4TW0OGNCmsQRhzCidlwTJADDlgAFTwAuhLq+AHqHyMe6IhKVHAV1C5ZBDBkhYupThPPreIQNGJTJBGXKLLw4Z8NmQu/Fb8PCkQwakBIxFRWPLvAJmhMpWh4AuFb7PKGBaqFzjkAGrhe/TSjNrQZJ1yAAJy5gCRoTKnEMGSFhGFDBoOBu7IhKWQe8wLRFLHQ6A7zCcFNNK59vvAjoqYK8DBuwTCLBhTUD8Hweahj9S2jjU297VqzrU26BVmi2yEjXRKg1PbHnpqYla7AeWxAi+GbhHHdSit2mYyN2XQQ5kQTJ6Y6qL3PUkCr2+H7v0+jcs0eueRLngGNeKa9mxY73g8JzpEtHusorAQ/7e+e7WUWIl//jSVTrK7QEu6KgW9d7tYr3B44iBWPJfkZZ8pZ4r2VngkC0HywMTLNwN5YSBcKtZWoGzernEBbyox2iJc6Np2KcGfnHisYet1CDouc2yCjbhp07MrD+3+QNxi4JkAscRswAAAABJRU5ErkJggg=="},joint.shapes.bpmn.IconInterface={initialize:function(){this._parent=(this._parent||this).constructor.__super__,this._parent.initialize.apply(this,arguments),this.listenTo(this,"change:icon",this._onIconChange),this._onIconChange(this,this.get("icon")||"none")},_onIconChange:function(t,e){var i=joint.shapes.bpmn.icons;if(!_.has(i,e))throw"BPMN: Unknown icon: "+e;t.attr("image/xlink:href",i[e])}},joint.shapes.bpmn.SubProcessInterface={initialize:function(){this._parent=(this._parent||this).constructor.__super__,this._parent.initialize.apply(this,arguments),this.listenTo(this,"change:subProcess",this._onSubProcessChange),this._onSubProcessChange(this,this.get("subProcess")||null)},_onSubProcessChange:function(t,e){t.attr({".sub-process":{visibility:e?"visible":"hidden","data-sub-process":e||""}})}},joint.shapes.bpmn.ActivityView=joint.shapes.basic.TextBlockView,joint.shapes.bpmn.Activity=joint.shapes.basic.TextBlock.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body outer"/><rect class="body inner"/></g>',"<switch>",'<foreignObject requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" class="fobj">','<body xmlns="http://www.w3.org/1999/xhtml"><div/></body>',"</foreignObject>",'<text class="content"/>','</switch><path class="sub-process"/><image class="icon"/></g>'].join(""),defaults:joint.util.deepSupplement({size:{width:100,height:100},type:"bpmn.Activity",attrs:{rect:{rx:8,ry:8,width:100,height:100},".body":{fill:"#ffffff",stroke:"#000000"},".inner":{transform:"scale(0.9,0.9) translate(5,5)"},path:{d:"M 0 0 L 30 0 30 30 0 30 z M 15 4 L 15 26 M 4 15 L 26 15",ref:".inner","ref-x":.5,"ref-dy":-30,"x-alignment":"middle",stroke:"#000000",fill:"transparent"},image:{ref:".inner","ref-x":5,width:20,height:20}},activityType:"task",subProcess:null},joint.shapes.basic.TextBlock.prototype.defaults),initialize:function(){joint.shapes.basic.TextBlock.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:activityType",this.onActivityTypeChange),this.listenTo(this,"change:subProcess",this.onSubProcessChange),this.onSubProcessChange(this,this.get("subProcess")),this.onActivityTypeChange(this,this.get("activityType"))},onActivityTypeChange:function(t,e){switch(e){case"task":t.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":1,"stroke-dasharray":"none"},path:{ref:".outer"},image:{ref:".outer"}});break;case"transaction":t.attr({".inner":{visibility:"visible"},".outer":{"stroke-width":1,"stroke-dasharray":"none"},path:{ref:".inner"},image:{ref:".inner"}});break;case"event-sub-process":t.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":1,"stroke-dasharray":"1,2"},path:{ref:".outer"},image:{ref:".outer"}});break;case"call-activity":t.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":5,"stroke-dasharray":"none"},path:{ref:".outer"},image:{ref:".outer"}});break;default:throw"BPMN: Unknown Activity Type: "+e}},onSubProcessChange:function(t,e){e?t.attr({".fobj div":{style:{verticalAlign:"baseline",paddingTop:10}},image:{"ref-dy":-25,"ref-y":""},text:{"ref-y":25}}):t.attr({".fobj div":{style:{verticalAlign:"middle",paddingTop:0}},image:{"ref-dy":"","ref-y":5},text:{"ref-y":.5}})}}).extend(joint.shapes.bpmn.IconInterface).extend(joint.shapes.bpmn.SubProcessInterface),joint.shapes.bpmn.AnnotationView=joint.shapes.basic.TextBlockView,joint.shapes.bpmn.Annotation=joint.shapes.basic.TextBlock.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body"/></g>',"<switch>",'<foreignObject requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" class="fobj">','<body xmlns="http://www.w3.org/1999/xhtml"><div/></body>',"</foreignObject>",'<text class="content"/>','</switch><path class="stroke"/></g>'].join(""),defaults:joint.util.deepSupplement({size:{width:100,height:100},type:"bpmn.Annotation",attrs:{rect:{width:100,height:100},".body":{"fill-opacity":.1,fill:"#ffffff",stroke:"none"},".fobj div":{style:{textAlign:"left",paddingLeft:10}},".stroke":{stroke:"#000000",fill:"none","stroke-width":3}},wingLength:20},joint.shapes.basic.TextBlock.prototype.defaults),initialize:function(){joint.shapes.basic.TextBlock.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:size",this.onSizeChange),this.onSizeChange(this,this.get("size"))},onSizeChange:function(t,e){t.attr(".stroke",{d:t.getStrokePathData(e.width,e.height,t.get("wingLength"))})},getStrokePathData:function(t,e,i){return i=Math.min(i,t),["M",i,"0 L 0 0 0",e,i,e].join(" ")}}),joint.shapes.bpmn.Gateway=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/><image/></g></g><text class="label"/>',defaults:joint.util.deepSupplement({type:"bpmn.Gateway",size:{width:80,height:80},attrs:{".body":{points:"40,0 80,40 40,80 0,40",fill:"#ffffff",stroke:"#000000"},".label":{text:"",ref:".body","ref-x":.5,"ref-dy":20,"y-alignment":"middle","x-alignment":"middle","font-size":14,"font-family":"Arial, helvetica, sans-serif",fill:"#000000"},image:{width:40,height:40,"xlink:href":"",transform:"translate(20,20)"}}},joint.dia.Element.prototype.defaults)}).extend(joint.shapes.bpmn.IconInterface),joint.shapes.bpmn.Event=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><circle class="body outer"/><circle class="body inner"/><image/></g><text class="label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Event",size:{width:60,height:60},attrs:{".body":{fill:"#ffffff",stroke:"#000000"},".outer":{"stroke-width":1,r:30,transform:"translate(30,30)"},".inner":{"stroke-width":1,r:26,transform:"translate(30,30)"},image:{width:40,height:40,"xlink:href":"",transform:"translate(10,10)"},".label":{text:"",fill:"#000000","font-family":"Arial","font-size":14,ref:".outer","ref-x":.5,"ref-dy":20,"x-alignment":"middle","y-alignment":"middle"}},eventType:"start"},joint.dia.Element.prototype.defaults),initialize:function(){joint.dia.Element.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:eventType",this.onEventTypeChange),this.onEventTypeChange(this,this.get("eventType"))},onEventTypeChange:function(t,e){switch(e){case"start":t.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":1}});break;case"end":t.attr({".inner":{visibility:"hidden"},".outer":{"stroke-width":5}});break;case"intermediate":t.attr({".inner":{visibility:"visible"},".outer":{"stroke-width":1}});break;default:throw"BPMN: Unknown Event Type: "+e}}}).extend(joint.shapes.bpmn.IconInterface),joint.shapes.bpmn.Pool=joint.dia.Element.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body"/></g>','<svg overflow="hidden" class="blackbox-wrap"><text class="blackbox-label"/></svg>','<rect class="header"/><text class="label"/>','<g class="lanes"/>',"</g>"].join(""),laneMarkup:'<g class="lane"><rect class="lane-body"/><rect class="lane-header"/><text class="lane-label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Pool",size:{width:600,height:300},attrs:{".body":{fill:"#ffffff",stroke:"#000000",width:500,height:200,"pointer-events":"stroke"},".header":{fill:"#ffffff",stroke:"#000000",width:20,ref:".body","ref-height":1,"pointer-events":"visiblePainted"},".label":{transform:"rotate(-90)",ref:".header","ref-x":10,"ref-y":.5,"font-family":"Arial","font-size":14,"x-alignment":"middle","text-anchor":"middle"},".lane-body":{fill:"#ffffff",stroke:"#000000","pointer-events":"stroke"},".lane-header":{fill:"#ffffff",stroke:"#000000","pointer-events":"visiblePainted"},".lane-label":{transform:"rotate(-90)","text-anchor":"middle","font-family":"Arial","font-size":13},".blackbox-wrap":{ref:".body","ref-width":1,"ref-height":1},".blackbox-label":{text:"Black Box",dx:"50%",dy:"50%","text-anchor":"middle",transform:"translate(0,-7)"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.PoolView=joint.dia.ElementView.extend({options:{headerWidth:20},initialize:function(){this.listenTo(this.model,"change:lanes",function(t,e){this.renderLanes(e)}),joint.dia.ElementView.prototype.initialize.apply(this,arguments)},update:function(){return _.isUndefined(this.lanesAttrs)?this.renderLanes(this.model.get("lanes")):joint.dia.ElementView.prototype.update.call(this,this.model,_.merge({},this.model.get("attrs"),this.lanesAttrs||{}))},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.$lanes=this.$(".lanes"),this.laneMarkup=V(this.model.laneMarkup)},renderLanes:function(t){t=t||{},this.index=0,this.lanesAttrs={".header":{width:this.options.headerWidth},".label":{text:t.label||""}},this.$lanes.empty(),t.sublanes&&this.renderSublanes(t.sublanes,0,0,1),this.update(this.model,_.merge({},this.model.get("attrs"),this.lanesAttrs))},renderSublanes:function(t,e,i,n){var r=this.options.headerWidth,a=1/t.length*n;_.each(t,function(t,n){var s="lane"+this.index,o="."+s+" .lane-body",l="."+s+" .lane-header",c="."+s+" .lane-label";t.name&&(s+=" "+t.name),this.$lanes.append(this.laneMarkup.clone().addClass(s).node);var h=e+r,u=i+a*n;this.lanesAttrs[o]={ref:".body","ref-height":a,"ref-width":-h,"ref-x":h,"ref-y":u},this.lanesAttrs[l]={width:r,ref:".body","ref-height":a,"ref-x":h,"ref-y":u},this.lanesAttrs[c]={text:t.label,ref:l,"ref-x":10,"ref-y":.5,"x-alignment":"middle"},this.index++,t.sublanes&&this.renderSublanes(t.sublanes,h,u,a)},this)}}),joint.shapes.bpmn.Group=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><rect class="body"/></g><rect class="label-rect"/><g class="label-group"><svg overflow="hidden" class="label-wrap"><text class="label"/></svg></g></g>',defaults:joint.util.deepSupplement({type:"bpmn.Group",size:{width:200,height:200},attrs:{".body":{width:200,height:200,stroke:"#000000","stroke-dasharray":"6,6","stroke-width":2,fill:"transparent",rx:15,ry:15,"pointer-events":"stroke"},".label-rect":{ref:".body","ref-width":.6,"ref-x":.4,"ref-y":-30,height:25,fill:"#ffffff",stroke:"#000000"},".label-group":{ref:".label-rect","ref-x":0,"ref-y":0},".label-wrap":{ref:".label-rect","ref-width":1,"ref-height":1},".label":{text:"",x:"50%",dy:5,"text-anchor":"middle","font-family":"Arial","font-size":14,fill:"#000000"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.DataObject=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/></g><text class="label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.DataObject",size:{width:60,height:80},attrs:{".body":{points:"20,0 60,0 60,80 0,80 0,20 20,0 20,20 0,20",stroke:"#000000",fill:"#ffffff"},".label":{ref:".body","ref-x":.5,"ref-dy":5,text:"","text-anchor":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.Conversation=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/></g><text class="label"/><path class="sub-process"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Conversation",size:{width:100,height:100},attrs:{".body":{points:"25,0 75,0 100,50 75,100 25,100 0,50",stroke:"#000000",fill:"#ffffff"},".label":{text:"",ref:".body","ref-x":.5,"ref-dy":5,"text-anchor":"middle"},path:{d:"M 0 0 L 30 0 30 30 0 30 z M 15 4 L 15 26 M 4 15 L 26 15",ref:".body","ref-x":.5,"ref-dy":-30,"x-alignment":"middle",fill:"#ffffff",stroke:"#000000","fill-opacity":0}},conversationType:"conversation"},joint.dia.Element.prototype.defaults),initialize:function(){joint.dia.Element.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:conversationType",this.onConversationTypeChange),this.onConversationTypeChange(this,this.get("conversationType"))},onConversationTypeChange:function(t,e){switch(e){case"conversation":t.attr("polygon/stroke-width",1);break;case"call-conversation":t.attr("polygon/stroke-width",4);break;default:throw"BPMN: Unknown Conversation Type: "+e}}}).extend(joint.shapes.bpmn.SubProcessInterface),joint.shapes.bpmn.Choreography=joint.shapes.basic.TextBlock.extend({markup:['<g class="rotatable">','<g class="scalable"><rect class="body"/></g>',"<switch>",'<foreignObject requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" class="fobj">','<body xmlns="http://www.w3.org/1999/xhtml"><div/></body>',"</foreignObject>",'<text class="content"/>',"</switch>",'<text class="label"/><path class="sub-process"/><g class="participants"/>',"</g>"].join(""),participantMarkup:'<g class="participant"><rect class="participant-rect"/><text class="participant-label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Choreography",size:{width:60,height:80},attrs:{rect:{},".body":{width:60,height:80,stroke:"#000000",fill:"#ffffff"},".label":{ref:".body","ref-x":.5,"ref-dy":5,text:"","text-anchor":"middle"},".participant-rect":{stroke:"#000000",fill:"#aaaaaa",ref:".body","ref-width":1},".participant-label":{"text-anchor":"middle",ref:".participant_0 .participant-rect","ref-x":.5,"ref-y":.5,"y-alignment":"middle"},".sub-process":{d:"M 0 0 L 30 0 30 30 0 30 z M 15 4 L 15 26 M 4 15 L 26 15",ref:".body","ref-x":.5,"ref-dy":-30,"x-alignment":"middle",fill:"transparent",stroke:"#000000"}},participants:[],initiatingParticipant:0},joint.shapes.basic.TextBlock.prototype.defaults)}).extend(joint.shapes.bpmn.SubProcessInterface),joint.shapes.bpmn.ChoreographyView=joint.shapes.basic.TextBlockView.extend({options:{participantHeight:20},initialize:function(){this.listenTo(this.model,"change:participants",function(t,e){this.renderParticipants(e)}),this.listenTo(this.model,"change:size",this.layoutAndUpdate),this.listenTo(this.model,"change:initiatingParticipant",this.layoutAndUpdate),joint.shapes.basic.TextBlockView.prototype.initialize.apply(this,arguments),this.noSVGForeignObjectElement&&this.off(null,"change:content").listenTo(this.model,"change:content",function(t){this.updateContent(t,this.participantsAttrs)})},update:function(){return _.isUndefined(this.participantsAttrs)?this.renderParticipants(this.model.get("participants")):(this.layoutAndUpdate(),this)},renderMarkup:function(){joint.dia.ElementView.prototype.renderMarkup.apply(this,arguments),this.$participants=this.$(".participants"),this.participantMarkup=V(this.model.participantMarkup)},renderParticipants:function(t){this.$participants.empty(),this.participantsAttrs={},_.each(t,function(t,e){var i="participant_"+e,n="."+i;this.participantsAttrs[n+" .participant-rect"]={height:this.options.participantHeight},this.participantsAttrs[n+" .participant-label"]={text:t},this.$participants.append(this.participantMarkup.clone().addClass(i).node)},this),this.layoutAndUpdate()},layoutAndUpdate:function(){var t=this.model.get("participants")||[],e=t.length,i=this.options.participantHeight,n=this.model.get("size").height,r=Math.max(0,n-i*e),a=0,s=this.model.get("initiatingParticipant"),o=Math.max(_.isNumber(s)?Math.abs(s):t.indexOf(s),0),l=Math.min(o,e-2);_.each(t,function(t,e){var n=".participant_"+e;this.participantsAttrs[n]={transform:"translate(0,"+a+")"},this.participantsAttrs[n+" .participant-rect"].fill=o==e?this.model.attr(".body/fill"):this.model.attr(".participant-rect/fill"),this.participantsAttrs[n+" .participant-rect"].stroke=o==e?this.model.attr(".body/stroke"):this.model.attr(".participant-rect/stroke"),a+=i+(l==e?r:0)},this);var c=2>e?0:l-e+1;this.participantsAttrs[".sub-process"]={"ref-dy":Math.max(-n,c*i-30)};var h=2>e?0:l+1;this.participantsAttrs[".fobj div"]={style:{height:r,paddingTop:i*h}},this.participantsAttrs[".content"]={"ref-y":i*h+r/2};var u=_.merge({},this.model.get("attrs"),this.participantsAttrs||{});joint.shapes.basic.TextBlockView.prototype.update.call(this,this.model,u)}}),joint.shapes.bpmn.Message=joint.dia.Element.extend({markup:'<g class="rotatable"><g class="scalable"><polygon class="body"/></g><text class="label"/></g>',defaults:joint.util.deepSupplement({type:"bpmn.Message",size:{width:60,height:40},attrs:{".body":{points:"0,0 60,0 60,40 0,40 0,0 60,0 30,20 0,0",stroke:"#000000",fill:"#ffffff"},".label":{ref:".body","ref-x":.5,"ref-dy":5,text:"","text-anchor":"middle"}}},joint.dia.Element.prototype.defaults)}),joint.shapes.bpmn.Flow=joint.dia.Link.extend({defaults:{type:"bpmn.Flow",attrs:{".marker-source":{d:"M 0 0"},".marker-target":{d:"M 10 0 L 0 5 L 10 10 z",fill:"#000000"},".connection":{"stroke-dasharray":" ","stroke-width":1},".connection-wrap":{style:"",onMouseOver:"",onMouseOut:""}},flowType:"normal"},initialize:function(){joint.dia.Link.prototype.initialize.apply(this,arguments),this.listenTo(this,"change:flowType",this.onFlowTypeChange),this.onFlowTypeChange(this,this.get("flowType"))},onFlowTypeChange:function(t,e){var i;switch(e){case"default":i={".marker-source":{d:"M 0 5 L 20 5 M 20 0 L 10 10",fill:"none"}};break;case"conditional":i={".marker-source":{d:"M 20 8 L 10 0 L 0 8 L 10 16 z",fill:"#FFF"}};break;case"normal":i={};break;case"message":i={".marker-target":{fill:"#FFF"},".connection":{"stroke-dasharray":"4,4"}};break;case"association":i={".marker-target":{d:"M 0 0"},".connection":{"stroke-dasharray":"4,4"}};break;case"conversation":i={".marker-target":{d:"M 0 0"},".connection":{"stroke-width":"7px"},".connection-wrap":{style:"stroke: #fff; stroke-width: 5px; opacity: 1;",onMouseOver:"var s=this.style;s.stroke='#000';s.strokeWidth=15;s.opacity=.4",onMouseOut:"var s=this.style;s.stroke='#fff';s.strokeWidth=5;s.opacity=1"}};break;default:throw"BPMN: Unknown Flow Type: "+e}t.attr(_.merge({},this.defaults.attrs,i))}}),joint.dia.CommandManager=Backbone.Model.extend({defaults:{cmdBeforeAdd:null,cmdNameRegex:/^(?:add|remove|change:\w+)$/},PREFIX_LENGTH:7,initialize:function(t){_.bindAll(this,"initBatchCommand","storeBatchCommand"),this.graph=t.graph,this.reset(),this.listen()},listen:function(){this.listenTo(this.graph,"all",this.addCommand,this),this.listenTo(this.graph,"batch:start",this.initBatchCommand,this),this.listenTo(this.graph,"batch:stop",this.storeBatchCommand,this)},createCommand:function(t){var e={action:void 0,data:{id:void 0,type:void 0,previous:{},next:{}},batch:t&&t.batch};return e},addCommand:function(t,e,i,n){if(this.get("cmdNameRegex").test(t)&&("function"!=typeof this.get("cmdBeforeAdd")||this.get("cmdBeforeAdd").apply(this,arguments))){var r=_.bind(function(t){this.redoStack=[],t.batch?(this.lastCmdIndex=Math.max(this.lastCmdIndex,0),this.trigger("batch",t)):(this.undoStack.push(t),this.trigger("add",t))},this),a=void 0;if(this.batchCommand?(a=this.batchCommand[Math.max(this.lastCmdIndex,0)],this.lastCmdIndex>=0&&(a.data.id!==e.id||a.action!==t)&&(a=_.find(this.batchCommand,function(i,n){return this.lastCmdIndex=n,i.data.id===e.id&&i.action===t},this),a||(this.lastCmdIndex=this.batchCommand.push(this.createCommand({batch:!0}))-1,a=_.last(this.batchCommand)))):(a=this.createCommand(),a.batch=!1),"add"===t||"remove"===t)return a.action=t,a.data.id=e.id,a.data.type=e.attributes.type,a.data.attributes=_.merge({},e.toJSON()),a.options=n||{},r(a);var s=t.substr(this.PREFIX_LENGTH);return a.batch&&a.action||(a.action=t,a.data.id=e.id,a.data.type=e.attributes.type,a.data.previous[s]=_.clone(e.previous(s)),a.options=n||{}),a.data.next[s]=_.clone(e.get(s)),r(a)}},initBatchCommand:function(){this.batchCommand?this.batchLevel++:(this.batchCommand=[this.createCommand({batch:!0})],this.lastCmdIndex=-1,this.batchLevel=0)},storeBatchCommand:function(){this.batchCommand&&0>=this.batchLevel?(this.lastCmdIndex>=0&&(this.redoStack=[],this.undoStack.push(this.batchCommand),this.trigger("add",this.batchCommand)),delete this.batchCommand,delete this.lastCmdIndex,delete this.batchLevel):this.batchCommand&&this.batchLevel>0&&this.batchLevel--},revertCommand:function(t){this.stopListening();var e;e=_.isArray(t)?t:[t];for(var i=e.length-1;i>=0;i--){var n=e[i],r=this.graph.getCell(n.data.id);switch(n.action){case"add":r.remove();break;case"remove":this.graph.addCell(n.data.attributes);break;default:var a=n.action.substr(this.PREFIX_LENGTH);r.set(a,n.data.previous[a])}}this.listen()},applyCommand:function(t){this.stopListening();var e;e=_.isArray(t)?t:[t];for(var i=0;e.length>i;i++){var n=e[i],r=this.graph.getCell(n.data.id);switch(n.action){case"add":this.graph.addCell(n.data.attributes);break;case"remove":r.remove();break;default:var a=n.action.substr(this.PREFIX_LENGTH);r.set(a,n.data.next[a])}}this.listen()},undo:function(){var t=this.undoStack.pop();t&&(this.revertCommand(t),this.redoStack.push(t))},redo:function(){var t=this.redoStack.pop();t&&(this.applyCommand(t),this.undoStack.push(t))},cancel:function(){this.hasUndo()&&(this.revertCommand(this.undoStack.pop()),this.redoStack=[])},reset:function(){this.undoStack=[],this.redoStack=[]},hasUndo:function(){return this.undoStack.length>0},hasRedo:function(){return this.redoStack.length>0}}),joint.dia.Validator=Backbone.Model.extend({initialize:function(t){this._map={},this._commandManager=t.commandManager,this.listenTo(this._commandManager,"add",this._onCommand)},defaults:{cancelInvalid:!0},_onCommand:function(t){return _.isArray(t)?_.find(t,function(t){return!this._validateCommand(t)},this):this._validateCommand(t)},_validateCommand:function(t){if(t.options&&t.options.validation===!1)return!0;var e;return _.each(this._map[t.action],function(i){function n(a){var s=i[r++];try{if(!s)return e=a,void 0;s(a,t,n)}catch(a){n(a)}}var r=0;n(e)}),e?(this.get("cancelInvalid")&&this._commandManager.cancel(),this.trigger("invalid",e),!1):!0},validate:function(t){var e=_.rest(arguments);return _.each(e,function(e){if(!_.isFunction(e))throw Error(t+" requires callback functions.")}),_.each(t.split(" "),function(t){(this._map[t]=this._map[t]||[]).push(e)},this),this}}),function(){function t(t,i,n){if(_.isUndefined(n))return e.call(this,t,i);n.direction=n.direction||"bottom-right";var r=g.normalizeAngle(this.get("angle")||0),a={"top-right":0,"top-left":1,"bottom-left":2,"bottom-right":3}[n.direction];n.absolute&&(a+=Math.floor((r+45)/90),a%=4);var s=this.getBBox(),o=s[["bottomLeft","corner","topRight","origin"][a]](),l=g.point(o).rotate(s.center(),-r),c=Math.sqrt(t*t+i*i)/2,h=a*Math.PI/2;h+=Math.atan(0==a%2?i/t:t/i),h-=g.toRad(r);var u=g.point.fromPolar(c,h,l),p=g.point(u).offset(t/-2,i/-2);this.resize(t,i).position(p.x,p.y)}var e=joint.dia.Element.prototype.resize;joint.dia.Element.prototype.resize=t}(),joint.ui.PaperScroller=Backbone.View.extend({className:"paper-scroller",events:{mousemove:"pan",touchmove:"pan",mouseout:"stopPanning"},initialize:function(){_.bindAll(this,"startPanning","stopPanning"),$(document.body).on("mouseup touchend",this.stopPanning)
25 },render:function(){return this.listenTo(this.options.paper,"scale resize",this.onScale),this.options.autoResizePaper&&(this._ow=this.options.paper.options.width,this._oh=this.options.paper.options.height,this.listenTo(this.options.paper.model,"all",function(){this.options.paper.fitToContent(this._ow,this._oh)})),this},onScale:function(t,e){var i=this.options.paper.viewport.getCTM(),n=i.a,r=i.d;V(this.options.paper.viewport).attr("transform",""),V(this.options.paper.viewport).scale(n,r),V(this.options.paper.svg).attr({width:this.options.paper.options.width*n,height:this.options.paper.options.height*r}),t&&e&&this.center(t,e)},center:function(t,e){(_.isUndefined(t)||_.isUndefined(e))&&(t=this.options.paper.options.width/2,e=this.options.paper.options.height/2);var i=this.options.paper.viewport.getCTM(),n=i.a,r=i.d,a=this.el.clientWidth/n/2,s=this.el.clientHeight/r/2;this.el.scrollLeft=(t-a)*n,this.el.scrollTop=(e-s)*r},centerContent:function(){var t=V(this.options.paper.viewport).bbox(!0,this.options.paper.svg);this.center(t.x+t.width/2,t.y+t.height/2)},startPanning:function(t){t=joint.util.normalizeEvent(t),this._panning=!0,this._clientX=t.clientX,this._clientY=t.clientY},pan:function(t){if(this._panning){t=joint.util.normalizeEvent(t);var e=t.clientX-this._clientX,i=t.clientY-this._clientY;this.el.scrollTop-=i,this.el.scrollLeft-=e,this._clientX=t.clientX,this._clientY=t.clientY}},stopPanning:function(){delete this._panning}}),joint.ui.SelectionView=Backbone.View.extend({options:{paper:void 0,graph:void 0},className:"selection",events:{"mousedown .selection-box":"startTranslatingSelection","touchstart .selection-box":"startTranslatingSelection"},initialize:function(){_.bindAll(this,"startSelecting","stopSelecting","adjustSelection"),$(document.body).on("mousemove.selectionView touchmove.selectionView",this.adjustSelection),this.listenTo(this.options.graph,"reset",this.cancelSelection),this.listenTo(this.options.paper,"scale",this.updateSelectionBoxes),this.listenTo(this.options.graph,"remove change",function(t,e){e["selectionView_"+this.cid]||this.updateSelectionBoxes()}),this.options.paper.$el.append(this.$el),this._boxCount=0},startTranslatingSelection:function(t){t.stopPropagation(),t=joint.util.normalizeEvent(t),this._action="translating",this.options.graph.trigger("batch:start");var e=this.options.paper.snapToGrid(g.point(t.clientX,t.clientY));this._snappedClientX=e.x,this._snappedClientY=e.y,this.trigger("selection-box:pointerdown",t),this.mouseupRegister()},startSelecting:function(t){t=joint.util.normalizeEvent(t),this.cancelSelection(),this._action="selecting",this._clientX=t.clientX,this._clientY=t.clientY;var e=t.target.parentElement||t.target.parentNode,i=$(e).offset(),n=e.scrollLeft,r=e.scrollTop;this._offsetX=void 0===t.offsetX?t.clientX-i.left+window.pageXOffset+n:t.offsetX,this._offsetY=void 0===t.offsetY?t.clientY-i.top+window.pageYOffset+r:t.offsetY,this.$el.css({width:1,height:1,left:this._offsetX,top:this._offsetY}).show(),this.mouseupRegister()},adjustSelection:function(t){t=joint.util.normalizeEvent(t);var e,i;switch(this._action){case"selecting":e=t.clientX-this._clientX,i=t.clientY-this._clientY,this.$el.width(),this.$el.height();var n=parseInt(this.$el.css("left"),10),r=parseInt(this.$el.css("top"),10);this.$el.css({left:0>e?this._offsetX+e:n,top:0>i?this._offsetY+i:r,width:Math.abs(e),height:Math.abs(i)});break;case"translating":var a=this.options.paper.snapToGrid(g.point(t.clientX,t.clientY)),s=a.x,o=a.y;e=s-this._snappedClientX,i=o-this._snappedClientY;var l={};if(this.model.each(function(t){var n={};n["selectionView_"+this.cid]=!0,t.translate(e,i,n);var r=this.options.graph.getConnectedLinks(t);_.each(r,function(t){if(!l[t.id]){var r=t.get("vertices");if(r&&r.length){var a=[];_.each(r,function(t){a.push({x:t.x+e,y:t.y+i})}),t.set("vertices",a,n)}l[t.id]=!0}})},this),e||i){var c=V(this.options.paper.viewport).scale();e*=c.sx,i*=c.sy,this.$(".selection-box").each(function(){var t=parseFloat($(this).css("left"),10),n=parseFloat($(this).css("top"),10);$(this).css({left:t+e,top:n+i})}),this._snappedClientX=s,this._snappedClientY=o}this.trigger("selection-box:pointermove",t)}},stopSelecting:function(t){switch(this._action){case"selecting":var e=this.$el.offset(),i=this.$el.width(),n=this.$el.height(),r=V(this.options.paper.viewport).toLocalPoint(e.left,e.top);r.x-=window.pageXOffset,r.y-=window.pageYOffset;var a=V(this.options.paper.viewport).scale();i/=a.sx,n/=a.sy;var s=this.options.paper.findViewsInArea(g.rect(r.x,r.y,i,n));s.length?(_.each(s,this.createSelectionBox,this),this.$el.addClass("selected")):this.$el.hide(),this.model.reset(_.pluck(s,"model"));break;case"translating":this.options.graph.trigger("batch:stop"),this.trigger("selection-box:pointerup",t);break;default:this.cancelSelection()}delete this._action},cancelSelection:function(){this.$el.hide().empty().removeClass("selected"),this.model.reset([]),this._boxCount=0},destroySelectionBox:function(t){this.$('[data-model="'+t.model.get("id")+'"]').remove(),0===this.$(".selection-box").length&&this.$el.hide().removeClass("selected"),this._boxCount=Math.max(0,this._boxCount-1)},createSelectionBox:function(t){var e=t.getBBox(),i=$("<div/>",{"class":"selection-box","data-model":t.model.get("id")});i.css({left:e.x,top:e.y,width:e.width,height:e.height}),this.$el.append(i),this.$el.addClass("selected").show(),this._boxCount++},updateSelectionBoxes:function(){this._boxCount&&this.$el.hide().removeClass("selected").find(".selection-box").each(_.bind(function(t,e){var i=$(e).remove().attr("data-model"),n=this.options.paper.findViewByModel(this.model.get(i));n&&this.createSelectionBox(n)},this))},mouseupRegister:function(){var t="function"==typeof window.ontouchend?"touchend.selectionView":"mouseup.selectionView";$(document.body).one(t,this.stopSelecting)},remove:function(){Backbone.View.prototype.remove.apply(this,arguments),$(document.body).off(".selectionView")}}),joint.ui.Clipboard=Backbone.Collection.extend({copyElements:function(t,e,i){i=i||{};var n=[],r=[],a={};t.each(function(s){var o=e.getConnectedLinks(s);n=n.concat(_.filter(o,function(e){return t.get(e.get("source").id)&&t.get(e.get("target").id)?!0:!1}));var l=s.clone();i.translate&&l.translate(i.translate.dx||20,i.translate.dy||20),r.push(l),a[s.get("id")]=l.get("id")});var s=_.unique(n);return n=_.map(s,function(t){var e=t.clone(),n=e.get("source"),r=e.get("target");return n.id=a[n.id],r.id=a[r.id],e.set({source:_.clone(n),target:_.clone(r)}),i.translate&&_.each(e.get("vertices"),function(t){t.x+=i.translate.dx||20,t.y+=i.translate.dy||20}),e}),this.reset(r.concat(n)),i.useLocalStorage&&window.localStorage&&localStorage.setItem("joint.ui.Clipboard.cells",JSON.stringify(this.toJSON())),(t.models||[]).concat(s)},pasteCells:function(t,e){e=e||{},e.useLocalStorage&&0===this.length&&window.localStorage&&this.reset(JSON.parse(localStorage.getItem("joint.ui.Clipboard.cells"))),t.trigger("batch:start"),this.each(function(i){i.unset("z"),i instanceof joint.dia.Link&&e.link&&i.set(e.link),t.addCell(i.toJSON())}),t.trigger("batch:stop")},clear:function(){this.reset([]),window.localStorage&&localStorage.removeItem("joint.ui.Clipboard.cells")}});var Handlebars={};(function(t,e){t.VERSION="1.0.0",t.COMPILER_REVISION=4,t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"},t.helpers={},t.partials={};var i=Object.prototype.toString,n="[object Function]",r="[object Object]";t.registerHelper=function(e,n,a){if(i.call(e)===r){if(a||n)throw new t.Exception("Arg not supported with multiple helpers");t.Utils.extend(this.helpers,e)}else a&&(n.not=a),this.helpers[e]=n},t.registerPartial=function(e,n){i.call(e)===r?t.Utils.extend(this.partials,e):this.partials[e]=n},t.registerHelper("helperMissing",function(t){if(2===arguments.length)return e;throw Error("Missing helper: '"+t+"'")}),t.registerHelper("blockHelperMissing",function(e,r){var a=r.inverse||function(){},s=r.fn,o=i.call(e);return o===n&&(e=e.call(this)),e===!0?s(this):e===!1||null==e?a(this):"[object Array]"===o?e.length>0?t.helpers.each(e,r):a(this):s(e)}),t.K=function(){},t.createFrame=Object.create||function(e){t.K.prototype=e;var i=new t.K;return t.K.prototype=null,i},t.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(e,i){if(e>=t.logger.level){var n=t.logger.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,i)}}},t.log=function(e,i){t.logger.log(e,i)},t.registerHelper("each",function(e,r){var a,s=r.fn,o=r.inverse,l=0,c="",h=i.call(e);if(h===n&&(e=e.call(this)),r.data&&(a=t.createFrame(r.data)),e&&"object"==typeof e)if(e instanceof Array)for(var u=e.length;u>l;l++)a&&(a.index=l),c+=s(e[l],{data:a});else for(var p in e)e.hasOwnProperty(p)&&(a&&(a.key=p),c+=s(e[p],{data:a}),l++);return 0===l&&(c=o(this)),c}),t.registerHelper("if",function(e,r){var a=i.call(e);return a===n&&(e=e.call(this)),!e||t.Utils.isEmpty(e)?r.inverse(this):r.fn(this)}),t.registerHelper("unless",function(e,i){return t.helpers["if"].call(this,e,{fn:i.inverse,inverse:i.fn})}),t.registerHelper("with",function(r,a){var s=i.call(r);return s===n&&(r=r.call(this)),t.Utils.isEmpty(r)?e:a.fn(r)}),t.registerHelper("log",function(e,i){var n=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;t.log(n,e)});var a=["description","fileName","lineNumber","message","name","number","stack"];t.Exception=function(){for(var t=Error.prototype.constructor.apply(this,arguments),e=0;a.length>e;e++)this[a[e]]=t[a[e]]},t.Exception.prototype=Error(),t.SafeString=function(t){this.string=t},t.SafeString.prototype.toString=function(){return""+this.string};var s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},o=/[&<>"'`]/g,l=/[&<>"'`]/,c=function(t){return s[t]||"&amp;"};t.Utils={extend:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},escapeExpression:function(e){return e instanceof t.SafeString?""+e:null==e||e===!1?"":(e=""+e,l.test(e)?e.replace(o,c):e)},isEmpty:function(t){return t||0===t?"[object Array]"===i.call(t)&&0===t.length?!0:!1:!0}},t.VM={template:function(e){var i={escapeExpression:t.Utils.escapeExpression,invokePartial:t.VM.invokePartial,programs:[],program:function(e,i,n){var r=this.programs[e];return n?r=t.VM.program(e,i,n):r||(r=this.programs[e]=t.VM.program(e,i)),r},merge:function(e,i){var n=e||i;return e&&i&&(n={},t.Utils.extend(n,i),t.Utils.extend(n,e)),n},programWithDepth:t.VM.programWithDepth,noop:t.VM.noop,compilerInfo:null};return function(n,r){r=r||{};var a=e.call(i,t,n,r.helpers,r.partials,r.data),s=i.compilerInfo||[],o=s[0]||1,l=t.COMPILER_REVISION;if(o!==l){if(l>o){var c=t.REVISION_CHANGES[l],h=t.REVISION_CHANGES[o];throw"Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+c+") or downgrade your runtime to an older version ("+h+")."}throw"Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+s[1]+")."}return a}},programWithDepth:function(t,e,i){var n=Array.prototype.slice.call(arguments,3),r=function(t,r){return r=r||{},e.apply(this,[t,r.data||i].concat(n))};return r.program=t,r.depth=n.length,r},program:function(t,e,i){var n=function(t,n){return n=n||{},e(t,n.data||i)};return n.program=t,n.depth=0,n},noop:function(){return""},invokePartial:function(i,n,r,a,s,o){var l={helpers:a,partials:s,data:o};if(i===e)throw new t.Exception("The partial "+n+" could not be found");if(i instanceof Function)return i(r,l);if(t.compile)return s[n]=t.compile(i,{data:o!==e}),s[n](r,l);throw new t.Exception("The partial "+n+" could not be compiled when running in runtime-only mode")}},t.template=t.VM.template})(Handlebars),this.joint=this.joint||{},this.joint.templates=this.joint.templates||{},this.joint.templates.halo=this.joint.templates.halo||{},this.joint.templates.halo["box.html"]=Handlebars.template(function(t,e,i,n,r){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{},'<label class="box"></label>\n'}),this.joint.templates.halo["handle.html"]=Handlebars.template(function(t,e,i,n,r){function a(t){var e="";return e+='style="background-image: url('+h(typeof t===c?t.apply(t):t)+')"'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var s,o,l="",c="function",h=this.escapeExpression,u=this,p=i.blockHelperMissing;return l+='<div class="handle ',(s=i.position)?s=s.call(e,{hash:{},data:r}):(s=e.position,s=typeof s===c?s.apply(e):s),l+=h(s)+" ",(s=i.name)?s=s.call(e,{hash:{},data:r}):(s=e.name,s=typeof s===c?s.apply(e):s),l+=h(s)+'" draggable="false" data-action="',(s=i.name)?s=s.call(e,{hash:{},data:r}):(s=e.name,s=typeof s===c?s.apply(e):s),l+=h(s)+'" ',o={hash:{},inverse:u.noop,fn:u.program(1,a,r),data:r},(s=i.icon)?s=s.call(e,o):(s=e.icon,s=typeof s===c?s.apply(e):s),i.icon||(s=p.call(e,s,o)),(s||0===s)&&(l+=s),l+=">\n    ",(s=i.content)?s=s.call(e,{hash:{},data:r}):(s=e.content,s=typeof s===c?s.apply(e):s),(s||0===s)&&(l+=s),l+="\n</div>\n\n"}),joint.ui.Halo=Backbone.View.extend({className:"halo",events:{"mousedown .handle":"onHandlePointerDown","touchstart .handle":"onHandlePointerDown"},options:{tinyTreshold:40,smallTreshold:80,loopLinkPreferredSide:"top",loopLinkWidth:40,boxContent:function(t){var e=_.template("x: <%= x %>, y: <%= y %>, width: <%= width %>, height: <%= height %>, angle: <%= angle %>"),i=t.model.getBBox();return e({x:Math.floor(i.x),y:Math.floor(i.y),width:i.width,height:i.height,angle:Math.floor(t.model.get("angle")||0)})},linkAttributes:{},smoothLinks:void 0,handles:[{name:"resize",position:"se",events:{pointerdown:"startResizing",pointermove:"doResize",pointerup:"stopBatch"}},{name:"remove",position:"nw",events:{pointerdown:"removeElement"}},{name:"clone",position:"n",events:{pointerdown:"startCloning",pointermove:"doClone",pointerup:"stopBatch"}},{name:"link",position:"e",events:{pointerdown:"startLinking",pointermove:"doLink",pointerup:"stopLinking"}},{name:"fork",position:"ne",events:{pointerdown:"startForking",pointermove:"doFork",pointerup:"stopBatch"}},{name:"unlink",position:"w",events:{pointerdown:"unlinkElement"}},{name:"rotate",position:"sw",events:{pointerdown:"startRotating",pointermove:"doRotate",pointerup:"stopBatch"}}]},initialize:function(){_.defaults(this.options,{paper:this.options.cellView.paper,graph:this.options.cellView.paper.model}),_.bindAll(this,"pointermove","pointerup","render","update","remove"),joint.ui.Halo.clear(this.options.paper),this.handles=[],_.each(this.options.handles,this.addHandle,this),this.listenTo(this.options.graph,"reset",this.remove),this.listenTo(this.options.graph,"all",this.update),this.listenTo(this.options.paper,"blank:pointerdown halo:create",this.remove),this.listenTo(this.options.paper,"scale",this.update),$(document.body).on("mousemove touchmove",this.pointermove),$(document).on("mouseup touchend",this.pointerup),this.options.paper.$el.append(this.$el)},render:function(){return this.options.cellView.model.on("remove",this.remove),this.$el.append(joint.templates.halo["box.html"]()),this.renderMagnets(),this.update(),this.$el.addClass("animate"),this.$el.attr("data-type",this.options.cellView.model.get("type")),this.toggleFork(),this},update:function(){if(!(this.options.cellView.model instanceof joint.dia.Link)){if(_.isFunction(this.options.boxContent)){var t=this.$(".box"),e=this.options.boxContent.call(this,this.options.cellView,t[0]);e&&t.html(e)}var i=this.options.cellView.getBBox();this.$el.toggleClass("tiny",i.width<this.options.tinyTreshold&&i.height<this.options.tinyTreshold),this.$el.toggleClass("small",!this.$el.hasClass("tiny")&&i.width<this.options.smallTreshold&&i.height<this.options.smallTreshold),this.$el.css({width:i.width,height:i.height,left:i.x,top:i.y}).show(),this.updateMagnets(),this.toggleUnlink()}},addHandle:function(t){return this.handles.push(t),this.$el.append(joint.templates.halo["handle.html"](t)),_.each(t.events,function(e,i){_.isString(e)?this.on("action:"+t.name+":"+i,this[e],this):this.on("action:"+t.name+":"+i,e)},this),this},removeHandle:function(t){var e=_.findIndex(this.handles,{name:t}),i=this.handles[e];return i&&(_.each(i.events,function(e,i){this.off("action:"+t+":"+i)},this),this.$(".handle."+t).remove(),this.handles.splice(e,1)),this},changeHandle:function(t,e){var i=_.findWhere(this.handles,{name:t});return i&&(this.removeHandle(t),this.addHandle(_.merge({name:t},i,e))),this},onHandlePointerDown:function(t){this._action=$(t.target).closest(".handle").attr("data-action"),this._action&&(this._clientX=t.clientX,this._clientY=t.clientY,this._startClientX=this._clientX,this._startClientY=this._clientY,this.triggerAction(this._action,"pointerdown",t))},triggerAction:function(t,e){var i=["action:"+t+":"+e].concat(_.rest(_.toArray(arguments),2));this.trigger.apply(this,i)},startCloning:function(t){t.preventDefault(),t.stopPropagation(),t=joint.util.normalizeEvent(t),this.options.graph.trigger("batch:start"),this._clone=this.options.cellView.model.clone(),this._clone.unset("z"),this.options.graph.addCell(this._clone,{halo:this.cid})},startLinking:function(t){t.preventDefault(),t.stopPropagation(),t=joint.util.normalizeEvent(t),this.options.graph.trigger("batch:start");var e=this.options.cellView,i=$.data(t.target,"selector"),n=this.options.paper.getDefaultLink(e,i&&e.el.querySelector(i));n.set("source",{id:e.model.id,selector:i}),n.set("target",{x:0,y:0}),n.attr(this.options.linkAttributes),_.isBoolean(this.options.smoothLinks)&&n.set("smooth",this.options.smoothLinks),this.options.graph.addCell(n,{validation:!1,halo:this.cid}),n.set("target",this.options.paper.snapToGrid({x:t.clientX,y:t.clientY})),this._linkView=this.options.paper.findViewByModel(n),this._linkView.startArrowheadMove("target")},startForking:function(t){t.preventDefault(),t.stopPropagation(),t=joint.util.normalizeEvent(t),this.options.graph.trigger("batch:start"),this._clone=this.options.cellView.model.clone(),this._clone.unset("z"),this.options.graph.addCell(this._clone,{halo:this.cid});var e=this.options.paper.getDefaultLink(this.options.cellView);e.set("source",{id:this.options.cellView.model.id}),e.set("target",{id:this._clone.id}),e.attr(this.options.linkAttributes),_.isBoolean(this.options.smoothLinks)&&e.set("smooth",this.options.smoothLinks),this.options.graph.addCell(e,{halo:this.cid})},startResizing:function(t){t.preventDefault(),t.stopPropagation(),t=joint.util.normalizeEvent(t),this.options.graph.trigger("batch:start"),this._flip=[1,0,0,1,1,0,0,1][Math.floor(g.normalizeAngle(this.options.cellView.model.get("angle"))/45)]},startRotating:function(t){t.preventDefault(),t.stopPropagation(),t=joint.util.normalizeEvent(t),this.options.graph.trigger("batch:start");var e=this.options.cellView.getBBox();if(this._center=g.rect(e).center(),t.offsetX===void 0||t.offsetY===void 0){var i=$(t.target).offset();t.offsetX=t.pageX-i.left,t.offsetY=t.pageY-i.top}this._rotationStart=g.point(t.offsetX+t.target.parentNode.offsetLeft,t.offsetY+t.target.parentNode.offsetTop+t.target.parentNode.offsetHeight);var n=this.options.cellView.model.get("angle");this._rotationStartAngle=n||0},doResize:function(t,e,i){var n=this.options.cellView.model.get("size"),r=Math.max(n.width+(this._flip?e:i),1),a=Math.max(n.height+(this._flip?i:e),1);this.options.cellView.model.resize(r,a,{absolute:!0})},doRotate:function(t,e,i,n,r){var a=g.point(this._rotationStart).offset(n,r),s=a.distance(this._center),o=this._center.distance(this._rotationStart),l=this._rotationStart.distance(a),c=(this._center.x-this._rotationStart.x)*(a.y-this._rotationStart.y)-(this._center.y-this._rotationStart.y)*(a.x-this._rotationStart.x),h=Math.acos((s*s+o*o-l*l)/(2*s*o));0>=c&&(h=-h);var u=-g.toDeg(h);u=g.snapToGrid(u,15),this.options.cellView.model.rotate(u+this._rotationStartAngle,!0)},doClone:function(t,e,i){this._clone.translate(e,i)},doFork:function(t,e,i){this._clone.translate(e,i)},doLink:function(t){var e=this.options.paper.snapToGrid({x:t.clientX,y:t.clientY});this._linkView.pointermove(t,e.x,e.y)},stopLinking:function(t){this._linkView.pointerup(t);var e=this._linkView.model.get("source").id,i=this._linkView.model.get("target").id;e&&i&&e===i&&this.makeLoopLink(this._linkView.model),this.stopBatch(),delete this._linkView},pointermove:function(t){if(this._action){t.preventDefault(),t.stopPropagation(),t=joint.util.normalizeEvent(t);var e=this.options.paper.snapToGrid({x:t.clientX,y:t.clientY}),i=this.options.paper.snapToGrid({x:this._clientX,y:this._clientY}),n=e.x-i.x,r=e.y-i.y;this.triggerAction(this._action,"pointermove",t,n,r,t.clientX-this._startClientX,t.clientY-this._startClientY),this._clientX=t.clientX,this._clientY=t.clientY}},pointerup:function(t){this._action&&(this.triggerAction(this._action,"pointerup",t),delete this._action)},stopBatch:function(){this.options.graph.trigger("batch:stop")},remove:function(){Backbone.View.prototype.remove.apply(this,arguments),$(document.body).off("mousemove touchmove",this.pointermove),$(document).off("mouseup touchend",this.pointerup)},removeElement:function(t){t.stopPropagation(),this.options.cellView.model.remove()},unlinkElement:function(t){t.stopPropagation(),this.options.graph.removeLinks(this.options.cellView.model)},toggleUnlink:function(){this.options.graph.getConnectedLinks(this.options.cellView.model).length>0?this.$(".unlink").show():this.$(".unlink").hide()},toggleFork:function(){var t=this.options.cellView.model.clone(),e=this.options.paper.createViewForModel(t);this.options.paper.options.validateConnection(this.options.cellView,null,e,null,"target")||this.$(".fork").hide(),e.remove(),t=null},makeLoopLink:function(t){var e,i,n=this.options.loopLinkWidth,r=this.options.paper.options,a=g.rect({x:0,y:0,width:r.width,height:r.height}),s=V(this.options.cellView.el).bbox(!1,this.options.paper.viewport),o=_.uniq([this.options.loopLinkPreferredSide,"top","bottom","left","right"]),l=_.find(o,function(t){var r,o=0,l=0;switch(t){case"top":r=g.point(s.x+s.width/2,s.y-n),o=n/2;break;case"bottom":r=g.point(s.x+s.width/2,s.y+s.height+n),o=n/2;break;case"left":r=g.point(s.x-n,s.y+s.height/2),l=n/2;break;case"right":r=g.point(s.x+s.width+n,s.y+s.height/2),l=n/2}return e=g.point(r).offset(-o,-l),i=g.point(r).offset(o,l),a.containsPoint(e)&&a.containsPoint(i)},this);l&&t.set("vertices",[e,i])},renderMagnets:function(){this._magnets=[];var t=this.$(".link"),e=this.options.cellView.$('[magnet="true"]');if(this.options.magnetFilter&&(e=_.isFunction(this.options.magnetFilter)?_.filter(e,this.options.magnetFilter):e.filter(this.options.magnetFilter)),t.length&&e.length){var i=t.width(),n=t.height();_.each(e,function(e){var r=e.getBoundingClientRect(),a=t.clone().addClass("halo-magnet").css({width:Math.min(r.width,i),height:Math.min(r.height,n),"background-size":"contain"}).data("selector",this.options.cellView.getSelector(e)).appendTo(this.$el);this._magnets.push({$halo:a,el:e})},this)}"false"==this.options.cellView.$el.attr("magnet")&&(t.hide(),this.$(".fork").hide())},updateMagnets:function(){if(this._magnets.length){var t=this.el.getBoundingClientRect();_.each(this._magnets,function(e){var i=e.el.getBoundingClientRect();e.$halo.css({left:i.left-t.left+(i.width-e.$halo.width())/2,top:i.top-t.top+(i.height-e.$halo.height())/2})},this)}}},{clear:function(t){t.trigger("halo:create")}});var Handlebars={};(function(t,e){t.VERSION="1.0.0",t.COMPILER_REVISION=4,t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"},t.helpers={},t.partials={};var i=Object.prototype.toString,n="[object Function]",r="[object Object]";t.registerHelper=function(e,n,a){if(i.call(e)===r){if(a||n)throw new t.Exception("Arg not supported with multiple helpers");t.Utils.extend(this.helpers,e)}else a&&(n.not=a),this.helpers[e]=n},t.registerPartial=function(e,n){i.call(e)===r?t.Utils.extend(this.partials,e):this.partials[e]=n},t.registerHelper("helperMissing",function(t){if(2===arguments.length)return e;throw Error("Missing helper: '"+t+"'")}),t.registerHelper("blockHelperMissing",function(e,r){var a=r.inverse||function(){},s=r.fn,o=i.call(e);return o===n&&(e=e.call(this)),e===!0?s(this):e===!1||null==e?a(this):"[object Array]"===o?e.length>0?t.helpers.each(e,r):a(this):s(e)}),t.K=function(){},t.createFrame=Object.create||function(e){t.K.prototype=e;var i=new t.K;return t.K.prototype=null,i},t.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(e,i){if(e>=t.logger.level){var n=t.logger.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,i)}}},t.log=function(e,i){t.logger.log(e,i)},t.registerHelper("each",function(e,r){var a,s=r.fn,o=r.inverse,l=0,c="",h=i.call(e);if(h===n&&(e=e.call(this)),r.data&&(a=t.createFrame(r.data)),e&&"object"==typeof e)if(e instanceof Array)for(var u=e.length;u>l;l++)a&&(a.index=l),c+=s(e[l],{data:a});else for(var p in e)e.hasOwnProperty(p)&&(a&&(a.key=p),c+=s(e[p],{data:a}),l++);return 0===l&&(c=o(this)),c}),t.registerHelper("if",function(e,r){var a=i.call(e);return a===n&&(e=e.call(this)),!e||t.Utils.isEmpty(e)?r.inverse(this):r.fn(this)}),t.registerHelper("unless",function(e,i){return t.helpers["if"].call(this,e,{fn:i.inverse,inverse:i.fn})}),t.registerHelper("with",function(r,a){var s=i.call(r);return s===n&&(r=r.call(this)),t.Utils.isEmpty(r)?e:a.fn(r)}),t.registerHelper("log",function(e,i){var n=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;t.log(n,e)});var a=["description","fileName","lineNumber","message","name","number","stack"];t.Exception=function(){for(var t=Error.prototype.constructor.apply(this,arguments),e=0;a.length>e;e++)this[a[e]]=t[a[e]]},t.Exception.prototype=Error(),t.SafeString=function(t){this.string=t},t.SafeString.prototype.toString=function(){return""+this.string};var s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},o=/[&<>"'`]/g,l=/[&<>"'`]/,c=function(t){return s[t]||"&amp;"};t.Utils={extend:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},escapeExpression:function(e){return e instanceof t.SafeString?""+e:null==e||e===!1?"":(e=""+e,l.test(e)?e.replace(o,c):e)},isEmpty:function(t){return t||0===t?"[object Array]"===i.call(t)&&0===t.length?!0:!1:!0}},t.VM={template:function(e){var i={escapeExpression:t.Utils.escapeExpression,invokePartial:t.VM.invokePartial,programs:[],program:function(e,i,n){var r=this.programs[e];return n?r=t.VM.program(e,i,n):r||(r=this.programs[e]=t.VM.program(e,i)),r},merge:function(e,i){var n=e||i;return e&&i&&(n={},t.Utils.extend(n,i),t.Utils.extend(n,e)),n},programWithDepth:t.VM.programWithDepth,noop:t.VM.noop,compilerInfo:null};return function(n,r){r=r||{};var a=e.call(i,t,n,r.helpers,r.partials,r.data),s=i.compilerInfo||[],o=s[0]||1,l=t.COMPILER_REVISION;if(o!==l){if(l>o){var c=t.REVISION_CHANGES[l],h=t.REVISION_CHANGES[o];throw"Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+c+") or downgrade your runtime to an older version ("+h+")."}throw"Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+s[1]+")."}return a}},programWithDepth:function(t,e,i){var n=Array.prototype.slice.call(arguments,3),r=function(t,r){return r=r||{},e.apply(this,[t,r.data||i].concat(n))};return r.program=t,r.depth=n.length,r},program:function(t,e,i){var n=function(t,n){return n=n||{},e(t,n.data||i)};return n.program=t,n.depth=0,n},noop:function(){return""},invokePartial:function(i,n,r,a,s,o){var l={helpers:a,partials:s,data:o};if(i===e)throw new t.Exception("The partial "+n+" could not be found");if(i instanceof Function)return i(r,l);if(t.compile)return s[n]=t.compile(i,{data:o!==e}),s[n](r,l);throw new t.Exception("The partial "+n+" could not be compiled when running in runtime-only mode")}},t.template=t.VM.template})(Handlebars),this.joint=this.joint||{},this.joint.templates=this.joint.templates||{},this.joint.templates.stencil=this.joint.templates.stencil||{},this.joint.templates.stencil["elements.html"]=Handlebars.template(function(t,e,i,n,r){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{},'<div class="elements"></div>\n'}),this.joint.templates.stencil["group.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+='<div class="group">\n    <h3 class="group-label">',(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+"</h3>\n</div>\n"}),this.joint.templates.stencil["stencil.html"]=Handlebars.template(function(t,e,i,n,r){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{},'<div class="stencil-paper-drag"></div>\n'}),joint.ui.Stencil=Backbone.View.extend({className:"stencil",events:{"click .group-label":"onGroupLabelClick","touchstart .group-label":"onGroupLabelClick"},options:{width:200,height:800},initialize:function(){this.graphs={},this.papers={},$(document.body).on("mousemove touchmove",_.bind(this.onDrag,this)),$(document.body).on("mouseup touchend",_.bind(this.onDragEnd,this))},render:function(){this.$el.html(joint.templates.stencil["stencil.html"](this.template));var t={width:this.options.width,height:this.options.height,interactive:!1};if(this.options.groups){var e=_.sortBy(_.pairs(this.options.groups),function(t){return t[1].index});_.each(e,function(e){var i=e[0],n=e[1],r=$(joint.templates.stencil["group.html"]({label:n.label||i}));r.attr("data-name",i),n.closed&&r.addClass("closed"),r.append($(joint.templates.stencil["elements.html"]())),this.$el.append(r);var a=new joint.dia.Graph;this.graphs[i]=a;var s=new joint.dia.Paper(_.extend({},t,{el:r.find(".elements"),model:a,width:n.width||t.width,height:n.height||t.height}));this.papers[i]=s},this)}else{this.$el.append($(joint.templates.stencil["elements.html"]()));var i=new joint.dia.Graph;this.graphs.__default__=i;var n=new joint.dia.Paper(_.extend(t,{el:this.$(".elements"),model:i}));this.papers.__default__=n}return this._graphDrag=new joint.dia.Graph,this._paperDrag=new joint.dia.Paper({el:this.$(".stencil-paper-drag"),width:1,height:1,model:this._graphDrag}),_.each(this.papers,function(t){t.on("cell:pointerdown",this.onDragStart,this)},this),this},load:function(t,e){var i=this.graphs[e||"__default__"];if(!i)throw Error("Stencil: group "+e+" does not exist.");i.resetCells(t);var n=this.options.height;e&&this.options.groups[e]&&(n=this.options.groups[e].height),n||this.papers[e||"__default__"].fitToContent(1,1,this.options.paperPadding||10)},getGraph:function(t){return this.graphs[t||"__default__"]},getPaper:function(t){return this.papers[t||"__default__"]},onDragStart:function(t,e){this.$el.addClass("dragging"),this._paperDrag.$el.addClass("dragging"),$(document.body).append(this._paperDrag.$el),this._clone=t.model.clone(),this._cloneBbox=t.getBBox();var i=5,n=g.point(this._cloneBbox.x-this._clone.get("position").x,this._cloneBbox.y-this._clone.get("position").y);this._clone.set("position",{x:-n.x+i,y:-n.y+i}),this._graphDrag.addCell(this._clone),this._paperDrag.setDimensions(this._cloneBbox.width+2*i,this._cloneBbox.height+2*i);var r=document.body.scrollTop||document.documentElement.scrollTop;this._paperDrag.$el.offset({left:e.clientX-this._cloneBbox.width/2,top:e.clientY+r-this._cloneBbox.height/2})},onDrag:function(t){if(t=joint.util.normalizeEvent(t),this._clone){var e=document.body.scrollTop||document.documentElement.scrollTop;this._paperDrag.$el.offset({left:t.clientX-this._cloneBbox.width/2,top:t.clientY+e-this._cloneBbox.height/2})}},onDragEnd:function(t){t=joint.util.normalizeEvent(t),this._clone&&this._cloneBbox&&(this.drop(t,this._clone.clone(),this._cloneBbox),this.$el.append(this._paperDrag.$el),this.$el.removeClass("dragging"),this._paperDrag.$el.removeClass("dragging"),this._clone.remove(),this._clone=void 0)
26 },drop:function(t,e,i){var n=this.options.paper,r=this.options.graph,a=n.$el.offset(),s=document.body.scrollTop||document.documentElement.scrollTop,o=document.body.scrollLeft||document.documentElement.scrollLeft,l=g.rect(a.left+parseInt(n.$el.css("border-left-width"),10)-o,a.top+parseInt(n.$el.css("border-top-width"),10)-s,n.$el.innerWidth(),n.$el.innerHeight()),c=n.svg.createSVGPoint();if(c.x=t.clientX,c.y=t.clientY,l.containsPoint(c)){var h=V("rect",{width:n.options.width,height:n.options.height,x:0,y:0,opacity:0});V(n.svg).prepend(h);var u=$(n.svg).offset();h.remove(),c.x+=o-u.left,c.y+=s-u.top;var p=c.matrixTransform(n.viewport.getCTM().inverse()),d=e.getBBox();p.x+=d.x-i.width/2,p.y+=d.y-i.height/2,e.set("position",{x:g.snapToGrid(p.x,n.options.gridSize),y:g.snapToGrid(p.y,n.options.gridSize)}),e.unset("z"),r.addCell(e,{stencil:this.cid})}},onGroupLabelClick:function(t){t.preventDefault();var e=$(t.target).closest(".group");this.toggleGroup(e.data("name"))},toggleGroup:function(t){this.$('.group[data-name="'+t+'"]').toggleClass("closed")},closeGroup:function(t){this.$('.group[data-name="'+t+'"]').addClass("closed")},openGroup:function(t){this.$('.group[data-name="'+t+'"]').removeClass("closed")},closeGroups:function(){this.$(".group").addClass("closed")},openGroups:function(){this.$(".group").removeClass("closed")}});var Handlebars={};(function(t,e){t.VERSION="1.0.0",t.COMPILER_REVISION=4,t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"},t.helpers={},t.partials={};var i=Object.prototype.toString,n="[object Function]",r="[object Object]";t.registerHelper=function(e,n,a){if(i.call(e)===r){if(a||n)throw new t.Exception("Arg not supported with multiple helpers");t.Utils.extend(this.helpers,e)}else a&&(n.not=a),this.helpers[e]=n},t.registerPartial=function(e,n){i.call(e)===r?t.Utils.extend(this.partials,e):this.partials[e]=n},t.registerHelper("helperMissing",function(t){if(2===arguments.length)return e;throw Error("Missing helper: '"+t+"'")}),t.registerHelper("blockHelperMissing",function(e,r){var a=r.inverse||function(){},s=r.fn,o=i.call(e);return o===n&&(e=e.call(this)),e===!0?s(this):e===!1||null==e?a(this):"[object Array]"===o?e.length>0?t.helpers.each(e,r):a(this):s(e)}),t.K=function(){},t.createFrame=Object.create||function(e){t.K.prototype=e;var i=new t.K;return t.K.prototype=null,i},t.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(e,i){if(e>=t.logger.level){var n=t.logger.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,i)}}},t.log=function(e,i){t.logger.log(e,i)},t.registerHelper("each",function(e,r){var a,s=r.fn,o=r.inverse,l=0,c="",h=i.call(e);if(h===n&&(e=e.call(this)),r.data&&(a=t.createFrame(r.data)),e&&"object"==typeof e)if(e instanceof Array)for(var u=e.length;u>l;l++)a&&(a.index=l),c+=s(e[l],{data:a});else for(var p in e)e.hasOwnProperty(p)&&(a&&(a.key=p),c+=s(e[p],{data:a}),l++);return 0===l&&(c=o(this)),c}),t.registerHelper("if",function(e,r){var a=i.call(e);return a===n&&(e=e.call(this)),!e||t.Utils.isEmpty(e)?r.inverse(this):r.fn(this)}),t.registerHelper("unless",function(e,i){return t.helpers["if"].call(this,e,{fn:i.inverse,inverse:i.fn})}),t.registerHelper("with",function(r,a){var s=i.call(r);return s===n&&(r=r.call(this)),t.Utils.isEmpty(r)?e:a.fn(r)}),t.registerHelper("log",function(e,i){var n=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;t.log(n,e)});var a=["description","fileName","lineNumber","message","name","number","stack"];t.Exception=function(){for(var t=Error.prototype.constructor.apply(this,arguments),e=0;a.length>e;e++)this[a[e]]=t[a[e]]},t.Exception.prototype=Error(),t.SafeString=function(t){this.string=t},t.SafeString.prototype.toString=function(){return""+this.string};var s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},o=/[&<>"'`]/g,l=/[&<>"'`]/,c=function(t){return s[t]||"&amp;"};t.Utils={extend:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},escapeExpression:function(e){return e instanceof t.SafeString?""+e:null==e||e===!1?"":(e=""+e,l.test(e)?e.replace(o,c):e)},isEmpty:function(t){return t||0===t?"[object Array]"===i.call(t)&&0===t.length?!0:!1:!0}},t.VM={template:function(e){var i={escapeExpression:t.Utils.escapeExpression,invokePartial:t.VM.invokePartial,programs:[],program:function(e,i,n){var r=this.programs[e];return n?r=t.VM.program(e,i,n):r||(r=this.programs[e]=t.VM.program(e,i)),r},merge:function(e,i){var n=e||i;return e&&i&&(n={},t.Utils.extend(n,i),t.Utils.extend(n,e)),n},programWithDepth:t.VM.programWithDepth,noop:t.VM.noop,compilerInfo:null};return function(n,r){r=r||{};var a=e.call(i,t,n,r.helpers,r.partials,r.data),s=i.compilerInfo||[],o=s[0]||1,l=t.COMPILER_REVISION;if(o!==l){if(l>o){var c=t.REVISION_CHANGES[l],h=t.REVISION_CHANGES[o];throw"Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+c+") or downgrade your runtime to an older version ("+h+")."}throw"Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+s[1]+")."}return a}},programWithDepth:function(t,e,i){var n=Array.prototype.slice.call(arguments,3),r=function(t,r){return r=r||{},e.apply(this,[t,r.data||i].concat(n))};return r.program=t,r.depth=n.length,r},program:function(t,e,i){var n=function(t,n){return n=n||{},e(t,n.data||i)};return n.program=t,n.depth=0,n},noop:function(){return""},invokePartial:function(i,n,r,a,s,o){var l={helpers:a,partials:s,data:o};if(i===e)throw new t.Exception("The partial "+n+" could not be found");if(i instanceof Function)return i(r,l);if(t.compile)return s[n]=t.compile(i,{data:o!==e}),s[n](r,l);throw new t.Exception("The partial "+n+" could not be compiled when running in runtime-only mode")}},t.template=t.VM.template})(Handlebars),this.joint=this.joint||{},this.joint.templates=this.joint.templates||{},this.joint.templates.inspector=this.joint.templates.inspector||{},this.joint.templates.inspector["color.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+="<label>",(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+':</label>\n<input type="color" class="color" data-type="',(a=i.type)?a=a.call(e,{hash:{},data:r}):(a=e.type,a=typeof a===o?a.apply(e):a),s+=l(a)+'" data-attribute="',(a=i.attribute)?a=a.call(e,{hash:{},data:r}):(a=e.attribute,a=typeof a===o?a.apply(e):a),s+=l(a)+'" value="',(a=i.value)?a=a.call(e,{hash:{},data:r}):(a=e.value,a=typeof a===o?a.apply(e):a),s+=l(a)+'" />\n'}),this.joint.templates.inspector["group.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+='<div class="group">\n    <h3 class="group-label">',(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+"</h3>\n</div>\n"}),this.joint.templates.inspector["list-item.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+='<div class="list-item" data-index="',(a=i.index)?a=a.call(e,{hash:{},data:r}):(a=e.index,a=typeof a===o?a.apply(e):a),s+=l(a)+'">\n    <button class="btn-list-del">-</button>\n</div>\n'}),this.joint.templates.inspector["list.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+="<label>",(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+':</label>\n<div class="list" data-type="',(a=i.type)?a=a.call(e,{hash:{},data:r}):(a=e.type,a=typeof a===o?a.apply(e):a),s+=l(a)+'" data-attribute="',(a=i.attribute)?a=a.call(e,{hash:{},data:r}):(a=e.attribute,a=typeof a===o?a.apply(e):a),s+=l(a)+'">\n    <button class="btn-list-add">+</button>\n    <div class="list-items">\n    </div>\n</div>\n'}),this.joint.templates.inspector["number.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+="<label>",(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+':</label>\n<input type="number" class="number" data-type="',(a=i.type)?a=a.call(e,{hash:{},data:r}):(a=e.type,a=typeof a===o?a.apply(e):a),s+=l(a)+'" data-attribute="',(a=i.attribute)?a=a.call(e,{hash:{},data:r}):(a=e.attribute,a=typeof a===o?a.apply(e):a),s+=l(a)+'" value="',(a=i.value)?a=a.call(e,{hash:{},data:r}):(a=e.value,a=typeof a===o?a.apply(e):a),s+=l(a)+'"/>\n'}),this.joint.templates.inspector["object-property.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+='<div class="object-property" data-property="',(a=i.property)?a=a.call(e,{hash:{},data:r}):(a=e.property,a=typeof a===o?a.apply(e):a),s+=l(a)+'">\n</div>\n'}),this.joint.templates.inspector["object.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+="<label>",(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+':</label>\n<div class="object" data-type="',(a=i.type)?a=a.call(e,{hash:{},data:r}):(a=e.type,a=typeof a===o?a.apply(e):a),s+=l(a)+'" data-attribute="',(a=i.attribute)?a=a.call(e,{hash:{},data:r}):(a=e.attribute,a=typeof a===o?a.apply(e):a),s+=l(a)+'">\n    <div class="object-properties"></div>\n</div>\n'}),this.joint.templates.inspector["range.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s,o="",l="function",c=this.escapeExpression;return o+="<form onchange=\"$(this).find('output').text(range.value)\">\n    <label>",(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===l?a.apply(e):a),o+=c(a)+": (<output>",(a=i.value)?a=a.call(e,{hash:{},data:r}):(a=e.value,a=typeof a===l?a.apply(e):a),o+=c(a)+"</output>"+c((a=e.options,a=null==a||a===!1?a:a.unit,typeof a===l?a.apply(e):a))+')</label>\n    <input type="range" class="range" name="range" data-type="',(s=i.type)?s=s.call(e,{hash:{},data:r}):(s=e.type,s=typeof s===l?s.apply(e):s),o+=c(s)+'" data-attribute="',(s=i.attribute)?s=s.call(e,{hash:{},data:r}):(s=e.attribute,s=typeof s===l?s.apply(e):s),o+=c(s)+'" min="'+c((a=e.options,a=null==a||a===!1?a:a.min,typeof a===l?a.apply(e):a))+'" max="'+c((a=e.options,a=null==a||a===!1?a:a.max,typeof a===l?a.apply(e):a))+'" step="'+c((a=e.options,a=null==a||a===!1?a:a.step,typeof a===l?a.apply(e):a))+'" value="',(s=i.value)?s=s.call(e,{hash:{},data:r}):(s=e.value,s=typeof s===l?s.apply(e):s),o+=c(s)+'"/>\n</form>\n'}),this.joint.templates.inspector["select.html"]=Handlebars.template(function(t,e,i,n,r){function a(t){var e,i="";return i+=' multiple size="'+p((e=t.options,e=null==e||e===!1?e:e.options,e=null==e||e===!1?e:e.length,typeof e===u?e.apply(t):e))+'" '}function s(t,e,n){var r,a,s,l="";return l+='\n    <option val="'+p(typeof t===u?t.apply(t):t)+'" ',s={hash:{},inverse:g.noop,fn:g.program(4,o,e),data:e},r=i["is-or-contains"]||t["is-or-contains"],a=r?r.call(t,t,n.value,s):d.call(t,"is-or-contains",t,n.value,s),(a||0===a)&&(l+=a),l+=">"+p(typeof t===u?t.apply(t):t)+"</option>\n    "}function o(){return" selected "}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var l,c,h="",u="function",p=this.escapeExpression,g=this,d=i.helperMissing;return h+="<label>",(l=i.label)?l=l.call(e,{hash:{},data:r}):(l=e.label,l=typeof l===u?l.apply(e):l),h+=p(l)+':</label>\n<select class="select" data-type="',(l=i.type)?l=l.call(e,{hash:{},data:r}):(l=e.type,l=typeof l===u?l.apply(e):l),h+=p(l)+'" data-attribute="',(l=i.attribute)?l=l.call(e,{hash:{},data:r}):(l=e.attribute,l=typeof l===u?l.apply(e):l),h+=p(l)+'" value="',(l=i.value)?l=l.call(e,{hash:{},data:r}):(l=e.value,l=typeof l===u?l.apply(e):l),h+=p(l)+'" ',c=i["if"].call(e,(l=e.options,null==l||l===!1?l:l.multiple),{hash:{},inverse:g.noop,fn:g.program(1,a,r),data:r}),(c||0===c)&&(h+=c),h+=">\n    ",c=i.each.call(e,(l=e.options,null==l||l===!1?l:l.items),{hash:{},inverse:g.noop,fn:g.programWithDepth(3,s,r,e),data:r}),(c||0===c)&&(h+=c),h+="\n</select>\n"}),this.joint.templates.inspector["text.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+="<label>",(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+':</label>\n<input type="text" class="text" data-type="',(a=i.type)?a=a.call(e,{hash:{},data:r}):(a=e.type,a=typeof a===o?a.apply(e):a),s+=l(a)+'" data-attribute="',(a=i.attribute)?a=a.call(e,{hash:{},data:r}):(a=e.attribute,a=typeof a===o?a.apply(e):a),s+=l(a)+'" value="',(a=i.value)?a=a.call(e,{hash:{},data:r}):(a=e.value,a=typeof a===o?a.apply(e):a),s+=l(a)+'" />\n'}),this.joint.templates.inspector["textarea.html"]=Handlebars.template(function(t,e,i,n,r){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var a,s="",o="function",l=this.escapeExpression;return s+="<label>",(a=i.label)?a=a.call(e,{hash:{},data:r}):(a=e.label,a=typeof a===o?a.apply(e):a),s+=l(a)+':</label>\n<textarea class="textarea" data-type="',(a=i.type)?a=a.call(e,{hash:{},data:r}):(a=e.type,a=typeof a===o?a.apply(e):a),s+=l(a)+'" data-attribute="',(a=i.attribute)?a=a.call(e,{hash:{},data:r}):(a=e.attribute,a=typeof a===o?a.apply(e):a),s+=l(a)+'">',(a=i.value)?a=a.call(e,{hash:{},data:r}):(a=e.value,a=typeof a===o?a.apply(e):a),s+=l(a)+"</textarea>\n"}),this.joint.templates.inspector["toggle.html"]=Handlebars.template(function(t,e,i,n,r){function a(){return" checked "}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{};var s,o="",l="function",c=this.escapeExpression,h=this;return o+="<label>",(s=i.label)?s=s.call(e,{hash:{},data:r}):(s=e.label,s=typeof s===l?s.apply(e):s),o+=c(s)+':</label>\n<div class="toggle">\n    <input type="checkbox" data-type="',(s=i.type)?s=s.call(e,{hash:{},data:r}):(s=e.type,s=typeof s===l?s.apply(e):s),o+=c(s)+'" data-attribute="',(s=i.attribute)?s=s.call(e,{hash:{},data:r}):(s=e.attribute,s=typeof s===l?s.apply(e):s),o+=c(s)+'" ',s=i["if"].call(e,e.value,{hash:{},inverse:h.noop,fn:h.program(1,a,r),data:r}),(s||0===s)&&(o+=s),o+=" />\n    <span><i></i></span>\n</div>\n"}),Handlebars.registerHelper("is",function(t,e,i){return t==e?i.fn(this):i.inverse(this)}),Handlebars.registerHelper("is-or-contains",function(t,e,i){return(_.isArray(e)?_.contains(e,t):t==e)?i.fn(this):i.inverse(this)}),Handlebars.registerPartial("list-item",joint.templates.inspector["list-item.html"]),joint.ui.Inspector=Backbone.View.extend({className:"inspector",options:{cellView:void 0,cell:void 0,live:!0},events:{mousedown:"startBatchCommand",change:"onChangeInput","click .group-label":"onGroupLabelClick","click .btn-list-add":"addListItem","click .btn-list-del":"deleteListItem"},initialize:function(){this.options.groups=this.options.groups||{},_.bindAll(this,"stopBatchCommand"),$(document).on("mouseup",this.stopBatchCommand),this.flatAttributes=joint.util.flattenObject(this.options.inputs,"/",function(t){return t.type}),this._when={},this._bound={};var t=_.map(this.flatAttributes,function(t,e){return t.when&&t.when.eq&&_.each(t.when.eq,function(t,i){var n={value:t,path:e};(this._when[i]||(this._when[i]=[])).push(n)},this),t.when&&t.when.regex&&_.each(t.when.regex,function(t,i){var n={regex:t,path:e};(this._when[i]||(this._when[i]=[])).push(n)},this),"select"==t.type&&_.isString(t.options)&&(this._bound[e]=t.options),t.path=e,t},this);this.groupedFlatAttributes=_.sortBy(t,function(t){var e=this.options.groups[t.group];return e?"a"+e.index+"b"+t.index:Number.MAX_VALUE},this),this.on("render",function(){this._byPath={},_.each(this.$("[data-attribute]"),function(t){var e=$(t);this._byPath[e.attr("data-attribute")]=e},this)},this),this.listenTo(this.getModel(),"all",this.onCellChange,this)},getModel:function(){return this.options.cell||this.options.cellView.model},onCellChange:function(t,e,i,n){if(n=n||{},!n["inspector_"+this.cid])switch(t){case"remove":this.remove();break;case"change:position":this.updateInputPosition();break;case"change:size":this.updateInputSize();break;case"change:angle":this.updateInputAngle();break;case"change:source":case"change:target":break;default:var r="change:";t.slice(0,r.length)===r&&this.render()}},render:function(){this.$el.empty();var t,e,i=[];return _.each(this.groupedFlatAttributes,function(n){if(t!==n.group){var r=this.options.groups[n.group],a=r?r.label||n.group:n.group;e=$(joint.templates.inspector["group.html"]({label:a})),e.attr("data-name",n.group),r&&r.closed&&e.addClass("closed"),i.push(e)}this.renderTemplate(e,n,n.path),t=n.group},this),this.$el.append(i),this.trigger("render"),this},getCellAttributeValue:function(t,e){var i=this.getModel(),n=joint.util.getByPath(i.attributes,t,"/");if(!e)return n;if(_.isUndefined(n)&&!_.isUndefined(e.defaultValue)&&(n=e.defaultValue),e.valueRegExp){if(_.isUndefined(n))throw Error("Inspector: defaultValue must be present when valueRegExp is used.");var r=n.match(RegExp(e.valueRegExp));n=r&&r[2]}return n},guard:function(t){var e=!0;if(t.when&&t.when.eq){var i=_.find(t.when.eq,function(t,e){var i=this.getCellAttributeValue(e);return i!==t?!0:!1},this);i&&(e=!1)}if(t.when&&t.when.regex){var i=_.find(t.when.regex,function(t,e){var i=this.getCellAttributeValue(e);return RegExp(t).test(i)?!1:!0},this);i&&(e=!1)}return!e},resolveBindings:function(t){switch(t.type){case"select":var e=t.options;t.items=_.isString(e)?joint.util.getByPath(this.getModel().attributes,e,"/"):e}},updateBindings:function(t){var e=_.reduce(this._bound,function(e,i,n){return t.indexOf(i)||e.push(n),e},[]);_.isEmpty(e)||(_.each(e,function(t){this.renderTemplate(null,this.flatAttributes[t],t,{replace:!0})},this),this.trigger("render"))},renderTemplate:function(t,e,i,n){t=t||this.$el,n=n||{},this.resolveBindings(e);var r=this.getCellAttributeValue(i,e),a=joint.templates.inspector[e.type+".html"]({options:e,type:e.type,label:e.label||i,attribute:i,value:r}),s=$('<div class="field"></div>').attr("data-field",i),o=$(a);if(s.append(o),this.guard(e)&&s.addClass("hidden"),_.each(e.attrs,function(t,e){s.find(e).addBack().filter(e).attr(t)}),"list"===e.type)_.each(r,function(t,n){var r=$(joint.templates.inspector["list-item.html"]({index:n}));this.renderTemplate(r,e.item,i+"/"+n),o.children(".list-items").append(r)},this);else if("object"===e.type){e.flatAttributes=joint.util.flattenObject(e.properties,"/",function(t){return t.type});var l=_.map(e.flatAttributes,function(t,e){return t.path=e,t});l=_.sortBy(l,function(t){return t.index}),_.each(l,function(t){var e=$(joint.templates.inspector["object-property.html"]({property:t.path}));this.renderTemplate(e,t,i+"/"+t.path),o.children(".object-properties").append(e)},this)}n.replace?t.find("[data-field="+i+"]").replaceWith(s):t.append(s)},updateInputPosition:function(){var t=this._byPath["position/x"],e=this._byPath["position/y"],i=this.getModel().get("position");t&&t.val(i.x),e&&e.val(i.y)},updateInputSize:function(){var t=this._byPath["size/width"],e=this._byPath["size/height"],i=this.getModel().get("size");t&&t.val(i.width),e&&e.val(i.height)},updateInputAngle:function(){var t=this._byPath.angle,e=this.getModel().get("angle");t&&t.val(e)},onChangeInput:function(t){var e=$(t.target),i=e.attr("data-attribute");this.options.live&&this.updateCell(e,i);var n=e.attr("data-type"),r=this.parse(n,e.val(),e[0]),a=this._when[i];this.trigger("change:"+i,r,e[0]),a&&_.each(a,function(t){var e=this._byPath[t.path],i=e.closest(".field"),n=!1;t.regex&&RegExp(t.regex).test(r)?n=!0:r===t.value&&(n=!0),n?i.removeClass("hidden"):i.addClass("hidden")},this)},getOptions:function(t){if(0===t.length)return void 0;var e=t.attr("data-attribute");t.attr("data-type");var i=this.flatAttributes[e];if(!i){var n=t.parent().closest("[data-attribute]"),r=n.attr("data-attribute");i=this.getOptions(n);var a=e.replace(r+"/",""),s=i;i=s.item||s.flatAttributes[a],i.parent=s}return i},updateCell:function(t,e){var i=this.getModel(),n={};t?n[e]=t:n=this._byPath,_.each(n,function(t,e){if(!t.hasClass("hidden")){var n,r,a=t.attr("data-type");switch(a){case"list":joint.util.unsetByPath(i.attributes,e,"/"),this.setProperty(e,[]);break;case"object":break;default:if(n=this.parse(a,t.val(),t[0]),r=this.getOptions(t),r.valueRegExp){var s=joint.util.getByPath(i.attributes,e,"/")||r.defaultValue;n=s.replace(RegExp(r.valueRegExp),"$1"+n+"$3")}this.setProperty(e,n)}this.updateBindings(e)}},this)},setProperty:function(t,e){var i,n=this.getModel(),r=t.split("/"),a=r[0],s={};if(s["inspector_"+this.cid]=!0,r.length>1){var o=_.cloneDeep(n.attributes);i=joint.util.getByPath(o,t,"/");var l={},c=l,h=a;_.each(_.rest(r),function(t){c=c[h]=_.isFinite(Number(t))?[]:{},h=t}),l=joint.util.setByPath(l,t,e,"/"),_.merge(o,l),n.set(a,o[a],s)}else i=n.get(a),n.set(a,e,s)},parse:function(t,e,i){switch(t){case"number":e=parseFloat(e);break;case"toggle":e=i.checked;break;default:e=e}return e},startBatchCommand:function(){this.getModel().trigger("batch:start")},stopBatchCommand:function(){this.getModel().trigger("batch:stop")},addListItem:function(t){var e=$(t.target),i=e.closest("[data-attribute]"),n=i.attr("data-attribute"),r=this.getOptions(i),a=i.children(".list-items").children(".list-item").last(),s=0===a.length?-1:parseInt(a.attr("data-index"),10),o=s+1,l=$(joint.templates.inspector["list-item.html"]({index:o}));this.renderTemplate(l,r.item,n+"/"+o),e.parent().children(".list-items").append(l),l.find("input").focus(),this.trigger("render"),this.options.live&&this.updateCell()},deleteListItem:function(t){var e=$(t.target).closest(".list-item");e.nextAll(".list-item").each(function(){var t=parseInt($(this).attr("data-index"),10),e=t-1;$(this).find("[data-attribute]").each(function(){$(this).attr("data-attribute",$(this).attr("data-attribute").replace("/"+t,"/"+e))}),$(this).attr("data-index",e)}),e.remove(),this.trigger("render"),this.options.live&&this.updateCell()},remove:function(){return $(document).off("mouseup",this.stopBatchCommand),Backbone.View.prototype.remove.apply(this,arguments)},onGroupLabelClick:function(t){t.preventDefault();var e=$(t.target).closest(".group");this.toggleGroup(e.data("name"))},toggleGroup:function(t){this.$('.group[data-name="'+t+'"]').toggleClass("closed")},closeGroup:function(t){this.$('.group[data-name="'+t+'"]').addClass("closed")},openGroup:function(t){this.$('.group[data-name="'+t+'"]').removeClass("closed")},closeGroups:function(){this.$(".group").addClass("closed")},openGroups:function(){this.$(".group").removeClass("closed")}});var Handlebars={};(function(t,e){t.VERSION="1.0.0",t.COMPILER_REVISION=4,t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"},t.helpers={},t.partials={};var i=Object.prototype.toString,n="[object Function]",r="[object Object]";t.registerHelper=function(e,n,a){if(i.call(e)===r){if(a||n)throw new t.Exception("Arg not supported with multiple helpers");t.Utils.extend(this.helpers,e)}else a&&(n.not=a),this.helpers[e]=n},t.registerPartial=function(e,n){i.call(e)===r?t.Utils.extend(this.partials,e):this.partials[e]=n},t.registerHelper("helperMissing",function(t){if(2===arguments.length)return e;throw Error("Missing helper: '"+t+"'")}),t.registerHelper("blockHelperMissing",function(e,r){var a=r.inverse||function(){},s=r.fn,o=i.call(e);return o===n&&(e=e.call(this)),e===!0?s(this):e===!1||null==e?a(this):"[object Array]"===o?e.length>0?t.helpers.each(e,r):a(this):s(e)}),t.K=function(){},t.createFrame=Object.create||function(e){t.K.prototype=e;var i=new t.K;return t.K.prototype=null,i},t.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(e,i){if(e>=t.logger.level){var n=t.logger.methodMap[e];"undefined"!=typeof console&&console[n]&&console[n].call(console,i)}}},t.log=function(e,i){t.logger.log(e,i)},t.registerHelper("each",function(e,r){var a,s=r.fn,o=r.inverse,l=0,c="",h=i.call(e);if(h===n&&(e=e.call(this)),r.data&&(a=t.createFrame(r.data)),e&&"object"==typeof e)if(e instanceof Array)for(var u=e.length;u>l;l++)a&&(a.index=l),c+=s(e[l],{data:a});else for(var p in e)e.hasOwnProperty(p)&&(a&&(a.key=p),c+=s(e[p],{data:a}),l++);return 0===l&&(c=o(this)),c}),t.registerHelper("if",function(e,r){var a=i.call(e);return a===n&&(e=e.call(this)),!e||t.Utils.isEmpty(e)?r.inverse(this):r.fn(this)}),t.registerHelper("unless",function(e,i){return t.helpers["if"].call(this,e,{fn:i.inverse,inverse:i.fn})}),t.registerHelper("with",function(r,a){var s=i.call(r);return s===n&&(r=r.call(this)),t.Utils.isEmpty(r)?e:a.fn(r)}),t.registerHelper("log",function(e,i){var n=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;t.log(n,e)});var a=["description","fileName","lineNumber","message","name","number","stack"];t.Exception=function(){for(var t=Error.prototype.constructor.apply(this,arguments),e=0;a.length>e;e++)this[a[e]]=t[a[e]]},t.Exception.prototype=Error(),t.SafeString=function(t){this.string=t},t.SafeString.prototype.toString=function(){return""+this.string};var s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},o=/[&<>"'`]/g,l=/[&<>"'`]/,c=function(t){return s[t]||"&amp;"};t.Utils={extend:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},escapeExpression:function(e){return e instanceof t.SafeString?""+e:null==e||e===!1?"":(e=""+e,l.test(e)?e.replace(o,c):e)},isEmpty:function(t){return t||0===t?"[object Array]"===i.call(t)&&0===t.length?!0:!1:!0}},t.VM={template:function(e){var i={escapeExpression:t.Utils.escapeExpression,invokePartial:t.VM.invokePartial,programs:[],program:function(e,i,n){var r=this.programs[e];return n?r=t.VM.program(e,i,n):r||(r=this.programs[e]=t.VM.program(e,i)),r},merge:function(e,i){var n=e||i;return e&&i&&(n={},t.Utils.extend(n,i),t.Utils.extend(n,e)),n},programWithDepth:t.VM.programWithDepth,noop:t.VM.noop,compilerInfo:null};return function(n,r){r=r||{};var a=e.call(i,t,n,r.helpers,r.partials,r.data),s=i.compilerInfo||[],o=s[0]||1,l=t.COMPILER_REVISION;if(o!==l){if(l>o){var c=t.REVISION_CHANGES[l],h=t.REVISION_CHANGES[o];throw"Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+c+") or downgrade your runtime to an older version ("+h+")."}throw"Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+s[1]+")."}return a}},programWithDepth:function(t,e,i){var n=Array.prototype.slice.call(arguments,3),r=function(t,r){return r=r||{},e.apply(this,[t,r.data||i].concat(n))};return r.program=t,r.depth=n.length,r},program:function(t,e,i){var n=function(t,n){return n=n||{},e(t,n.data||i)};return n.program=t,n.depth=0,n},noop:function(){return""},invokePartial:function(i,n,r,a,s,o){var l={helpers:a,partials:s,data:o};if(i===e)throw new t.Exception("The partial "+n+" could not be found");if(i instanceof Function)return i(r,l);if(t.compile)return s[n]=t.compile(i,{data:o!==e}),s[n](r,l);throw new t.Exception("The partial "+n+" could not be compiled when running in runtime-only mode")}},t.template=t.VM.template})(Handlebars),this.joint=this.joint||{},this.joint.templates=this.joint.templates||{},this.joint.templates["freetransform.html"]=Handlebars.template(function(t,e,i,n,r){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,t.helpers),r=r||{},'<div class="resize" data-position="top-left" draggable="false"/>\n<div class="resize" data-position="top" draggable="false"/>\n<div class="resize" data-position="top-right" draggable="false"/>\n<div class="resize" data-position="right" draggable="false"/>\n<div class="resize" data-position="bottom-right" draggable="false"/>\n<div class="resize" data-position="bottom" draggable="false"/>\n<div class="resize" data-position="bottom-left" draggable="false"/>\n<div class="resize" data-position="left" draggable="false"/>\n<div class="rotate" draggable="false"/>\n\n'}),joint.ui.FreeTransform=Backbone.View.extend({className:"free-transform",template:"freetransform",events:{"mousedown .resize":"startResizing","mousedown .rotate":"startRotating","touchstart .resize":"startResizing","touchstart .rotate":"startRotating"},options:{directions:["nw","n","ne","e","se","s","sw","w"]},initialize:function(){this.options.cellView&&_.defaults(this.options,{cell:this.options.cellView.model,paper:this.options.cellView.paper,graph:this.options.cellView.paper.model}),_.bindAll(this,"update","remove","pointerup","pointermove"),joint.ui.FreeTransform.clear(this.options.paper),$(document.body).on("mousemove touchmove",this.pointermove),$(document).on("mouseup touchend",this.pointerup),this.listenTo(this.options.graph,"all",this.update),this.listenTo(this.options.graph,"reset",this.remove),this.listenTo(this.options.cell,"remove",this.remove),this.listenTo(this.options.paper,"blank:pointerdown freetransform:create",this.remove),this.listenTo(this.options.paper,"scale",this.update),this.options.paper.$el.append(this.el)},render:function(){this.$el.html(joint.templates["freetransform.html"](this.template)),this.$el.attr("data-type",this.options.cell.get("type")),this.update()},update:function(){var t=this.options.paper.viewport.getCTM(),e=this.options.cell.getBBox();e.x*=t.a,e.x+=t.e,e.y*=t.d,e.y+=t.f,e.width*=t.a,e.height*=t.d;var i=g.normalizeAngle(this.options.cell.get("angle")||0),n="rotate("+i+"deg)";this.$el.css({width:e.width+4,height:e.height+4,left:e.x-3,top:e.y-3,transform:n,"-webkit-transform":n,"-ms-transform":n});var r=Math.floor(i*(this.options.directions.length/360));if(r!=this._previousDirectionsShift){var a=_.rest(this.options.directions,r).concat(_.first(this.options.directions,r));this.$(".resize").removeClass("nw n ne e se s sw w").each(function(t,e){$(e).addClass(a[t])}),this._previousDirectionsShift=r}},startResizing:function(t){t.stopPropagation(),this.options.graph.trigger("batch:start");var e=$(t.target).data("position"),i=0,n=0;_.each(e.split("-"),function(t){i={left:-1,right:1}[t]||i,n={top:-1,bottom:1}[t]||n}),e={top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[e]||e;var r={"top-right":"bottomLeft","top-left":"corner","bottom-left":"topRight","bottom-right":"origin"}[e];this._initial={angle:g.normalizeAngle(this.options.cell.get("angle")||0),resizeX:i,resizeY:n,selector:r,direction:e},this._action="resize",this.startOp(t.target)},startRotating:function(t){t.stopPropagation(),this.options.graph.trigger("batch:start");var e=this.options.cell.getBBox().center(),i=this.options.paper.snapToGrid({x:t.clientX,y:t.clientY});this._initial={centerRotation:e,modelAngle:g.normalizeAngle(this.options.cell.get("angle")||0),startAngle:g.point(i).theta(e)},this._action="rotate",this.startOp(t.target)},pointermove:function(t){if(this._action){t=joint.util.normalizeEvent(t);var e=this.options.paper.snapToGrid({x:t.clientX,y:t.clientY}),i=this.options.paper.options.gridSize,n=this.options.cell,r=this._initial;switch(this._action){case"resize":var a=n.getBBox(),s=g.point(e).rotate(a.center(),r.angle),o=s.difference(a[r.selector]()),l=r.resizeX?o.x*r.resizeX:a.width,c=r.resizeY?o.y*r.resizeY:a.height;l=i>l?i:g.snapToGrid(l,i),c=i>c?i:g.snapToGrid(c,i),(a.width!=l||a.height!=c)&&n.resize(l,c,{direction:r.direction});break;case"rotate":var h=r.startAngle-g.point(e).theta(r.centerRotation);n.rotate(g.snapToGrid(r.modelAngle+h,15),!0)}}},pointerup:function(){this._action&&(this.stopOp(),this.options.graph.trigger("batch:stop"),delete this._action,delete this._initial)
27 },remove:function(){Backbone.View.prototype.remove.apply(this,arguments),$("body").off("mousemove touchmove",this.pointermove),$(document).off("mouseup touchend",this.pointerup)},startOp:function(t){t&&($(t).addClass("in-operation"),this._elementOp=t),this.$el.addClass("in-operation")},stopOp:function(){this._elementOp&&($(this._elementOp).removeClass("in-operation"),delete this._elementOp),this.$el.removeClass("in-operation")}},{clear:function(t){t.trigger("freetransform:create")}}),joint.ui.Tooltip=Backbone.View.extend({className:"tooltip",options:{left:void 0,right:void 0,top:void 0,bottom:void 0,padding:10,target:void 0,rootTarget:void 0},initialize:function(){_.bindAll(this,"render","hide","position"),this.options.rootTarget?(this.$rootTarget=$(this.options.rootTarget),this.$rootTarget.on("mouseover",this.options.target,this.render),this.$rootTarget.on("mouseout",this.options.target,this.hide),this.$rootTarget.on("mousedown",this.options.target,this.hide)):(this.$target=$(this.options.target),this.$target.on("mouseover",this.render),this.$target.on("mouseout",this.hide),this.$target.on("mousedown",this.hide)),this.$el.addClass(this.options.direction)},remove:function(){this.$target.off("mouseover",this.render),this.$target.off("mouseout",this.hide),this.$target.off("mousedown",this.hide),Backbone.View.prototype.remove.apply(this,arguments)},hide:function(){Backbone.View.prototype.remove.apply(this,arguments)},render:function(t){var e,i=!_.isUndefined(t.x)&&!_.isUndefined(t.y);i?e=t:(this.$target=$(t.target).closest(this.options.target),e=this.$target[0]),this.$el.html(_.isFunction(this.options.content)?this.options.content(e):this.options.content),this.$el.hide(),$(document.body).append(this.$el);var n=this.$("img");n.length?n.on("load",_.bind(function(){this.position(i?e:void 0)},this)):this.position(i?e:void 0)},getElementBBox:function(t){var e,i=$(t),n=i.offset(),r=document.body.scrollTop||document.documentElement.scrollTop,a=document.body.scrollLeft||document.documentElement.scrollLeft;return n.top-=r||0,n.left-=a||0,t.ownerSVGElement?(e=V(t).bbox(),e.x=n.left,e.y=n.top):e={x:n.left,y:n.top,width:i.outerWidth(),height:i.outerHeight()},e},position:function(t){var e;e=t?{x:t.x,y:t.y,width:1,height:1}:this.getElementBBox(this.$target[0]);var i=this.options.padding;this.$el.show();var n=this.$el.outerHeight(),r=this.$el.outerWidth();if(this.options.left){var a=$(_.isFunction(this.options.left)?this.options.left(this.$target[0]):this.options.left),s=this.getElementBBox(a[0]);this.$el.css({left:s.x+s.width+i,top:e.y+e.height/2-n/2})}else if(this.options.right){var o=$(_.isFunction(this.options.right)?this.options.right(this.$target[0]):this.options.right),l=this.getElementBBox(o[0]);this.$el.css({left:l.x-r-i,top:e.y+e.height/2-n/2})}else if(this.options.top){var c=$(_.isFunction(this.options.top)?this.options.top(this.$target[0]):this.options.top),h=this.getElementBBox(c[0]);this.$el.css({top:h.y+h.height+i,left:e.x+e.width/2-r/2})}else if(this.options.bottom){var u=$(_.isFunction(this.options.bottom)?this.options.bottom(this.$target[0]):this.options.bottom),p=this.getElementBBox(u[0]);this.$el.css({top:p.y-n-i,left:e.x+e.width/2-r/2})}else this.$el.css({left:e.x+e.width+i,top:e.y+e.height/2-n/2})}}),function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(a)return a(s,!0);throw Error("Cannot find module '"+s+"'")}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){var i=t[s][1][e];return r(i?i:e)},c,c.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;n.length>s;s++)r(n[s]);return r}({1:[function(t){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};e.dagre=t("./index")},{"./index":2}],2:[function(t,e,i){i.Digraph=t("graphlib").Digraph,i.Graph=t("graphlib").Graph,i.layout=t("./lib/layout"),i.version=t("./lib/version")},{"./lib/layout":3,"./lib/version":18,graphlib:24}],3:[function(t,e){var i=t("./util"),n=t("./rank"),r=t("./order"),a=t("graphlib").CGraph,s=t("graphlib").CDigraph;e.exports=function(){function e(t){var e=new s;t.eachNode(function(t,i){void 0===i&&(i={}),e.addNode(t,{width:i.width,height:i.height}),i.hasOwnProperty("rank")&&(e.node(t).prefRank=i.rank)}),t.parent&&t.nodes().forEach(function(i){e.parent(i,t.parent(i))}),t.eachEdge(function(t,i,n,r){void 0===r&&(r={});var a={e:t,minLen:r.minLen||1,width:r.width||0,height:r.height||0,points:[]};e.addEdge(null,i,n,a)});var i=t.graph()||{};return e.graph({rankDir:i.rankDir||g.rankDir,orderRestarts:i.orderRestarts}),e}function o(t){var a,s=f.rankSep();try{return a=i.time("initLayoutGraph",e)(t),0===a.order()?a:(a.eachEdge(function(t,e,i,n){n.minLen*=2}),f.rankSep(s/2),i.time("rank.run",n.run)(a,g.rankSimplex),i.time("normalize",l)(a),i.time("order",r)(a,g.orderMaxSweeps),i.time("position",d.run)(a),i.time("undoNormalize",c)(a),i.time("fixupEdgePoints",h)(a),i.time("rank.restoreEdges",n.restoreEdges)(a),i.time("createFinalGraph",u)(a,t.isDirected()))}finally{f.rankSep(s)}}function l(t){var e=0;t.eachEdge(function(i,n,r,a){var s=t.node(n).rank,o=t.node(r).rank;if(o>s+1){for(var l=n,c=s+1,h=0;o>c;++c,++h){var u="_D"+ ++e,p={width:a.width,height:a.height,edge:{id:i,source:n,target:r,attrs:a},rank:c,dummy:!0};0===h?p.index=0:c+1===o&&(p.index=1),t.addNode(u,p),t.addEdge(null,l,u,{}),l=u}t.addEdge(null,l,r,{}),t.delEdge(i)}})}function c(t){t.eachNode(function(e,i){if(i.dummy){if("index"in i){var n=i.edge;t.hasEdge(n.id)||t.addEdge(n.id,n.source,n.target,n.attrs);var r=t.edge(n.id).points;r[i.index]={x:i.x,y:i.y,ul:i.ul,ur:i.ur,dl:i.dl,dr:i.dr}}t.delNode(e)}})}function h(t){t.eachEdge(function(t,e,i,n){n.reversed&&n.points.reverse()})}function u(t,e){var i=e?new s:new a;i.graph(t.graph()),t.eachNode(function(t,e){i.addNode(t,e)}),t.eachNode(function(e){i.parent(e,t.parent(e))}),t.eachEdge(function(t,e,n,r){i.addEdge(r.e,e,n,r)});var n=0,r=0;return t.eachNode(function(e,i){t.children(e).length||(n=Math.max(n,i.x+i.width/2),r=Math.max(r,i.y+i.height/2))}),t.eachEdge(function(t,e,i,a){var s=Math.max.apply(Math,a.points.map(function(t){return t.x})),o=Math.max.apply(Math,a.points.map(function(t){return t.y}));n=Math.max(n,s+a.width/2),r=Math.max(r,o+a.height/2)}),i.graph().width=n,i.graph().height=r,i}function p(t){return function(){return arguments.length?(t.apply(null,arguments),f):t()}}var g={debugLevel:0,orderMaxSweeps:r.DEFAULT_MAX_SWEEPS,rankSimplex:!1,rankDir:"TB"},d=t("./position")(),f={};return f.orderIters=i.propertyAccessor(f,g,"orderMaxSweeps"),f.rankSimplex=i.propertyAccessor(f,g,"rankSimplex"),f.nodeSep=p(d.nodeSep),f.edgeSep=p(d.edgeSep),f.universalSep=p(d.universalSep),f.rankSep=p(d.rankSep),f.rankDir=i.propertyAccessor(f,g,"rankDir"),f.debugAlignment=p(d.debugAlignment),f.debugLevel=i.propertyAccessor(f,g,"debugLevel",function(t){i.log.level=t,d.debugLevel(t)}),f.run=i.time("Total layout",o),f._normalize=l,f}},{"./order":4,"./position":9,"./rank":10,"./util":17,graphlib:24}],4:[function(t,e){function n(t,e){function i(){t.eachNode(function(t,e){g[t]=e.order})}2>arguments.length&&(e=d);var n=t.graph().orderRestarts||0,r=u(t);r.forEach(function(e){e=e.filterNodes(function(e){return!t.children(e).length})});for(var a,o=0,l=Number.MAX_VALUE,g={},f=0;Number(n)+1>f&&0!==l;++f){a=Number.MAX_VALUE,p(t,n>0),c.log(2,"Order phase start cross count: "+t.graph().orderInitCC);var m,I,y;for(m=0,I=0;4>I&&e>m&&a>0;++m,++I,++o)s(t,r,m),y=h(t),a>y&&(I=0,a=y,l>y&&(i(),l=y)),c.log(3,"Order phase start "+f+" iter "+m+" cross count: "+y)}Object.keys(g).forEach(function(e){t.children&&t.children(e).length||(t.node(e).order=g[e])}),t.graph().orderCC=l,c.log(2,"Order iterations: "+o),c.log(2,"Order phase best cross count: "+t.graph().orderCC)}function r(t,e){var i={};return e.forEach(function(e){i[e]=t.inEdges(e).map(function(e){return t.node(t.source(e)).order})}),i}function a(t,e){var i={};return e.forEach(function(e){i[e]=t.outEdges(e).map(function(e){return t.node(t.target(e)).order})}),i}function s(t,e,i){0===i%2?o(t,e,i):l(t,e,i)}function o(t,e){var n;for(i=1;e.length>i;++i)n=g(e[i],n,r(t,e[i].nodes()))}function l(t,e){var n;for(i=e.length-2;i>=0;--i)g(e[i],n,a(t,e[i].nodes()))}var c=t("./util"),h=t("./order/crossCount"),u=t("./order/initLayerGraphs"),p=t("./order/initOrder"),g=t("./order/sortLayer");e.exports=n;var d=24;n.DEFAULT_MAX_SWEEPS=d},{"./order/crossCount":5,"./order/initLayerGraphs":6,"./order/initOrder":7,"./order/sortLayer":8,"./util":17}],5:[function(t,e){function i(t){for(var e=0,i=r.ordering(t),a=1;i.length>a;++a)e+=n(t,i[a-1],i[a]);return e}function n(t,e,i){var n=[];e.forEach(function(e){var i=[];t.outEdges(e).forEach(function(e){i.push(t.node(t.target(e)).order)}),i.sort(function(t,e){return t-e}),n=n.concat(i)});for(var r=1;i.length>r;)r<<=1;var a=2*r-1;r-=1;for(var s=[],o=0;a>o;++o)s[o]=0;var l=0;return n.forEach(function(t){var e=t+r;for(++s[e];e>0;)e%2&&(l+=s[e+1]),e=e-1>>1,++s[e]}),l}var r=t("../util");e.exports=i},{"../util":17}],6:[function(t,e){function i(t){function e(n){if(null===n)return t.children(n).forEach(function(t){e(t)}),void 0;var a=t.node(n);a.minRank="rank"in a?a.rank:Number.MAX_VALUE,a.maxRank="rank"in a?a.rank:Number.MIN_VALUE;var s=new r;return t.children(n).forEach(function(i){var n=e(i);s=r.union([s,n]),a.minRank=Math.min(a.minRank,t.node(i).minRank),a.maxRank=Math.max(a.maxRank,t.node(i).maxRank)}),"rank"in a&&s.add(a.rank),s.keys().forEach(function(t){t in i||(i[t]=[]),i[t].push(n)}),s}var i=[];e(null);var a=[];return i.forEach(function(e,i){a[i]=t.filterNodes(n(e))}),a}var n=t("graphlib").filter.nodesFromList,r=t("cp-data").Set;e.exports=i},{"cp-data":19,graphlib:24}],7:[function(t,e){function i(t,e){var i=[];t.eachNode(function(e,n){var r=i[n.rank];t.children&&t.children(e).length>0||(r||(r=i[n.rank]=[]),r.push(e))}),i.forEach(function(i){e&&r.shuffle(i),i.forEach(function(e,i){t.node(e).order=i})});var a=n(t);t.graph().orderInitCC=a,t.graph().orderCC=Number.MAX_VALUE}var n=t("./crossCount"),r=t("../util");e.exports=i},{"../util":17,"./crossCount":5}],8:[function(t,e){function i(t,e,i){var r=[],a={};t.eachNode(function(t,e){r[e.order]=t;var s=i[t];s.length&&(a[t]=n.sum(s)/s.length)});var s=t.nodes().filter(function(t){return void 0!==a[t]});s.sort(function(e,i){return a[e]-a[i]||t.node(e).order-t.node(i).order});for(var o=0,l=0,c=s.length;c>l;++o)void 0!==a[r[o]]&&(t.node(s[l++]).order=o)}var n=t("../util");e.exports=i},{"../util":17}],9:[function(t,e){var i=t("./util");e.exports=function(){function t(t){t=t.filterNodes(i.filterNonSubgraphs(t));var e=i.ordering(t),s=n(t,e),o={};["u","d"].forEach(function(i){"d"===i&&e.reverse(),["l","r"].forEach(function(n){"r"===n&&h(e);var l=i+n,u=r(t,e,s,"u"===i?"predecessors":"successors");o[l]=a(t,e,u.pos,u.root,u.align),y.debugLevel>=3&&I(i+n,t,e,o[l]),"r"===n&&c(o[l]),"r"===n&&h(e)}),"d"===i&&e.reverse()}),l(t,e,o),t.eachNode(function(e){var i=[];for(var n in o){var r=o[n][e];f(n,t,e,r),i.push(r)}i.sort(function(t,e){return t-e}),d(t,e,(i[1]+i[2])/2)});var g=0,v="BT"===t.graph().rankDir||"RL"===t.graph().rankDir;e.forEach(function(e){var n=i.max(e.map(function(e){return p(t,e)}));g+=n/2,e.forEach(function(e){m(t,e,v?-g:g)}),g+=n/2+y.rankSep});var C=i.min(t.nodes().map(function(e){return d(t,e)-u(t,e)/2})),b=i.min(t.nodes().map(function(e){return m(t,e)-p(t,e)/2}));t.eachNode(function(e){d(t,e,d(t,e)-C),m(t,e,m(t,e)-b)})}function e(t,e){return e>t?(""+t).length+":"+t+"-"+e:(""+e).length+":"+e+"-"+t}function n(t,i){function n(t){var i=h[t];(s>i||i>l)&&(c[e(a[o],t)]=!0)}var r,a,s,o,l,c={},h={};if(2>=i.length)return c;i[1].forEach(function(t,e){h[t]=e});for(var u=1;i.length-1>u;++u){r=i[u],a=i[u+1],s=0,o=0;for(var p=0;a.length>p;++p){var g=a[p];if(h[g]=p,l=void 0,t.node(g).dummy){var d=t.predecessors(g)[0];void 0!==d&&t.node(d).dummy&&(l=h[d])}if(void 0===l&&p===a.length-1&&(l=r.length-1),void 0!==l){for(;p>=o;++o)t.predecessors(a[o]).forEach(n);s=l}}}return c}function r(t,i,n,r){var a={},s={},o={};return i.forEach(function(t){t.forEach(function(t,e){s[t]=t,o[t]=t,a[t]=e})}),i.forEach(function(i){var l=-1;i.forEach(function(i){var c,h=t[r](i);h.length>0&&(h.sort(function(t,e){return a[t]-a[e]}),c=(h.length-1)/2,h.slice(Math.floor(c),Math.ceil(c)+1).forEach(function(t){o[i]===i&&!n[e(t,i)]&&a[t]>l&&(o[t]=i,o[i]=s[i]=s[t],l=a[t])}))})}),{pos:a,root:s,align:o}}function a(t,e,n,r,a){function s(t,e,i){c[t][e]=e in c[t]?Math.min(c[t][e],i):i}function o(e){if(!(e in p)){p[e]=0;var i=e;do{if(n[i]>0){var c=r[u[i]];o(c),l[e]===e&&(l[e]=l[c]);var h=g(t,u[i])+g(t,i);l[e]!==l[c]?s(l[c],l[e],p[e]-p[c]-h):p[e]=Math.max(p[e],p[c]+h)}i=a[i]}while(i!==e)}}var l={},c={},h={},u={},p={};return e.forEach(function(t){t.forEach(function(e,i){l[e]=e,c[e]={},i>0&&(u[e]=t[i-1])})}),i.values(r).forEach(function(t){o(t)}),e.forEach(function(t){t.forEach(function(t){if(p[t]=p[r[t]],t===r[t]&&t===l[t]){var e=0;t in c&&Object.keys(c[t]).length>0&&(e=i.min(Object.keys(c[t]).map(function(e){return c[t][e]+(e in h?h[e]:0)}))),h[t]=e}})}),e.forEach(function(t){t.forEach(function(t){p[t]+=h[l[r[t]]]||0})}),p}function s(t,e,n){return i.min(e.map(function(t){var e=t[0];return n[e]}))}function o(t,e,n){return i.max(e.map(function(t){var e=t[t.length-1];return n[e]}))}function l(t,e,i){function n(t){i[u][t]+=c[u]}var r,a={},l={},c={},h=Number.POSITIVE_INFINITY;for(var u in i){var p=i[u];a[u]=s(t,e,p),l[u]=o(t,e,p);var g=l[u]-a[u];h>g&&(h=g,r=u)}["u","d"].forEach(function(t){["l","r"].forEach(function(e){var i=t+e;c[i]="l"===e?a[r]-a[i]:l[r]-l[i]})});for(u in i)t.eachNode(n)}function c(t){for(var e in t)t[e]=-t[e]}function h(t){t.forEach(function(t){t.reverse()})}function u(t,e){switch(t.graph().rankDir){case"LR":return t.node(e).height;case"RL":return t.node(e).height;default:return t.node(e).width}}function p(t,e){switch(t.graph().rankDir){case"LR":return t.node(e).width;case"RL":return t.node(e).width;default:return t.node(e).height}}function g(t,e){if(null!==y.universalSep)return y.universalSep;var i=u(t,e),n=t.node(e).dummy?y.edgeSep:y.nodeSep;return(i+n)/2}function d(t,e,i){if("LR"===t.graph().rankDir||"RL"===t.graph().rankDir){if(3>arguments.length)return t.node(e).y;t.node(e).y=i}else{if(3>arguments.length)return t.node(e).x;t.node(e).x=i}}function f(t,e,i,n){if("LR"===e.graph().rankDir||"RL"===e.graph().rankDir){if(3>arguments.length)return e.node(i)[t];e.node(i)[t]=n}else{if(3>arguments.length)return e.node(i)[t];e.node(i)[t]=n}}function m(t,e,i){if("LR"===t.graph().rankDir||"RL"===t.graph().rankDir){if(3>arguments.length)return t.node(e).x;t.node(e).x=i}else{if(3>arguments.length)return t.node(e).y;t.node(e).y=i}}function I(t,e,i,n){i.forEach(function(i,r){var a,s;i.forEach(function(i){var o=n[i];if(a){var l=g(e,a)+g(e,i);l>o-s&&console.log("Position phase: sep violation. Align: "+t+". Layer: "+r+". "+"U: "+a+" V: "+i+". Actual sep: "+(o-s)+" Expected sep: "+l)}a=i,s=o})})}var y={nodeSep:50,edgeSep:10,universalSep:null,rankSep:30},v={};return v.nodeSep=i.propertyAccessor(v,y,"nodeSep"),v.edgeSep=i.propertyAccessor(v,y,"edgeSep"),v.universalSep=i.propertyAccessor(v,y,"universalSep"),v.rankSep=i.propertyAccessor(v,y,"rankSep"),v.debugLevel=i.propertyAccessor(v,y,"debugLevel"),v.run=t,v}},{"./util":17}],10:[function(t,e,i){function n(t,e){a(t),u.time("constraints.apply",f.apply)(t),s(t),u.time("acyclic",p)(t);var i=t.filterNodes(u.filterNonSubgraphs(t));g(i),I(i).forEach(function(t){var n=i.filterNodes(y.nodesFromList(t));c(n,e)}),u.time("constraints.relax",f.relax(t)),u.time("reorientEdges",l)(t)}function r(t){p.undo(t)}function a(t){t.eachEdge(function(e,i,n,r){if(i===n){var a=o(t,e,i,n,r,0,!1),s=o(t,e,i,n,r,1,!0),l=o(t,e,i,n,r,2,!1);t.addEdge(null,a,i,{minLen:1,selfLoop:!0}),t.addEdge(null,a,s,{minLen:1,selfLoop:!0}),t.addEdge(null,i,l,{minLen:1,selfLoop:!0}),t.addEdge(null,s,l,{minLen:1,selfLoop:!0}),t.delEdge(e)}})}function s(t){t.eachEdge(function(e,i,n,r){if(i===n){var a=r.originalEdge,s=o(t,a.e,a.u,a.v,a.value,0,!0);t.addEdge(null,i,s,{minLen:1}),t.addEdge(null,s,n,{minLen:1}),t.delEdge(e)}})}function o(t,e,i,n,r,a,s){return t.addNode(null,{width:s?r.width:0,height:s?r.height:0,edge:{id:e,source:i,target:n,attrs:r},dummy:!0,index:a})}function l(t){t.eachEdge(function(e,i,n,r){t.node(i).rank>t.node(n).rank&&(t.delEdge(e),r.reversed=!0,t.addEdge(e,n,i,r))})}function c(t,e){var i=d(t);e&&(u.log(1,"Using network simplex for ranking"),m(t,i)),h(t)}function h(t){var e=u.min(t.nodes().map(function(e){return t.node(e).rank}));t.eachNode(function(t,i){i.rank-=e})}var u=t("./util"),p=t("./rank/acyclic"),g=t("./rank/initRank"),d=t("./rank/feasibleTree"),f=t("./rank/constraints"),m=t("./rank/simplex"),I=t("graphlib").alg.components,y=t("graphlib").filter;i.run=n,i.restoreEdges=r},{"./rank/acyclic":11,"./rank/constraints":12,"./rank/feasibleTree":13,"./rank/initRank":14,"./rank/simplex":16,"./util":17,graphlib:24}],11:[function(t,e){function i(t){function e(r){r in n||(n[r]=i[r]=!0,t.outEdges(r).forEach(function(n){var s,o=t.target(n);r===o?console.error('Warning: found self loop "'+n+'" for node "'+r+'"'):o in i?(s=t.edge(n),t.delEdge(n),s.reversed=!0,++a,t.addEdge(n,o,r,s)):e(o)}),delete i[r])}var i={},n={},a=0;return t.eachNode(function(t){e(t)}),r.log(2,"Acyclic Phase: reversed "+a+" edge(s)"),a}function n(t){t.eachEdge(function(e,i,n,r){r.reversed&&(delete r.reversed,t.delEdge(e),t.addEdge(e,n,i,r))})}var r=t("../util");e.exports=i,e.exports.undo=n},{"../util":17}],12:[function(t,e,i){function n(t){return"min"!==t&&"max"!==t&&0!==t.indexOf("same_")?(console.error("Unsupported rank type: "+t),!1):!0}function r(t,e,i,n){t.inEdges(e).forEach(function(e){var r,a=t.edge(e);r=a.originalEdge?a:{originalEdge:{e:e,u:t.source(e),v:t.target(e),value:a},minLen:t.edge(e).minLen},a.selfLoop&&(n=!1),n?(t.addEdge(null,i,t.source(e),r),r.reversed=!0):t.addEdge(null,t.source(e),i,r)})}function a(t,e,i,n){t.outEdges(e).forEach(function(e){var r,a=t.edge(e);r=a.originalEdge?a:{originalEdge:{e:e,u:t.source(e),v:t.target(e),value:a},minLen:t.edge(e).minLen},a.selfLoop&&(n=!1),n?(t.addEdge(null,t.target(e),i,r),r.reversed=!0):t.addEdge(null,i,t.target(e),r)})}function s(t,e,i){void 0!==i&&t.children(e).forEach(function(e){e===i||t.outEdges(i,e).length||t.node(e).dummy||t.addEdge(null,i,e,{minLen:0})})}function o(t,e,i){void 0!==i&&t.children(e).forEach(function(e){e===i||t.outEdges(e,i).length||t.node(e).dummy||t.addEdge(null,e,i,{minLen:0})})}i.apply=function(t){function e(i){var l={};t.children(i).forEach(function(s){if(t.children(s).length)return e(s),void 0;var o=t.node(s),c=o.prefRank;if(void 0!==c){if(!n(c))return;c in l?l.prefRank.push(s):l.prefRank=[s];var h=l[c];void 0===h&&(h=l[c]=t.addNode(null,{originalNodes:[]}),t.parent(h,i)),r(t,s,h,"min"===c),a(t,s,h,"max"===c),t.node(h).originalNodes.push({u:s,value:o,parent:i}),t.delNode(s)}}),s(t,i,l.min),o(t,i,l.max)}e(null)},i.relax=function(t){var e=[];t.eachEdge(function(t,i,n,r){var a=r.originalEdge;a&&e.push(a)}),t.eachNode(function(e,i){var n=i.originalNodes;n&&(n.forEach(function(e){e.value.rank=i.rank,t.addNode(e.u,e.value),t.parent(e.u,e.parent)}),t.delNode(e))}),e.forEach(function(e){t.addEdge(e.e,e.u,e.v,e.value)})}},{}],13:[function(t,e){function i(t){function e(i){var r=!0;return t.predecessors(i).forEach(function(a){s.has(a)&&!n(t,a,i)&&(s.has(i)&&(o.addNode(i,{}),s.remove(i),o.graph({root:i})),o.addNode(a,{}),o.addEdge(null,a,i,{reversed:!0}),s.remove(a),e(a),r=!1)}),t.successors(i).forEach(function(a){s.has(a)&&!n(t,i,a)&&(s.has(i)&&(o.addNode(i,{}),s.remove(i),o.graph({root:i})),o.addNode(a,{}),o.addEdge(null,i,a,{}),s.remove(a),e(a),r=!1)}),r}function i(){var e=Number.MAX_VALUE;s.keys().forEach(function(i){t.predecessors(i).forEach(function(r){if(!s.has(r)){var a=n(t,r,i);Math.abs(a)<Math.abs(e)&&(e=-a)}}),t.successors(i).forEach(function(r){if(!s.has(r)){var a=n(t,i,r);Math.abs(a)<Math.abs(e)&&(e=a)}})}),o.eachNode(function(i){t.node(i).rank-=e})}var s=new r(t.nodes()),o=new a;if(1===s.size()){var l=t.nodes()[0];return o.addNode(l,{}),o.graph({root:l}),o}for(;s.size();){for(var c=o.order()?o.nodes():s.keys(),h=0,u=c.length;u>h&&e(c[h]);++h);s.size()&&i()}return o}function n(t,e,i){var n=t.node(i).rank-t.node(e).rank,r=s.max(t.outEdges(e,i).map(function(e){return t.edge(e).minLen}));return n-r}var r=t("cp-data").Set,a=t("graphlib").Digraph,s=t("../util");e.exports=i},{"../util":17,"cp-data":19,graphlib:24}],14:[function(t,e){function i(t){var e=r(t);e.forEach(function(e){var i=t.inEdges(e);if(0===i.length)return t.node(e).rank=0,void 0;var r=i.map(function(e){return t.node(t.source(e)).rank+t.edge(e).minLen});t.node(e).rank=n.max(r)})}var n=t("../util"),r=t("graphlib").alg.topsort;e.exports=i},{"../util":17,graphlib:24}],15:[function(t,e){function i(t,e,i,n){return Math.abs(t.node(e).rank-t.node(i).rank)-n}e.exports={slack:i}},{}],16:[function(t,e){function i(t,e){for(n(t,e);;){var i=o(e);if(null===i)break;var r=l(t,e,i);c(t,e,i,r)}}function n(t,e){function i(n){var r=e.successors(n);for(var s in r){var o=r[s];i(o)}n!==e.graph().root&&a(t,e,n)}r(e),e.eachEdge(function(t,e,i,n){n.cutValue=0}),i(e.graph().root)}function r(t){function e(n){var r=t.successors(n),a=i;for(var s in r){var o=r[s];e(o),a=Math.min(a,t.node(o).low)}t.node(n).low=a,t.node(n).lim=i++}var i=0;e(t.graph().root)}function a(t,e,i){var n=e.inEdges(i)[0],r=[],a=e.outEdges(i);for(var o in a)r.push(e.target(a[o]));var l,c=0,h=0,u=0,p=0,g=0,d=t.outEdges(i);for(var f in d){var m=t.target(d[f]);for(l in r)s(e,m,r[l])&&h++;s(e,m,i)||p++}var I=t.inEdges(i);for(var y in I){var v=t.source(I[y]);for(l in r)s(e,v,r[l])&&u++;s(e,v,i)||g++}var C=0;for(l in r){var b=e.edge(a[l]).cutValue;e.edge(a[l]).reversed?C-=b:C+=b}e.edge(n).reversed?c-=C-h+u-p+g:c+=C-h+u-p+g,e.edge(n).cutValue=c}function s(t,e,i){return t.node(i).low<=t.node(e).lim&&t.node(e).lim<=t.node(i).lim}function o(t){var e=t.edges();for(var i in e){var n=e[i],r=t.edge(n);if(0>r.cutValue)return n}return null}function l(t,e,i){var n,r=e.source(i),a=e.target(i),o=e.node(a).lim<e.node(r).lim?a:r,l=!e.edge(i).reversed,c=Number.POSITIVE_INFINITY;if(l?t.eachEdge(function(r,a,l,h){if(r!==i&&s(e,a,o)&&!s(e,l,o)){var u=g.slack(t,a,l,h.minLen);c>u&&(c=u,n=r)}}):t.eachEdge(function(r,a,l,h){if(r!==i&&!s(e,a,o)&&s(e,l,o)){var u=g.slack(t,a,l,h.minLen);c>u&&(c=u,n=r)}}),void 0===n){var h=[],u=[];throw t.eachNode(function(t){s(e,t,o)?u.push(t):h.push(t)}),Error("No edge found from outside of tree to inside")}return n}function c(t,e,i,r){function a(t){var i=e.inEdges(t);for(var n in i){var r=i[n],s=e.source(r),o=e.edge(r);a(s),e.delEdge(r),o.reversed=!o.reversed,e.addEdge(r,t,s,o)}}e.delEdge(i);var s=t.source(r),o=t.target(r);a(o);for(var l=s,c=e.inEdges(l);c.length>0;)l=e.source(c[0]),c=e.inEdges(l);e.graph().root=l,e.addEdge(null,s,o,{cutValue:0}),n(t,e),h(t,e)}function h(t,e){function i(n){var r=e.successors(n);r.forEach(function(e){var r=u(t,n,e);t.node(e).rank=t.node(n).rank+r,i(e)})}i(e.graph().root)}function u(t,e,i){var n=t.outEdges(e,i);if(n.length>0)return p.max(n.map(function(e){return t.edge(e).minLen}));var r=t.inEdges(e,i);return r.length>0?-p.max(r.map(function(e){return t.edge(e).minLen})):void 0}var p=t("../util"),g=t("./rankUtil");e.exports=i},{"../util":17,"./rankUtil":15}],17:[function(t,e,n){function r(t,e){return function(){var i=(new Date).getTime();try{return e.apply(null,arguments)}finally{a(1,t+" time: "+((new Date).getTime()-i)+"ms")}}}function a(t){a.level>=t&&console.log.apply(console,Array.prototype.slice.call(arguments,1))}n.min=function(t){return Math.min.apply(Math,t)},n.max=function(t){return Math.max.apply(Math,t)},n.all=function(t,e){for(var i=0;t.length>i;++i)if(!e(t[i]))return!1;return!0},n.sum=function(t){return t.reduce(function(t,e){return t+e},0)},n.values=function(t){return Object.keys(t).map(function(e){return t[e]})},n.shuffle=function(t){for(i=t.length-1;i>0;--i){var e=Math.floor(Math.random()*(i+1)),n=t[e];t[e]=t[i],t[i]=n}},n.propertyAccessor=function(t,e,i,n){return function(r){return arguments.length?(e[i]=r,n&&n(r),t):e[i]}},n.ordering=function(t){var e=[];return t.eachNode(function(t,i){var n=e[i.rank]||(e[i.rank]=[]);n[i.order]=t}),e},n.filterNonSubgraphs=function(t){return function(e){return 0===t.children(e).length}},r.enabled=!1,n.time=r,a.level=0,n.log=a},{}],18:[function(t,e){e.exports="0.4.5"},{}],19:[function(t,e,i){i.Set=t("./lib/Set"),i.PriorityQueue=t("./lib/PriorityQueue"),i.version=t("./lib/version")},{"./lib/PriorityQueue":20,"./lib/Set":21,"./lib/version":23}],20:[function(t,e){function i(){this._arr=[],this._keyIndices={}}e.exports=i,i.prototype.size=function(){return this._arr.length},i.prototype.keys=function(){return this._arr.map(function(t){return t.key})},i.prototype.has=function(t){return t in this._keyIndices},i.prototype.priority=function(t){var e=this._keyIndices[t];return void 0!==e?this._arr[e].priority:void 0},i.prototype.min=function(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key},i.prototype.add=function(t,e){var i=this._keyIndices;if(!(t in i)){var n=this._arr,r=n.length;return i[t]=r,n.push({key:t,priority:e}),this._decrease(r),!0}return!1},i.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},i.prototype.decrease=function(t,e){var i=this._keyIndices[t];if(e>this._arr[i].priority)throw Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[i].priority+" New: "+e);this._arr[i].priority=e,this._decrease(i)},i.prototype._heapify=function(t){var e=this._arr,i=2*t,n=i+1,r=t;e.length>i&&(r=e[i].priority<e[r].priority?i:r,e.length>n&&(r=e[n].priority<e[r].priority?n:r),r!==t&&(this._swap(t,r),this._heapify(r)))},i.prototype._decrease=function(t){for(var e,i=this._arr,n=i[t].priority;0!==t&&(e=t>>1,!(n>i[e].priority));)this._swap(t,e),t=e},i.prototype._swap=function(t,e){var i=this._arr,n=this._keyIndices,r=i[t],a=i[e];i[t]=a,i[e]=r,n[a.key]=t,n[r.key]=e}},{}],21:[function(t,e){function i(t){if(this._size=0,this._keys={},t)for(var e=0,i=t.length;i>e;++e)this.add(t[e])}function n(t){var e,i=Object.keys(t),n=i.length,r=Array(n);for(e=0;n>e;++e)r[e]=t[i[e]];return r}var r=t("./util");e.exports=i,i.intersect=function(t){if(0===t.length)return new i;for(var e=new i(r.isArray(t[0])?t[0]:t[0].keys()),n=1,a=t.length;a>n;++n)for(var s=e.keys(),o=r.isArray(t[n])?new i(t[n]):t[n],l=0,c=s.length;c>l;++l){var h=s[l];o.has(h)||e.remove(h)}return e},i.union=function(t){for(var e=r.reduce(t,function(t,e){return t+(e.size?e.size():e.length)},0),n=Array(e),a=0,s=0,o=t.length;o>s;++s)for(var l=t[s],c=r.isArray(l)?l:l.keys(),h=0,u=c.length;u>h;++h)n[a++]=c[h];return new i(n)},i.prototype.size=function(){return this._size},i.prototype.keys=function(){return n(this._keys)},i.prototype.has=function(t){return t in this._keys},i.prototype.add=function(t){return t in this._keys?!1:(this._keys[t]=t,++this._size,!0)},i.prototype.remove=function(t){return t in this._keys?(delete this._keys[t],--this._size,!0):!1}},{"./util":22}],22:[function(t,e,i){i.isArray=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i.reduce="function"!=typeof Array.prototype.reduce?function(t,e,i){"use strict";if(null===t||t===void 0)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof e)throw new TypeError(e+" is not a function");var n,r,a=t.length>>>0,s=!1;for(arguments.length>1&&(r=i,s=!0),n=0;a>n;++n)t.hasOwnProperty(n)&&(s?r=e(r,t[n],n,t):(r=t[n],s=!0));if(!s)throw new TypeError("Reduce of empty array with no initial value");return r}:function(t,e,i){return t.reduce(e,i)}},{}],23:[function(t,e){e.exports="1.1.3"},{}],24:[function(t,e,i){i.Graph=t("./lib/Graph"),i.Digraph=t("./lib/Digraph"),i.CGraph=t("./lib/CGraph"),i.CDigraph=t("./lib/CDigraph"),t("./lib/graph-converters"),i.alg={isAcyclic:t("./lib/alg/isAcyclic"),components:t("./lib/alg/components"),dijkstra:t("./lib/alg/dijkstra"),dijkstraAll:t("./lib/alg/dijkstraAll"),findCycles:t("./lib/alg/findCycles"),floydWarshall:t("./lib/alg/floydWarshall"),postorder:t("./lib/alg/postorder"),preorder:t("./lib/alg/preorder"),prim:t("./lib/alg/prim"),tarjan:t("./lib/alg/tarjan"),topsort:t("./lib/alg/topsort")},i.converter={json:t("./lib/converter/json.js")};var n=t("./lib/filter");i.filter={all:n.all,nodesFromList:n.nodesFromList},i.version=t("./lib/version")},{"./lib/CDigraph":26,"./lib/CGraph":27,"./lib/Digraph":28,"./lib/Graph":29,"./lib/alg/components":30,"./lib/alg/dijkstra":31,"./lib/alg/dijkstraAll":32,"./lib/alg/findCycles":33,"./lib/alg/floydWarshall":34,"./lib/alg/isAcyclic":35,"./lib/alg/postorder":36,"./lib/alg/preorder":37,"./lib/alg/prim":38,"./lib/alg/tarjan":39,"./lib/alg/topsort":40,"./lib/converter/json.js":42,"./lib/filter":43,"./lib/graph-converters":44,"./lib/version":46}],25:[function(t,e){function i(){this._value=void 0,this._nodes={},this._edges={},this._nextId=0}function n(t,e,i){(t[e]||(t[e]=new a)).add(i)}function r(t,e,i){var n=t[e];n.remove(i),0===n.size()&&delete t[e]}var a=t("cp-data").Set;e.exports=i,i.prototype.order=function(){return Object.keys(this._nodes).length},i.prototype.size=function(){return Object.keys(this._edges).length},i.prototype.graph=function(t){return 0===arguments.length?this._value:(this._value=t,void 0)},i.prototype.hasNode=function(t){return t in this._nodes},i.prototype.node=function(t,e){var i=this._strictGetNode(t);return 1===arguments.length?i.value:(i.value=e,void 0)},i.prototype.nodes=function(){var t=[];return this.eachNode(function(e){t.push(e)}),t},i.prototype.eachNode=function(t){for(var e in this._nodes){var i=this._nodes[e];t(i.id,i.value)}},i.prototype.hasEdge=function(t){return t in this._edges},i.prototype.edge=function(t,e){var i=this._strictGetEdge(t);return 1===arguments.length?i.value:(i.value=e,void 0)},i.prototype.edges=function(){var t=[];return this.eachEdge(function(e){t.push(e)}),t},i.prototype.eachEdge=function(t){for(var e in this._edges){var i=this._edges[e];t(i.id,i.u,i.v,i.value)}},i.prototype.incidentNodes=function(t){var e=this._strictGetEdge(t);return[e.u,e.v]},i.prototype.addNode=function(t,e){if(void 0===t||null===t){do t="_"+ ++this._nextId;while(this.hasNode(t))}else if(this.hasNode(t))throw Error("Graph already has node '"+t+"'");return this._nodes[t]={id:t,value:e},t},i.prototype.delNode=function(t){this._strictGetNode(t),this.incidentEdges(t).forEach(function(t){this.delEdge(t)},this),delete this._nodes[t]},i.prototype._addEdge=function(t,e,i,r,a,s){if(this._strictGetNode(e),this._strictGetNode(i),void 0===t||null===t){do t="_"+ ++this._nextId;while(this.hasEdge(t))}else if(this.hasEdge(t))throw Error("Graph already has edge '"+t+"'");return this._edges[t]={id:t,u:e,v:i,value:r},n(a[i],e,t),n(s[e],i,t),t},i.prototype._delEdge=function(t,e,i){var n=this._strictGetEdge(t);r(e[n.v],n.u,t),r(i[n.u],n.v,t),delete this._edges[t]},i.prototype.copy=function(){var t=new this.constructor;return t.graph(this.graph()),this.eachNode(function(e,i){t.addNode(e,i)}),this.eachEdge(function(e,i,n,r){t.addEdge(e,i,n,r)}),t._nextId=this._nextId,t},i.prototype.filterNodes=function(t){var e=new this.constructor;return e.graph(this.graph()),this.eachNode(function(i,n){t(i)&&e.addNode(i,n)}),this.eachEdge(function(t,i,n,r){e.hasNode(i)&&e.hasNode(n)&&e.addEdge(t,i,n,r)}),e},i.prototype._strictGetNode=function(t){var e=this._nodes[t];if(void 0===e)throw Error("Node '"+t+"' is not in graph");return e},i.prototype._strictGetEdge=function(t){var e=this._edges[t];if(void 0===e)throw Error("Edge '"+t+"' is not in graph");return e}},{"cp-data":19}],26:[function(t,e){var i=t("./Digraph"),n=t("./compoundify"),r=n(i);e.exports=r,r.fromDigraph=function(t){var e=new r,i=t.graph();return void 0!==i&&e.graph(i),t.eachNode(function(t,i){void 0===i?e.addNode(t):e.addNode(t,i)}),t.eachEdge(function(t,i,n,r){void 0===r?e.addEdge(null,i,n):e.addEdge(null,i,n,r)}),e},r.prototype.toString=function(){return"CDigraph "+JSON.stringify(this,null,2)}},{"./Digraph":28,"./compoundify":41}],27:[function(t,e){var i=t("./Graph"),n=t("./compoundify"),r=n(i);
28 e.exports=r,r.fromGraph=function(t){var e=new r,i=t.graph();return void 0!==i&&e.graph(i),t.eachNode(function(t,i){void 0===i?e.addNode(t):e.addNode(t,i)}),t.eachEdge(function(t,i,n,r){void 0===r?e.addEdge(null,i,n):e.addEdge(null,i,n,r)}),e},r.prototype.toString=function(){return"CGraph "+JSON.stringify(this,null,2)}},{"./Graph":29,"./compoundify":41}],28:[function(t,e){function i(){r.call(this),this._inEdges={},this._outEdges={}}var n=t("./util"),r=t("./BaseGraph"),a=t("cp-data").Set;e.exports=i,i.prototype=new r,i.prototype.constructor=i,i.prototype.isDirected=function(){return!0},i.prototype.successors=function(t){return this._strictGetNode(t),Object.keys(this._outEdges[t]).map(function(t){return this._nodes[t].id},this)},i.prototype.predecessors=function(t){return this._strictGetNode(t),Object.keys(this._inEdges[t]).map(function(t){return this._nodes[t].id},this)},i.prototype.neighbors=function(t){return a.union([this.successors(t),this.predecessors(t)]).keys()},i.prototype.sources=function(){var t=this;return this._filterNodes(function(e){return 0===t.inEdges(e).length})},i.prototype.sinks=function(){var t=this;return this._filterNodes(function(e){return 0===t.outEdges(e).length})},i.prototype.source=function(t){return this._strictGetEdge(t).u},i.prototype.target=function(t){return this._strictGetEdge(t).v},i.prototype.inEdges=function(t,e){this._strictGetNode(t);var i=a.union(n.values(this._inEdges[t])).keys();return arguments.length>1&&(this._strictGetNode(e),i=i.filter(function(t){return this.source(t)===e},this)),i},i.prototype.outEdges=function(t,e){this._strictGetNode(t);var i=a.union(n.values(this._outEdges[t])).keys();return arguments.length>1&&(this._strictGetNode(e),i=i.filter(function(t){return this.target(t)===e},this)),i},i.prototype.incidentEdges=function(t,e){return arguments.length>1?a.union([this.outEdges(t,e),this.outEdges(e,t)]).keys():a.union([this.inEdges(t),this.outEdges(t)]).keys()},i.prototype.toString=function(){return"Digraph "+JSON.stringify(this,null,2)},i.prototype.addNode=function(t,e){return t=r.prototype.addNode.call(this,t,e),this._inEdges[t]={},this._outEdges[t]={},t},i.prototype.delNode=function(t){r.prototype.delNode.call(this,t),delete this._inEdges[t],delete this._outEdges[t]},i.prototype.addEdge=function(t,e,i,n){return r.prototype._addEdge.call(this,t,e,i,n,this._inEdges,this._outEdges)},i.prototype.delEdge=function(t){r.prototype._delEdge.call(this,t,this._inEdges,this._outEdges)},i.prototype._filterNodes=function(t){var e=[];return this.eachNode(function(i){t(i)&&e.push(i)}),e}},{"./BaseGraph":25,"./util":45,"cp-data":19}],29:[function(t,e){function i(){r.call(this),this._incidentEdges={}}var n=t("./util"),r=t("./BaseGraph"),a=t("cp-data").Set;e.exports=i,i.prototype=new r,i.prototype.constructor=i,i.prototype.isDirected=function(){return!1},i.prototype.neighbors=function(t){return this._strictGetNode(t),Object.keys(this._incidentEdges[t]).map(function(t){return this._nodes[t].id},this)},i.prototype.incidentEdges=function(t,e){return this._strictGetNode(t),arguments.length>1?(this._strictGetNode(e),e in this._incidentEdges[t]?this._incidentEdges[t][e].keys():[]):a.union(n.values(this._incidentEdges[t])).keys()},i.prototype.toString=function(){return"Graph "+JSON.stringify(this,null,2)},i.prototype.addNode=function(t,e){return t=r.prototype.addNode.call(this,t,e),this._incidentEdges[t]={},t},i.prototype.delNode=function(t){r.prototype.delNode.call(this,t),delete this._incidentEdges[t]},i.prototype.addEdge=function(t,e,i,n){return r.prototype._addEdge.call(this,t,e,i,n,this._incidentEdges,this._incidentEdges)},i.prototype.delEdge=function(t){r.prototype._delEdge.call(this,t,this._incidentEdges,this._incidentEdges)}},{"./BaseGraph":25,"./util":45,"cp-data":19}],30:[function(t,e){function i(t){function e(i,n){r.has(i)||(r.add(i),n.push(i),t.neighbors(i).forEach(function(t){e(t,n)}))}var i=[],r=new n;return t.nodes().forEach(function(t){var n=[];e(t,n),n.length>0&&i.push(n)}),i}var n=t("cp-data").Set;e.exports=i},{"cp-data":19}],31:[function(t,e){function i(t,e,i,r){function a(e){var n=t.incidentNodes(e),r=n[0]!==l?n[0]:n[1],a=s[r],h=i(e),u=c.distance+h;if(0>h)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+h);a.distance>u&&(a.distance=u,a.predecessor=l,o.decrease(r,u))}var s={},o=new n;i=i||function(){return 1},r=r||(t.isDirected()?function(e){return t.outEdges(e)}:function(e){return t.incidentEdges(e)}),t.eachNode(function(t){var i=t===e?0:Number.POSITIVE_INFINITY;s[t]={distance:i},o.add(t,i)});for(var l,c;o.size()>0&&(l=o.removeMin(),c=s[l],c.distance!==Number.POSITIVE_INFINITY);)r(l).forEach(a);return s}var n=t("cp-data").PriorityQueue;e.exports=i},{"cp-data":19}],32:[function(t,e){function i(t,e,i){var r={};return t.eachNode(function(a){r[a]=n(t,a,e,i)}),r}var n=t("./dijkstra");e.exports=i},{"./dijkstra":31}],33:[function(t,e){function i(t){return n(t).filter(function(t){return t.length>1})}var n=t("./tarjan");e.exports=i},{"./tarjan":39}],34:[function(t,e){function i(t,e,i){var n={},r=t.nodes();return e=e||function(){return 1},i=i||(t.isDirected()?function(e){return t.outEdges(e)}:function(e){return t.incidentEdges(e)}),r.forEach(function(a){n[a]={},n[a][a]={distance:0},r.forEach(function(t){a!==t&&(n[a][t]={distance:Number.POSITIVE_INFINITY})}),i(a).forEach(function(i){var r=t.incidentNodes(i),s=r[0]!==a?r[0]:r[1],o=e(i);n[a][s].distance>o&&(n[a][s]={distance:o,predecessor:a})})}),r.forEach(function(t){var e=n[t];r.forEach(function(i){var a=n[i];r.forEach(function(i){var n=a[t],r=e[i],s=a[i],o=n.distance+r.distance;s.distance>o&&(s.distance=o,s.predecessor=r.predecessor)})})}),n}e.exports=i},{}],35:[function(t,e){function i(t){try{n(t)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}var n=t("./topsort");e.exports=i},{"./topsort":40}],36:[function(t,e){function i(t,e,i){function r(e,n){if(a.has(e))throw Error("The input graph is not a tree: "+t);a.add(e),t.neighbors(e).forEach(function(t){t!==n&&r(t,e)}),i(e)}var a=new n;if(t.isDirected())throw Error("This function only works for undirected graphs");r(e)}var n=t("cp-data").Set;e.exports=i},{"cp-data":19}],37:[function(t,e){function i(t,e,i){function r(e,n){if(a.has(e))throw Error("The input graph is not a tree: "+t);a.add(e),i(e),t.neighbors(e).forEach(function(t){t!==n&&r(t,e)})}var a=new n;if(t.isDirected())throw Error("This function only works for undirected graphs");r(e)}var n=t("cp-data").Set;e.exports=i},{"cp-data":19}],38:[function(t,e){function i(t,e){function i(i){var n=t.incidentNodes(i),r=n[0]!==a?n[0]:n[1],s=l.priority(r);if(void 0!==s){var c=e(i);s>c&&(o[r]=a,l.decrease(r,c))}}var a,s=new n,o={},l=new r;if(0===t.order())return s;t.eachNode(function(t){l.add(t,Number.POSITIVE_INFINITY),s.addNode(t)}),l.decrease(t.nodes()[0],0);for(var c=!1;l.size()>0;){if(a=l.removeMin(),a in o)s.addEdge(null,a,o[a]);else{if(c)throw Error("Input graph is not connected: "+t);c=!0}t.incidentEdges(a).forEach(i)}return s}var n=t("../Graph"),r=t("cp-data").PriorityQueue;e.exports=i},{"../Graph":29,"cp-data":19}],39:[function(t,e){function i(t){function e(s){var o=r[s]={onStack:!0,lowlink:i,index:i++};if(n.push(s),t.successors(s).forEach(function(t){t in r?r[t].onStack&&(o.lowlink=Math.min(o.lowlink,r[t].index)):(e(t),o.lowlink=Math.min(o.lowlink,r[t].lowlink))}),o.lowlink===o.index){var l,c=[];do l=n.pop(),r[l].onStack=!1,c.push(l);while(s!==l);a.push(c)}}if(!t.isDirected())throw Error("tarjan can only be applied to a directed graph. Bad input: "+t);var i=0,n=[],r={},a=[];return t.nodes().forEach(function(t){t in r||e(t)}),a}e.exports=i},{}],40:[function(t,e){function i(t){function e(s){if(s in r)throw new n;s in i||(r[s]=!0,i[s]=!0,t.predecessors(s).forEach(function(t){e(t)}),delete r[s],a.push(s))}if(!t.isDirected())throw Error("topsort can only be applied to a directed graph. Bad input: "+t);var i={},r={},a=[],s=t.sinks();if(0!==t.order()&&0===s.length)throw new n;return t.sinks().forEach(function(t){e(t)}),a}function n(){}e.exports=i,i.CycleException=n,n.prototype.toString=function(){return"Graph has at least one cycle"}},{}],41:[function(t,e){function i(t){function e(){t.call(this),this._parents={},this._children={},this._children[null]=new n}return e.prototype=new t,e.prototype.constructor=e,e.prototype.parent=function(t,e){if(this._strictGetNode(t),2>arguments.length)return this._parents[t];if(t===e)throw Error("Cannot make "+t+" a parent of itself");null!==e&&this._strictGetNode(e),this._children[this._parents[t]].remove(t),this._parents[t]=e,this._children[e].add(t)},e.prototype.children=function(t){return null!==t&&this._strictGetNode(t),this._children[t].keys()},e.prototype.addNode=function(e,i){return e=t.prototype.addNode.call(this,e,i),this._parents[e]=null,this._children[e]=new n,this._children[null].add(e),e},e.prototype.delNode=function(e){var i=this.parent(e);return this._children[e].keys().forEach(function(t){this.parent(t,i)},this),this._children[i].remove(e),delete this._parents[e],delete this._children[e],t.prototype.delNode.call(this,e)},e.prototype.copy=function(){var e=t.prototype.copy.call(this);return this.nodes().forEach(function(t){e.parent(t,this.parent(t))},this),e},e.prototype.filterNodes=function(e){function i(t){var e=n.parent(t);return null===e||r.hasNode(e)?(a[t]=e,e):e in a?a[e]:i(e)}var n=this,r=t.prototype.filterNodes.call(this,e),a={};return r.eachNode(function(t){r.parent(t,i(t))}),r},e}var n=t("cp-data").Set;e.exports=i},{"cp-data":19}],42:[function(t,e,i){function n(t){return Object.prototype.toString.call(t).slice(8,-1)}var r=t("../Graph"),a=t("../Digraph"),s=t("../CGraph"),o=t("../CDigraph");i.decode=function(t,e,i){if(i=i||a,"Array"!==n(t))throw Error("nodes is not an Array");if("Array"!==n(e))throw Error("edges is not an Array");if("string"==typeof i)switch(i){case"graph":i=r;break;case"digraph":i=a;break;case"cgraph":i=s;break;case"cdigraph":i=o;break;default:throw Error("Unrecognized graph type: "+i)}var l=new i;return t.forEach(function(t){l.addNode(t.id,t.value)}),l.parent&&t.forEach(function(t){t.children&&t.children.forEach(function(e){l.parent(e,t.id)})}),e.forEach(function(t){l.addEdge(t.id,t.u,t.v,t.value)}),l},i.encode=function(t){var e=[],i=[];t.eachNode(function(i,n){var r={id:i,value:n};if(t.children){var a=t.children(i);a.length&&(r.children=a)}e.push(r)}),t.eachEdge(function(t,e,n,r){i.push({id:t,u:e,v:n,value:r})});var n;if(t instanceof o)n="cdigraph";else if(t instanceof s)n="cgraph";else if(t instanceof a)n="digraph";else{if(!(t instanceof r))throw Error("Couldn't determine type of graph: "+t);n="graph"}return{nodes:e,edges:i,type:n}}},{"../CDigraph":26,"../CGraph":27,"../Digraph":28,"../Graph":29}],43:[function(t,e,i){var n=t("cp-data").Set;i.all=function(){return function(){return!0}},i.nodesFromList=function(t){var e=new n(t);return function(t){return e.has(t)}}},{"cp-data":19}],44:[function(t){var e=t("./Graph"),i=t("./Digraph");e.prototype.toDigraph=e.prototype.asDirected=function(){var t=new i;return this.eachNode(function(e,i){t.addNode(e,i)}),this.eachEdge(function(e,i,n,r){t.addEdge(null,i,n,r),t.addEdge(null,n,i,r)}),t},i.prototype.toGraph=i.prototype.asUndirected=function(){var t=new e;return this.eachNode(function(e,i){t.addNode(e,i)}),this.eachEdge(function(e,i,n,r){t.addEdge(e,i,n,r)}),t}},{"./Digraph":28,"./Graph":29}],45:[function(t,e,i){i.values=function(t){var e,i=Object.keys(t),n=i.length,r=Array(n);for(e=0;n>e;++e)r[e]=t[i[e]];return r}},{}],46:[function(t,e){e.exports="0.7.4"},{}]},{},[1]),joint.layout.DirectedGraph={layout:function(t,e){e=e||{};var i=this._prepareData(t),n=dagre.layout();e.debugLevel&&n.debugLevel(e.debugLevel),e.rankDir&&n.rankDir(e.rankDir),e.rankSep&&n.rankSep(e.rankSep),e.edgeSep&&n.edgeSep(e.edgeSep),e.nodeSep&&n.nodeSep(e.nodeSep);var r=n.run(i);return r.eachNode(function(e,i){i.dummy||t.get("cells").get(e).set("position",{x:i.x-i.width/2,y:i.y-i.height/2})}),e.setLinkVertices&&r.eachEdge(function(e,i,n,r){var a=t.get("cells").get(e);a&&t.get("cells").get(e).set("vertices",r.points)}),{width:r.graph().width,height:r.graph().height}},_prepareData:function(t){var e=new dagre.Digraph;return _.each(t.getElements(),function(t){e.hasNode(t.id)||e.addNode(t.id,{width:t.get("size").width,height:t.get("size").height,rank:t.get("rank")})}),_.each(t.getLinks(),function(t){if(!e.hasEdge(t.id)){var i=t.get("source").id,n=t.get("target").id;e.addEdge(t.id,i,n,{minLen:t.get("minLen")||1})}}),e}},joint.layout.ForceDirected=Backbone.Model.extend({defaults:{linkDistance:10,linkStrength:1,charge:10},initialize:function(){this.elements=this.get("graph").getElements(),this.links=this.get("graph").getLinks(),this.cells=this.get("graph").get("cells"),this.width=this.get("width"),this.height=this.get("height"),this.gravityCenter=this.get("gravityCenter"),this.t=1,this.energy=1/0,this.progress=0},start:function(){var t=this.get("width"),e=this.get("height");_.each(this.elements,function(i){i.set("position",{x:Math.random()*t,y:Math.random()*e}),i.charge=i.get("charge")||this.get("charge"),i.weight=i.get("weight")||1;var n=i.get("position");i.x=n.x,i.y=n.y,i.px=i.x,i.py=i.y,i.fx=0,i.fy=0},this),_.each(this.links,function(t){t.strength=t.get("strength")||this.get("linkStrength"),t.distance=t.get("distance")||this.get("linkDistance"),t.source=this.cells.get(t.get("source").id),t.target=this.cells.get(t.get("target").id)},this)},step:function(){if(.005>.99*this.t)return this.notifyEnd();var t=this.width,e=this.height,i=.1,n=this.gravityCenter,r=this.energy;this.energy=0;var a,s,o=0,l=0,c=0,h=0,u=this.elements.length,p=this.links.length;for(a=0;u-1>a;a++){var g=this.elements[a];for(o+=g.x,l+=g.y,s=a+1;u>s;s++){var d=this.elements[s],f=d.x-g.x,m=d.y-g.y,I=f*f+m*m,y=Math.sqrt(I),v=this.t*g.charge/I,C=v*f,b=v*m;g.fx-=C,g.fy-=b,d.fx+=C,d.fy+=b,this.energy+=C*C+b*b}}for(o+=this.elements[u-1].x,l+=this.elements[u-1].y,a=0;p>a;a++){var A=this.links[a],g=A.source,d=A.target,f=d.x-g.x,m=d.y-g.y,I=f*f+m*m,y=Math.sqrt(I),w=this.t*A.strength*(y-A.distance)/y,C=w*f,b=w*m,x=g.weight/(g.weight+d.weight);g.x+=C*(1-x),g.y+=b*(1-x),d.x-=C*x,d.y-=b*x,this.energy+=C*C+b*b}for(a=0;u>a;a++){var M=this.elements[a],j={x:M.x,y:M.y};n&&(j.x+=(n.x-j.x)*this.t*i,j.y+=(n.y-j.y)*this.t*i),j.x+=M.fx,j.y+=M.fy,j.x=Math.max(0,Math.min(t,j.x)),j.y=Math.max(0,Math.min(e,j.y));var N=.9;j.x+=(M.px-j.x)*N,j.y+=(M.py-j.y)*N,M.px=j.x,M.py=j.y,M.fx=M.fy=0,M.x=j.x,M.y=j.y,c+=M.x,h+=M.y,this.notify(M,a,j)}this.t=this.cool(this.t,this.energy,r);var k=o-c,D=l-h,z=Math.sqrt(k*k+D*D);1>z&&this.notifyEnd()},cool:function(t,e,i){return i>e?(this.progress+=1,this.progress>=5?(this.progress=0,t/.99):t):(this.progress=0,.99*t)},notify:function(t,e,i){t.set("position",i)},notifyEnd:function(){this.trigger("end")}}),joint.layout=joint.layout||{},joint.layout.GridLayout={layout:function(t,e){e=e||{};var i=t.getElements(),n=e.columns||1,r=e.dx||0,a=e.dy||0,s=e.columnWidth||this._maxDim(i,"width")+r,o=e.rowHeight||this._maxDim(i,"height")+a,l=_.isUndefined(e.centralize)||e.centralize!==!1,c=!!e.resizeToFit;_.each(i,function(t,e){var i=0,h=0,u=t.get("size");if(c){var p=s-2*r,g=o-2*a,d=u.height*(u.width?p/u.width:1),f=u.width*(u.height?g/u.height:1);d>o?p=f:g=d,u={width:p,height:g},t.set("size",u)}l&&(i=(s-u.width)/2,h=(o-u.height)/2),t.set("position",{x:e%n*s+r+i,y:Math.floor(e/n)*o+a+h})})},_maxDim:function(t,e){return _.reduce(t,function(t,i){return Math.max(i.get("size")[e],t)},0)}},joint.format.gexf={},joint.format.gexf.toCellsArray=function(t,e,i){var n=new DOMParser,r=n.parseFromString(t,"text/xml");if("parsererror"==r.documentElement.nodeName)throw Error("Error while parsing GEXF file.");var a=r.documentElement.querySelectorAll("node"),s=r.documentElement.querySelectorAll("edge"),o=[];return _.each(a,function(t){var i=parseFloat(t.querySelector("size").getAttribute("value")),n=e({id:t.getAttribute("id"),width:i,height:i,label:t.getAttribute("label")});o.push(n)}),_.each(s,function(t){var e=i({source:t.getAttribute("source"),target:t.getAttribute("target")});o.unshift(e)}),o},joint.dia.Paper.prototype.toSVG=function(t){t=t||{};var e=V(this.viewport).attr("transform");V(this.viewport).attr("transform","");var i=this.getContentBBox(),n=this.svg.cloneNode(!0);V(this.viewport).attr("transform",e||""),n.removeAttribute("style"),t.preserveDimensions?V(n).attr({width:i.width,height:i.height}):V(n).attr({width:"100%",height:"100%"}),V(n).attr("viewBox",i.x+" "+i.y+" "+i.width+" "+i.height);for(var r=document.styleSheets.length,a=[],s=r-1;s>=0;s--)a[s]=document.styleSheets[s],document.styleSheets[s].disabled=!0;var o={};$(this.svg).find("*").each(function(t){var e=window.getComputedStyle(this,null),i={};_.each(e,function(t){i[t]=e.getPropertyValue(t)}),o[t]=i}),r!=document.styleSheets.length&&_.each(a,function(t,e){document.styleSheets[e]=t});for(var s=0;r>s;s++)document.styleSheets[s].disabled=!1;var l={};$(this.svg).find("*").each(function(t){var e=window.getComputedStyle(this,null),i=o[t],n={};_.each(e,function(t){e.getPropertyValue(t)!==i[t]&&(n[t]=e.getPropertyValue(t))}),l[t]=n}),$(n).find("*").each(function(t){$(this).css(l[t])}),$(n).find(".connection-wrap, .marker-vertices, .link-tools, .marker-arrowheads").remove();var c;try{var h=new XMLSerializer;c=h.serializeToString(n)}catch(u){console.error("Error serializing paper to SVG:",u)}var p=!!window.chrome&&!window.opera,g="Microsoft Internet Explorer"==navigator.appName,d=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0;if(p&&(c=c.replace('xlink="','xmlns:xlink="')),g){var f='xmlns="'+this.svg.namespaceURI+'"',m=c.match(RegExp(f,"g"));m&&m.length>=2&&(c=c.replace(RegExp(f),""))}return d&&(c=c.replace('xlink="','xmlns:xlink="'),c=c.replace(/href="/g,'xlink:href="')),c},joint.dia.Paper.prototype.openAsSVG=function(){var t=this.toSVG(),e="menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes",i=_.uniqueId("svg_output"),n="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t))),r=window.open("",i,e);r.document.write('<img src="'+n+'" style="max-height:100%" />')},function(){function t(){var t={};return t.FRAMERATE=30,t.MAX_VIRTUAL_PIXELS=3e4,t.init=function(e){var i=0;t.UniqueId=function(){return i++,"canvg"+i},t.Definitions={},t.Styles={},t.Animations=[],t.Images=[],t.ctx=e,t.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(t,e){this.viewPorts.push({width:t,height:e})},this.RemoveCurrent=function(){this.viewPorts.pop()},this.Current=function(){return this.viewPorts[this.viewPorts.length-1]},this.width=function(){return this.Current().width},this.height=function(){return this.Current().height},this.ComputeSize=function(t){return null!=t&&"number"==typeof t?t:"x"==t?this.width():"y"==t?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},t.init(),t.ImagesLoaded=function(){for(var e=0;t.Images.length>e;e++)if(!t.Images[e].loaded)return!1;return!0},t.trim=function(t){return t.replace(/^\s+|\s+$/g,"")},t.compressSpaces=function(t){return t.replace(/[\s\r\t\n]+/gm," ")},t.ajax=function(t){var e;return e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),e?(e.open("GET",t,!1),e.send(null),e.responseText):null},t.parseXml=function(t){if(window.DOMParser){var e=new DOMParser;return e.parseFromString(t,"text/xml")}t=t.replace(/<!DOCTYPE svg[^>]*>/,"");var i=new ActiveXObject("Microsoft.XMLDOM");return i.async="false",i.loadXML(t),i},t.Property=function(t,e){this.name=t,this.value=e},t.Property.prototype.getValue=function(){return this.value},t.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},t.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},t.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},t.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},t.Property.prototype.addOpacity=function(e){var i=this.value;if(null!=e&&""!=e&&"string"==typeof this.value){var n=new RGBColor(this.value);n.ok&&(i="rgba("+n.r+", "+n.g+", "+n.b+", "+e+")")}return new t.Property(this.name,i)},t.Property.prototype.getDefinition=function(){var e=this.value.match(/#([^\)'"]+)/);return e&&(e=e[1]),e||(e=this.value),t.Definitions[e]},t.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},t.Property.prototype.getFillStyleDefinition=function(e,i){var n=this.getDefinition();if(null!=n&&n.createGradient)return n.createGradient(t.ctx,e,i);if(null!=n&&n.createPattern){if(n.getHrefAttribute().hasValue()){var r=n.attribute("patternTransform");n=n.getHrefAttribute().getDefinition(),r.hasValue()&&(n.attribute("patternTransform",!0).value=r.value)}return n.createPattern(t.ctx,e)}return null},t.Property.prototype.getDPI=function(){return 96},t.Property.prototype.getEM=function(e){var i=12,n=new t.Property("fontSize",t.Font.Parse(t.ctx.font).fontSize);return n.hasValue()&&(i=n.toPixels(e)),i},t.Property.prototype.getUnits=function(){var t=this.value+"";return t.replace(/[0-9\.\-]/g,"")},t.Property.prototype.toPixels=function(e,i){if(!this.hasValue())return 0;var n=this.value+"";if(n.match(/em$/))return this.numValue()*this.getEM(e);if(n.match(/ex$/))return this.numValue()*this.getEM(e)/2;if(n.match(/px$/))return this.numValue();if(n.match(/pt$/))return this.numValue()*this.getDPI(e)*(1/72);if(n.match(/pc$/))return 15*this.numValue();if(n.match(/cm$/))return this.numValue()*this.getDPI(e)/2.54;if(n.match(/mm$/))return this.numValue()*this.getDPI(e)/25.4;if(n.match(/in$/))return this.numValue()*this.getDPI(e);if(n.match(/%$/))return this.numValue()*t.ViewPort.ComputeSize(e);var r=this.numValue();return i&&1>r?r*t.ViewPort.ComputeSize(e):r},t.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/s$/)?1e3*this.numValue():t.match(/ms$/)?this.numValue():this.numValue()},t.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/deg$/)?this.numValue()*(Math.PI/180):t.match(/grad$/)?this.numValue()*(Math.PI/200):t.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)},t.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(e,i,n,r,a,s){var o=null!=s?this.Parse(s):this.CreateFont("","","","","",t.ctx.font);return{fontFamily:a||o.fontFamily,fontSize:r||o.fontSize,fontStyle:e||o.fontStyle,fontWeight:n||o.fontWeight,fontVariant:i||o.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var e=this;this.Parse=function(i){for(var n={},r=t.trim(t.compressSpaces(i||"")).split(" "),a={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},s="",o=0;r.length>o;o++)a.fontStyle||-1==e.Styles.indexOf(r[o])?a.fontVariant||-1==e.Variants.indexOf(r[o])?a.fontWeight||-1==e.Weights.indexOf(r[o])?a.fontSize?"inherit"!=r[o]&&(s+=r[o]):("inherit"!=r[o]&&(n.fontSize=r[o].split("/")[0]),a.fontStyle=a.fontVariant=a.fontWeight=a.fontSize=!0):("inherit"!=r[o]&&(n.fontWeight=r[o]),a.fontStyle=a.fontVariant=a.fontWeight=!0):("inherit"!=r[o]&&(n.fontVariant=r[o]),a.fontStyle=a.fontVariant=!0):("inherit"!=r[o]&&(n.fontStyle=r[o]),a.fontStyle=!0);return""!=s&&(n.fontFamily=s),n}},t.ToNumberArray=function(e){for(var i=t.trim(t.compressSpaces((e||"").replace(/,/g," "))).split(" "),n=0;i.length>n;n++)i[n]=parseFloat(i[n]);return i},t.Point=function(t,e){this.x=t,this.y=e},t.Point.prototype.angleTo=function(t){return Math.atan2(t.y-this.y,t.x-this.x)},t.Point.prototype.applyTransform=function(t){var e=this.x*t[0]+this.y*t[2]+t[4],i=this.x*t[1]+this.y*t[3]+t[5];this.x=e,this.y=i},t.CreatePoint=function(e){var i=t.ToNumberArray(e);return new t.Point(i[0],i[1])},t.CreatePath=function(e){for(var i=t.ToNumberArray(e),n=[],r=0;i.length>r;r+=2)n.push(new t.Point(i[r],i[r+1]));return n},t.BoundingBox=function(t,e,n,r){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.x=function(){return this.x1},this.y=function(){return this.y1},this.width=function(){return this.x2-this.x1},this.height=function(){return this.y2-this.y1},this.addPoint=function(t,e){null!=t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),this.x1>t&&(this.x1=t),t>this.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),this.y1>e&&(this.y1=e),e>this.y2&&(this.y2=e))},this.addX=function(t){this.addPoint(t,null)},this.addY=function(t){this.addPoint(null,t)},this.addBoundingBox=function(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)},this.addQuadraticCurve=function(t,e,i,n,r,a){var s=t+2/3*(i-t),o=e+2/3*(n-e),l=s+1/3*(r-t),c=o+1/3*(a-e);this.addBezierCurve(t,e,s,l,o,c,r,a)},this.addBezierCurve=function(t,e,n,r,a,s,o,l){var c=[t,e],h=[n,r],u=[a,s],p=[o,l];for(this.addPoint(c[0],c[1]),this.addPoint(p[0],p[1]),i=0;1>=i;i++){var g=function(t){return Math.pow(1-t,3)*c[i]+3*Math.pow(1-t,2)*t*h[i]+3*(1-t)*Math.pow(t,2)*u[i]+Math.pow(t,3)*p[i]},d=6*c[i]-12*h[i]+6*u[i],f=-3*c[i]+9*h[i]-9*u[i]+3*p[i],m=3*h[i]-3*c[i];if(0!=f){var I=Math.pow(d,2)-4*m*f;if(!(0>I)){var y=(-d+Math.sqrt(I))/(2*f);y>0&&1>y&&(0==i&&this.addX(g(y)),1==i&&this.addY(g(y)));var v=(-d-Math.sqrt(I))/(2*f);v>0&&1>v&&(0==i&&this.addX(g(v)),1==i&&this.addY(g(v)))}}else{if(0==d)continue;var C=-m/d;C>0&&1>C&&(0==i&&this.addX(g(C)),1==i&&this.addY(g(C)))}}},this.isPointInBox=function(t,e){return t>=this.x1&&this.x2>=t&&e>=this.y1&&this.y2>=e},this.addPoint(t,e),this.addPoint(n,r)},t.Transform=function(e){var i=this;this.Type={},this.Type.translate=function(e){this.p=t.CreatePoint(e),this.apply=function(t){t.translate(this.p.x||0,this.p.y||0)},this.unapply=function(t){t.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(t){t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(e){var i=t.ToNumberArray(e);this.angle=new t.Property("angle",i[0]),this.cx=i[1]||0,this.cy=i[2]||0,this.apply=function(t){t.translate(this.cx,this.cy),t.rotate(this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.unapply=function(t){t.translate(this.cx,this.cy),t.rotate(-1*this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.applyToPoint=function(t){var e=this.angle.toRadians();t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),t.applyTransform([Math.cos(e),Math.sin(e),-Math.sin(e),Math.cos(e),0,0]),t.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(e){this.p=t.CreatePoint(e),this.apply=function(t){t.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(t){t.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(t){t.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(e){this.m=t.ToNumberArray(e),this.apply=function(t){t.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.applyToPoint=function(t){t.applyTransform(this.m)}},this.Type.SkewBase=function(e){this.base=i.Type.matrix,this.base(e),this.angle=new t.Property("angle",e)},this.Type.SkewBase.prototype=new this.Type.matrix,this.Type.skewX=function(t){this.base=i.Type.SkewBase,this.base(t),this.m=[1,0,Math.tan(this.angle.toRadians()),1,0,0]},this.Type.skewX.prototype=new this.Type.SkewBase,this.Type.skewY=function(t){this.base=i.Type.SkewBase,this.base(t),this.m=[1,Math.tan(this.angle.toRadians()),0,1,0,0]},this.Type.skewY.prototype=new this.Type.SkewBase,this.transforms=[],this.apply=function(t){for(var e=0;this.transforms.length>e;e++)this.transforms[e].apply(t)},this.unapply=function(t){for(var e=this.transforms.length-1;e>=0;e--)this.transforms[e].unapply(t)},this.applyToPoint=function(t){for(var e=0;this.transforms.length>e;e++)this.transforms[e].applyToPoint(t)};for(var n=t.trim(t.compressSpaces(e)).replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/),r=0;n.length>r;r++){var a=t.trim(n[r].split("(")[0]),s=n[r].split("(")[1].replace(")",""),o=new this.Type[a](s);o.type=a,this.transforms.push(o)}},t.AspectRatio=function(e,i,n,r,a,s,o,l,c,h){i=t.compressSpaces(i),i=i.replace(/^defer\s/,"");var u=i.split(" ")[0]||"xMidYMid",p=i.split(" ")[1]||"meet",g=n/r,d=a/s,f=Math.min(g,d),m=Math.max(g,d);"meet"==p&&(r*=f,s*=f),"slice"==p&&(r*=m,s*=m),c=new t.Property("refX",c),h=new t.Property("refY",h),c.hasValue()&&h.hasValue()?e.translate(-f*c.toPixels("x"),-f*h.toPixels("y")):(u.match(/^xMid/)&&("meet"==p&&f==d||"slice"==p&&m==d)&&e.translate(n/2-r/2,0),u.match(/YMid$/)&&("meet"==p&&f==g||"slice"==p&&m==g)&&e.translate(0,a/2-s/2),u.match(/^xMax/)&&("meet"==p&&f==d||"slice"==p&&m==d)&&e.translate(n-r,0),u.match(/YMax$/)&&("meet"==p&&f==g||"slice"==p&&m==g)&&e.translate(0,a-s)),"none"==u?e.scale(g,d):"meet"==p?e.scale(f,f):"slice"==p&&e.scale(m,m),e.translate(null==o?0:-o,null==l?0:-l)},t.Element={},t.EmptyProperty=new t.Property("EMPTY",""),t.Element.ElementBase=function(e){if(this.attributes={},this.styles={},this.children=[],this.attribute=function(e,i){var n=this.attributes[e];return null!=n?n:(1==i&&(n=new t.Property(e,""),this.attributes[e]=n),n||t.EmptyProperty)},this.getHrefAttribute=function(){for(var e in this.attributes)if(e.match(/:href$/))return this.attributes[e];return t.EmptyProperty},this.style=function(e,i){var n=this.styles[e];if(null!=n)return n;var r=this.attribute(e);if(null!=r&&r.hasValue())return this.styles[e]=r,r;var a=this.parent;if(null!=a){var s=a.style(e);if(null!=s&&s.hasValue())return s}return 1==i&&(n=new t.Property(e,""),this.styles[e]=n),n||t.EmptyProperty},this.render=function(t){if("none"!=this.style("display").value&&"hidden"!=this.attribute("visibility").value){if(t.save(),this.attribute("mask").hasValue()){var e=this.attribute("mask").getDefinition();null!=e&&e.apply(t,this)}else if(this.style("filter").hasValue()){var i=this.style("filter").getDefinition();null!=i&&i.apply(t,this)}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}},this.setContext=function(){},this.clearContext=function(){},this.renderChildren=function(t){for(var e=0;this.children.length>e;e++)this.children[e].render(t)},this.addChild=function(e,i){var n=e;i&&(n=t.CreateElement(e)),n.parent=this,this.children.push(n)},null!=e&&1==e.nodeType){for(var i=0;e.childNodes.length>i;i++){var n=e.childNodes[i];if(1==n.nodeType&&this.addChild(n,!0),this.captureTextNodes&&3==n.nodeType){var r=n.nodeValue||n.text||"";""!=t.trim(t.compressSpaces(r))&&this.addChild(new t.Element.tspan(n),!1)}}for(var i=0;e.attributes.length>i;i++){var a=e.attributes[i];this.attributes[a.nodeName]=new t.Property(a.nodeName,a.nodeValue)}var s=t.Styles[e.nodeName];if(null!=s)for(var o in s)this.styles[o]=s[o];if(this.attribute("class").hasValue())for(var l=t.compressSpaces(this.attribute("class").value).split(" "),c=0;l.length>c;c++){if(s=t.Styles["."+l[c]],null!=s)for(var o in s)this.styles[o]=s[o];if(s=t.Styles[e.nodeName+"."+l[c]],null!=s)for(var o in s)this.styles[o]=s[o]}if(this.attribute("id").hasValue()){var s=t.Styles["#"+this.attribute("id").value];if(null!=s)for(var o in s)this.styles[o]=s[o]}if(this.attribute("style").hasValue())for(var s=this.attribute("style").value.split(";"),i=0;s.length>i;i++)if(""!=t.trim(s[i])){var h=s[i].split(":"),o=t.trim(h[0]),u=t.trim(h[1]);this.styles[o]=new t.Property(o,u)}this.attribute("id").hasValue()&&null==t.Definitions[this.attribute("id").value]&&(t.Definitions[this.attribute("id").value]=this)}},t.Element.RenderedElementBase=function(e){this.base=t.Element.ElementBase,this.base(e),this.setContext=function(e){if(this.style("fill").isUrlDefinition()){var i=this.style("fill").getFillStyleDefinition(this,this.style("fill-opacity"));null!=i&&(e.fillStyle=i)}else if(this.style("fill").hasValue()){var n=this.style("fill");"currentColor"==n.value&&(n.value=this.style("color").value),e.fillStyle="none"==n.value?"rgba(0,0,0,0)":n.value
29 }if(this.style("fill-opacity").hasValue()){var n=new t.Property("fill",e.fillStyle);n=n.addOpacity(this.style("fill-opacity").value),e.fillStyle=n.value}if(this.style("stroke").isUrlDefinition()){var i=this.style("stroke").getFillStyleDefinition(this,this.style("stroke-opacity"));null!=i&&(e.strokeStyle=i)}else if(this.style("stroke").hasValue()){var r=this.style("stroke");"currentColor"==r.value&&(r.value=this.style("color").value),e.strokeStyle="none"==r.value?"rgba(0,0,0,0)":r.value}if(this.style("stroke-opacity").hasValue()){var r=new t.Property("stroke",e.strokeStyle);r=r.addOpacity(this.style("stroke-opacity").value),e.strokeStyle=r.value}if(this.style("stroke-width").hasValue()){var a=this.style("stroke-width").toPixels();e.lineWidth=0==a?.001:a}if(this.style("stroke-linecap").hasValue()&&(e.lineCap=this.style("stroke-linecap").value),this.style("stroke-linejoin").hasValue()&&(e.lineJoin=this.style("stroke-linejoin").value),this.style("stroke-miterlimit").hasValue()&&(e.miterLimit=this.style("stroke-miterlimit").value),this.style("stroke-dasharray").hasValue()){var s=t.ToNumberArray(this.style("stroke-dasharray").value);e.setLineDash!==void 0?e.setLineDash(s):e.webkitLineDash!==void 0?e.webkitLineDash=s:e.mozDash!==void 0&&(e.mozDash=s);var o=this.style("stroke-dashoffset").numValueOrDefault(1);e.lineDashOffset!==void 0?e.lineDashOffset=o:e.webkitLineDashOffset!==void 0?e.webkitLineDashOffset=o:e.mozDashOffset!==void 0&&(e.mozDashOffset=o)}if(e.font!==void 0&&(e.font=""+t.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").toPixels()+"px":"",this.style("font-family").value)),this.attribute("transform").hasValue()){var l=new t.Transform(this.attribute("transform").value);l.apply(e)}if(this.style("clip-path").hasValue()){var c=this.style("clip-path").getDefinition();null!=c&&c.apply(e)}this.style("opacity").hasValue()&&(e.globalAlpha=this.style("opacity").numValue())}},t.Element.RenderedElementBase.prototype=new t.Element.ElementBase,t.Element.PathElementBase=function(e){this.base=t.Element.RenderedElementBase,this.base(e),this.path=function(e){return null!=e&&e.beginPath(),new t.BoundingBox},this.renderChildren=function(e){this.path(e),t.Mouse.checkPath(this,e),""!=e.fillStyle&&(this.attribute("fill-rule").hasValue()?e.fill(this.attribute("fill-rule").value):e.fill()),""!=e.strokeStyle&&e.stroke();var i=this.getMarkers();if(null!=i){if(this.style("marker-start").isUrlDefinition()){var n=this.style("marker-start").getDefinition();n.render(e,i[0][0],i[0][1])}if(this.style("marker-mid").isUrlDefinition())for(var n=this.style("marker-mid").getDefinition(),r=1;i.length-1>r;r++)n.render(e,i[r][0],i[r][1]);if(this.style("marker-end").isUrlDefinition()){var n=this.style("marker-end").getDefinition();n.render(e,i[i.length-1][0],i[i.length-1][1])}}},this.getBoundingBox=function(){return this.path()},this.getMarkers=function(){return null}},t.Element.PathElementBase.prototype=new t.Element.RenderedElementBase,t.Element.svg=function(e){this.base=t.Element.RenderedElementBase,this.base(e),this.baseClearContext=this.clearContext,this.clearContext=function(e){this.baseClearContext(e),t.ViewPort.RemoveCurrent()},this.baseSetContext=this.setContext,this.setContext=function(e){e.strokeStyle="rgba(0,0,0,0)",e.lineCap="butt",e.lineJoin="miter",e.miterLimit=4,this.baseSetContext(e),this.attribute("x").hasValue()||(this.attribute("x",!0).value=0),this.attribute("y").hasValue()||(this.attribute("y",!0).value=0),e.translate(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"));var i=t.ViewPort.width(),n=t.ViewPort.height();if(this.attribute("width").hasValue()||(this.attribute("width",!0).value="100%"),this.attribute("height").hasValue()||(this.attribute("height",!0).value="100%"),this.root===void 0){i=this.attribute("width").toPixels("x"),n=this.attribute("height").toPixels("y");var r=0,a=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(r=-this.attribute("refX").toPixels("x"),a=-this.attribute("refY").toPixels("y")),e.beginPath(),e.moveTo(r,a),e.lineTo(i,a),e.lineTo(i,n),e.lineTo(r,n),e.closePath(),e.clip()}if(t.ViewPort.SetCurrent(i,n),this.attribute("viewBox").hasValue()){var s=t.ToNumberArray(this.attribute("viewBox").value),o=s[0],l=s[1];i=s[2],n=s[3],t.AspectRatio(e,this.attribute("preserveAspectRatio").value,t.ViewPort.width(),i,t.ViewPort.height(),n,o,l,this.attribute("refX").value,this.attribute("refY").value),t.ViewPort.RemoveCurrent(),t.ViewPort.SetCurrent(s[2],s[3])}}},t.Element.svg.prototype=new t.Element.RenderedElementBase,t.Element.rect=function(e){this.base=t.Element.PathElementBase,this.base(e),this.path=function(e){var i=this.attribute("x").toPixels("x"),n=this.attribute("y").toPixels("y"),r=this.attribute("width").toPixels("x"),a=this.attribute("height").toPixels("y"),s=this.attribute("rx").toPixels("x"),o=this.attribute("ry").toPixels("y");return this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(o=s),this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(s=o),s=Math.min(s,r/2),o=Math.min(o,a/2),null!=e&&(e.beginPath(),e.moveTo(i+s,n),e.lineTo(i+r-s,n),e.quadraticCurveTo(i+r,n,i+r,n+o),e.lineTo(i+r,n+a-o),e.quadraticCurveTo(i+r,n+a,i+r-s,n+a),e.lineTo(i+s,n+a),e.quadraticCurveTo(i,n+a,i,n+a-o),e.lineTo(i,n+o),e.quadraticCurveTo(i,n,i+s,n),e.closePath()),new t.BoundingBox(i,n,i+r,n+a)}},t.Element.rect.prototype=new t.Element.PathElementBase,t.Element.circle=function(e){this.base=t.Element.PathElementBase,this.base(e),this.path=function(e){var i=this.attribute("cx").toPixels("x"),n=this.attribute("cy").toPixels("y"),r=this.attribute("r").toPixels();return null!=e&&(e.beginPath(),e.arc(i,n,r,0,2*Math.PI,!0),e.closePath()),new t.BoundingBox(i-r,n-r,i+r,n+r)}},t.Element.circle.prototype=new t.Element.PathElementBase,t.Element.ellipse=function(e){this.base=t.Element.PathElementBase,this.base(e),this.path=function(e){var i=4*((Math.sqrt(2)-1)/3),n=this.attribute("rx").toPixels("x"),r=this.attribute("ry").toPixels("y"),a=this.attribute("cx").toPixels("x"),s=this.attribute("cy").toPixels("y");return null!=e&&(e.beginPath(),e.moveTo(a,s-r),e.bezierCurveTo(a+i*n,s-r,a+n,s-i*r,a+n,s),e.bezierCurveTo(a+n,s+i*r,a+i*n,s+r,a,s+r),e.bezierCurveTo(a-i*n,s+r,a-n,s+i*r,a-n,s),e.bezierCurveTo(a-n,s-i*r,a-i*n,s-r,a,s-r),e.closePath()),new t.BoundingBox(a-n,s-r,a+n,s+r)}},t.Element.ellipse.prototype=new t.Element.PathElementBase,t.Element.line=function(e){this.base=t.Element.PathElementBase,this.base(e),this.getPoints=function(){return[new t.Point(this.attribute("x1").toPixels("x"),this.attribute("y1").toPixels("y")),new t.Point(this.attribute("x2").toPixels("x"),this.attribute("y2").toPixels("y"))]},this.path=function(e){var i=this.getPoints();return null!=e&&(e.beginPath(),e.moveTo(i[0].x,i[0].y),e.lineTo(i[1].x,i[1].y)),new t.BoundingBox(i[0].x,i[0].y,i[1].x,i[1].y)},this.getMarkers=function(){var t=this.getPoints(),e=t[0].angleTo(t[1]);return[[t[0],e],[t[1],e]]}},t.Element.line.prototype=new t.Element.PathElementBase,t.Element.polyline=function(e){this.base=t.Element.PathElementBase,this.base(e),this.points=t.CreatePath(this.attribute("points").value),this.path=function(e){var i=new t.BoundingBox(this.points[0].x,this.points[0].y);null!=e&&(e.beginPath(),e.moveTo(this.points[0].x,this.points[0].y));for(var n=1;this.points.length>n;n++)i.addPoint(this.points[n].x,this.points[n].y),null!=e&&e.lineTo(this.points[n].x,this.points[n].y);return i},this.getMarkers=function(){for(var t=[],e=0;this.points.length-1>e;e++)t.push([this.points[e],this.points[e].angleTo(this.points[e+1])]);return t.push([this.points[this.points.length-1],t[t.length-1][1]]),t}},t.Element.polyline.prototype=new t.Element.PathElementBase,t.Element.polygon=function(e){this.base=t.Element.polyline,this.base(e),this.basePath=this.path,this.path=function(t){var e=this.basePath(t);return null!=t&&(t.lineTo(this.points[0].x,this.points[0].y),t.closePath()),e}},t.Element.polygon.prototype=new t.Element.polyline,t.Element.path=function(e){this.base=t.Element.PathElementBase,this.base(e);var i=this.attribute("d").value;i=i.replace(/,/gm," "),i=i.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),i=i.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),i=i.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2"),i=i.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),i=i.replace(/([0-9])([+\-])/gm,"$1 $2"),i=i.replace(/(\.[0-9]*)(\.)/gm,"$1 $2"),i=i.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 "),i=t.compressSpaces(i),i=t.trim(i),this.PathParser=new function(e){this.tokens=e.split(" "),this.reset=function(){this.i=-1,this.command="",this.previousCommand="",this.start=new t.Point(0,0),this.control=new t.Point(0,0),this.current=new t.Point(0,0),this.points=[],this.angles=[]},this.isEnd=function(){return this.i>=this.tokens.length-1},this.isCommandOrEnd=function(){return this.isEnd()?!0:null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var e=new t.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(e)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t,t},this.getAsCurrentPoint=function(){var t=this.getPoint();return this.current=t,t},this.getReflectedControlPoint=function(){if("c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase())return this.current;var e=new t.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y);return e},this.makeAbsolute=function(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},this.addMarker=function(t,e,i){null!=i&&this.angles.length>0&&null==this.angles[this.angles.length-1]&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(i)),this.addMarkerAngle(t,null==e?null:e.angleTo(t))},this.addMarkerAngle=function(t,e){this.points.push(t),this.angles.push(e)},this.getMarkerPoints=function(){return this.points},this.getMarkerAngles=function(){for(var t=0;this.angles.length>t;t++)if(null==this.angles[t])for(var e=t+1;this.angles.length>e;e++)if(null!=this.angles[e]){this.angles[t]=this.angles[e];break}return this.angles}}(i),this.path=function(e){var i=this.PathParser;i.reset();var n=new t.BoundingBox;for(null!=e&&e.beginPath();!i.isEnd();)switch(i.nextCommand(),i.command){case"M":case"m":var r=i.getAsCurrentPoint();for(i.addMarker(r),n.addPoint(r.x,r.y),null!=e&&e.moveTo(r.x,r.y),i.start=i.current;!i.isCommandOrEnd();){var r=i.getAsCurrentPoint();i.addMarker(r,i.start),n.addPoint(r.x,r.y),null!=e&&e.lineTo(r.x,r.y)}break;case"L":case"l":for(;!i.isCommandOrEnd();){var a=i.current,r=i.getAsCurrentPoint();i.addMarker(r,a),n.addPoint(r.x,r.y),null!=e&&e.lineTo(r.x,r.y)}break;case"H":case"h":for(;!i.isCommandOrEnd();){var s=new t.Point((i.isRelativeCommand()?i.current.x:0)+i.getScalar(),i.current.y);i.addMarker(s,i.current),i.current=s,n.addPoint(i.current.x,i.current.y),null!=e&&e.lineTo(i.current.x,i.current.y)}break;case"V":case"v":for(;!i.isCommandOrEnd();){var s=new t.Point(i.current.x,(i.isRelativeCommand()?i.current.y:0)+i.getScalar());i.addMarker(s,i.current),i.current=s,n.addPoint(i.current.x,i.current.y),null!=e&&e.lineTo(i.current.x,i.current.y)}break;case"C":case"c":for(;!i.isCommandOrEnd();){var o=i.current,l=i.getPoint(),c=i.getAsControlPoint(),h=i.getAsCurrentPoint();i.addMarker(h,c,l),n.addBezierCurve(o.x,o.y,l.x,l.y,c.x,c.y,h.x,h.y),null!=e&&e.bezierCurveTo(l.x,l.y,c.x,c.y,h.x,h.y)}break;case"S":case"s":for(;!i.isCommandOrEnd();){var o=i.current,l=i.getReflectedControlPoint(),c=i.getAsControlPoint(),h=i.getAsCurrentPoint();i.addMarker(h,c,l),n.addBezierCurve(o.x,o.y,l.x,l.y,c.x,c.y,h.x,h.y),null!=e&&e.bezierCurveTo(l.x,l.y,c.x,c.y,h.x,h.y)}break;case"Q":case"q":for(;!i.isCommandOrEnd();){var o=i.current,c=i.getAsControlPoint(),h=i.getAsCurrentPoint();i.addMarker(h,c,c),n.addQuadraticCurve(o.x,o.y,c.x,c.y,h.x,h.y),null!=e&&e.quadraticCurveTo(c.x,c.y,h.x,h.y)}break;case"T":case"t":for(;!i.isCommandOrEnd();){var o=i.current,c=i.getReflectedControlPoint();i.control=c;var h=i.getAsCurrentPoint();i.addMarker(h,c,c),n.addQuadraticCurve(o.x,o.y,c.x,c.y,h.x,h.y),null!=e&&e.quadraticCurveTo(c.x,c.y,h.x,h.y)}break;case"A":case"a":for(;!i.isCommandOrEnd();){var o=i.current,u=i.getScalar(),p=i.getScalar(),g=i.getScalar()*(Math.PI/180),d=i.getScalar(),f=i.getScalar(),h=i.getAsCurrentPoint(),m=new t.Point(Math.cos(g)*(o.x-h.x)/2+Math.sin(g)*(o.y-h.y)/2,-Math.sin(g)*(o.x-h.x)/2+Math.cos(g)*(o.y-h.y)/2),I=Math.pow(m.x,2)/Math.pow(u,2)+Math.pow(m.y,2)/Math.pow(p,2);I>1&&(u*=Math.sqrt(I),p*=Math.sqrt(I));var y=(d==f?-1:1)*Math.sqrt((Math.pow(u,2)*Math.pow(p,2)-Math.pow(u,2)*Math.pow(m.y,2)-Math.pow(p,2)*Math.pow(m.x,2))/(Math.pow(u,2)*Math.pow(m.y,2)+Math.pow(p,2)*Math.pow(m.x,2)));isNaN(y)&&(y=0);var v=new t.Point(y*u*m.y/p,y*-p*m.x/u),C=new t.Point((o.x+h.x)/2+Math.cos(g)*v.x-Math.sin(g)*v.y,(o.y+h.y)/2+Math.sin(g)*v.x+Math.cos(g)*v.y),b=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))},A=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(b(t)*b(e))},w=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(A(t,e))},x=w([1,0],[(m.x-v.x)/u,(m.y-v.y)/p]),M=[(m.x-v.x)/u,(m.y-v.y)/p],j=[(-m.x-v.x)/u,(-m.y-v.y)/p],N=w(M,j);-1>=A(M,j)&&(N=Math.PI),A(M,j)>=1&&(N=0);var k=1-f?1:-1,D=x+k*(N/2),z=new t.Point(C.x+u*Math.cos(D),C.y+p*Math.sin(D));if(i.addMarkerAngle(z,D-k*Math.PI/2),i.addMarkerAngle(h,D-k*Math.PI),n.addPoint(h.x,h.y),null!=e){var A=u>p?u:p,S=u>p?1:u/p,T=u>p?p/u:1;e.translate(C.x,C.y),e.rotate(g),e.scale(S,T),e.arc(0,0,A,x,x+N,1-f),e.scale(1/S,1/T),e.rotate(-g),e.translate(-C.x,-C.y)}}break;case"Z":case"z":null!=e&&e.closePath(),i.current=i.start}return n},this.getMarkers=function(){for(var t=this.PathParser.getMarkerPoints(),e=this.PathParser.getMarkerAngles(),i=[],n=0;t.length>n;n++)i.push([t[n],e[n]]);return i}},t.Element.path.prototype=new t.Element.PathElementBase,t.Element.pattern=function(e){this.base=t.Element.ElementBase,this.base(e),this.createPattern=function(e){var i=this.attribute("width").toPixels("x",!0),n=this.attribute("height").toPixels("y",!0),r=new t.Element.svg;r.attributes.viewBox=new t.Property("viewBox",this.attribute("viewBox").value),r.attributes.width=new t.Property("width",i+"px"),r.attributes.height=new t.Property("height",n+"px"),r.attributes.transform=new t.Property("transform",this.attribute("patternTransform").value),r.children=this.children;var a=document.createElement("canvas");a.width=i,a.height=n;var s=a.getContext("2d");this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&s.translate(this.attribute("x").toPixels("x",!0),this.attribute("y").toPixels("y",!0));for(var o=-1;1>=o;o++)for(var l=-1;1>=l;l++)s.save(),s.translate(o*a.width,l*a.height),r.render(s),s.restore();var c=e.createPattern(a,"repeat");return c}},t.Element.pattern.prototype=new t.Element.ElementBase,t.Element.marker=function(e){this.base=t.Element.ElementBase,this.base(e),this.baseRender=this.render,this.render=function(e,i,n){e.translate(i.x,i.y),"auto"==this.attribute("orient").valueOrDefault("auto")&&e.rotate(n),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&e.scale(e.lineWidth,e.lineWidth),e.save();var r=new t.Element.svg;r.attributes.viewBox=new t.Property("viewBox",this.attribute("viewBox").value),r.attributes.refX=new t.Property("refX",this.attribute("refX").value),r.attributes.refY=new t.Property("refY",this.attribute("refY").value),r.attributes.width=new t.Property("width",this.attribute("markerWidth").value),r.attributes.height=new t.Property("height",this.attribute("markerHeight").value),r.attributes.fill=new t.Property("fill",this.attribute("fill").valueOrDefault("black")),r.attributes.stroke=new t.Property("stroke",this.attribute("stroke").valueOrDefault("none")),r.children=this.children,r.render(e),e.restore(),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&e.scale(1/e.lineWidth,1/e.lineWidth),"auto"==this.attribute("orient").valueOrDefault("auto")&&e.rotate(-n),e.translate(-i.x,-i.y)}},t.Element.marker.prototype=new t.Element.ElementBase,t.Element.defs=function(e){this.base=t.Element.ElementBase,this.base(e),this.render=function(){}},t.Element.defs.prototype=new t.Element.ElementBase,t.Element.GradientBase=function(e){this.base=t.Element.ElementBase,this.base(e),this.gradientUnits=this.attribute("gradientUnits").valueOrDefault("objectBoundingBox"),this.stops=[];for(var i=0;this.children.length>i;i++){var n=this.children[i];"stop"==n.type&&this.stops.push(n)}this.getGradient=function(){},this.createGradient=function(e,i,n){var r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition());var a=function(e){if(n.hasValue()){var i=new t.Property("color",e);return i.addOpacity(n.value).value}return e},s=this.getGradient(e,i);if(null==s)return a(r.stops[r.stops.length-1].color);for(var o=0;r.stops.length>o;o++)s.addColorStop(r.stops[o].offset,a(r.stops[o].color));if(this.attribute("gradientTransform").hasValue()){var l=t.ViewPort.viewPorts[0],c=new t.Element.rect;c.attributes.x=new t.Property("x",-t.MAX_VIRTUAL_PIXELS/3),c.attributes.y=new t.Property("y",-t.MAX_VIRTUAL_PIXELS/3),c.attributes.width=new t.Property("width",t.MAX_VIRTUAL_PIXELS),c.attributes.height=new t.Property("height",t.MAX_VIRTUAL_PIXELS);var h=new t.Element.g;h.attributes.transform=new t.Property("transform",this.attribute("gradientTransform").value),h.children=[c];var u=new t.Element.svg;u.attributes.x=new t.Property("x",0),u.attributes.y=new t.Property("y",0),u.attributes.width=new t.Property("width",l.width),u.attributes.height=new t.Property("height",l.height),u.children=[h];var p=document.createElement("canvas");p.width=l.width,p.height=l.height;var g=p.getContext("2d");return g.fillStyle=s,u.render(g),g.createPattern(p,"no-repeat")}return s}},t.Element.GradientBase.prototype=new t.Element.ElementBase,t.Element.linearGradient=function(e){this.base=t.Element.GradientBase,this.base(e),this.getGradient=function(t,e){var i=e.getBoundingBox();this.attribute("x1").hasValue()||this.attribute("y1").hasValue()||this.attribute("x2").hasValue()||this.attribute("y2").hasValue()||(this.attribute("x1",!0).value=0,this.attribute("y1",!0).value=0,this.attribute("x2",!0).value=1,this.attribute("y2",!0).value=0);var n="objectBoundingBox"==this.gradientUnits?i.x()+i.width()*this.attribute("x1").numValue():this.attribute("x1").toPixels("x"),r="objectBoundingBox"==this.gradientUnits?i.y()+i.height()*this.attribute("y1").numValue():this.attribute("y1").toPixels("y"),a="objectBoundingBox"==this.gradientUnits?i.x()+i.width()*this.attribute("x2").numValue():this.attribute("x2").toPixels("x"),s="objectBoundingBox"==this.gradientUnits?i.y()+i.height()*this.attribute("y2").numValue():this.attribute("y2").toPixels("y");return n==a&&r==s?null:t.createLinearGradient(n,r,a,s)}},t.Element.linearGradient.prototype=new t.Element.GradientBase,t.Element.radialGradient=function(e){this.base=t.Element.GradientBase,this.base(e),this.getGradient=function(t,e){var i=e.getBoundingBox();this.attribute("cx").hasValue()||(this.attribute("cx",!0).value="50%"),this.attribute("cy").hasValue()||(this.attribute("cy",!0).value="50%"),this.attribute("r").hasValue()||(this.attribute("r",!0).value="50%");var n="objectBoundingBox"==this.gradientUnits?i.x()+i.width()*this.attribute("cx").numValue():this.attribute("cx").toPixels("x"),r="objectBoundingBox"==this.gradientUnits?i.y()+i.height()*this.attribute("cy").numValue():this.attribute("cy").toPixels("y"),a=n,s=r;this.attribute("fx").hasValue()&&(a="objectBoundingBox"==this.gradientUnits?i.x()+i.width()*this.attribute("fx").numValue():this.attribute("fx").toPixels("x")),this.attribute("fy").hasValue()&&(s="objectBoundingBox"==this.gradientUnits?i.y()+i.height()*this.attribute("fy").numValue():this.attribute("fy").toPixels("y"));var o="objectBoundingBox"==this.gradientUnits?(i.width()+i.height())/2*this.attribute("r").numValue():this.attribute("r").toPixels();return t.createRadialGradient(a,s,0,n,r,o)}},t.Element.radialGradient.prototype=new t.Element.GradientBase,t.Element.stop=function(e){this.base=t.Element.ElementBase,this.base(e),this.offset=this.attribute("offset").numValue(),0>this.offset&&(this.offset=0),this.offset>1&&(this.offset=1);var i=this.style("stop-color");this.style("stop-opacity").hasValue()&&(i=i.addOpacity(this.style("stop-opacity").value)),this.color=i.value},t.Element.stop.prototype=new t.Element.ElementBase,t.Element.AnimateBase=function(e){this.base=t.Element.ElementBase,this.base(e),t.Animations.push(this),this.duration=0,this.begin=this.attribute("begin").toMilliseconds(),this.maxDuration=this.begin+this.attribute("dur").toMilliseconds(),this.getProperty=function(){var t=this.attribute("attributeType").value,e=this.attribute("attributeName").value;return"CSS"==t?this.parent.style(e,!0):this.parent.attribute(e,!0)},this.initialValue=null,this.initialUnits="",this.removed=!1,this.calcValue=function(){return""},this.update=function(t){if(null==this.initialValue&&(this.initialValue=this.getProperty().value,this.initialUnits=this.getProperty().getUnits()),this.duration>this.maxDuration){if("indefinite"!=this.attribute("repeatCount").value&&"indefinite"!=this.attribute("repeatDur").value)return"remove"!=this.attribute("fill").valueOrDefault("remove")||this.removed?!1:(this.removed=!0,this.getProperty().value=this.initialValue,!0);this.duration=0}this.duration=this.duration+t;var e=!1;if(this.begin<this.duration){var i=this.calcValue();if(this.attribute("type").hasValue()){var n=this.attribute("type").value;i=n+"("+i+")"}this.getProperty().value=i,e=!0}return e},this.from=this.attribute("from"),this.to=this.attribute("to"),this.values=this.attribute("values"),this.values.hasValue()&&(this.values.value=this.values.value.split(";")),this.progress=function(){var e={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(this.values.hasValue()){var i=e.progress*(this.values.value.length-1),n=Math.floor(i),r=Math.ceil(i);e.from=new t.Property("from",parseFloat(this.values.value[n])),e.to=new t.Property("to",parseFloat(this.values.value[r])),e.progress=(i-n)/(r-n)}else e.from=this.from,e.to=this.to;return e}},t.Element.AnimateBase.prototype=new t.Element.ElementBase,t.Element.animate=function(e){this.base=t.Element.AnimateBase,this.base(e),this.calcValue=function(){var t=this.progress(),e=t.from.numValue()+(t.to.numValue()-t.from.numValue())*t.progress;return e+this.initialUnits}},t.Element.animate.prototype=new t.Element.AnimateBase,t.Element.animateColor=function(e){this.base=t.Element.AnimateBase,this.base(e),this.calcValue=function(){var t=this.progress(),e=new RGBColor(t.from.value),i=new RGBColor(t.to.value);if(e.ok&&i.ok){var n=e.r+(i.r-e.r)*t.progress,r=e.g+(i.g-e.g)*t.progress,a=e.b+(i.b-e.b)*t.progress;return"rgb("+parseInt(n,10)+","+parseInt(r,10)+","+parseInt(a,10)+")"}return this.attribute("from").value}},t.Element.animateColor.prototype=new t.Element.AnimateBase,t.Element.animateTransform=function(e){this.base=t.Element.AnimateBase,this.base(e),this.calcValue=function(){for(var e=this.progress(),i=t.ToNumberArray(e.from.value),n=t.ToNumberArray(e.to.value),r="",a=0;i.length>a;a++)r+=i[a]+(n[a]-i[a])*e.progress+" ";return r}},t.Element.animateTransform.prototype=new t.Element.animate,t.Element.font=function(e){this.base=t.Element.ElementBase,this.base(e),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.isRTL=!1,this.isArabic=!1,this.fontFace=null,this.missingGlyph=null,this.glyphs=[];for(var i=0;this.children.length>i;i++){var n=this.children[i];"font-face"==n.type?(this.fontFace=n,n.style("font-family").hasValue()&&(t.Definitions[n.style("font-family").value]=this)):"missing-glyph"==n.type?this.missingGlyph=n:"glyph"==n.type&&(""!=n.arabicForm?(this.isRTL=!0,this.isArabic=!0,this.glyphs[n.unicode]===void 0&&(this.glyphs[n.unicode]=[]),this.glyphs[n.unicode][n.arabicForm]=n):this.glyphs[n.unicode]=n)}},t.Element.font.prototype=new t.Element.ElementBase,t.Element.fontface=function(e){this.base=t.Element.ElementBase,this.base(e),this.ascent=this.attribute("ascent").value,this.descent=this.attribute("descent").value,this.unitsPerEm=this.attribute("units-per-em").numValue()},t.Element.fontface.prototype=new t.Element.ElementBase,t.Element.missingglyph=function(e){this.base=t.Element.path,this.base(e),this.horizAdvX=0},t.Element.missingglyph.prototype=new t.Element.path,t.Element.glyph=function(e){this.base=t.Element.path,this.base(e),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.unicode=this.attribute("unicode").value,this.arabicForm=this.attribute("arabic-form").value},t.Element.glyph.prototype=new t.Element.path,t.Element.text=function(e){this.captureTextNodes=!0,this.base=t.Element.RenderedElementBase,this.base(e),this.baseSetContext=this.setContext,this.setContext=function(t){this.baseSetContext(t),this.style("dominant-baseline").hasValue()&&(t.textBaseline=this.style("dominant-baseline").value),this.style("alignment-baseline").hasValue()&&(t.textBaseline=this.style("alignment-baseline").value)},this.getBoundingBox=function(){return new t.BoundingBox(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"),0,0)},this.renderChildren=function(t){this.x=this.attribute("x").toPixels("x"),this.y=this.attribute("y").toPixels("y"),this.x+=this.getAnchorDelta(t,this,0);for(var e=0;this.children.length>e;e++)this.renderChild(t,this,e)},this.getAnchorDelta=function(t,e,i){var n=this.style("text-anchor").valueOrDefault("start");if("start"!=n){for(var r=0,a=i;e.children.length>a;a++){var s=e.children[a];if(a>i&&s.attribute("x").hasValue())break;r+=s.measureTextRecursive(t)}return-1*("end"==n?r:r/2)}return 0},this.renderChild=function(t,e,i){var n=e.children[i];n.attribute("x").hasValue()?n.x=n.attribute("x").toPixels("x")+this.getAnchorDelta(t,e,i):(this.attribute("dx").hasValue()&&(this.x+=this.attribute("dx").toPixels("x")),n.attribute("dx").hasValue()&&(this.x+=n.attribute("dx").toPixels("x")),n.x=this.x),this.x=n.x+n.measureText(t),n.attribute("y").hasValue()?n.y=n.attribute("y").toPixels("y"):(this.attribute("dy").hasValue()&&(this.y+=this.attribute("dy").toPixels("y")),n.attribute("dy").hasValue()&&(this.y+=n.attribute("dy").toPixels("y")),n.y=this.y),this.y=n.y,n.render(t);for(var i=0;n.children.length>i;i++)this.renderChild(t,n,i)}},t.Element.text.prototype=new t.Element.RenderedElementBase,t.Element.TextElementBase=function(e){this.base=t.Element.RenderedElementBase,this.base(e),this.getGlyph=function(t,e,i){var n=e[i],r=null;if(t.isArabic){var a="isolated";(0==i||" "==e[i-1])&&e.length-2>i&&" "!=e[i+1]&&(a="terminal"),i>0&&" "!=e[i-1]&&e.length-2>i&&" "!=e[i+1]&&(a="medial"),i>0&&" "!=e[i-1]&&(i==e.length-1||" "==e[i+1])&&(a="initial"),t.glyphs[n]!==void 0&&(r=t.glyphs[n][a],null==r&&"glyph"==t.glyphs[n].type&&(r=t.glyphs[n]))}else r=t.glyphs[n];return null==r&&(r=t.missingGlyph),r},this.renderChildren=function(e){var i=this.parent.style("font-family").getDefinition();if(null==i)""!=e.fillStyle&&e.fillText(t.compressSpaces(this.getText()),this.x,this.y),""!=e.strokeStyle&&e.strokeText(t.compressSpaces(this.getText()),this.x,this.y);else{var n=this.parent.style("font-size").numValueOrDefault(t.Font.Parse(t.ctx.font).fontSize),r=this.parent.style("font-style").valueOrDefault(t.Font.Parse(t.ctx.font).fontStyle),a=this.getText();i.isRTL&&(a=a.split("").reverse().join(""));for(var s=t.ToNumberArray(this.parent.attribute("dx").value),o=0;a.length>o;o++){var l=this.getGlyph(i,a,o),c=n/i.fontFace.unitsPerEm;e.translate(this.x,this.y),e.scale(c,-c);var h=e.lineWidth;e.lineWidth=e.lineWidth*i.fontFace.unitsPerEm/n,"italic"==r&&e.transform(1,0,.4,1,0,0),l.render(e),"italic"==r&&e.transform(1,0,-.4,1,0,0),e.lineWidth=h,e.scale(1/c,-1/c),e.translate(-this.x,-this.y),this.x+=n*(l.horizAdvX||i.horizAdvX)/i.fontFace.unitsPerEm,void 0===s[o]||isNaN(s[o])||(this.x+=s[o])}}},this.getText=function(){},this.measureTextRecursive=function(t){for(var e=this.measureText(t),i=0;this.children.length>i;i++)e+=this.children[i].measureTextRecursive(t);return e},this.measureText=function(e){var i=this.parent.style("font-family").getDefinition();if(null!=i){var n=this.parent.style("font-size").numValueOrDefault(t.Font.Parse(t.ctx.font).fontSize),r=0,a=this.getText();i.isRTL&&(a=a.split("").reverse().join(""));for(var s=t.ToNumberArray(this.parent.attribute("dx").value),o=0;a.length>o;o++){var l=this.getGlyph(i,a,o);r+=(l.horizAdvX||i.horizAdvX)*n/i.fontFace.unitsPerEm,void 0===s[o]||isNaN(s[o])||(r+=s[o])}return r}var c=t.compressSpaces(this.getText());if(!e.measureText)return 10*c.length;e.save(),this.setContext(e);var h=e.measureText(c).width;return e.restore(),h}},t.Element.TextElementBase.prototype=new t.Element.RenderedElementBase,t.Element.tspan=function(e){this.captureTextNodes=!0,this.base=t.Element.TextElementBase,this.base(e),this.text=e.nodeValue||e.text||"",this.getText=function(){return this.text}},t.Element.tspan.prototype=new t.Element.TextElementBase,t.Element.tref=function(e){this.base=t.Element.TextElementBase,this.base(e),this.getText=function(){var t=this.getHrefAttribute().getDefinition();return null!=t?t.children[0].getText():void 0}},t.Element.tref.prototype=new t.Element.TextElementBase,t.Element.a=function(e){this.base=t.Element.TextElementBase,this.base(e),this.hasText=!0;for(var i=0;e.childNodes.length>i;i++)3!=e.childNodes[i].nodeType&&(this.hasText=!1);this.text=this.hasText?e.childNodes[0].nodeValue:"",this.getText=function(){return this.text},this.baseRenderChildren=this.renderChildren,this.renderChildren=function(e){if(this.hasText){this.baseRenderChildren(e);var i=new t.Property("fontSize",t.Font.Parse(t.ctx.font).fontSize);t.Mouse.checkBoundingBox(this,new t.BoundingBox(this.x,this.y-i.toPixels("y"),this.x+this.measureText(e),this.y))}else{var n=new t.Element.g;n.children=this.children,n.parent=this,n.render(e)}},this.onclick=function(){window.open(this.getHrefAttribute().value)},this.onmousemove=function(){t.ctx.canvas.style.cursor="pointer"}},t.Element.a.prototype=new t.Element.TextElementBase,t.Element.image=function(e){this.base=t.Element.RenderedElementBase,this.base(e);var i=this.getHrefAttribute().value,n=i.match(/\.svg$/);if(t.Images.push(this),this.loaded=!1,n)this.img=t.ajax(i),this.loaded=!0;else{this.img=document.createElement("img");var r=this;this.img.onload=function(){r.loaded=!0},this.img.onerror=function(){"undefined"!=typeof console&&(console.log('ERROR: image "'+i+'" not found'),r.loaded=!0)},this.img.src=i}this.renderChildren=function(e){var i=this.attribute("x").toPixels("x"),r=this.attribute("y").toPixels("y"),a=this.attribute("width").toPixels("x"),s=this.attribute("height").toPixels("y");0!=a&&0!=s&&(e.save(),n?e.drawSvg(this.img,i,r,a,s):(e.translate(i,r),t.AspectRatio(e,this.attribute("preserveAspectRatio").value,a,this.img.width,s,this.img.height,0,0),e.drawImage(this.img,0,0)),e.restore())},this.getBoundingBox=function(){var e=this.attribute("x").toPixels("x"),i=this.attribute("y").toPixels("y"),n=this.attribute("width").toPixels("x"),r=this.attribute("height").toPixels("y");return new t.BoundingBox(e,i,e+n,i+r)}},t.Element.image.prototype=new t.Element.RenderedElementBase,t.Element.g=function(e){this.base=t.Element.RenderedElementBase,this.base(e),this.getBoundingBox=function(){for(var e=new t.BoundingBox,i=0;this.children.length>i;i++)e.addBoundingBox(this.children[i].getBoundingBox());return e}},t.Element.g.prototype=new t.Element.RenderedElementBase,t.Element.symbol=function(e){this.base=t.Element.RenderedElementBase,this.base(e),this.baseSetContext=this.setContext,this.setContext=function(e){if(this.baseSetContext(e),this.attribute("viewBox").hasValue()){var i=t.ToNumberArray(this.attribute("viewBox").value),n=i[0],r=i[1];
30 width=i[2],height=i[3],t.AspectRatio(e,this.attribute("preserveAspectRatio").value,this.attribute("width").toPixels("x"),width,this.attribute("height").toPixels("y"),height,n,r),t.ViewPort.SetCurrent(i[2],i[3])}}},t.Element.symbol.prototype=new t.Element.RenderedElementBase,t.Element.style=function(e){this.base=t.Element.ElementBase,this.base(e);for(var i="",n=0;e.childNodes.length>n;n++)i+=e.childNodes[n].nodeValue;i=i.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,""),i=t.compressSpaces(i);for(var r=i.split("}"),n=0;r.length>n;n++)if(""!=t.trim(r[n]))for(var a=r[n].split("{"),s=a[0].split(","),o=a[1].split(";"),l=0;s.length>l;l++){var c=t.trim(s[l]);if(""!=c){for(var h={},u=0;o.length>u;u++){var p=o[u].indexOf(":"),g=o[u].substr(0,p),d=o[u].substr(p+1,o[u].length-p);null!=g&&null!=d&&(h[t.trim(g)]=new t.Property(t.trim(g),t.trim(d)))}if(t.Styles[c]=h,"@font-face"==c)for(var f=h["font-family"].value.replace(/"/g,""),m=h.src.value.split(","),I=0;m.length>I;I++)if(m[I].indexOf('format("svg")')>0)for(var y=m[I].indexOf("url"),v=m[I].indexOf(")",y),C=m[I].substr(y+5,v-y-6),b=t.parseXml(t.ajax(C)),A=b.getElementsByTagName("font"),w=0;A.length>w;w++){var x=t.CreateElement(A[w]);t.Definitions[f]=x}}}},t.Element.style.prototype=new t.Element.ElementBase,t.Element.use=function(e){this.base=t.Element.RenderedElementBase,this.base(e),this.baseSetContext=this.setContext,this.setContext=function(t){this.baseSetContext(t),this.attribute("x").hasValue()&&t.translate(this.attribute("x").toPixels("x"),0),this.attribute("y").hasValue()&&t.translate(0,this.attribute("y").toPixels("y"))},this.getDefinition=function(){var t=this.getHrefAttribute().getDefinition();return this.attribute("width").hasValue()&&(t.attribute("width",!0).value=this.attribute("width").value),this.attribute("height").hasValue()&&(t.attribute("height",!0).value=this.attribute("height").value),t},this.path=function(t){var e=this.getDefinition();null!=e&&e.path(t)},this.getBoundingBox=function(){var t=this.getDefinition();return null!=t?t.getBoundingBox():void 0},this.renderChildren=function(t){var e=this.getDefinition();if(null!=e){var i=e.parent;e.parent=null,e.render(t),e.parent=i}}},t.Element.use.prototype=new t.Element.RenderedElementBase,t.Element.mask=function(e){this.base=t.Element.ElementBase,this.base(e),this.apply=function(e,i){var n=this.attribute("x").toPixels("x"),r=this.attribute("y").toPixels("y"),a=this.attribute("width").toPixels("x"),s=this.attribute("height").toPixels("y");if(0==a&&0==s){for(var o=new t.BoundingBox,l=0;this.children.length>l;l++)o.addBoundingBox(this.children[l].getBoundingBox());var n=Math.floor(o.x1),r=Math.floor(o.y1),a=Math.floor(o.width()),s=Math.floor(o.height())}var c=i.attribute("mask").value;i.attribute("mask").value="";var h=document.createElement("canvas");h.width=n+a,h.height=r+s;var u=h.getContext("2d");this.renderChildren(u);var p=document.createElement("canvas");p.width=n+a,p.height=r+s;var g=p.getContext("2d");i.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=u.createPattern(h,"no-repeat"),g.fillRect(0,0,n+a,r+s),e.fillStyle=g.createPattern(p,"no-repeat"),e.fillRect(0,0,n+a,r+s),i.attribute("mask").value=c},this.render=function(){}},t.Element.mask.prototype=new t.Element.ElementBase,t.Element.clipPath=function(e){this.base=t.Element.ElementBase,this.base(e),this.apply=function(e){for(var i=0;this.children.length>i;i++){var n=this.children[i];if(n.path!==void 0){var r=null;n.attribute("transform").hasValue()&&(r=new t.Transform(n.attribute("transform").value),r.apply(e)),n.path(e),e.clip(),r&&r.unapply(e)}}},this.render=function(){}},t.Element.clipPath.prototype=new t.Element.ElementBase,t.Element.filter=function(e){this.base=t.Element.ElementBase,this.base(e),this.apply=function(t,e){var i=e.getBoundingBox(),n=Math.floor(i.x1),r=Math.floor(i.y1),a=Math.floor(i.width()),s=Math.floor(i.height()),o=e.style("filter").value;e.style("filter").value="";for(var l=0,c=0,h=0;this.children.length>h;h++){var u=this.children[h].extraFilterDistance||0;l=Math.max(l,u),c=Math.max(c,u)}var p=document.createElement("canvas");p.width=a+2*l,p.height=s+2*c;var g=p.getContext("2d");g.translate(-n+l,-r+c),e.render(g);for(var h=0;this.children.length>h;h++)this.children[h].apply(g,0,0,a+2*l,s+2*c);t.drawImage(p,0,0,a+2*l,s+2*c,n-l,r-c,a+2*l,s+2*c),e.style("filter",!0).value=o},this.render=function(){}},t.Element.filter.prototype=new t.Element.ElementBase,t.Element.feMorphology=function(e){this.base=t.Element.ElementBase,this.base(e),this.apply=function(){}},t.Element.feMorphology.prototype=new t.Element.ElementBase,t.Element.feColorMatrix=function(e){function i(t,e,i,n,r,a){return t[4*i*n+4*e+a]}function n(t,e,i,n,r,a,s){t[4*i*n+4*e+a]=s}this.base=t.Element.ElementBase,this.base(e),this.apply=function(t,e,r,a,s){for(var o=t.getImageData(0,0,a,s),r=0;s>r;r++)for(var e=0;a>e;e++){var l=i(o.data,e,r,a,s,0),c=i(o.data,e,r,a,s,1),h=i(o.data,e,r,a,s,2),u=(l+c+h)/3;n(o.data,e,r,a,s,0,u),n(o.data,e,r,a,s,1,u),n(o.data,e,r,a,s,2,u)}t.clearRect(0,0,a,s),t.putImageData(o,0,0)}},t.Element.feColorMatrix.prototype=new t.Element.ElementBase,t.Element.feGaussianBlur=function(e){this.base=t.Element.ElementBase,this.base(e),this.blurRadius=Math.floor(this.attribute("stdDeviation").numValue()),this.extraFilterDistance=this.blurRadius,this.apply=function(e,i,n,r,a){return stackBlurCanvasRGBA===void 0?("undefined"!=typeof console&&console.log("ERROR: StackBlur.js must be included for blur to work"),void 0):(e.canvas.id=t.UniqueId(),e.canvas.style.display="none",document.body.appendChild(e.canvas),stackBlurCanvasRGBA(e.canvas.id,i,n,r,a,this.blurRadius),document.body.removeChild(e.canvas),void 0)}},t.Element.feGaussianBlur.prototype=new t.Element.ElementBase,t.Element.title=function(){},t.Element.title.prototype=new t.Element.ElementBase,t.Element.desc=function(){},t.Element.desc.prototype=new t.Element.ElementBase,t.Element.MISSING=function(t){"undefined"!=typeof console&&console.log("ERROR: Element '"+t.nodeName+"' not yet implemented.")},t.Element.MISSING.prototype=new t.Element.ElementBase,t.CreateElement=function(e){var i=e.nodeName.replace(/^[^:]+:/,"");i=i.replace(/\-/g,"");var n=null;return n=t.Element[i]!==void 0?new t.Element[i](e):new t.Element.MISSING(e),n.type=e.nodeName,n},t.load=function(e,i){t.loadXml(e,t.ajax(i))},t.loadXml=function(e,i){t.loadXmlDoc(e,t.parseXml(i))},t.loadXmlDoc=function(e,i){t.init(e);var n=function(t){for(var i=e.canvas;i;)t.x-=i.offsetLeft,t.y-=i.offsetTop,i=i.offsetParent;return window.scrollX&&(t.x+=window.scrollX),window.scrollY&&(t.y+=window.scrollY),t};1!=t.opts.ignoreMouse&&(e.canvas.onclick=function(e){var i=n(new t.Point(null!=e?e.clientX:event.clientX,null!=e?e.clientY:event.clientY));t.Mouse.onclick(i.x,i.y)},e.canvas.onmousemove=function(e){var i=n(new t.Point(null!=e?e.clientX:event.clientX,null!=e?e.clientY:event.clientY));t.Mouse.onmousemove(i.x,i.y)});var r=t.CreateElement(i.documentElement);r.root=!0;var a=!0,s=function(){t.ViewPort.Clear(),e.canvas.parentNode&&t.ViewPort.SetCurrent(e.canvas.parentNode.clientWidth,e.canvas.parentNode.clientHeight),1!=t.opts.ignoreDimensions&&(r.style("width").hasValue()&&(e.canvas.width=r.style("width").toPixels("x"),e.canvas.style.width=e.canvas.width+"px"),r.style("height").hasValue()&&(e.canvas.height=r.style("height").toPixels("y"),e.canvas.style.height=e.canvas.height+"px"));var n=e.canvas.clientWidth||e.canvas.width,s=e.canvas.clientHeight||e.canvas.height;if(1==t.opts.ignoreDimensions&&r.style("width").hasValue()&&r.style("height").hasValue()&&(n=r.style("width").toPixels("x"),s=r.style("height").toPixels("y")),t.ViewPort.SetCurrent(n,s),null!=t.opts.offsetX&&(r.attribute("x",!0).value=t.opts.offsetX),null!=t.opts.offsetY&&(r.attribute("y",!0).value=t.opts.offsetY),null!=t.opts.scaleWidth&&null!=t.opts.scaleHeight){var o=1,l=1,c=t.ToNumberArray(r.attribute("viewBox").value);r.attribute("width").hasValue()?o=r.attribute("width").toPixels("x")/t.opts.scaleWidth:isNaN(c[2])||(o=c[2]/t.opts.scaleWidth),r.attribute("height").hasValue()?l=r.attribute("height").toPixels("y")/t.opts.scaleHeight:isNaN(c[3])||(l=c[3]/t.opts.scaleHeight),r.attribute("width",!0).value=t.opts.scaleWidth,r.attribute("height",!0).value=t.opts.scaleHeight,r.attribute("viewBox",!0).value="0 0 "+n*o+" "+s*l,r.attribute("preserveAspectRatio",!0).value="none"}1!=t.opts.ignoreClear&&e.clearRect(0,0,n,s),r.render(e),a&&(a=!1,"function"==typeof t.opts.renderCallback&&t.opts.renderCallback(i))},o=!0;t.ImagesLoaded()&&(o=!1,s()),t.intervalID=setInterval(function(){var e=!1;if(o&&t.ImagesLoaded()&&(o=!1,e=!0),1!=t.opts.ignoreMouse&&(e|=t.Mouse.hasEvents()),1!=t.opts.ignoreAnimation)for(var i=0;t.Animations.length>i;i++)e|=t.Animations[i].update(1e3/t.FRAMERATE);"function"==typeof t.opts.forceRedraw&&1==t.opts.forceRedraw()&&(e=!0),e&&(s(),t.Mouse.runEvents())},1e3/t.FRAMERATE)},t.stop=function(){t.intervalID&&clearInterval(t.intervalID)},t.Mouse=new function(){this.events=[],this.hasEvents=function(){return 0!=this.events.length},this.onclick=function(t,e){this.events.push({type:"onclick",x:t,y:e,run:function(t){t.onclick&&t.onclick()}})},this.onmousemove=function(t,e){this.events.push({type:"onmousemove",x:t,y:e,run:function(t){t.onmousemove&&t.onmousemove()}})},this.eventElements=[],this.checkPath=function(t,e){for(var i=0;this.events.length>i;i++){var n=this.events[i];e.isPointInPath&&e.isPointInPath(n.x,n.y)&&(this.eventElements[i]=t)}},this.checkBoundingBox=function(t,e){for(var i=0;this.events.length>i;i++){var n=this.events[i];e.isPointInBox(n.x,n.y)&&(this.eventElements[i]=t)}},this.runEvents=function(){t.ctx.canvas.style.cursor="";for(var e=0;this.events.length>e;e++)for(var i=this.events[e],n=this.eventElements[e];n;)i.run(n),n=n.parent;this.events=[],this.eventElements=[]}},t}this.canvg=function(e,i,n){if(null!=e||null!=i||null!=n){n=n||{},"string"==typeof e&&(e=document.getElementById(e)),null!=e.svg&&e.svg.stop();var r=t();(1!=e.childNodes.length||"OBJECT"!=e.childNodes[0].nodeName)&&(e.svg=r),r.opts=n;var a=e.getContext("2d");i.documentElement!==void 0?r.loadXmlDoc(a,i):"<"==i.substr(0,1)?r.loadXml(a,i):r.load(a,i)}else for(var s=document.getElementsByTagName("svg"),o=0;s.length>o;o++){var l=s[o],c=document.createElement("canvas");c.width=l.clientWidth,c.height=l.clientHeight,l.parentNode.insertBefore(c,l),l.parentNode.removeChild(l);var h=document.createElement("div");h.appendChild(l),canvg(c,h.innerHTML)}}}(),"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,i,n,r){canvg(this.canvas,t,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:i,scaleWidth:n,scaleHeight:r})});var mul_table=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],shg_table=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];if(joint.dia.Paper.prototype.toDataURL=function(t,e){if("function"!=typeof this.toSVG)throw Error("The joint.format.svg.js plugin must be loaded.");e=e||{};var i,n,r,a,s=e.padding||0;if(e.width&&e.height)i=e.width,n=e.height,s=Math.min(s,i/2-1,n/2-1),a=i-2*s,r=n-2*s;else{var o=this.viewport.getBoundingClientRect();a=o.width||1,r=o.height||1,i=a+2*s,n=r+2*s}var l=new Image;l.onload=function(){function o(){p=document.createElement("canvas"),p.width=i,p.height=n,u=p.getContext("2d"),u.fillStyle=e.backgroundColor||"white",u.fillRect(0,0,i,n)}var h,u,p;o(),u.drawImage(l,s,s,a,r);try{h=p.toDataURL(e.type,e.quality)}catch(g){return"undefined"==typeof canvg?(console.error("Canvas tainted. Canvg library required."),void 0):(o(),canvg(p,c,{ignoreDimensions:!0,ignoreClear:!0,offsetX:s,offsetY:s,renderCallback:function(){h=p.toDataURL(e.type,e.quality),t(h)}}),void 0)}t(h)};var c=this.toSVG();c=c.replace('width="100%"','width="'+a+'"').replace('height="100%"','height="'+r+'"'),l.src="data:image/svg+xml;base64,"+btoa(c)},joint.dia.Paper.prototype.toPNG=function(t,e){e=e||{},e.type="image/png",this.toDataURL(t,e)},joint.dia.Paper.prototype.toJPEG=function(t,e){e=e||{},e.type="image/jpeg",this.toDataURL(t,e)},function(){function t(t,e){var i=V(this.svg),n=this.getContentBBox().moveAndExpand({x:-t.padding,y:-t.padding,width:2*t.padding,height:2*t.padding});e.attrs={width:i.attr("width"),height:i.attr("height"),viewBox:i.attr("viewBox")},e.scrollLeft=this.el.scrollLeft,e.scrollTop=this.el.scrollTop,i.attr({width:"100%",height:"100%",viewBox:[n.x,n.y,n.width,n.height].join(" ")}),this.$el.addClass("printarea").addClass(t.size),t.detachBody&&(e.$parent=this.$el.parent(),e.$content=$(document.body).children().detach(),this.$el.appendTo(document.body))}function e(t,e){var i=V(this.svg),n=!!window.chrome&&!window.opera,r=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;!n&&!r||e.attrs.viewBox||(i.node.removeAttributeNS(null,"viewBox"),delete e.attrs.viewBox),i.attr(e.attrs),this.$el.removeClass("printarea").removeClass(t.size),t.detachBody&&(this.$el.appendTo(e.$parent),e.$content.appendTo(document.body)),this.el.scrollLeft=e.scrollLeft,this.el.scrollTop=e.scrollTop}var i="onbeforeprint"in window;joint.dia.Paper.prototype.print=function(n){n=n||{},_.defaults(n,{size:"a4",padding:5,detachBody:!0});var r={},a=_.bind(t,this,n,r),s=_.bind(e,this,n,r);if(i?($(window).one("beforeprint",a),$(window).one("afterprint",s)):a(),window.print(),!i){var o=_.once(s);$(document).one("mouseover",o),_.delay(o,1e3)}}}(),"object"==typeof exports)var joint={com:{},util:require("../../../src/core").util},WebSocketServer=require("ws").Server,WebSocket=require("ws"),_=require("lodash"),url=require("url"),Backbone=require("backbone");joint.com=joint.com||{},joint.com.Channel=function(t){if(this.options=t,!this.options||!this.options.graph)throw Error("Channel: missing a graph.");this.options.ttl=this.options.ttl||60,this.options.healthCheckInterval=this.options.healthCheckInterval||36e5,this.options.reconnectInterval=this.options.reconnectInterval||1e4,this._isClient=!!this.options.url,this._clients=[],this.messageQueue=[],this.id=this.options.id||(this._isClient?"c_":"s_")+joint.util.uuid(),this.state={},this.state[this.id]=0,this.sites={},this.sites[this.id]={socket:void 0,outgoing:[],ttl:this.options.ttl},this.initialize()},_.extend(joint.com.Channel.prototype,Backbone.Events),joint.com.Channel.prototype.initialize=function(){this.options.graph.on("all",this.onGraphChange.bind(this)),this._isClient?this.connectClient():this.options.port&&(this.server=new WebSocketServer({port:this.options.port}),this.server.on("connection",this.onConnection.bind(this))),this._isClient||(this._healthCheckInterval=setInterval(this.healthCheck.bind(this),this.options.healthCheckInterval))},joint.com.Channel.prototype.connectClient=function(){var t=this.options.url+"/?channelId="+this.id+"&state="+JSON.stringify(this.state)+(this.options.query?"&query="+JSON.stringify(this.options.query):"");this.options.debugLevel>0&&this.log("connectClient",t);var e=new WebSocket(t);e.onopen=this.onConnection.bind(this,e),e.onclose=this.onClose.bind(this,e)},joint.com.Channel.prototype.close=function(){this._reconnectTimeout&&clearTimeout(this._reconnectTimeout),this._healthCheckInterval&&clearInterval(this._healthCheckInterval),this._closed=!0,_.each(this.sites,function(t){t.socket&&t.socket.close()}),this.server&&this.server.close()},joint.com.Channel.prototype.healthCheck=function(){this.options.debugLevel>0&&this.log("healthCheck",_.object(_.keys(this.sites),_.pluck(this.sites,"ttl"))),_.each(this.sites,function(t,e){e!==this.id&&(t.socket&&1===t.socket.readyState?t.ttl=this.options.ttl:t.ttl-=1,0>=t.ttl&&(delete this.sites[e],delete this.state[e]))},this)},joint.com.Channel.prototype.onConnection=function(t){if(this._clients.push(t),this._isClient)this.sites[this.id].socket=t,t.onmessage=function(e){this.onMessage(t,e.data)}.bind(this);else{var e=url.parse(t.upgradeReq.url,!0),i=e.query.channelId;if(this.sites[i])this.sites[i].socket=t;else{this.debugLevel>1&&this.log("new_site",i),this.sites[i]={socket:t,outgoing:[],ttl:this.options.ttl},this.state[i]=0;var n={channelId:this.id,state:JSON.parse(JSON.stringify(this.state)),action:"graph",graph:this.options.graph.toJSON()};this.messageQueue.push({type:"op",data:n,source:this.id,target:[i]}),this.send()}t.on("message",this.onMessage.bind(this,t)),t.on("close",this.onClose.bind(this,t))}},joint.com.Channel.prototype.onClose=function(t){var e=this._clients.indexOf(t);-1!==e&&this._clients.splice(e,1),this._isClient&&!this._closed&&(this._reconnectTimeout&&clearTimeout(this._reconnectTimeout),this._reconnectTimeout=setTimeout(this.connectClient.bind(this),this.options.reconnectInterval)),this.trigger("close",t)},joint.com.Channel.prototype.onMessage=function(t,e){this.trigger("message:received",e),this.options.debugLevel>1&&this.log("message",e);try{e=JSON.parse(e)}catch(i){return console.error("Channel: message parsing failed.",i)}if("notification"==e.type)return this.trigger(e.data.event,e.data.data),this.sendNotification(e);var n=e.data;if(this._isClient){var r=this.sites[this.id];n=this.receive(r,this.id,n)}else{var a=this.sites[n.channelId];n=this.receive(a,n.channelId,n);var r=this.sites[this.id];n=this.receive(r,this.id,n)}this.state[n.channelId]="graph"===n.action?n.state[n.channelId]:(this.state[n.channelId]||0)+1,this.options.debugLevel>1&&this.log("new state",this.state),this.execute(n),_.each(this.sites,function(t,e){e!==this.id&&e!==n.channelId&&this.receive(t,e,n)},this),this._isClient||(e.op=n,this.messageQueue.push(e),this.broadcast(e)),this.trigger("message:processed",e)},joint.com.Channel.prototype.receive=function(t,e,i){if(!t)return i;this.options.debugLevel>1&&this.log("receive",e,i),this.options.debugLevel>1&&this.log("outgoing",t.outgoing),t.outgoing=_.filter(t.outgoing,function(t){return t.state[t.channelId]>=(i.state[t.channelId]||0)}),this.options.debugLevel>1&&this.log("outgoing.length",t.outgoing.length);for(var n=0;t.outgoing.length>n;n++){var r=t.outgoing[n],a=this.transform(i,r);i=a[0],t.outgoing[n]=a[1]}return i},joint.com.Channel.prototype.transform=function(t,e){return this.options.debugLevel>1&&this.log("transform",t,e),"change:target"===t.action&&"remove"===e.action&&t.cell.target.id===e.cell.id&&(t.cell.target={x:0,y:0}),"change:source"===t.action&&"remove"===e.action&&t.cell.source.id===e.cell.id&&(t.cell.source={x:0,y:0}),[t,e]},joint.com.Channel.prototype.execute=function(t){var e;switch(t.action){case"add":this.options.graph.addCell(t.cell,{remote:!0});break;case"remove":e=this.options.graph.getCell(t.cell.id),e&&e.remove({remote:!0,disconnectLinks:!0});break;case"graph":this.options.graph.fromJSON(t.graph);break;default:var i=t.action.substr("change:".length);e=this.options.graph.getCell(t.cell.id),e&&e.set(i,t.cell[i],{remote:!0})}},joint.com.Channel.prototype.broadcast=function(t){t.target=this._isClient?_.keys(this.sites):_.keys(_.omit(this.sites,this.id,t.source)),this.send()},joint.com.Channel.prototype.send=function(){if(!this._paused){for(var t=[],e=0;this.messageQueue.length>e;e++){var i=this.messageQueue[e];this.sendMessage(i)&&t.push(e)}t.forEach(_.bind(function(t){this.messageQueue.splice(t,1)},this))}},joint.com.Channel.prototype.sendMessage=function(t){this.debugLevel>1&&this.log("sendMessage",t);var e=[];return t.target.forEach(function(i,n){var r=this.sites[i];return r?(r.socket&&1===r.socket.readyState&&(this.debugLevel>1&&this.log("sendMessage",i,t),r.socket.send(JSON.stringify(t)),e.push(n)),void 0):e.push(n)},this),e.forEach(function(e){t.target.splice(e,1)}),t.target.length?!1:!0},joint.com.Channel.prototype.log=function(t){var e="Channel ["+this.id+"] "+t.toUpperCase()+": ";console.log.apply(console,[e].concat(_.rest(_.toArray(arguments))))},joint.com.Channel.prototype.pause=function(){this._paused=!0},joint.com.Channel.prototype.unpause=function(){this._paused=!1,this.send()},joint.com.Channel.prototype.notify=function(t,e){var i={type:"notification",source:this.id,data:{event:t,data:e}};this.sendNotification(i)},joint.com.Channel.prototype.sendNotification=function(t){t.target=this._isClient?_.keys(this.sites):_.keys(_.omit(this.sites,this.id,t.source)),this.sendMessage(t)},joint.com.Channel.prototype.onGraphChange=function(t,e,i,n){if(!n||!n.remote){var r="add"===t||"remove"===t||"change:"===t.substr(0,"change:".length);if(r){var a={channelId:this.id,state:JSON.parse(JSON.stringify(this.state)),action:t,cell:e.toJSON()},s={type:"op",data:a,source:this.id};this.options.debugLevel>1&&this.log("generate",s),this.messageQueue.push(s),this.broadcast(s),this.sites[this.id].outgoing.push(a),this.state[this.id]++}}},joint.com.ChannelHub=function(t){if(this.options=t,!this.options.port)throw Error("ChannelHub: missing a port.");this.initialize()},_.extend(joint.com.ChannelHub.prototype,Backbone.Events),joint.com.ChannelHub.prototype.initialize=function(){this.server=new WebSocketServer({port:this.options.port}),this.server.on("connection",this.onConnection.bind(this))},joint.com.ChannelHub.prototype.onConnection=function(t){var e=url.parse(t.upgradeReq.url,!0),i={query:e.query};if(!this.router)throw Error("ChannelHub: missing a router.");var n=this.router(i);n.onConnection(t)},joint.com.ChannelHub.prototype.route=function(t){this.router=t},joint.com.ChannelHub.prototype.close=function(){this.server.close()},"object"==typeof exports&&(module.exports.Channel=joint.com.Channel,module.exports.ChannelHub=joint.com.ChannelHub);