From 70e243d1c48f9554bd4e28e80f7ff766db6fe857 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 10 Jun 2016 07:36:43 +0200 Subject: HONEYCOMB-7: Remove VBD form HC VBD is now subproject of ODL: https://git.opendaylight.org/gerrit/#/admin/projects/honeycomb/vbd Change-Id: I1bf01a01cca50fe5e3f4f82a53c6b15ec5c7091d Signed-off-by: Marek Gradzki --- .../src/main/resources/vpp/assets/js/next.js | 101 --------------------- 1 file changed, 101 deletions(-) delete mode 100644 vbd/gui/module/src/main/resources/vpp/assets/js/next.js (limited to 'vbd/gui/module/src/main/resources/vpp/assets/js/next.js') diff --git a/vbd/gui/module/src/main/resources/vpp/assets/js/next.js b/vbd/gui/module/src/main/resources/vpp/assets/js/next.js deleted file mode 100644 index b9af39949..000000000 --- a/vbd/gui/module/src/main/resources/vpp/assets/js/next.js +++ /dev/null @@ -1,101 +0,0 @@ -/*Copyright (c) 2015 Cisco and/or its affiliates. - -The NeXt SDK is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives (CC BY-NC-ND) 4.0 International License . A copy of the license can be found in the license.txt file accompanying this distribution and at http://creativecommons.org/licenses/by-nc-nd/4.0/ - -The code, technical concepts, all information contained herein, and related documentation are the property of and are vested in Cisco Technology, Inc. and/or its affiliated entities, under various laws including copyright, international treaties, patent, trade secret and/or contract. All use of the material herein must be in strict accordance with the terms of the license noted above. Any rights not expressly licensed are reserved.*/ -/*Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License - -By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. - -Section 1 – Definitions. - -Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. -Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. -Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. -Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. -Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. -Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. -Licensor means the individual(s) or entity(ies) granting rights under this Public License. -NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. -Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. -Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. -You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. -Section 2 – Scope. - -License grant. -Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: -reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and -produce and reproduce, but not Share, Adapted Material for NonCommercial purposes only. -Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. -Term. The term of this Public License is specified in Section 6(a). -Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. -Downstream recipients. -Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. -No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. -No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). -Other rights. - -Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. -Patent and trademark rights are not licensed under this Public License. -To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. -Section 3 – License Conditions. - -Your exercise of the Licensed Rights is expressly made subject to the following conditions. - -Attribution. - -If You Share the Licensed Material, You must: - -retain the following if it is supplied by the Licensor with the Licensed Material: -identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); -a copyright notice; -a notice that refers to this Public License; -a notice that refers to the disclaimer of warranties; -a URI or hyperlink to the Licensed Material to the extent reasonably practicable; -indicate if You modified the Licensed Material and retain an indication of any previous modifications; and -indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. -For the avoidance of doubt, You do not have permission under this Public License to Share Adapted Material. -You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. -If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. -Section 4 – Sui Generis Database Rights. - -Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: - -for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only and provided You do not Share Adapted Material; -if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and -You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. -For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. -Section 5 – Disclaimer of Warranties and Limitation of Liability. - -Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. -To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. -The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. -Section 6 – Term and Termination. - -This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. -Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: - -automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or -upon express reinstatement by the Licensor. -For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. -For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. -Sections 1, 5, 6, 7, and 8 survive termination of this Public License. -Section 7 – Other Terms and Conditions. - -The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. -Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. -Section 8 – Interpretation. - -For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. -To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. -No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. -Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.*/ -var nx={VERSION:"0.8",DEBUG:!1,global:function(){return this}.call(null)};!function(){Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a,arguments)}})}(),function(a){var b=Array.isArray||function(a){return a&&a.constructor===Array},c=function(a){var b=Object.prototype.hasOwnProperty;if(!a||"[object Object]"!==Object.prototype.toString(a)||a.nodeType||a===window)return!1;try{if(a.constructor&&!b.call(a,"constructor")&&!b.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return void 0===d||b.call(a,d)};a.extend=function(a){for(var b=1,c=arguments.length;c>b;b++){var d=arguments[b];for(var e in d)d.hasOwnProperty(e)&&(a[e]=d[e])}return a},a.each=function(c,d,e){if(c&&d)if(c.__each__)c.__each__(d,e);else if(b(c)||"[object Arguments]"===Object.prototype.toString.call(c)||a.global.NodeList&&c instanceof NodeList||a.global.HTMLCollection&&c instanceof HTMLCollection)for(var f=0,g=c.length;g>f&&d.call(e,c[f],f)!==!1;f++);else for(var h in c)if(c.hasOwnProperty(h)&&d.call(e,c[h],h)===!1)break},a.clone=function(){var d=function(){var a,d,e,f,g;return a=function(a,b){for(var c=0;c=0)return g;if(!b(g)&&!c(g))return g;var h,i,j,k=[],l=[],m=g,n=b(g)?[]:{};for(d(k,m,n),l.push({origin:m,dest:n,keys:f(m),idx:0});;){if(h=e(l),!h)break;if(m=h.origin,n=h.dest,h.keys.length<=h.idx)l.pop();else{if(i=h.keys[h.idx++],b(m[i]))n[i]=[];else{if(!c(m[i])){n[i]=m[i];continue}n[i]={}}j=a(k,m[i]),j?n[i]=j:(d(k,m[i],n[i]),l.push({origin:m[i],dest:n[i],keys:f(m[i]),idx:0}))}}return n}}();return function(b,c){if(b){if(b.__clone__)return b.__clone__(c);if(c)return d(b);if(a.is(b,"Array"))return b.slice(0);var e={};for(var f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);return e}return b}}(),a.is=function(a,d){if(a&&a.__is__)return a.__is__(d);switch(d){case"Undefined":return void 0===a;case"Null":return null===a;case"Object":return a&&"object"==typeof a;case"String":case"Boolean":case"Number":case"Function":return typeof a===d.toLowerCase();case"Array":return b(a);case"POJO":return c(a);default:return a instanceof d}},a.get=function(a,b){return a?a.__get__?a.__get__(b):a[b]:void 0},a.set=function(a,b,c){a&&(a.__set__?a.__set__(b):a[b]=c)},a.gets=function(a){if(a){if(a.__gets__)return a.__gets__();var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}},a.sets=function(a,b){if(a&&b)if(a.__sets__)a.__sets__(b);else for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},a.has=function(a,b){return a?a.__has__?a.__has__(b):b in a:!1},a.compare=function(a,b){return a&&a.__compare__?a.__compare__(b):a===b?0:a>b?1:b>a?-1:1},a.path=function(a,c,d){var e=a;if(c){var f,g,h,i=0;if("string"==typeof c)f=c.split(".");else{if(!b(c))return a;f=c}if(h=f.length,void 0===d)for(;e&&h>i;i++)g=f[i],e=e.__get__?e.__get__(g):e[g];else{for(h-=1;e&&h>i;i++)g=f[i],e=e.__get__?e.__get__(g):e[g]=e[g]||{};g=f[i],e&&(e.__set__?e.__set__(g,d):e[g]=d,e=d)}}return e},a.idle=function(){},a.identity=function(a){return a},a.uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()}}(nx),function(a){function b(){}function c(a,b){var c=j+b,d=a[c]&&"event"==a[c].__type__,e=a[c]=function(a,c){var d=this.__listeners__,e=d[b]=d[b]||[{owner:null,handler:null,context:null}];e[0]={owner:this,handler:a,context:c}};return e.__name__=b,e.__type__="event",d||a.__events__.push(b),e}function d(b,c,d){(a.is(d,a.keyword.internal.Keyword)||!a.is(d,"Object"))&&(d={value:d});var e,f=b[c]&&"property"==b[c].__type__;d.dependencies?(a.is(d.dependencies,"String")&&(d.dependencies=d.dependencies.replace(/\s/g,"").split(",")),e=a.keyword.binding({source:d.dependencies,async:!0,callback:function(){var b=this.owner;d.update&&d.update.apply(b,arguments),a.is(d.value,"Function")?b.set(c,d.value.apply(b,arguments)):d.update||d.value||b.set(c,arguments[0])}})):e=d.value,b[c]&&d.inherits&&(d=a.extend({},b[c].__meta__,d));var g=function(a,b){return void 0===a&&0===arguments.length?g.__getter__.call(this,b):g.__setter__.call(this,a,b)};return g.__name__=c,g.__type__="property",g.__meta__=d,g.__getter__=d.get||function(){return this["_"+c]},g.__setter__=d.set||function(a){this["_"+c]=a},g.getMeta=function(a){return a?g.__meta__[a]:g.__meta__},a.is(b,"Function")&&b.__properties__&&!b.__static__?b.prototype[c]=g:b[c]=g,void 0!==e&&(b.__defaults__[c]=e),f||(a.is(b,"Function")||b.__properties__!==b.constructor.__properties||(b.__properties__=b.__properties__.slice()),b.__properties__.push(c)),g}function e(a,b,c){var d=a[b]&&"method"==a[b].__type__;a[b]&&a[b]!==c&&(c.__super__=a[b]),c.__name__=b,c.__type__="method",c.__meta__={},a[b]=c,d||a.__methods__.push(b)}function f(f,j,m){m||(a.is(j,"Object")?(m=j,j=null,a.is(f,"Function")&&(j=f,f=null)):j||(a.is(f,"Object")?(m=f,f=null):a.is(f,"Function")&&(j=f,f=null))),m=m||{};var n,o,p,q,r,s,t=j||b,u=m.mixins||[],v=m.events||[],w=m.properties||{},x=m.methods||{},y=m.static||!1,z=m.statics||{};if(a.is(u,"Function")&&(u=[u]),t.__static__)throw new Error("Static class cannot be inherited.");if(y){for(r=function(){throw new Error("Cannot instantiate static class.")},r.__classId__=g++,r.__className__=f?f:"Anonymous",r.__static__=!0,r.__events__=[],r.__properties__=[],r.__methods__=[],r.__defaults__={},p=0,q=v.length;q>p;p++)c(r,v[p]);for(o in w)w.hasOwnProperty(o)&&d(r,o,w[o]);for(o in x)x.hasOwnProperty(o)&&e(r,o,x[o]);for(o in z)z.hasOwnProperty(o)&&(r[o]=z[o]);a.each(r.__defaults__,function(b,c){if(a.is(b,"Function"))this["_"+c]=b.call(this);else if(a.is(b,a.keyword.internal.Keyword))switch(b.type){case"binding":b.apply(this,c)}else this["_"+c]=b},r),x.init&&x.init.call(r)}else{r=function(){var b=arguments[0];"[object Arguments]"!==Object.prototype.toString.call(b)&&(b=arguments);var c=this.__mixins__;this.__id__=h++,this.__listeners__={},this.__bindings__=this.__bindings__||{},this.__watchers__=this.__watchers__||{},this.__keyword_bindings__=this.__keyword_bindings__||[],this.__keyword_watchers__=this.__keyword_watchers__||{},this.__keyword_init__=this.__keyword_init__||[],this.__initializing__=!0;for(var d=0,e=c.length;e>d;d++){var f=c[d].__ctor__;f&&f.call(this)}a.each(r.__defaults__,function(b,c){a.is(b,"Function")?this["_"+c]=b.call(this):a.is(b,a.keyword.internal.Keyword)?this.__keyword_bindings__.push({name:c,definition:b}):this["_"+c]=b},this),a.each(r.__properties__,function(b){var c=this[b];if(c&&"property"===c.__type__){var d=c.__meta__,e=d.watcher,f=d.init;e&&this.watch&&(a.is(e,"String")&&(e=this[e]),this.watch(b,e.bind(this)),this.__keyword_watchers__[b]=e),f&&this.__keyword_init__.push(f)}},this),a.each(this.__keyword_bindings__,function(a){a.instance=a.definition.apply(this,a.name)},this),a.each(this.__keyword_init__,function(a){a.apply(this,b)},this),this.__ctor__&&this.__ctor__.apply(this,b),a.each(this.__keyword_watchers__,function(a,b){a.call(this,b,this[b].call(this))},this),a.each(this.__keyword_bindings__,function(a){a.instance.notify()},this),this.__initializing__=!1},s=function(){},s.prototype=t.prototype,n=new s,n.constructor=r,n.__events__=t.__events__.slice(0),n.__properties__=t.__properties__.slice(0),n.__methods__=t.__methods__.slice(0),n.__defaults__=a.clone(t.__defaults__),n.__mixins__=t.__mixins__.concat(u),r.__classId__=g++,r.__className__=n.__className__=f?f:"Anonymous",r.__super__=n.__super__=t,r.prototype=n,x.init&&(n.__ctor__=x.init);for(o in m)m.hasOwnProperty(o)&&(n[i+o]=r[i+o]=m[o]);for(a.each(u,function(b){var f=b.prototype;a.each(b.__events__,function(a){c(n,a)}),a.each(b.__properties__,function(a){d(n,a,f[a].__meta__)}),a.each(b.__methods__,function(a){"init"!==a&&"dispose"!==a&&e(n,a,f[a])})}),p=0,q=v.length;q>p;p++)c(n,v[p]);for(o in w)w.hasOwnProperty(o)&&d(n,o,w[o]);for(o in x)x.hasOwnProperty(o)&&e(n,o,x[o]);for(o in z)z.hasOwnProperty(o)&&(r[o]=z[o]);r.__ctor__=n.__ctor__,r.__events__=n.__events__,r.__properties__=n.__properties__,r.__methods__=n.__methods__,r.__defaults__=n.__defaults__,r.__mixins__=n.__mixins__}return f&&a.path(l,f,r),k[r.__classId__]=r,r}var g=1,h=1,i="@",j="on",k={},l=a.global,m=b.prototype={constructor:b,dispose:function(){this.__listeners__={}},destroy:function(){this.dispose()},inherited:function(){var a=this.inherited.caller.__super__;return a?a.apply(this,arguments):void 0},is:function(b){if("string"==typeof b&&(b=a.path(l,b)),b){if(this instanceof b)return!0;for(var c=this.__mixins__,d=0,e=c.length;e>d;d++){var f=c[d];if(b===f)return!0}}return!1},has:function(a){var b=this[a];return b&&"property"==b.__type__},get:function(a){var b=this[a];return void 0!==b?"property"==b.__type__?b.call(this):b:void 0},set:function(a,b){var c=this[a];if(void 0!==c){if("property"==c.__type__)return c.call(this,b);this[a]=b}else this[a]=b},gets:function(){var b={};return a.each(this.__properties__,function(a){b[a]=this.get(a)},this),b},sets:function(a){if(a)for(var b in a)a.hasOwnProperty(b)&&this.set(b,a[b])},can:function(a){var b=this[j+a];return b&&"event"==b.__type__},on:function(a,b,c){var d=this.__listeners__,e=d[a]=d[a]||[{owner:null,handler:null,context:null}],f={owner:this,handler:b,context:c||this};return e.push(f),{release:function(){var a=e.indexOf(f);a>=0&&e.splice(a,1)}}},off:function(a,b,c){var d,e=this.__listeners__[a];if(e)if(b){c=c||this;for(var f=0,g=e.length;g>f;f++)if(d=e[f],d.handler==b&&d.context==c){e.splice(f,1);break}}else e.length=1},upon:function(a,b,c){var d=this.__listeners__,e=d[a]=d[a]||[{owner:null,handler:null,context:null}];e[0]={owner:this,handler:b,context:c}},fire:function(a,b){var c,d,e,f,g,h=this.__listeners__[a];for(g=h?h.slice():[],c=0,d=g.length;d>c;c++)if(e=g[c],e&&e.handler&&(h[c]===e||h.indexOf(e)>=0)&&(f=e.handler.call(e.context,e.owner,b),f===!1))return!1},__is__:function(a){return this.is(a)},__has__:function(a){return this.has(a)},__get__:function(a){return this.get(a)},__set__:function(a,b){return this.set(a,b)},__gets__:function(){return this.gets()},__sets__:function(a){return this.sets(a)}};b.__classId__=m.__classId__=0,b.__className__=m.__className__="nx.Object",b.__events__=m.__events__=[],b.__properties__=m.__properties__=[],b.__methods__=m.__methods__=[],b.__defaults__=m.__defaults__={},b.__mixins__=m.__mixins__=[],b.extendEvent=c,b.extendProperty=d,b.extendMethod=e,a.Object=b,a.define=f,a.classes=k}(nx),function(a){var b=a.keyword=a.keyword||{binding:function(b,c,d){var e=!1;return"string"!=typeof b&&(e=!!b.context,c=b.callback,d=b.async,b=b.source),new a.keyword.internal.Keyword({type:"binding",context:e,source:b,async:d,callback:c})},internal:{idle:function(){},watch:function(){var c=function(c,d,e,f){function g(i,j){if(i&&jj;j++){var l=h[j].split("=");g[l[0]]=l[1]}g.target=this,g.targetPath=b,g.sourcePath=i,g.source=e,g.converter&&(g.converter=c.converters[g.converter]||a.path(window,g.converter))}else g=a.clone(d),g.target=this,g.targetPath=b,g.source=g.source||this;f&&f.destroy(),this.__bindings__[b]=new c(g)},clearBinding:function(a){var b=this.__bindings__[a];b&&(b.destroy(),this.__bindings__[a]=null)},_watch:function(b,c,d){var e=this.__watchers__,f=e[b]=e[b]||[],g=this[b],h={owner:this,handler:c,context:d};if(f.push(h),g&&"property"==g.__type__&&!g._watched){var i=g.__setter__,j=g.getMeta("dependencies"),k=g.getMeta("equalityCheck");a.each(j,function(a){this.watch(a,function(){this.notify(b)},this)},this),g.__setter__=function(a,c){var d=this.get(b);return(d!==a||c&&c.force||k===!1)&&i.call(this,a,c)!==!1?this.notify(b,d):!1},g._watched=!0}return{affect:function(){var a=h.owner.get(b);h&&h.handler&&h.handler.call(h.context||h.owner,b,a,a,h.owner)},release:function(){var a=f.indexOf(h);a>=0&&f.splice(a,1)}}},_unwatch:function(a,b,c){var d,e=this.__watchers__,f=e[a];if(f)if(b){for(var g=0,h=f.length;h>g;g++)if(d=f[g],d.handler==b&&d.context==c){f.splice(g,1);break}}else f.length=0},_notify:function(a,b){var c,d,e,f=this.__watchers__[a];for(e=f?f.slice():[],c=0;c=0)&&d.handler.call(d.context||d.owner,a,this.get(a),b,d.owner)}}}),c=a.define("nx.Binding",b,{statics:{converters:{"boolean":{convert:function(a){return!!a},convertBack:function(a){return!!a}},inverted:{convert:function(a){return!a},convertBack:function(a){return!a}},number:{convert:function(a){return Number(a)},convertBack:function(a){return a}}},format:function(a,b){return a?a.replace("{0}",b):""}},properties:{target:{value:null},targetPath:{value:""},sourcePath:{value:""},source:{get:function(){return this._source},set:function(a){this._initialized&&this._source!==a&&(this._rebind(0,a),"<"==this._direction[0]&&this._updateTarget(),this._source=a)}},bindingType:{value:"auto"},direction:{value:"auto"},trigger:{value:"auto"},format:{value:"auto"},converter:{value:"auto"}},methods:{init:function(b){if(this.sets(b),b.target){var d,e=this.target(),f=this.targetPath(),g=this.sourcePath(),h=this.bindingType(),i=this.direction(),j=this.format(),k=this.converter(),l=e[f],m=this._watchers=[],n=this._keys=g.split("."),o=0,p=n.length,q=this;if(l){var r=l.__meta__.binding;"auto"==h&&(h=l.__type__),"auto"==i&&(i=this._direction=r&&r.direction||"<-"),"auto"==j&&(j=r&&r.format),"auto"==k&&(k=r&&r.converter)}else"auto"==h&&(h=e.can(f)?"event":"property"),"auto"==i&&(i=this._direction="<-"),"auto"==j&&(j=null),"auto"==k&&(k=null);if(k&&a.is(k,"Function")&&(k={convert:k,convertBack:function(a){return a}}),"<"==i[0])for(;p>o;o++)m.push({key:n[o],handler:function(a){return function(b,c){q._rebind(a,c),q._updateTarget()}}(o+1)});"event"==h?(d=m[p-1].key,m.length--,this._updateTarget=function(){var a=this._actualValue;a&&e.upon(f,a[d],a)}):this._updateTarget=function(){var b=this._actualValue;k&&(b=k.convert.call(this,b)),j&&(b=c.format(j,b)),a.path(e,f,b)},">"==i[1]&&e.watch&&"method"===e.watch.__type__&&e.watch(f,this._onTargetChanged=function(b,c){var d=c;k&&(d=k.convertBack.call(this,d)),a.path(this.source(),g,d)},this),this._initialized=!0,this.source(b.source)}},dispose:function(){this._target;this._rebind(0,null)},_rebind:function(a,b){for(var c,d=this._watchers,e=b,f=a,g=d.length;g>f;f++){var h=d[f],i=h.key,j=h.handler;c=h.source,c&&c.unwatch&&"method"===c.unwatch.__type__&&c.unwatch(i,j,this),h.source=e,e&&(e.watch&&"method"===e.watch.__type__&&e.watch(i,j,this),e=e.get?e.get(i):e[i])}this._actualValue=e}}})}(nx),function(a){var b=a.define("nx.data.Counter",{events:["change","increase","decrease"],methods:{init:function(){this._nummap={},this._strmap={},this._objmap=[],this._nxomap={},this._null=0,this._true=0,this._false=0,this._undefined=0},getCount:function(a){if("[object Null]"!==Object.prototype.toString.call(null)){if(null===a)return this._null;if(void 0===a)return this._undefined}switch(Object.prototype.toString.call(a)){case"[object Null]":return this._null;case"[object Boolean]":return a?this._true:this._false;case"[object Undefined]":return this._undefined;case"[object Number]":return this._nummap[a]||0;case"[object String]":return this._strmap[a]||0;default:return a.__id__?this._nxomap[a.__id__]||0:b.getArrayMapValue(this._objmap,a)||0}},setCount:function(a,c){"[object Null]"!==Object.prototype.toString.call(null)&&(null===a?this._null=c:void 0===a&&(this._undefined=c));var d=this.getCount(a);if(d===c)return c;switch(Object.prototype.toString.call(a)){case"[object Null]":this._null=c;break;case"[object Boolean]":a?this._true=c:this._false=c;break;case"[object Undefined]":this._undefined=c;break;case"[object Number]":this._nummap[a]=c;break;case"[object String]":this._strmap[a]=c;break;default:a.__id__?this._nxomap[a.__id__]=c:b.setArrayMapValue(this._objmap,a,c)}var e={item:a,previousCount:d,count:c};return d>c?this.fire("decrease",e):this.fire("increase",e),this.fire("change",e),c},increase:function(a,b){return b=arguments.length>1?Math.floor(1*b||0):1,this.setCount(a,this.getCount(a)+b)},decrease:function(a,b){return b=arguments.length>1?Math.floor(1*b||0):1,this.setCount(a,this.getCount(a)-b)},__addArrayItem:function(a){this._arrcache.push(a)},__removeArrayItem:function(a){var b=this._arrcache.indexOf(a);this._arrcache.splice(b,1)},__getArrayCounter:function(b){var c=0;return a.each(this._arrcache,function(a){b===a&&c++}),c}},statics:{_getArrayMapItem:function(a,b){return a.filter(function(a){return a.key===b})[0]},getArrayMapValue:function(a,c){return(b._getArrayMapItem(a,c)||{}).value},setArrayMapValue:function(a,c,d){var e=b._getArrayMapItem(a,c);return e?e.value=d:a.push({key:c,value:d}),d}}})}(nx),function(a){var b=a.Iterable,c=a.define("nx.data.Collection",b,{properties:{count:{get:function(){return this._data.length},set:function(){throw new Error("Unable to set count of Collection")}},length:{get:function(){return this._data.length},set:function(){throw new Error("Unable to set length of Collection")}},unique:{set:function(a){if(!!this._unique!=!!a&&(this._unique=!!a,a)){var b,c=this._data,d=c.length;for(b=d-1;b>0;b--)this.indexOf(c[b])=0;c--)(this.indexOf(e[c])>=0||e.indexOf(e[c])=0?(b._data.splice(c,1),c):-1};if(arguments.length>1){var d,e=[];for(d=arguments.length-1;d>=0;d--)e.unshift(c(arguments[d]));return e}return c(a)},removeAt:function(a){return this._data.splice(a,1)[0]},insert:function(a,b){return this._unique&&-1!=this.indexOf(a)?null:(this._data.splice(b,0,a),a)},insertRange:function(a,c){var d,e=this._data,f=b.toArray(a).slice();if(this._unique)for(d=f.length-1;d>=0;d--)(this.indexOf(f[d])>=0||f.indexOf(f[d])d;d++)if(0===a.compare(c[d],b))return d;return-1},lastIndexOf:function(b){var c=this._data;if(c.lastIndexOf)return c.lastIndexOf(b);for(var d=c.length-1;d>=0;d--)if(0===a.compare(c[d],b))return d;return-1},contains:function(a){return this.indexOf(a)>=0},toggle:function(a,b){arguments.length<=1?this.contains(a)?this.remove(a):this.add(a):b?this.add(a):this.remove(a)},sort:function(a){return this._data.sort(a)},each:function(b,c){a.each(this._data,b,c)},toArray:function(){return this._data.slice(0)}}})}(nx),function(a){{var b=a.Iterable,c=a.define({properties:{key:{},value:{set:function(a){this._dict?this._dict.setItem(this._key,a):this._value=a}}},methods:{init:function(a,b){this._dict=a,this._key=b}}}),d=a.define(b,{methods:{init:function(a){this._dict=a},each:function(a,b){this._dict.each(function(c){a.call(b,c.key())})}}}),e=a.define(b,{methods:{init:function(a){this._dict=a},each:function(a,b){this._dict.each(function(c){a.call(b,c.value())})}}});a.define("nx.data.Dictionary",b,{properties:{count:{get:function(){return this._items.length}},keys:{get:function(){return this._keys}},values:{get:function(){return this._values}}},methods:{init:function(a){this._map={},this._items=[];this.setItems(a),this._keys=new d(this),this._values=new e(this)},contains:function(a){return a in this._map},getItem:function(a){var b=this._map[a];return b&&b._value},setItem:function(a,b){var d=this._map[a];return d||(d=this._map[a]=new c(this,""+a),this._items.push(d)),d._value=b,d},setItems:function(b){b&&a.each(b,function(a,b){this.setItem(b,a)},this)},removeItem:function(a){var b=this._map;if(a in b){var c=b[a],d=this._items.indexOf(c);return delete b[a],d>=0&&this._items.splice(d,1),c._dict=null,c}},clear:function(){var b=this._items.slice();return this._map={},this._items=[],a.each(b,function(a){a._dict=null}),b},each:function(b,c){c=c||this,a.each(this._map,function(a,d){b.call(c,a,d)})},toArray:function(){return this._items.slice()},toObject:function(){var a={};return this.each(function(b){a[b.key()]=b.value()}),a}}})}}(nx),function(a){a.define("nx.data.ObservableObject",a.Observable,{methods:{init:function(a){this.inherited(),this._data=a||{}},dispose:function(){this.inherited(),this._data=null},has:function(a){var b=this[a];return b&&"property"==b.__type__||a in this._data},get:function(a){var b=this[a];return void 0===b?this._data[a]:"property"==b.__type__?b.call(this):void 0},set:function(a,b){var c=this[a];if(void 0===c){if(this._data[a]!==b)return this._data[a]=b,this.notify(a),!0}else if("property"==c.__type__)return c.call(this,b)},gets:function(){var b=a.clone(this._data);return a.each(this.__properties__,function(a){b[a]=this.get(a)},this),b}}})}(nx),function(a){var b=/^(&&|\|\||&|\||\^|-|\(|\)|[a-zA-Z\_][a-zA-Z\d\_]*|\s)*$/,c=/&&|\|\||&|\||\^|-|\(|\)|[a-zA-Z\_][a-zA-Z\d\_]*/g,d=/[a-zA-Z\_][a-zA-Z\d\_]*/,e=/&&|\|\||&|\||\^|-|\(|\)/,f={"-":"complement","&":"cross","^":"delta","|":"union","&&":"and","||":"or"},g=a.define("nx.data.ObservableCollection",a.data.Collection,{mixins:a.Observable,events:["change"],methods:{add:function(a){return a=this.inherited(a),this._unique&&null===a||(this.notify("count"),this.notify("length"),this.fire("change",{action:"add",items:[a]})),a},addRange:function(a){var b=this.inherited(a);return b.length&&(this.notify("count"),this.notify("length"),this.fire("change",{action:"add",items:b})),b},insert:function(a,b){return a=this.inherited(a,b),this._unique&&null===a||(this.notify("count"),this.notify("length"),this.fire("change",{action:"add",items:[a],index:b})),a},insertRange:function(a,b){var c=this.inherited(a,b);return c.length&&(this.notify("count"),this.notify("length"),this.fire("change",{action:"add",items:c,index:b})),c},remove:function(a){var b;return arguments.length>1?(a=Array.prototype.slice.call(arguments),b=this.inherited.apply(this,a),b.length&&(this.notify("count"),this.notify("length"),this.fire("change",{action:"remove",items:a,indices:b})),b):(b=this.inherited(a),b>=0&&(this.notify("count"),this.notify("length"),this.fire("change",{action:"remove",items:[a],index:b,indices:[b]})),b)},removeAt:function(a){var b=this.inherited(a);return void 0!==b&&(this.notify("count"),this.notify("length"),this.fire("change",{action:"remove",items:[b],index:a})),b},clear:function(){var a=this.inherited();this.notify("count"),this.notify("length"),this.fire("change",{action:"clear",items:a})},sort:function(a){var b=this.inherited(a);return this.notify("count"),this.notify("length"),this.fire("change",{action:"sort",comparator:a||function(a,b){return a>b?1:b>a?-1:0}}),b},monitor:function(b){var c=this,d={objcache:[],idcache:{},findPair:function(a){var b;for(b=0;b=0&&(n.count+=1*!n.map[a]+1*!!b-1,n.map[a]=b,n.sync())}};return h=j.monitor(n.monitor),{release:function(){f&&f.release(),h.release()}}},_calculate:function(b,c){var d,e,h=this,i=c[0];switch(i){case"&&":e=function(d){var f,g,i,j;return"string"==typeof c[d]?f=h.map().getItem(c[d]):(f=new a.data.ObservableCollection,g=h._calculate(f,c[d])),d>=c.length-1?i=f.monitor(function(a){return b.add(a),function(){b.remove(a)}}):(i=f.watch("length",function(a,b){b?j=e(d+1):j&&(j.release(),j=null)}),i.affect()),{release:function(){j&&j.release(),i&&i.release(),g&&g.release()}}},d=e(1);break;case"||":e=function(d){var f,i,j,k;return"string"==typeof c[d]?f=h.map().getItem(c[d]):(f=new a.data.ObservableCollection,i=h._calculate(f,c[d])),d>=c.length-1?j=f.monitor(g.getCollectionSyncMonitor(b)):(j=f.watch("length",function(a,c){k&&k.release(),k=c?f.monitor(g.getCollectionSyncMonitor(b)):e(d+1)}),j.affect()),{release:function(){k&&k.release(),j&&j.release(),i&&i.release()}}},d=e(1);break;default:e=function(){var d,e,j,k=[],l=[];for(d=1;dd&&e>=f&&b.add(c.item),d>=f&&f>e&&b.remove(c.item)}),h=c[0].monitor(function(a){return d.increase(a,f),function(){d.decrease(a,f)}});return e.push(h),a.each(c,function(a,b){if(b>0){var c=a.monitor(function(a){return d.decrease(a),function(){d.increase(a)}});e.push(c)}}),{release:function(){g.release(),a.each(e,function(a){a.release()})}}},delta:function(b,c){b.clear();var d=!0,e=[];return a.each(c,function(a){var c=a.monitor(function(a){return b.toggle(a),function(){d&&b.toggle(a)}});e.push(c)}),{release:function(){d=!1,a.each(e,function(a){a.release()})}}},or:function(a,b){a.clear();var c,d=!0,e=function(c){var f,g,h=b[c];return f=h.watch("length",function(f,i){g&&g.release(),g=c=0)return c},f=function(a,b,c){return"[object Array]"===Object.prototype.toString.call(b)&&b[0]===a?(b.push(c),b):[a,b,c]};return function(a){"string"==typeof a&&(a=a.match(c)),a=a.concat([")"]);for(var g,h,i,j=[],k=[],l=[];a.length;)if(g=a.shift(),")"===g)for(;(h=j.pop())&&"("!==h;)i=k.pop(),k.push(f(h,k.pop(),i));else if("("===g)j.push(g);else if(g.match(d))k.push(g),-1==l.indexOf(g)&&l.push(g);else if(g.match(e)){for(;j.length;){if(h=j.pop(),"("===h||b(h)>b(g)){j.push(h);break}i=k.pop(),k.push(f(h,k.pop(),i))}j.push(g)}return k[0]&&(k[0].operands=l),k[0]}}()}})}(nx),function(a){var b=a.Observable,c=a.data.Dictionary,d=a.define(b,{properties:{key:{},value:{set:function(a){this._dict?this._dict.setItem(this._key,a):this._value=a}}},methods:{init:function(a,b){this._dict=a,this._key=b}}});a.define("nx.data.ObservableDictionary",c,{mixins:b,events:["change"],methods:{setItem:function(a,b){var c,e=this._map,f=this._items,g=e[a];g?(c=g.value,g._value=b,g.notify("value"),this.fire("change",{action:"replace",items:[g],oldValue:c,newValue:b,oldItem:g,newItem:g})):(g=e[a]=new d(this,a),f.push(g),g._dict=this,g._value=b,this.notify("count"),this.fire("change",{action:"add",index:f.length-1,items:[g]}))},removeItem:function(a){var b=this._map;if(a in b){var c=b[a],d=this._items.indexOf(c);return delete b[a],d>=0&&this._items.splice(d,1),c._dict=null,this.notify("count"),this.fire("change",{action:"remove",items:[c]}),c}},clear:function(){var a=this.inherited();this.notify("count"),this.fire("change",{action:"clear",items:a})},monitor:function(a,b){if("string"==typeof a&&a.indexOf(",")>=0||"[object Array]"===Object.prototype.toString.call(a))return"string"==typeof a&&(a=a.replace(/\s/g,"").split(",")),this._monitor(a,b);"function"==typeof a&&(b=a,a=null);var c=this,d={map:{},get:function(a){return d.map[a]},set:function(b,c){if(!a||a===b){var e=d.get(b);e&&e(),c?d.map[b]=c:delete d.map[b]}},release:function(){var a,b=d.map;for(a in b)b[a]()},callback:function(c,d){return a?a===c?b(d):void 0:b(c,d)}},e=c.on("change",function(a,b){var c,e,f,g;switch(b.action){case"replace":case"add":for(c=0;c=0&&(d.values[e]=item.value(),f=!0);f&&d.affect()});return{affect:d.affect,release:e.release}}}})}(nx),function(a){{var b=a.Iterable,c=Array.prototype,d=c.every,e=c.some,f=c.filter,g=c.map,h=c.reduce;a.define("nx.data.Query",a.Iterable,{methods:{init:function(a){this._iter=a,this.reset()},reset:function(){this._where=null,this._orderBy=null,this._unions=[],this._joins=[],this._begin=0,this._end=null},where:function(a){return this._where=a,this},orderBy:function(b,c){return this._orderBy=a.is(b,"Function")?c?function(a,c){return b(c,a)}:b:c?function(c,d){return a.compare(a.path(d,b),a.path(c,b))}:function(c,d){return a.compare(a.path(c,b),a.path(d,b))},this},groupBy:function(){throw new Error("Not Implemented")},distinct:function(){throw new Error("Not Implemented")},skip:function(a){return this._begin=a,this._end&&(this._end+=a),this},take:function(a){return this._end=this._begin+a,this},join:function(){throw this._join=function(){},new Error("Not Implemented")},select:function(b){var c=this.toArray();return a.is(b,"Function")?g.call(c,b):a.is(b,"String")?g.call(c,function(c){return a.path(c,b)}):a.is(b,"Array")?g.call(c,function(c){var d={};return a.each(b,function(b){a.path(d,b,a.path(c,b))}),d}):c},first:function(a){var b=this.toArray();if(!a)return b[0];for(var c=0,d=b.length;d>c;c++){var e=b[c];if(a(e))return e}},last:function(a){var b=this.toArray();if(!a)return b[b.length-1];for(var c=b.length-1;c>=0;c--){var d=b[c];if(a(d))return d}},all:function(a){return d.call(this.toArray(),a)},any:function(a){return e.call(this.toArray(),a)},max:function(){return h.call(this.toArray(),function(a,b){return a>b?a:b})},min:function(){return h.call(this.toArray(),function(a,b){return b>a?a:b})},sum:function(){return h.call(this.toArray(),function(a,b){return a+b})},average:function(){var a=this.toArray();return h.call(a,function(a,b){return a+b})/a.length},toArray:function(){var c=b.toArray(this._iter);return a.each(this._unions,function(a){c.concat(b.toArray(a))}),this._where&&(c=f.call(c,this._where)),this._orderBy&&(c=c.sort(this._orderBy)),c=this._end>0?c.slice(this._begin,this._end):c.slice(this._begin),this.reset(),c}},statics:{query:function(){var b,c={publics:{select:function(b,c){var d=[];if(a.is(b,"Array")&&a.is(c,"Function")){var e,f;for(e=0;e1?d:d[0]):(f=d.map,g=d.aggregate),"string"==typeof f&&(f=f.replace(/\s/g,"").split(",")),a.is(f,"Array")&&f[0]&&"string"==typeof f[0]&&(f=function(a){return function(b){var c,d={};for(c=0;cc[e])return f?-1:1;if(c[e]>b[e])return f?1:-1}return 0}}(c)),c&&"function"==typeof c&&b.sort(c),b}},query:function(a,b){return 1==arguments.length&&(b=a,a=b.array),a?(b.select&&(a=c.publics.select(a,b.select)),b.aggregate&&(a=c.privates.aggregate(a,b.aggregate)),b.mapping&&(a=c.privates.mapping(a,b.mapping)),b.orderby&&(a=c.privates.orderby(a,b.orderby)),a):a}};for(b in c.publics)c.query[b]=c.publics[b];return c.query}()}})}}(nx),function(a){a.define("nx.data.SortedMap",{mixins:a.Observable,events:["change"],properties:{length:{get:function(){return this._data.length}}},methods:{init:function(b){b=b||[];var c=this.__validateData(b);if(!c)throw Error("init data are invalid!");this._data=b,this._map={};var d=this;a.each(b,function(a){var b=d._map;b[a.key]=a})},__validateData:function(b){var c=!0;return a.is(b,"Array")?a.each(b,function(a){return void 0===a.key||void 0===a.value?(c=!1,!1):void 0}):c=!1,c},add:function(a,b,c){var d={key:a,value:b};return this._map[a]=d,void 0===c&&(c=this._data.length),this._data.splice(c,0,d),this.notify("length"),this.fire("change",{action:"add",index:c,key:a,value:b}),b},remove:function(a){var b,c;if(c=this._map[a],void 0!==c){var d=this._data.indexOf(c);if(!(d>-1))throw'key:"'+a+'" has been found in the _map but not exists in the _data!';b=c.value,this._data.splice(d,1),delete this._map[a],this.notify("length"),this.fire("change",{action:"remove",index:d,key:a,value:b})}return b},removeAt:function(a){var b,c=this.__getItemAt(a);return void 0!==c&&(b=c.value,this._data.splice(a,1),delete this._map[c.key],this.notify("length"),this.fire("change",{action:"remove",index:a,key:c.key,value:b})),b},__getItemAt:function(a){var b=this._data[a>-1?a:this._data.length+a];return b},getKeyAt:function(a){var b,c=this.__getItemAt(a);return c&&(b=c.key),b},indexOf:function(a){var b=this._map[a],c=-1;return void 0!==b&&(c=this._data.indexOf(b)),c},getValue:function(a){var b,c=this._map[a];return void 0!==c&&(b=c.value),b},setValue:function(a,b){var c=this._map[a];if(void 0===c)throw Error('the key:"'+a+'" dos not exists!');var d=c.value,e=this._data.indexOf(c);return c.value=b,this.fire("change",{action:"set",index:e,key:a,value:b,oldValue:d}),b},getValueAt:function(a){var b,c=this.__getItemAt(a);return void 0!==c&&(b=c.value),b},setValueAt:function(a,b){var c=this.__getItemAt(a);if(void 0!==c){var d=c.value;c.value=b,this.fire("change",{action:"set",index:a,key:c.key,value:b,oldValue:d})}return b},setIndex:function(a,b){var c=this.indexOf(a),d=!0;if(-1!=c&&b!==c){var e=this._data.splice(c,1);this._data.splice(b,0,e[0]),this.fire("change",{action:"reorder",index:b,oldIndex:c,key:a})}else d=!1;return d},sort:function(a){this._data.sort(function(b,c){return a.call(null,b.key,b.value,c.key,c.value)})},toArray:function(){for(var b=this._data.slice(0),c=0,d=b.length;d>c;c++)b[c]=a.clone(b[c]);return b},each:function(a){for(var b=this.toArray(),c=0,d=b.length;d>c;c++){var e=b[c];a.call(this,e.key,e.value,c)}},__each__:function(a){for(var b=this.toArray(),c=0,d=b.length;d>c;c++){var e=b[c];a.call(this,e.key,e.value)}}}})}(nx),function(a){function b(a){var b,c=new RegExp(a+"(\\d+\\.\\d+)");return(b=c.exec(j))?parseFloat(b[1]):0}var c,d=a.global,e=d.document,f=e.documentMode||0,g=e.compatMode,h=d.navigator,i=d.location,j=h.userAgent.toLowerCase(),k=i.protocol.toLowerCase(),l=e.createElement("div"),m=l.style,n=(c=j.match(/msie (\d+)\./))&&c[1];m.cssText="opacity:.55";var o={webkit:["webkit","-webkit-"],gecko:["Moz","-moz-"],presto:["O","-o-"],trident:["ms","-ms-"]},p={windows:/windows|win32/,macintosh:/macintosh|mac_powerpc/,linux:/linux/},q={addEventListener:!!e.addEventListener,dispatchEvent:!!e.dispatchEvent,getBoundingClientRect:!!e.documentElement.getBoundingClientRect,onmousewheel:"onmousewheel"in e,XDomainRequest:!!d.XDomainRequest,crossDomain:!(!d.XDomainRequest&&!d.XMLHttpRequest),getComputedStyle:"getComputedStyle"in d,iePropertyChange:!!(n&&9>n),w3cChange:!n||n>8,w3cFocus:!n||n>8,w3cInput:!n||n>9,innerText:"innerText"in l,firstElementChild:"firstElementChild"in l,cssFloat:"cssFloat"in m,opacity:/^0.55$/.test(m.opacity),filter:"filter"in m,classList:!!l.classList,removeProperty:"removeProperty"in m,touch:"ontouchstart"in e.documentElement},r={firefox:function(){return{name:"gecko",version:b("rv:")}},opera:function(){var a=b("presto\\/"),c="presto";return a||(c="webkit",a=b("webkit\\/")),{name:c,version:a}},ie:function(){return{name:"trident",version:b("trident\\/")||4}},"default":function(){return{name:"webkit",version:b("webkit\\/")}}},s=function(){var a;for(a in p)if(p[a].test(j))break;return{name:a}}(),t=function(){var a,c,d,e,f=0;for(a in u)if(c=u[a],d=new RegExp(c.is).test(j),e=new RegExp(c.exclude).test(j),d&&!e){j.indexOf("opr/")>-1&&(a="opera",c.version="\\bopr/"),f=b(c.version);break}return{name:a,version:f}}(),u={ie:{is:"msie",exclude:"opera",version:"msie "},firefox:{is:"gecko",exclude:"webkit",version:"\\bfirefox/"},chrome:{is:"\\bchrome\\b",exclude:null,version:"\\bchrome/"},safari:{is:"safari",exclude:"\\bchrome\\b",version:"version/"},opera:{is:"opera",exclude:null,version:"version/"}},v={BACKSPACE:8,TAB:9,CLEAR:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,META:"chrome"===t.name||"webkit"===t.name||"safari"===t.name?91:224,PAUSE:19,CAPS_LOCK:20,ESCAPE:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,INSERT:45,DELETE:46,HELP:47,LEFT_WINDOW:91,RIGHT_WINDOW:92,SELECT:93,NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,NUMPAD_MULTIPLY:106,NUMPAD_PLUS:107,NUMPAD_ENTER:108,NUMPAD_MINUS:109,NUMPAD_PERIOD:110,NUMPAD_DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,NUM_LOCK:144,SCROLL_LOCK:145},w=(r[t]||r["default"])();a.define("nx.Env",{"static":!0,properties:{documentMode:{value:f},compatMode:{value:g},userAgent:{value:j},strict:{value:"CSS1Compat"===g},secure:{value:0===k.indexOf("https")},os:{value:s},prefix:{value:o[w.name]},engine:{value:w},browser:{value:t},keyMap:{value:v}},methods:{support:function(a){return q[a]},getSupportMap:function(){return q},registerSupport:function(a,b){a in q||(q[a]=b)}}})}(nx),function(a){var b=a.global,c=b.document,d=a.Env,e=c.createElement("div"),f=e.style,g=/width|height|top|right|bottom|left|size|margin|padding/i,h=/[c-x%]/,i="px",j=/(?:^|-)([a-z])/g,k=/([A-Z])/g,l={lineHeight:!0,zIndex:!0,zoom:!0},m={"float":"cssFloat"},n={},o={};a.ready=function(c){var d;if("string"==typeof c&&(c=a.path(b,c)),"function"==typeof c){if(c.__classId__){var e=a.define(a.ui.Application,{properties:{comp:{value:function(){return new c}}},methods:{start:function(){this.comp().attach(this)},stop:function(){this.comp().detach(this)}}});d=function(){var a=new e;a.start()}}else d=c;window.addEventListener("load",d)}};a.define("nx.Util",{"static":!0,methods:{getCssText:function(b){var c=[""];return a.each(b,function(a,b){c.push(this.getStyleProperty(b,!0)+":"+this.getStyleValue(b,a))},this),c.join(";")},getStyleValue:function(a,b){var c=this.getStyleProperty(a),d=b;return g.test(c)&&(h.test(b)||l[c]||(d+=i)),d},getStyleProperty:function(a,b){if(b){if(a in o)return o[a]}else if(a in n)return n[a];var c=m[a]||this.lowerCamelCase(a);return c in f?b&&(c=this.deCamelCase(a),o[a]=c):b?(c=d.prefix()[1]+a,o[a]=c):(c=d.prefix()[0]+this.upperCamelCase(a),n[a]=c),c},lowerCamelCase:function(a){var b=this.upperCamelCase(a);return b.charAt(0).toLowerCase()+b.substring(1)},upperCamelCase:function(a){return a.replace(j,function(a,b){return b.toUpperCase()})},deCamelCase:function(a){return a.replace(k,function(a,b){return"-"+b.toLowerCase()})},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)}}})}(nx),function(a){{var b=a.data.Collection;a.define("nx.dom.Node",{methods:{init:function(a){this.$dom=a},compare:function(a){return a&&this.$dom===a.$dom?0:-1},isElement:function(){return 1===this.$dom.nodeType},index:function(){var a,b=0;if(null!==this.parentNode())for(;null!==(a=this.previousSibling());)++b;else b=-1;return b},childAt:function(a){var b=null;if(a>=0)for(b=this.firstChild();b&&--a>=0;){b=b.nextSibling();break}return b},contains:function(a){return this.$dom&&this.$dom.contains(a.$dom)},firstChild:function(){return new this.constructor(this.$dom.firstElementChild)},lastChild:function(){return new this.constructor(this.$dom.lastElementChild)},previousSibling:function(){return new this.constructor(this.$dom.previousElementSibling)},nextSibling:function(){return new this.constructor(this.$dom.nextElementSibling)},parentNode:function(){return new this.constructor(this.$dom.parentNode)},children:function(){var c=new b;return a.each(this.$dom.children,function(a){c.add(new this.constructor(a))},this),c},cloneNode:function(a){return new this.constructor(this.$dom.cloneNode(a))},hasChild:function(a){return a.$dom.parentNode==this.$dom},appendChild:function(a){this.$dom.appendChild(a.$dom)},insertBefore:function(a,b){this.$dom.insertBefore(a.$dom,b.$dom)},removeChild:function(a){this.hasChild(a)&&this.$dom.removeChild(a.$dom)},empty:function(){this.children().each(function(a){this.removeChild(a)},this)}}})}}(nx),function(a){a.define("nx.dom.Text",a.dom.Node)}(nx),function(a){function b(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")}var c=a.global,d=c.document,e=a.Env,f=a.Util,g=/^t(?:able|d|h)$/i,h=/\s+/,i={thin:"2px",medium:"4px",thick:"6px"},j="gecko"===e.engine().name,k="margin",l="padding",m="border",n="position",o="fixed",p=a.data.Collection,q={value:{set:function(a,b){var c=a.type;switch(c){case"checkbox":case"radio":a.checked=!!b;break;default:a.value=b}},get:function(a){var b=a.type,c=a.value;switch(b){case"checkbox":case"radio":c=!!a.checked;break;default:c=a.value}return c}}},r={"class":"className","for":"htmlFor"},s={disabled:"disabled",readonly:"readonly",checked:"checked"};!function(){a.each(r,function(a,b){q[b]={set:function(b,c){b[a]=c},get:function(b){return b[a]}}}),a.each(s,function(a,b){q[b]={set:function(c,d){d?c.setAttribute(b,b):c.removeAttribute(b),c[a]=!!d},get:function(b){return!!b[a]}}})}();var t=a.define("nx.dom.Element",a.dom.Node,{methods:{get:function(a){return"text"===a?this.getText():"html"==a?this.getHtml():this.getAttribute(a)},set:function(a,b){"text"===a?this.setText(b):"html"==a?this.setHtml(b):this.setAttribute(a,b)},select:function(a){var b=this.$dom.querySelector(a);return new t(b)},selectAll:function(a){for(var b=this.$dom.querySelectorAll(a),c=0,d=b[c],e=new p;d;c++)d=b[c],e.add(new t(d));return e},focus:function(){this.$dom.focus()},blur:function(){this.$dom.blur()},show:function(){this.setAttribute("nx-status","")},hide:function(){this.setAttribute("nx-status","hidden")},hasClass:function(c){var d=this.$dom;return a.Env.support("classList")?this.$dom.classList.contains(c):b(d,c)>-1},setClass:function(a,b){b?this.addClass(a):this.removeClass(a)},addClass:function(){var b=this.$dom,c=arguments,d=b.classList;if(d){if(a.Env.support("classList"))return 1===c.length&&c[0].search(h)>-1&&(c=c[0].split(h)),d.add.apply(d,c);if(!this.hasClass(c[0])){var e=b.className;return b.className=e?e+" "+c[0]:c[0]}}},removeClass:function(){var c=this.$dom;if(c)if(a.Env.support("classList")){var d=this.$dom.classList;if(d)return d.remove.apply(d,arguments)}else{var e=c.className,f=b(c,arguments[0]),g=arguments[0];f>-1&&(0===f?e!==g&&(g+=" "):g=" "+g,c.className=e.replace(g,""))}},toggleClass:function(b){this.$dom;return a.Env.support("classList")?this.$dom.classList.toggle(b):void(this.hasClass(b)?this.removeClass(b):this.addClass(b))},getDocument:function(){var a=this.$dom,b=d;return a&&(b=9===a.nodeType?a:a.ownerDocument||a.document),b},getWindow:function(){var a=this.getDocument();return a.defaultView||a.parentWindow||c},getRoot:function(){return e.strict()?d.documentElement:d.body},getBound:function(){var a=this.$dom.getBoundingClientRect(),b=this.getRoot(),c=b.clientTop||0,d=b.clientLeft||0;return{top:a.top-c,right:a.right,bottom:a.bottom,left:a.left-d,width:a.width,height:a.height}},margin:function(a){return this._getBoxWidth(k,a)},padding:function(a){return this._getBoxWidth(l,a)},border:function(a){return this._getBoxWidth(m,a)},getOffset:function(){var a=this.$dom.getBoundingClientRect(),b=this.getRoot(),d=b.clientTop||0,e=b.clientLeft||0;return{top:a.top+(c.pageYOffset||b.scrollTop)-d,left:a.left+(c.pageXOffset||b.scrollLeft)-e}},setOffset:function(a){var b=this.getStyle(n),d=a,e={left:Math.max(c.pageXOffset||0,root.scrollLeft),top:Math.max(c.pageYOffset||0,root.scrollTop)};b===o&&(d={left:parseFloat(d)+e.scrollX,top:parseFloat(d)+e.scrollY}),this.setStyles(d)},hasStyle:function(a){var b=this.$dom.style.cssText;return b.indexOf(a+":")>-1},getStyle:function(a,b){var c=f.getStyleProperty(a);if(b)return this.$dom.style[c];var d=getComputedStyle(this.$dom,null);return d[c]||""},setStyle:function(a,b){var c=f.getStyleProperty(a);this.$dom.style[c]=f.getStyleValue(a,b)},removeStyle:function(a){var b=f.getStyleProperty(a,!0);this.$dom.style.removeProperty(b)},setStyles:function(a){this.$dom.style.cssText+=f.getCssText(a)},getAttribute:function(a){var b=q[a];return b?b.get?b.get(this.$dom):this.$dom.getAttribute(b):this.$dom.getAttribute(a)},setAttribute:function(a,b){if(null!==b&&void 0!==b){var c=q[a];return c?c.set?c.set(this.$dom,b):this.$dom.setAttribute(c,b):this.$dom.setAttribute(a,b)}},removeAttribute:function(a){this.$dom.removeAttribute(r[a]||a)},getAttributes:function(){var b={};return a.each(this.$dom.attributes,function(a){b[a.name]=a.value}),b},setAttributes:function(b){a.each(b,function(a,b){this.setAttribute(b,a)},this)},getText:function(){return this.$dom.textContent},setText:function(a){this.$dom.textContent=a},getHtml:function(){return this.$dom.innerHTML},setHtml:function(a){this.$dom.innerHTML=a},addEventListener:function(a,b,c){this.$dom.addEventListener(a,b,c||!1)},removeEventListener:function(a,b,c){this.$dom.removeEventListener(a,b,c||!1)},_getBoxWidth:function(a,b){var c,d,e=this.$dom;switch(a){case l:case k:d=this.getStyle(a+"-"+b),c=parseFloat(d);break;default:d=this.getStyle("border-"+b+"-width"),j&&g.test(e.tagName)&&(d=0),c=parseFloat(d)||i[d]}return c||0}}})}(nx),function(a){var b=a.data.Collection;a.define("nx.dom.Fragment",a.dom.Node,{methods:{children:function(){var c=new b;return a.each(this.$dom.childNodes,function(a){c.add(new this.constructor(a))},this),c}}})}(nx),function(a){var b=a.dom.Element,c=a.dom.Fragment,d=a.dom.Text,e=a.global,f=e.document,g=a.Util,h={topFrame:null,hasReady:!1,queue:[]},i={setHasReady:function(a){h.hasReady=a},getHasReady:function(){return h.hasReady},addQueue:function(a){h.queue.push(a)},clearQueue:function(){h.queue.length=0},execQueue:function(){for(var a=0,b=h.queue.length;b>a;a++)h.queue[a]()},setTopFrame:function(a){h.topFrame=a},getTopFrame:function(){return h.topFrame}},j={initReady:function(a){return i.addQueue(a),j.isReady()},fireReady:function(){i.execQueue(),i.clearQueue()},setTopFrame:function(){try{i.setTopFrame(null===e.frameElement&&f.documentElement)}catch(a){}},doScrollCheck:function(){var a=i.getTopFrame();if(a&&a.doScroll){try{a.doScroll("left")}catch(b){return setTimeout(j.doScrollCheck,50)}j.fireReady()}},isOnLoad:function(a){return"load"===(a||e.event).type},isReady:function(){return i.getHasReady()||"complete"===f.readyState},detach:function(){f.addEventListener?(f.removeEventListener("DOMContentLoaded",j.completed,!1),e.removeEventListener("load",j.completed,!1)):(f.detachEvent("onreadystatechange",j.completed),e.detachEvent("onload",j.completed))},w3cReady:function(){f.addEventListener("DOMContentLoaded",j.completed,!1),e.addEventListener("load",j.completed,!1)},ieReady:function(){f.attachEvent("onreadystatechange",j.completed),e.attachEvent("onload",j.completed),j.setTopFrame(),j.doScrollCheck()},readyMain:function(){return"complete"===f.readyState?setTimeout(j.readyMain):void(f.addEventListener?j.w3cReady():j.ieReady())},completed:function(a){(j.isReady()||j.isOnLoad(a))&&(i.setHasReady(!0),j.detach(),j.fireReady())}},k={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},l=a.define("nx.dom.Document",{"static":!0,properties:{cssStyleSheet:{get:function(){var a=this._cssStyleSheet;if(!a){var b=f.getElementById("nx-style")||this._createStyleNode();a=this._cssStyleSheet=this._getCSSStyleSheetInstance(b)}return a}},root:{get:function(){return f.documentElement}},body:{get:function(){return new b(f.body)}},html:{get:function(){return new b(f.getElementsByTagName("html")[0])}}},methods:{init:function(){this.__listeners__={},this._documentListeners={}},on:function(a,b,c){var d=this.__listeners__,e=d[a]=d[a]||[{owner:null,handler:null,context:null}];e.push({owner:this,handler:b,context:c||this}),this._attachDocumentListeners(a);var f;return{release:function(){f.off(a,b,c)}}},off:function(a,b,c){var d,e=this.__listeners__[a];if(e)if(b){c=c||this;for(var f=0,g=e.length;g>f;f++)if(d=e[f],d.handler==b&&d.context==c){e.splice(f,1);break}}else e.length=1},upon:function(a,b,c){var d=this.__listeners__,e=d[a]=d[a]||[{owner:null,handler:null,context:null}];e[0]={owner:this,handler:b,context:c},this._attachDocumentListeners(a)},fire:function(a,b){var c,d,e=this.__listeners__[a];if(e){e=e.slice();for(var f=0,g=e.length;g>f;f++)if(c=e[f],c&&c.handler&&(d=c.handler.call(c.context,c.owner,b),d===!1))return!1}},registerNS:function(a,b){k[a]=b},resolveNS:function(a){return k[a]},createFragment:function(){return new c(f.createDocumentFragment())},createElement:function(a){return new b(f.createElement(a))},createText:function(a){return new d(f.createTextNode(a))},createElementNS:function(a,c){var d=l.resolveNS(a);if(d)return new b(f.createElementNS(d,c));throw new Error("The namespace "+a+" is not registered.")},wrap:function(b){return a.is(b,Node)?b:void 0},docRect:function(){var a=this.root(),b=e.innerHeight||0,c=e.innerWidth||0,d=a.scrollWidth,f=a.scrollHeight,g={left:Math.max(e.pageXOffset||0,a.scrollLeft),top:Math.max(e.pageYOffset||0,a.scrollTop)};return d=Math.max(d,c),f=Math.max(f,b),{width:c,height:b,scrollWidth:d,scrollHeight:f,scrollX:g.left,scrollY:g.top}},ready:function(a){j.initReady(a)?setTimeout(j.fireReady,1):j.readyMain()},addRule:function(a,b,c){return this._ruleAction("add",[a,b,c])},insertRule:function(a,b){return this._ruleAction("insert",[a,b])},deleteRule:function(a){return this._ruleAction("delete",[a])},removeRule:function(a,b){return this._ruleAction("remove",[a,b])},addRules:function(b){a.each(b,function(a,b){this.addRule(b,g.getCssText(a),null)},this)},deleteRules:function(){for(var a=this.cssStyleSheet().rules.length;a--;)this.deleteRule(0)},_ruleAction:function(a,b){var c=this.cssStyleSheet(),d=b.length-1;return b[d]=this._defRuleIndex(c,b[d]),c[a+"Rule"].apply(c,b),this._defRuleIndex(c,null)},_defRuleIndex:function(a,b){return null===b?a.rules.length:b},_createStyleNode:function(){var a=f.createElement("style");return a.type="text/css",a.id="nx-style",(f.head||f.getElementsByTagName("head")[0]||f.documentElement).appendChild(a),a},_getCSSStyleSheetInstance:function(a){var b,c=f.styleSheets,d=null;for(b in c)if(d=c[b],d.ownerNode===a)break;return d},_attachDocumentListeners:function(a){var b=this._documentListeners;if(!(a in b)){var c=this,d=b[a]=function(b){c.fire(a,b)};f.addEventListener(a,d)}}}})}(nx),function(a){function b(b){if(a.is(b,"String")){var c=b.indexOf("{"),d=b.indexOf("}");if(c>=0&&d>c)return b.slice(c+1,d)}return null}function c(c,d,e,f,h){if(a.is(e,g))c.setBinding(d,a.extend(e.gets(),{bindingType:"property"}));else{var i=b(e);null!==i?"#"===i[0]?c.setBinding(d,i.slice(1)+",bindingType=property",h||c):c.setBinding(d,(i?"model."+i:"model")+",bindingType=property",f||c):c.set(d,e)}}function d(c,d,e,f,h){if(a.is(e,g))c.setBinding(d,e.gets());else{var i=b(e);null!==i?"#"===i[0]?c.setBinding(d,i.slice(1)+",bindingType=event",h||c):c.setBinding(d,(i?"model."+i:"model")+",bindingType=event",f||c):c.on(d,e,h||c)}}function e(b,g){if(b||0===b){var h;if(a.is(b,"Array"))h=new m("fragment"),a.each(b,function(a){e(a,g).attach(h)});else if(a.is(b,"Object")){var i=b.type;if(i){var j=a.is(i,"String")?a.path(f,i):i;if(!a.is(j,"Function"))throw new Error('Component "'+i+'" is not defined.');h=new j}else h=new m(b.tag||"div");var k=b.name,l=b.props,n=b.events,o=b.content;k&&h.register("@name",k),g&&h.owner(g),a.each(n,function(a,b){d(h,b,a,h,g)}),a.each(l,function(b,d){a.is(b,"Array")&&a.each(b,function(b){a.is(b,"Object")&&(b.__owner__=g)}),a.is(b,"Object")&&(b.__owner__=g),c(h,d,b,h,g)}),void 0!==o&&c(h,"content",o,h,g)}else h=new m("text",b);return h}return null}var f=a.global,g=a.Binding,h=a.data.Collection,i=a.dom.Document,j=a.define("nx.ui.AbstractComponent",a.Observable,{"abstract":!0,statics:{createComponent:e},events:["enter","leave","contententer","contentleave"],properties:{content:{get:function(){return this._content},set:function(b){a.each(this._content.toArray(),function(a){a.destroy()}),a.is(b,j)?b.attach(this):a.is(b,"Array")?a.each(b,function(a){e(a,this.owner()).attach(this)},this):(b||0===b)&&e(b,this.owner()).attach(this)}},model:{get:function(){return this._model_was_set?this._model:this._inheritedModel},set:function(b,c){return c&&this._model_was_set?!1:(c?this._inheritedModel=b:(this._model=b,this._model_was_set=!0),void this._content.each(function(c){a.is(c,"String")||c.model(b,!0)}))}},owner:{value:null},parent:{value:null}},methods:{init:function(){this.inherited(),this._resources={},this._content=new h},attach:function(b,c){if(this.detach(),a.is(b,j)){var d=this.resolve("@name"),e=this.owner()||b;d&&e.register(d,this),this.onAttach(b,c),b.onChildAttach(this,c),c>=0?b.content().insert(this,c):b.content().add(this),this.parent(b),this.owner(e),b.fire("contententer",{content:this,owner:e}),this.fire("enter",{parent:b,owner:e}),this._attached=!0}},detach:function(){if(this._attached){var a=this.resolve("@name"),b=this.owner(),c=this.parent();a&&b.unregister(a),this.onDetach(c),c.onChildDetach(this),c.content().remove(this),this.parent(null),this.owner(null),c.fire("contentleave",{content:this,owner:b}),this.fire("leave",{parent:c,owner:b}),this._attached=!1}},register:function(a,b,c){var d=this._resources;(d&&!(a in d)||c)&&(d[a]=b)},unregister:function(a){var b=this._resources;b&&a in b&&delete b[a]},resolve:function(a){var b=this._resources;return b&&a in b?b[a]:void 0},getContainer:function(a){if("fragment"===this.resolve("@tag")){var b=this.parent();if(b)return b.getContainer(a)}return this.resolve("@root")},dispose:function(){this.inherited(),this._content&&this._content.each(function(a){a.dispose()}),this._resources=null,this._content=null,this._model=null,this._inheritedModel=null,this.dispose=function(){}},destroy:function(){this.detach(),this.inherited()},onAttach:function(){},onDetach:function(){},onChildAttach:function(){},onChildDetach:function(){}}}),k=a.define(a.Observable,{methods:{init:function(a){this.inherited(),this._comp=a,this._classList=[]},has:function(a){return a in this._classList},get:function(a){return this._classList[a]},set:function(a,b){this._classList[a]=b,this._comp.resolve("@root").set("class",this._classList.join(" "))},hasClass:function(a){return this._classList.indexOf(a)>=0},addClass:function(a){this.hasClass(a)||(this._classList.push(a),this._comp.resolve("@root").set("class",this._classList.join(" ")))},removeClass:function(a){var b=this._classList.indexOf(a);b>=0&&(this._classList.splice(b,1),this._comp.resolve("@root").set("class",this._classList.join(" ")))},toggleClass:function(a){var b=this._classList.indexOf(a);b>=0?this._classList.splice(b,1):this._classList.push(a),this._comp.resolve("@root").set("class",this._classList.join(" "))},dispose:function(){this.inherited(),this._comp=null,this._classList=null}}}),l=a.define(a.Observable,{methods:{init:function(a){this.inherited(),this._comp=a},get:function(a){return this._comp.resolve("@root").getStyle(a)},set:function(a,b){this._comp.resolve("@root").setStyle(a,b)},dispose:function(){this.inherited(),this._comp=null}}}),m=a.define(j,{"final":!0,events:["generated"],properties:{"class":{get:function(){return this._class},set:function(b){var d=this._class;a.is(b,"Array")?a.each(b,function(a,e){c(d,""+e,a,this,b.__owner__||this.owner())},this):a.is(b,"Object")?(b.add&&this._class.addClass(b.add),b.remove&&this._class.addClass(b.remove),b.toggle&&this._class.addClass(b.toggle)):this.resolve("@root").set("class",b) -}},style:{get:function(){return this._style},set:function(b){if(a.is(b,"Object")){var d=this._style;a.each(b,function(a,e){c(d,e,a,this,b.__owner__||this.owner())},this)}else this.resolve("@root").set("style",b)}},template:{get:function(){return this._template},set:function(a){this._template=a,this._generateContent()}},items:{get:function(){return this._items},set:function(a){var b=this._items;b&&b.off&&b.off("change",this._onItemsChange,this),b=this._items=a,b&&b.on&&b.on("change",this._onItemsChange,this),this._generateContent()}},value:{get:function(){return this.resolve("@root").get("value")},set:function(a){return this.resolve("@root").set("value",a)},binding:{direction:"<>"}},states:{value:null},dom:{get:function(){return this.resolve("@root")}}},methods:{init:function(a,b){if(this.inherited(),this._domListeners={},this._resources={},this._content=new h,this._class=new k(this),this._style=new l(this),a){var c=a.split(":");if(2===c.length){var d=c[0];a=c[1],this.register("@ns",d),this.register("@root",i.createElementNS(d,a))}else"text"===a?this.register("@root",i.createText(b)):"fragment"===a?this.register("@root",i.createFragment()):this.register("@root",i.createElement(a));this.register("@tag",a)}switch(a){case"input":case"textarea":this.on("change",function(a,b){switch(b.target.type){case"checkbox":case"radio":this.notify("checked");break;default:this.notify("value")}},this),this.on("input",function(){this.notify("value")},this);break;case"select":this.on("change",function(){this.notify("selectedIndex"),this.notify("value")},this)}},get:function(a){return this.has(a)||a.indexOf(":")>=0?this.inherited(a):this.resolve("@root").get(a)},set:function(a,b){this.has(a)||a.indexOf(":")>=0?this.inherited(a,b):(this.resolve("@root").set(a,b),this.notify(a))},on:function(a,b,c){return this._attachDomListener(a),this.inherited(a,b,c)},upon:function(a,b,c){return this._attachDomListener(a),this.inherited(a,b,c)},dispose:function(){var b=this.resolve("@root");b&&a.each(this._domListeners,function(a,c){":"===c.charAt(0)?b.removeEventListener(c.slice(1),a,!0):b.removeEventListener(c,a)}),this.items(null),this._class.dispose(),this._style.dispose(),this.inherited(),this._domListeners=null},onAttach:function(b,c){var d=this.resolve("@root");if(d){var e=b.getContainer(this);if(c>=0){var f=b.content().getItem(c);f&&"fragment"===f.resolve("@tag")&&(f=f.content().getItem(0)),f?e.insertBefore(d,f.resolve("@root")):e.appendChild(d)}else e.appendChild(d);var g=this.states(),h=null;if(g&&(h=g.enter),h){var i=d.$dom.style.cssText,j="all "+(h.duration||500)+"ms";d.setStyles(a.extend({transition:j},h)),this.upon("transitionend",function(){d.removeStyle("transition")}),setTimeout(function(){d.$dom.style.cssText=i+";transition: "+j},10)}}},onDetach:function(b){var c=this.resolve("@root");if(c){var d=this.resolve("@tag"),e=this;if("fragment"===d)a.each(e.content(),function(a){c.appendChild(a.resolve("@root"))});else{var f=this.states(),g=null;if(f&&(g=f.leave),g){var h=c.$dom.style.cssText,i="all "+(g.duration||500)+"ms";c.setStyle("transition",i),setTimeout(function(){c.setStyles(g)},10),this.upon("transitionend",function(){c.$dom.style.cssText=h,b.getContainer(this).removeChild(c)})}else b.getContainer(this).removeChild(c)}}},_attachDomListener:function(a){var b=this._domListeners;if(!(a in b)){var c=this,d=this.resolve("@root"),e=b[a]=function(b){c.fire(a,b)};":"===a.charAt(0)?d.addEventListener(a.slice(1),e,!0):d.addEventListener(a,e)}},_generateContent:function(){var b=this._template,c=this._items;a.each(this._content.toArray(),function(a){a.detach(),setTimeout(function(){a.dispose()},600)}),b&&c&&(a.each(c,function(a){var c=e(b,this.owner());c.model(a),c.attach(this)},this),this.fire("generated"))},_onItemsChange:function(b,c){var d=this._template,f=c.action,g=c.index;if(g=g>=0?g:-1,"add"===f)a.each(c.items,function(a,b){var c=e(d,this.owner());c.model(a),c.attach(this,g+b)},this);else if("remove"===f)a.each(c.items,function(b){a.each(this.content().toArray(),function(a){a.model()===b&&a.detach()},this)},this);else if("replace"===f);else if("sort"===f){var h=c.comparator,i=this.content().toArray().sort(function(a,b){return h(a.model(),b.model())});a.each(i,function(a){a.attach(this)},this)}else this._generateContent()}}})}(nx),function(a){var b=a.ui.AbstractComponent;a.define("nx.ui.Component",b,{properties:{model:{get:function(){return void 0===this._model?this._inheritedModel:this._model},set:function(b,c){c?this._inheritedModel=b:this._model=b;var d=this.view();d&&d.model(b,!0);var e=this._content;e&&e.each(function(c){a.is(c,"String")||c.model(b,!0)})}},"class":{get:function(){return this.view().get("class")},set:function(a){this.view().set("class",a)}},style:{get:function(){return this.view().style()},set:function(a){this.view().style(a)}},dom:{get:function(){return this.resolve("@root")}}},methods:{init:function(){this.inherited();var c=this["@view"];if(a.is(c,"Function")){for(var d,e=this.constructor;e&&(e=e.__super__,!(d=e["@view"])););c=c.call(this,a.clone(d,!0))}if(c){var f=b.createComponent(c,this);this.register("@root",f.resolve("@root")),this.register("@tag",f.resolve("@tag")),this.register("@comp",f)}},view:function(a){return this.resolve(a||"@comp")},get:function(a){return this.has(a)?this.inherited(a):this.view().get(a)},set:function(a,b){this.has(a)?this.inherited(a,b):(this.view().set(a,b),this.notify(a))},onAttach:function(a,b){this.view().onAttach(a,b)},onDetach:function(){this.view().onDetach(this.parent())},on:function(a,b,c){return this.can(a)?this.inherited(a,b,c):this.view().on(a,b,c)},upon:function(a,b,c){this.can(a)?this.inherited(a,b,c):this.view().upon(a,b,c)},off:function(a,b,c){this.can(a)?this.inherited(a,b,c):this.view().off(a,b,c)},dispose:function(){var a=this.view();a&&a.dispose(),this.inherited()}}})}(nx),function(a){var b=(a.global,a.dom.Document);a.define("nx.ui.Application",a.ui.AbstractComponent,{properties:{container:{}},methods:{init:function(){this.inherited();var c=this.start,d=this.stop,e=this;this.start=function(d){return b.ready(function(){a.app=e,c.call(e,d)}),this},this.stop=function(){a.app=null,d.call(e)},this._globalListeners={}},start:function(){throw new Error('Method "start" is not implemented')},stop:function(){throw new Error('Method "stop" is not implemented')},getContainer:function(){return this.container()?new a.dom.Element(this.container()):b.body()},on:function(a,b,c){return this.can(a)||this._attachGlobalListeners(a),this.inherited(a,b,c)},upon:function(a,b,c){this.can(a)||this._attachGlobalListeners(a),this.inherited(a,b,c)},_attachGlobalListeners:function(a){var b=this._globalListeners;if(!(a in b)){var c=this,d=b[a]=function(b){c.fire(a,b)};window.addEventListener(a,d)}}}})}(nx),function(a){a.define("nx.util",{"static":!0,methods:{uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()},without:function(a,b){for(var c;-1!=(c=a.indexOf(b));)a.splice(c,1);return a},find:function(a,b,c){var d;return a.some(function(a,e,f){return b.call(c||this,a,e,f)?(d=a,!0):void 0}),d},uniq:function(b,c,d){var e=c?b.map(c.bind(d||this)):b,f=[];return a.each(e,function(a,c){-1==f.indexOf(a)&&f.push(b[c])}),f},indexOf:function(a,b){return a.indexOf(b)},setProperty:function(b,c,d,e){void 0!==d&&(a.is(d,"String")?"model"==d.substr(0,5)?b.setBinding(c,d+",direction=<>",b):"{#"==d.substr(0,2)?b.setBinding(c,"owner."+d.substring(2,d.length-1)+",direction=<>",e):"{"==d.substr(0,1)?b.setBinding(c,"owner.model."+d.substring(1,d.length-1),e):b.set(c,d):b.set(c,d))},loadScript:function(a,b){var c=document.createElement("script");c.type="text/javascript",c.readyState?c.onreadystatechange=function(){("loaded"==c.readyState||"complete"==c.readyState)&&(c.onreadystatechange=null,b())}:c.onload=function(){b()},c.src=a,document.getElementsByTagName("head")[0].appendChild(c)},parseURL:function(a){var b=document.createElement("a");return b.href=a,{source:a,protocol:b.protocol.replace(":",""),host:b.hostname,port:b.port,query:b.search,params:function(){for(var a,c={},d=b.search.replace(/^\?/,"").split("&"),e=d.length,f=0;e>f;f++)d[f]&&(a=d[f].split("="),c[a[0]]=a[1]);return c}(),file:(b.pathname.match(/\/([^\/?#]+)$/i)||[,""])[1],hash:b.hash.replace("#",""),path:b.pathname.replace(/^([^\/])/,"/$1"),relative:(b.href.match(/tps?:\/\/[^\/]+(.+)/)||[,""])[1],segments:b.pathname.replace(/^\//,"").split("/")}},keys:function(a){return Object.keys(a)},values:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(a[c]);return b},boundHitTest:function(a,b){var c=b.top>=a.top&&b.top<=a.top+a.height,d=b.left>=a.left&&b.left<=a.left+a.width,e=a.top+a.height>=b.top+b.height&&b.top+b.height>=a.top,f=a.left+a.width>=b.left+b.width&&b.left+b.width>=a.left,g=a.top>=b.top&&a.top+a.height<=b.top+b.height,h=a.left>=b.left&&a.left+a.width<=b.left+b.width;return c&&d||e&&f||c&&f||e&&d||c&&h||e&&h||d&&g||f&&g},isFirefox:function(){return navigator.userAgent.indexOf("Firefox")>0}}})}(nx,nx.global),function(a){a.util.query=function(){var a,b={publics:{select:function(a,b){var c=[];if($.isArray(a)&&$.isFunction(b)){var d,e;for(d=0;d1?c:c[0]):(e=c.map,f=c.aggregate),"string"==typeof e&&(e=e.replace(/\s/g,"").split(",")),$.isArray(e)&&e[0]&&"string"==typeof e[0]&&(e=function(a){return function(b){var c,d={};for(c=0;cc[e])return f?-1:1;if(c[e]>b[e])return f?1:-1}return 0}}(b)),b&&"function"==typeof b&&a.sort(b),a}},query:function(a,c){return 1==arguments.length&&(c=a,a=c.array),a?(c.select&&(a=b.publics.select(a,c.select)),c.aggregate&&(a=b.privates.aggregate(a,c.aggregate)),c.mapping&&(a=b.privates.mapping(a,c.mapping)),c.orderby&&(a=b.privates.orderby(a,c.orderby)),a):a}};for(a in b.publics)b.query[a]=b.publics[a];return b.query}()}(nx,nx.global),function(a){var b=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return window.setTimeout(a,1e3/60)}}(),c=function(){return window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelAnimationFrame||window.mozCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.msCancelRequestAnimationFrame||window.oCancelAnimationFrame||window.oCancelRequestAnimationFrame||window.clearTimeout}();a.define("nx.graphic.Animation",{statics:{requestAnimationFrame:b,cancelAnimationFrame:c},events:["complete"],properties:{callback:{set:function(a){this._callback=a,this.createAnimation(),this.autoStart()&&this.start()},get:function(){return this._callback||function(){}}},duration:{value:1e3},interval:{value:1e3/60},autoStart:{value:!1},complete:{value:function(){return function(){}}},context:{value:this}},methods:{init:function(a){this.inherited(arguments),this.sets(a)},createAnimation:function(){var a,c,d,e=this,f=this.callback(),g=this.duration(),h=this.interval(),i=0;this.fn=function(){d=+new Date,a?c=g?(d-a)/g:0:(a=+new Date,c=0),(c>=1||d-i>=h)&&(i=d,c>1&&(c=1),f.call(e.context(),c)===!1&&(g=1,e._completeFN())),1>c?e.ani_id=b(e.fn):1==c&&e._completeFN()}},start:function(){this.ani_id=b(this.fn)},stop:function(){c(this.ani_id)},_completeFN:function(){this.complete().call(this.context()),this.stop(),this.fire("complete")}}})}(nx,nx.util),function(a){var b=1e3;a.define("nx.widget.ZIndexManager",null,{"static":!0,methods:{getIndex:function(){return b++}}})}(nx,nx.global),function(a){var b;!function(){a&&a.ui&&!b&&(b=a.define(a.ui.Component,{view:{props:{"class":"nx n-popupContainer",style:{position:"absolute",top:"0px",left:"0px"}}}}),a.define("nx.ui.PopupContainer",{"static":!0,properties:{container:{value:function(){return new b}}},methods:{addPopup:function(a){this.container().view().dom().appendChild(a.view().dom())}}})),document.body&&a&&a.ui?document.body.firstChild?document.body.insertBefore(a.ui.PopupContainer.container().view().dom().$dom,document.body.firstChild):document.body.appendChild(a.ui.PopupContainer.container().view().dom().$dom):setTimeout(arguments.callee,10)}()}(nx,nx.global),function(a){var b=a.ui.PopupContainer;a.define("nx.ui.Popup",a.ui.Component,{events:["open","close"],view:{props:{style:"position:absolute",tabindex:-1},events:{blur:function(){}}},properties:{target:{value:document},direction:{value:"auto"},width:{value:null},height:{value:null},offset:{value:0},offsetX:{value:0},offsetY:{value:0},align:{value:!1},position:{value:"absolute"},location:{value:"outer"},listenResize:{value:!1},lazyClose:{value:!1},pin:{value:!1},registeredPositionMap:{value:function(){return{}}},scrollClose:{value:!1}},methods:{init:function(a){this.inherited(a),this.sets(a),this._defaultConfig=this.gets()},attach:function(a){this.inherited(a),this.appendToPopupContainer()},appendToPopupContainer:function(){this._appended||(b.addPopup(this),this._delayCloseEvent(),this._listenResizeEvent(),this._appended=!0,this._closed=!1)},open:function(b){this._clearTimeout();var c=0,d=0,e=this.view().dom();this.sets(b||{}),this._resetOffset(b);var f=e.get("data-nx-popup-direction");f&&e.removeClass(f),this.appendToPopupContainer();var g=this.target(),h={width:0,height:0};if(g.resolve&&g.view&&(g=g.view()),void 0!==g.x&&void 0!==g.y)c=g.x,d=g.y;else if(g!=document){var i=g.getOffset();c=i.left,d=i.top,h=g.getBound()}else c=0,d=0;var j=this.width(),k=this.height();this.align()&&(j=h.width||0),j&&(e.setStyle("width",j),e.setStyle("max-width",j),this.width(j)),k&&e.setStyle("height",k),e.setStyle("display","block"),c+=this.offsetX(),d+=this.offsetY();var l=this._popupSize=e.getBound(),m=this.offset(),n={outer:{bottom:{left:c,top:d+h.height+m},top:{left:c,top:d-l.height-m},right:{left:c+h.width+m,top:d},left:{left:c-l.width-m,top:d}},inner:{bottom:{left:c+h.width/2-l.width/2+m,top:d},top:{left:c+h.width/2-l.width/2,top:d+h.height-l.height-m},left:{left:c+h.width-l.width-m,top:d+h.height/2-l.height/2},right:{left:c+m,top:d+h.height/2-l.height/2}},tooltip:{bottom:{left:c+h.width/2-l.width/2,top:d+h.height+m+2},"bottom-left":{left:c-22,top:d+h.height+m+2},"bottom-right":{left:c+h.width-l.width+22,top:d+h.height+m+2},top:{left:c+h.width/2-l.width/2,top:d-l.height-m-2},"top-left":{left:c-22,top:d-l.height-m-2},"top-right":{left:c+h.width/2-l.width/2+22,top:d-l.height-m-2},right:{left:c+h.width+m+2,top:d+h.height/2-l.height/2},"right-top":{left:c+h.width+m+2,top:0>=d?0:d-22},"right-bottom":{left:c+h.width+m+2,top:d+h.height-l.height},left:{left:c-l.width-m-2,top:d+h.height/2-l.height/2},"left-top":{left:c-l.width-m-2,top:0>=d?0:d-22},"left-bottom":{left:c-l.width-m-2,top:d+h.height-l.height}}},o=this.location();this._directionMap=n[o];var p=this.direction();(null==p||"auto"==p)&&(p=this._hitTest()),p||(p="bottom");var q=this._directionMap[p];e.setStyles({top:q.top,left:q.left,position:"position","z-index":a.widget.ZIndexManager.getIndex(),display:"block"}),e.set("data-nx-popup-direction",p),e.addClass("popup"),e.addClass(p),e.addClass("in"),this.fire("open"),this.dom().$dom.focus()},close:function(a){this._clearTimeout();var b=this.view().dom();this.pin()||(a||!this.lazyClose()?(this._closed=!0,b.removeClass("in"),b.setStyle("display","none"),this.fire("close")):this._delayClose())},_clearTimeout:function(){this.timer&&clearTimeout(this.timer)},_delayClose:function(){var a=this;this._clearTimeout(),this.timer=setTimeout(function(){a.close(!0)},500)},_delayCloseEvent:function(){this.lazyClose()&&(this.on("mouseenter",function(){this.timer&&clearTimeout(this.timer)},this),this.on("mouseleave",function(){clearTimeout(this.timer),this.close(!0)},this))},_listenResizeEvent:function(){this.listenResize(),this.scrollClose()},_hitTest:function(){var b=a.dom.Document.docRect(),c=Object.keys(this._directionMap),d=c[0];return c.some(function(a){var c={left:this._directionMap[a].left,top:this._directionMap[a].top,width:this._popupSize.width,height:this._popupSize.height},e=c.left>=b.scrollX&&c.top>=b.scrollY&&c.left+c.width<=b.width+b.scrollX&&c.top+c.height<=b.height+b.scrollY;return e?(d=a,!0):void 0},this),d},_resetOffset:function(a){}}})}(nx,nx.global),function(a){a.define("nx.ui.Popover",a.ui.Popup,{properties:{title:{get:function(){return this._title},set:function(a){return a?this.view("title").dom().setStyle("display","block"):this.view("title").dom().setStyle("display","none"),this._title!=a?(this._title=a,!0):!1}},location:{value:"tooltip"}},view:{props:{"class":"popover fade",style:{outline:"none"},tabindex:-1},events:{blur:function(){}},content:[{props:{"class":"arrow"}},{tag:"h3",name:"title",props:{"class":"popover-title",style:{display:"none"}},content:"{#title}"},{name:"body",props:{"class":"popover-content"}}]},methods:{getContainer:function(){return this.view("body").dom()}}})}(nx,nx.global),function(a){a.define("nx.graphic.DragManager",a.Observable,{"static":!0,properties:{node:{},referrer:{},track:{},dragging:{value:!1}},methods:{init:function(){window.addEventListener("mousedown",this._capture_mousedown.bind(this),!0),window.addEventListener("mousemove",this._capture_mousemove.bind(this),!0),window.addEventListener("mouseup",this._capture_mouseup.bind(this),!0),window.addEventListener("touchstart",this._capture_mousedown.bind(this),!0),window.addEventListener("touchmove",this._capture_mousemove.bind(this),!0),window.addEventListener("touchend",this._capture_mouseup.bind(this),!0)},start:function(a){return function(b,c){if(b&&!this.node()){c=c===window||c===document||c===document.body?document.body:c||b,c="function"==typeof c.dom?c.dom().$dom:c,this.node(b),this.referrer(c);var d,e=[];d=c.getBoundingClientRect(),this.track(e);var f=a.touches&&a.touches.length?a.touches[0].pageX:a.pageX,g=a.touches&&a.touches.length?a.touches[0].pageY:a.pageY,h=[f-document.body.scrollLeft-d.left,g-document.body.scrollTop-d.top];return e.push(h),e[0].time=a.timeStamp,a.dragCapture=function(){},!0}}.bind(this)},move:function(a){var b=this.node();b&&(a.drag=this._makeDragData(a),this.dragging()||(this.dragging(!0),b.fire("dragstart",a)),b.fire("dragmove",a))},end:function(a){var b=this.node();b&&(a.drag=this._makeDragData(a),this.dragging()&&b.fire("dragend",a),this.node(null),this.track(null),this.dragging(!1))},_makeDragData:function(a){var b=this.track(),c=this.referrer().getBoundingClientRect(),d=a.touches&&a.touches.length?a.touches[0].pageX:a.pageX,e=a.touches&&a.touches.length?a.touches[0].pageY:a.pageY,f=[d-document.body.scrollLeft-c.left,e-document.body.scrollTop-c.top],g=b[0],h=b[b.length-1];return f.time=a.timeStamp,b.push(f),b.length>20&&b.splice(1,b.length-20),{target:this.node(),accord:this.referrer(),origin:g,current:f,offset:[f[0]-g[0],f[1]-g[1]],delta:[f[0]-h[0],f[1]-h[1]],track:b}},_capture_mousedown:function(a){a.captureDrag&&(this._lastDragCapture=a.captureDrag),a.captureDrag="mousedown"===a.type||"touchstart"===a.type?this.start(a):function(){}},_capture_mousemove:function(a){this.move(a);var b=this.node();return b?(a.stopPropagation(),a.preventDefault(),!1):void 0},_capture_mouseup:function(a){this.end(a)}}})}(nx,nx.global),function(a){a.Object.delegateEvent=function(b,c,d,e){d.can(e)||(b.on(c,function(a,b){d.fire(e,b)}),a.Object.extendEvent(d,e))};var b={transform:"webkitTransform"};a.define("nx.graphic.Component",a.ui.Component,{events:["dragstart","dragmove","dragend"],properties:{translateX:{set:function(a){this.setTransform(a)}},translateY:{set:function(a){this.setTransform(null,a)}},scale:{set:function(a){this.setTransform(null,null,a)}},translate:{get:function(){return{x:this._translateX||0,y:this._translateY||0}},set:function(a){this.setTransform(a.x,a.y)}},visible:{get:function(){return void 0!==this._visible?this._visible:!0},set:function(a){this.view()&&(a?this.view().dom().removeClass("n-hidden"):this.view().dom().addClass("n-hidden")),this._visible=a}},"class":{get:function(){return void 0!==this._class?this._class:""},set:function(a){return this._class!==a?(this._class=a,this.dom().addClass(a),!0):!1}}},view:{},methods:{init:function(a){this.inherited(a),this.sets(a)},setTransform:function(a,b,c,d){var e=parseFloat(null!=a?a:this._translateX||0),f=parseFloat(null!=b?b:this._translateY||0),g=parseFloat(null!=c?c:this._scale||1);this.setStyle("transform"," matrix("+g+",0,0,"+g+","+e+", "+f+")",d),this.dom().$dom.setAttribute("transform"," translate("+e+", "+f+") scale("+g+")"),this._translateX=e,this._translateY=f,this._scale=g},setStyle:function(a,c,d,e,f){d?this.setTransition(e,f,d):e&&setTimeout(function(){e.call(f||this)},0);var g=this.dom().$dom;g.style[a]=c,b[a]&&(g.style[b[a]]=c)},setTransition:function(a,b,c){var d=this.dom();c?(d.setStyle("transition","all "+c+"s ease"),this.on("transitionend",function e(){a&&a.call(b||this),d.setStyle("transition",""),this.off("transitionend",e,this)},this)):(d.setStyle("transition",""),a&&setTimeout(function(){a.call(b||this)},0))},append:function(a){var b;b=this._parentElement=a?a.view().dom():this._parentElement||this.view().dom().parentNode(),b&&b.$dom&&this._resources&&this.view()&&!b.contains(this.view().dom())&&b.appendChild(this.view().dom())},remove:function(){var a=this._parentElement=this._parentElement||this.view().dom().parentNode();a&&this._resources&&this.view()&&a.removeChild(this.view().dom())},getBound:function(){return this.dom().$dom.getBoundingClientRect()},hide:function(){this.visible(!1)},show:function(){this.visible(!0)},animate:function(b){var c=this,d=[],e=this.view();a.each(b.to,function(a,b){var c=this.has(b)?this.get(b):e.getStyle(b);d.push({key:b,oldValue:c,newValue:a})},this),this._ani&&(this._ani.stop(),this._ani.dispose(),delete this._ani);var f=this._ani=new a.graphic.Animation({duration:b.duration||1e3,context:b.context||this});f.callback(function(b){a.each(d,function(a){var d=a.oldValue+(a.newValue-a.oldValue)*b;c.set(a.key,d)})}),b.complete&&f.complete(b.complete),f.on("complete",function(){this.fire("animationCompleted"),f.dispose(),delete this._ani},this),f.start()},_processPropertyValue:function(b){var c=b;return a.is(b,"Function")&&(c=b.call(this,this.model(),this)),c},dispose:function(){this._resources&&this._resources["@root"]&&this.view().dom().$dom.remove(),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Group",a.graphic.Component,{properties:{"data-id":{set:function(b){a.each(this.content(),function(a){a.set("data-id",b)}),this.view().set("data-id",b),this["_data-id"]=b}}},view:{tag:"svg:g"},methods:{move:function(a,b){var c=this.translate();this.setTransform(a+c.x,b+c.y)}}})}(nx,nx.global),function(a){var b="http://www.w3.org/1999/xlink";a.define("nx.graphic.Icon",a.graphic.Component,{view:{tag:"svg:g",content:[{name:"bgtext",tag:"svg:text"},{name:"text",tag:"svg:text"},{tag:"svg:g",name:"image",content:{name:"use",tag:"svg:use"}}]},properties:{imageType:{value:"font"},iconType:{get:function(){return this._iconType},set:function(c){var d=a.graphic.Icons.get(c.toLowerCase()),e=d.size,f=this.view("image").dom(),g=this.view("text").dom(),h=this.view("bgtext").dom(),i=this.view("use").dom();d.font?(g.setStyle("display","block"),i.setStyle("display","none"),g.$dom.firstChild&&g.$dom.removeChild(g.$dom.firstChild),g.$dom.appendChild(document.createTextNode(d.font[0])),g.addClass("fontIcon iconShape"),h.$dom.firstChild&&h.$dom.removeChild(h.$dom.firstChild),h.$dom.appendChild(document.createTextNode(d.font[1])),h.addClass("fontIcon iconBG"),this.imageType("font")):(g.setStyle("display","none"),i.setStyle("display","block"),h.$dom.firstChild&&h.$dom.removeChild(h.$dom.firstChild),h.$dom.appendChild(document.createTextNode("\ue61d")),h.addClass("fontIcon iconBG"),i.$dom.setAttributeNS(b,"xlink:href","#"+c),f.setStyle("transform","translate("+e.width/-2+"px, "+e.height/-2+"px)"),this.imageType("image")),this.view().set("iconType",c),this.view().dom().addClass("n-topology-icon"),this.size(e),this._iconType=d.name}},size:{value:function(){return{width:36,height:36}}},color:{set:function(a){"font"==this.imageType()&&this.view("text").dom().setStyle("fill",a),this.view("bgtext").dom().setStyle("fill",this.showIcon()?"":a),this.view("image").dom().set("color",a),this._color=a}},scale:{set:function(b){var c=this.view("text").dom(),d=this.view("bgtext").dom(),e=this.view("image").dom(),f=this.size(),g=Math.max(f.width,f.height),h=this.showIcon()?g*b:4+8*b;c.setStyle("font-size",h),d.setStyle("font-size",h),"image"==this.imageType()&&b&&e.setStyle("transform","translate("+f.width/-2+"px, "+f.height/-2+"px) scale("+b+")"),a.util.isFirefox()&&(c.$dom.setAttribute("transform"," translate(0, "+h/2+")"),d.$dom.setAttribute("transform"," translate(0, "+h/2+")")),this._scale=b}},showIcon:{get:function(){return void 0!==this._showIcon?this._showIcon:!0},set:function(a){var b=this.view("text").dom(),c=this.view("bgtext").dom(),d=this.view("image").dom();a?("font"==this.imageType()?(b.setStyle("display","block"),c.setStyle("display","block")):(d.setStyle("display","block"),c.setStyle("display","none")),c.removeClass("iconBGActive"),this.view().dom().addClass("showIcon")):("font"==this.imageType()?b.setStyle("display","none"):d.setStyle("display","none"),c.setStyle("display","block"),c.addClass("iconBGActive"),this.view().dom().removeClass("showIcon")),this._showIcon=a,this._color&&this.color(this._color,{force:!0}),this._scale&&this.scale(this._scale,{force:!0})}}}})}(nx,nx.global),function(a){var b=a.define("nx.graphic.Icons",{"static":!0,statics:{icons:{}},methods:{get:function(a){return b.icons[a]||b.icons.switch},getSVGString:function(a){return e[a].icon},getTypeList:function(){return Object.keys(e)},registerIcon:function(a,e,f,g){var h=document.createElementNS(d,"image");h.setAttributeNS(c,"href",e),b.icons[a]={size:{width:f,height:g},icon:h.cloneNode(!0),name:a}},__each__:function(b,c){var d=b||function(){};a.each(e,function(a,b){var f=a.icon;d.call(c||this,f,b,e)})}}}),c="http://www.w3.org/1999/xlink",d="http://www.w3.org/2000/svg",e={"switch":{width:32,height:32,name:"Switch",font:["\ue618","\ue619"]},router:{width:32,height:32,name:"Router",font:["\ue61c","\ue61d"]},wlc:{width:32,height:32,font:["\ue60f","\ue610"]},unknown:{width:32,height:32,font:["\ue612","\ue611"]},server:{width:32,height:32,font:["\ue61b","\ue61a"]},phone:{width:32,height:32,font:["\ue61e","\ue61f"]},nexus5000:{width:32,height:32,font:["\ue620","\ue621"]},ipphone:{width:32,height:32,font:["\ue622","\ue623"]},host:{width:32,height:32,font:["\ue624","\ue625"]},camera:{width:32,height:32,font:["\ue626","\ue627"]},accesspoint:{width:32,height:32,font:["\ue628","\ue629"]},groups:{width:32,height:32,font:["\ue615","\ue62f"]},groupm:{width:32,height:32,font:["\ue616","\ue630"]},groupl:{width:32,height:32,font:["\ue617","\ue631"]},collapse:{width:16,height:16,font:["\ue62e","\ue61d"]},expand:{width:14,height:14,font:["\ue62d","\ue61d"]},cloud:{width:48,height:48,font:["\ue633","\ue633"]},unlinked:{width:32,height:32,font:["\ue646","\ue61d"]},firewall:{width:32,height:32,font:["\ue647","\ue648"]},hostgroup:{width:32,height:32,font:["\ue64d","\ue64c"]},wirelesshost:{width:32,height:32,font:["\ue64e","\ue64c"]}};a.each(e,function(a,c){var d=b.icons[c]={size:{width:a.width,height:a.height},name:c};a.font?d.font=a.font:a.icon&&(d.icon=(new DOMParser).parseFromString(a.icon,"text/xml").documentElement.cloneNode(!0))})}(nx,nx.global),function(a){a.define("nx.graphic.Circle",a.graphic.Component,{view:{tag:"svg:circle"}})}(nx,nx.global),function(a){var b="http://www.w3.org/1999/xlink";a.define("nx.graphic.Image",a.graphic.Component,{properties:{src:{get:function(){return void 0!==this._src?this._src:0},set:function(a){if(this._src!==a){if(this._src=a,this.view()&&void 0!==a){var c=this.view().dom().$dom;c.setAttributeNS(b,"href",a)}return!0}return!1}}},view:{tag:"svg:image"}})}(nx,nx.global),function(a){a.define("nx.graphic.Line",a.graphic.Component,{view:{tag:"svg:line"}})}(nx,nx.global),function(a){a.define("nx.graphic.Path",a.graphic.Component,{view:{tag:"svg:path"}})}(nx,nx.global),function(a){a.define("nx.graphic.Polygon",a.graphic.Path,{properties:{nodes:{get:function(){return this._nodes||[]},set:function(b){this._nodes=b;var c=b;if(0!==c.length){if(1==c.length){var d=c[0];c.push({x:d.x-1,y:d.y-1}),c.push({x:d.x+1,y:d.y-1})}else 2==c.length&&(c.push([c[0].x+1,c[0].y+1]),c.push(c[1]));var e=a.data.Convex.process(c),f=[];f.push("M ",e[0].x," ",e[0].y);for(var g=1;gg&&d.applyScale(g*f/d.scale(),c),d.scale()/f0?Math.acos(b[0][0]/c):-Math.acos(b[0][0]/c)),{x:b[2][0],y:b[2][1],scale:c,rotate:d}}return{x:0,y:0,scale:1,rotate:0}}},x:{get:function(){return void 0!==this._x?this._x:this.transform_internal_().x},set:function(a){return this._applyTransform("x",a),isNaN(this.transform_internal_().x)||this._x===this.transform_internal_().x?!1:(this._x=this.transform_internal_().x,!0)}},y:{get:function(){return void 0!==this._y?this._y:this.transform_internal_().y},set:function(a){return this._applyTransform("y",a),isNaN(this.transform_internal_().y)||this._y===this.transform_internal_().y?!1:(this._y=this.transform_internal_().y,!0)}},scale:{get:function(){return void 0!==this._scale?this._scale:this.transform_internal_().scale},set:function(a){return this._applyTransform("scale",a),isNaN(this.transform_internal_().scale)||this._scale===this.transform_internal_().scale?!1:(this._scale=this.transform_internal_().scale,!0)}},rotate:{get:function(){return void 0!==this._rotate?this._rotate:this.transform_internal_().rotate},set:function(a){return this._applyTransform("rotate",a),isNaN(this.transform_internal_().rotate)||this._rotate===this.transform_internal_().rotate?!1:(this._rotate=this.transform_internal_().rotate,!0)}}},methods:{applyTranslate:function(b,c){this.matrix(a.geometry.Matrix.multiply(this.matrix(),[[1,0,0],[0,1,0],[b,c,1]]))},applyScale:function(b,c){this.matrix(c?a.geometry.Matrix.multiply(this.matrix(),[[1,0,0],[0,1,0],[-c[0],-c[1],1]],[[b,0,0],[0,b,0],[0,0,1]],[[1,0,0],[0,1,0],[c[0],c[1],1]]):a.geometry.Matrix.multiply(this.matrix(),[[b,0,0],[0,b,0],[0,0,1]]))},applyRotate:function(b,c){this.x(),this.y(),sin(b),cos(b);this.matrix(c?a.geometry.Matrix.multiply(this.matrix(),[[1,0,0],[0,1,0],[-c[0],-c[1],1]],[[cos,sin,0],[-sin,cos,0],[0,0,1]],[[1,0,0],[0,1,0],[c[0],c[1],1]]):a.geometry.Matrix.multiply(this.matrix(),[[cos,sin,0],[-sin,cos,0],[0,0,1]]))},applyMatrix:function(){var b=Array.prototype.slice.call(arguments);b=a.util.query({array:b,mapping:function(b){return a.is(b,a.geometry.Matrix)?b.matrix():b}}),b.unshift(this.matrix()),this.matrix(a.geometry.Matrix.multiply.apply(this,b))},_applyTransform:function(a,b){if(this["_"+a]!==b&&!isNaN(b))if(b===this.transform_internal_()[a])this["_"+a]=b,this.notify(a);else switch(a){case"x":this.applyTranslate(b-this.transform_internal_().x,0);break;case"y":this.applyTranslate(0,b-this.transform_internal_().y);break;case"scale":this.applyScale(b/this.transform_internal_().scale,[this.transform_internal_().x,this.transform_internal_().y]);break;case"rotate":this.applyRotate(b-this.transform_internal_().rotate,[this.transform_internal_().x,this.transform_internal_().y])}},toString:function(){return a.geometry.Matrix.stringify(this.matrix())}}})}(nx,nx.ui,window),function(a){var b=a.define("nx.geometry.Matrix",a.Observable,{mixins:[a.geometry.MatrixSupport],methods:{init:function(a){this.inherited(),this.matrix(a)},equal:function(c){return b.equal(this.matrix(),a.is(c,b)?c.matrix():c)}},statics:{I:[[1,0,0],[0,1,0],[0,0,1]],isometric:function(a){return a&&(a[0][0]||a[0][1])&&a[0][0]===a[1][1]&&a[0][1]===-a[1][0]},approximate:function(b,c){if(!b||!c||b.length!=c.length)return!1;var d;for(d=0;d1;){if(a=l[0],b=l[1],a[0].length!=b.length)return null;for(i=a.length,j=b[0].length,k=b.length,c=[],f=0;i>f;f++){for(d=[],g=0;j>g;g++){for(e=0,h=0;k>h;h++)e+=a[f][h]*b[h][g];d.push(e)}c.push(d)}l.splice(0,2,c)}return l[0]},transpose:function(a){var b,c,d=[],e=a.length,f=a[0].length;for(c=0;f>c;c++)for(d[c]=[],b=0;e>b;b++)d[c].push(a[b][c]);return d},inverse:function(a){var b=a[0][0],c=a[0][1],d=a[1][0],e=a[1][1],f=a[2][0],g=a[2][1],h=b*e-c*d;return 0===h?null:[[e/h,-c/h,0],[-d/h,b/h,0],[(d*g-e*f)/h,(c*f-b*g)/h,1]]},stringify:function(a){return[a[0][0],a[0][1],a[1][0],a[1][1],a[2][0],a[2][1]].join(",").replace(/-?\d+e[+-]?\d+/g,"0")}}})}(nx,nx.ui,window),function(a){var b=a.define("nx.geometry.Math",a.Observable,{statics:function(){function a(a){return function(c){var d=a(c);return b.approximate(d,0)?0:d}}return{approximate:function(a,b){var c=a-b;return 1e-10>c&&c>-1e-10},sin:a(Math.sin),cos:a(Math.cos),tan:a(Math.tan),cot:function(a){var b=Math.tan(a);return b>1e10||-1e10>b?0:1/b}}}()})}(nx,nx.ui,window),function(a){var b=a.define("nx.geometry.BezierCurve",a.Observable,{statics:function(){function a(a){var b,c=[];for(b=0;b1)throw"Invalid bread point list: "+a.join(",");d.push((a[b]-c)/(1-c)),c=a[b]}return d}function e(a,b,c,d,e){return b*(1-a)*(1-a)*(1-a)+3*c*(1-a)*(1-a)*a+3*d*(1-a)*a*a+e*a*a*a}return{slice:function(a,c,d){return 0===c?0===d?null:b.breakdown(a,d).beziers[0]:d?b.breakdown(a,c,d).beziers[1]:b.breakdown(a,c).beziers[1]},breakdown:function(e){var f=Array.prototype.slice.call(arguments,1);if(!f.length)throw"Invalid argument length: "+arguments.length;f=d(f);var g,h,i,j=[e[0]],k=[];for(h=a(e);f.length;)g=f.shift(),i=b.separate(h,g),j.push(i.point),k.push(c(i.left)),h=i.right;return j.push(e[e.length-1]),k.push(c(h)),{points:j,beziers:k}},separate:function(a,b){for(var c,d,e=1-b,f=function(a){return[a[0][0]*e+a[1][0]*b,a[0][1]*e+a[1][1]*b]},g=function(a,b){return[f([a[0],b[0]]),f([a[1],b[1]])]},h=function(a){var b,c=[];for(b=0;bb)return null;var c=[];if(2===b){var d=a[0],e=a[2],f=a[1],g=[(d[0]+e[0])/2,(d[1]+e[1])/2],h=[2*f[0]-g[0],2*f[1]-g[1]];c.push(d,h,e)}return c},locationAlongCurve:function(a,b){var c,d=1e3,f=0,g=[],h=a[0];if(!b)return 0;for(var i=0;d>=i;i++){c=i/d;var j=e(c,h[0],a[1][0],a[2][0],a[3][0]),k=e(c,h[1],a[1][1],a[2][1],a[3][1]);if(i>0){var l=j-g[0],m=k-g[1],n=Math.sqrt(l*l+m*m);if(b>f&&f+n>b)return i/d;f+=n}g=[j,k]}return 0/0},getLength:function(a){for(var b,c=1e3,d=0,f=[],g=a[0],h=0;c>=h;h++){b=h/c;var i=e(b,g[0],a[1][0],a[2][0],a[3][0]),j=e(b,g[1],a[1][1],a[2][1],a[3][1]);if(h>0){var k=i-f[0],l=j-f[1];d+=Math.sqrt(k*k+l*l)}f=[i,j]}return d}}}()})}(nx,nx.ui,window),function(a){var b=a.define("nx.geometry.Vector",a.Observable,{statics:{approximate:function(b,c){if(!b||!c||b.length!=c.length)return!1;var d;for(d=0;d0?b:-b},circumferentialAngle:function(){var a=this.angle();return 0>a&&(a+=360),a},slope:function(){return this.y/this.x},add:function(a){return new b(this.x+a.x,this.y+a.y)},subtract:function(a){return new b(this.x-a.x,this.y-a.y)},multiply:function(a){return new b(this.x*a,this.y*a)},divide:function(a){return new b(this.x/a,this.y/a)},rotate:function(a){var c=this.x,d=this.y,e=Math.sin(a/180*Math.PI),f=Math.cos(a/180*Math.PI);return new b(c*f-d*e,c*e+d*f)},negate:function(){return new b(-this.x,-this.y)},normal:function(){var a=this.length()||1;return new b(-this.y/a,this.x/a)},normalize:function(){var a=this.length()||1;return new b(this.x/a,this.y/a)},clone:function(){return new b(this.x,this.y)}}})}(nx,window),function(a){var b=a.geometry.Vector,c=a.define("nx.geometry.Line",a.Observable,{methods:{init:function(a,c){this.start=a||new b,this.end=c||new b,this.dir=this.end.subtract(this.start)},length:function(){return this.dir.length()},squaredLength:function(){return this.dir.squaredLength()},angle:function(){return this.dir.angle()},circumferentialAngle:function(){var a=this.angle();return 0>a&&(a+=360),a},center:function(){return this.start.add(this.end).divide(2)},slope:function(){return this.dir.slope()},general:function(){var a=this.slope(),b=this.start;return isFinite(a)?[a,-1,b.y-a*b.x]:[1,0,-b.x]},intersection:function(a){var c=this.general(),d=a.general();return new b((c[1]*d[2]-d[1]*c[2])/(c[0]*d[1]-d[0]*c[1]),(c[0]*d[2]-d[0]*c[2])/(d[0]*c[1]-c[0]*d[1]))},pedal:function(a){var c=this.dir,d=this.general(),e=[c.x,c.y,-a.x*c.x-a.y*c.y];return new b((d[1]*e[2]-e[1]*d[2])/(d[0]*e[1]-e[0]*d[1]),(d[0]*e[2]-e[0]*d[2])/(e[0]*d[1]-d[0]*e[1]))},translate:function(a){return a=a.rotate(this.angle()),new c(this.start.add(a),this.end.add(a))},rotate:function(a){return new c(this.start.rotate(a),this.end.rotate(a))},negate:function(){return new c(this.end,this.start)},normal:function(){var a=this.dir,c=this.dir.length();return new b(-a.y/c,a.x/c)},pad:function(a,b){var d=this.dir.normalize();return new c(this.start.add(d.multiply(a)),this.end.add(d.multiply(-b)))},clone:function(){return new c(this.start,this.end)}}})}(nx),function(a){a.data.QuadTree=function(a,c,d,e){var f=c||800,g=d||600,h=a,i=0,j=0,k=0,l=0;if(this.root=null,this.alpha=0,h){for(var m,n,o,p=0,q=h.length;q>p;p++)m=h[p],m.dx=0,m.dy=0,n=m.x,o=m.y,isNaN(n)&&(n=m.x=Math.random()*f),isNaN(o)&&(o=m.y=Math.random()*g),i>n?i=n:n>k&&(k=n),j>o?j=o:o>l&&(l=o);var r=k-i,s=l-j;r>s?l=j+r:k=i+s;var t=this.root=new b(this,i,j,k,l);for(p=0;q>p;p++)t.insert(h[p])}};var b=function(a,c,d,e,f){var g=this.x1=c,h=this.y1=d,i=this.x2=e,j=this.y2=f,k=.5*(g+i),l=.5*(h+j),m=.5*(e-c),n=.5*(f-d);this.point=null,this.nodes=null,this.insert=function(a){var b=this.point,c=this.nodes;return b||c?void(b?Math.abs(b.x-a.x)+Math.abs(b.y-a.y)<.01?this._insert(a):(this.point=null,this._insert(b),this._insert(a)):this._insert(a)):void(this.point=a)},this._insert=function(c){var d=c.x>=k,e=c.y>=l,f=(e<<1)+d,i=g+m*d,j=h+n*e,o=this.nodes||(this.nodes=[]),p=o[f]||(o[f]=new b(a,i,j,i+m,j+n));p.insert(c)}}}(nx,nx.global),function(a){a.data.NextForce=function(b,c){var d=b||800,e=c||800,f=4,g=100,h=.1;this.charge=1200,this.alpha=1,this.totalEnergy=1/0,this.maxEnergy=1/0;var i=2,j=.8;this.nodes=null,this.links=null,this.quadTree=null,this.setTopoData=function(a){for(var b,c,d,e,f=this.nodes=a.nodes,g=this.links=a.links,h=this.nodeMap={},i=this.weightMap={},j=this.maxWeight=1,k=0,l=f.length; l>k; k++)b=f[k],d=b.id,h[d]=b,i[d]=0;if(g)for(l=g.length,k=0; l>k; ++k)c=g[k],d=c.source,e=++i[d],e>j&&(this.maxWeight=e),d=c.target,e=++i[d],e>j&&(this.maxWeight=e)},this.start=function(){for(var a=i*this.nodes.length;;)if(this.tick(),this.maxEnergy<5*i&&this.totalEnergyg;g++)h=b[g],this._calculateChargeEffect(f,h);this._changePosition()},this._changePosition=function(){var a,b,c,d,e,f,g,h=0,i=0,j=this.nodes,k=j.length,l=0,m=0,n=0,o=0,p=!0;for(a=0;k>a;a++)b=j[a],f=.5*b.dx,g=.5*b.dy,e=Math.abs(f)+Math.abs(g),b.fixed||(h+=e,e>i&&(i=e)),b.fixed?(c=b.x,d=b.y):(c=b.x+=f,d=b.y+=g,p=!1),l>c?l=c:c>n&&(n=c),m>d?m=d:d>o&&(o=d);this.totalEnergy=p?0:h,this.maxEnergy=p?0:i,this.x1=l,this.y1=m,this.x2=n,this.y2=o},this._calculateCenterGravitation=function(){var a,b,c,f=this.nodes,g=f.length,i=.5*h;b=d/2,c=e/2;for(var j=0;g>j;j++)a=f[j],a.dx+=(b-a.x)*i,a.dy+=(c-a.y)*i},this._calculateLinkEffect=function(){var a,b,c,d,e,h,i,j,k,l,m,n,o,p,q=this.links,r=this.nodeMap,s=this.weightMap;if(q)for(b=q.length,a=0;b>a;++a)if(c=q[a],d=r[c.source],e=r[c.target],h=e.x-d.x,i=e.y-d.y,0===h&&0===i&&(e.x+=5*Math.random(),e.y+=5*Math.random(),h=e.x-d.x,i=e.y-d.y),j=h*h+i*i,k=Math.sqrt(j),j){var t=this.maxWeight;l=f*(k-g)/k,h*=l,i*=l,n=s[d.id],o=s[e.id],p=n+o,m=n/p,e.dx-=h*m/t,e.dy-=i*m/t,m=1-m,d.dx+=h*m/t,d.dy+=i*m/t}},this._calculateQuadTreeCharge=function(a){if(!a.fixed){var b=a.nodes,c=a.point,d=0,e=0,f=0;if(!b)return a.charge=a.pointCharge=this.charge,a.chargeX=c.x,void(a.chargeY=c.y);if(b)for(var g,h,i=0,j=b.length;j>i;i++)g=b[i],g&&(this._calculateQuadTreeCharge(g),h=g.charge,f+=h,d+=h*g.chargeX,e+=h*g.chargeY);if(c){var k=this.charge;f+=k,d+=k*c.x,e+=k*c.y}a.charge=f,a.chargeX=d/f,a.chargeY=e/f}},this._calculateChargeEffect=function(a,b){if(this.__calculateChargeEffect(a,b)){var c=a.nodes;if(c)for(var d,e=0,f=c.length;f>e;e++)d=c[e],d&&this._calculateChargeEffect(d,b)}},this.__calculateChargeEffect=function(a,b){if(a.point!=b){var c,d=a.chargeX-b.x,e=a.chargeY-b.y,f=d*d+e*e,g=Math.sqrt(f),h=1/g;if((a.x2-a.x1)*h(e-c)*i)return f=b.charge*i*i,a.px-=g*f,a.py-=h*f,!0;b.point&&isFinite(i)&&(f=b.pointCharge*i*i,a.px-=g*f,a.py-=h*f)}return!b.charge}}var d,e,f,g={},h=[100,100],i=0,j=.9,k=function(){return 100},l=function(){return 1},m=-1200,n=.1,o=.8,p=[],q=[];return g.tick=function(){if((i*=.99)<.005)return i=0,!0;var g,k,l,o,r,s,t,u,v,w=p.length,x=q.length;for(k=0;x>k;++k)l=q[k],o=l.source,r=l.target,u=r.x-o.x,v=r.y-o.y,(s=u*u+v*v)&&(s=i*e[k]*((s=Math.sqrt(s))-d[k])/s,u*=s,v*=s,r.x-=u*(t=o.weight/(r.weight+o.weight)),r.y-=v*t,o.x+=u*(t=1-t),o.y+=v*t);if((t=i*n)&&(u=h[0]/2,v=h[1]/2,k=-1,t))for(;++k0?a:0:a>0&&(i=a,g.tick()),g):i},g.start=function(){function a(a,d){for(var e,f=b(c),g=-1,h=f.length;++gi;++i)j[i]=[];for(i=0;r>i;++i){var a=q[i];j[a.source.index].push(a.target),j[a.target.index].push(a.source)}}return j[c]}var c,i,j,n,o=p.length,r=q.length,s=h[0],t=h[1];for(c=0;o>c;++c)(n=p[c]).index=c,n.weight=0;for(d=[],e=[],c=0;r>c;++c)n=q[c],"number"==typeof n.source&&(n.source=p[n.source]),"number"==typeof n.target&&(n.target=p[n.target]),d[c]=k.call(this,n,c),e[c]=l.call(this,n,c),++n.source.weight,++n.target.weight;for(c=0;o>c;++c)n=p[c],isNaN(n.x)&&(n.x=a("x",s)),isNaN(n.y)&&(n.y=a("y",t)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(f=[],"function"==typeof m)for(c=0;o>c;++c)f[c]=+m.call(this,p[c],c);else for(c=0;o>c;++c)f[c]=m;return g.resume()},g.resume=function(){return g.alpha(.1)},g.stop=function(){return g.alpha(0)},g};var b=function(a,c,d){var e=0,f=0;if(a.charge=0,!a.leaf)for(var g,h=a.nodes,i=h.length,j=-1;++j=i,l=b.y>=j,m=(l<<1)+k;a.leaf=!1,a=a.nodes[m]||(a.nodes[m]=d()),k?c=i:f=i,l?e=j:g=j,h(a,b,c,e,f,g)}var j,k=-1,l=a.length;if(arguments.length<5)if(3===arguments.length)g=c,f=b,c=b=0;else for(b=c=1/0,f=g=-1/0;++kf&&(f=j.x),j.y>g&&(g=j.y);var m=f-b,n=g-c;m>n?g=c+m:f=b+n;var o=d();return o.add=function(a){h(o,a,b,c,f,g)},o.visit=function(a){e(a,o,b,c,f,g)},a.forEach(o.add),o},d=function(){return{leaf:!0,nodes:[],point:null}},e=function(a,b,c,d,f,g){if(!a(b,c,d,f,g)){var h=.5*(c+f),i=.5*(d+g),j=b.nodes;j[0]&&e(a,j[0],c,d,h,i),j[1]&&e(a,j[1],h,d,f,i),j[2]&&e(a,j[2],c,i,h,g),j[3]&&e(a,j[3],h,i,f,g)}}}(nx,nx.global),function(a){a.define("nx.data.Convex",{"static":!0,methods:{multiply:function(a,b,c){return(a.x-c.x)*(b.y-c.y)-(b.x-c.x)*(a.y-c.y)},dis:function(a,b){return Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))},process:function(a){var b,c,d,e=[],f=a.length,g=0,h=2;for(b=1;f>b;b++)(a[b].yb;b++){for(g=b,c=b+1;f>c;c++)(this.multiply(a[c],a[g],a[0])>0||0===this.multiply(a[c],a[g],a[0])&&this.dis(a[0],a[c])b;b++){for(;h>0&&this.multiply(a[b],e[h],e[h-1])>=0;)h--,e.pop();e[++h]=a[b]}return e}}})}(nx,nx.global),function(a){var b=a.geometry.Vector;a.define("nx.data.Vertex",a.data.ObservableObject,{events:["updateCoordinate"],properties:{id:{},positionGetter:{value:function(){return function(){return{x:a.path(this._data,"x")||0,y:a.path(this._data,"y")||0}}}},positionSetter:{value:function(){return function(b){if(this._data){var c=a.path(this._data,"x"),d=a.path(this._data,"y");return b.x!==c||b.y!==d?(a.path(this._data,"x",b.x),a.path(this._data,"y",b.y),!0):!1}}}},position:{get:function(){return{x:this._x||0,y:this._y||0}},set:function(a){var b=!1,c={x:this._x,y:this._y};void 0!==a.x&&this._x!==a.x&&(this._x=a.x,b=!0),void 0!==a.y&&this._y!==a.y&&(this._y=a.y,b=!0),b&&(this.positionSetter().call(this,{x:this._x,y:this._y}),this.fire("updateCoordinate",{oldPosition:c,newPosition:{x:this._x,y:this._y}}),this.notify("vector"))}},x:{get:function(){return this._x||0},set:function(a){this.position({x:parseFloat(a)})}},y:{get:function(){return this._y||0},set:function(a){this.position({y:parseFloat(a)})}},vector:{get:function(){var a=this.position();return new b(a.x,a.y)}},restricted:{value:!1},visible:{get:function(){return void 0!==this._visible?this._visible:!0},set:function(b){this._visible=b;var c=this.graph();b===!1?this.generated()&&(a.each(this.edgeSetCollections(),function(a,b){c.deleteEdgeSetCollection(b)},this),c.removeVertex(this.id())):this.restricted()||this.generated()||(c.generateVertex(this),a.each(this.edgeSets(),function(a){c._generateConnection(a)}));var d=this.parentVertexSet();d&&c.updateVertexSet(d)}},generated:{value:!1},updated:{value:!1},type:{value:"vertex"},edgeSets:{value:function(){return{}}},edgeSetCollections:{value:function(){return{}}},edges:{get:function(){var b={};return a.each(this.edgeSets(),function(c){a.extend(b,c.edges())}),b}},connectedVertices:{get:function(){var a={};return this.eachConnectedVertex(function(b,c){a[c]=b},this),a}},graph:{},parentVertexSet:{},rootVertexSet:{get:function(){for(var a=this.parentVertexSet();a&&a.parentVertexSet();)a=a.parentVertexSet();return a}},generatedRootVertexSet:{get:function(){for(var a,b=this.parentVertexSet();b;)b.generated()&&b.activated()&&(a=b),b=b.parentVertexSet();return a}},selected:{value:!1}},methods:{set:function(b,c){this.has(b)?this[b].call(this,c):(a.path(this._data,b,c),this.notify(b))},get:function(b){return this.has(b)?this[b].call(this):a.path(this._data,b)},has:function(a){var b=this[a];return b&&"property"==b.__type__},getData:function(){return this._data},addEdgeSet:function(a,b){var c=this.edgeSets();c[b]=a},removeEdgeSet:function(a){var b=this.edgeSets();delete b[a]},addEdgeSetCollection:function(a,b){var c=this.edgeSetCollections();c[b]=a},removeEdgeSetCollection:function(a){var b=this.edgeSetCollections();delete b[a]},eachConnectedVertex:function(b,c){var d=this.id();a.each(this.edgeSets(),function(a){var e=a.sourceID()==d?a.target():a.source();e.visible()&&!e.restricted()&&b.call(c||this,e,e.id())},this),a.each(this.edgeSetCollections(),function(a){var e=a.sourceID()==d?a.target():a.source();e.visible()&&!e.restricted()&&b.call(c||this,e,e.id())},this)},translate:function(a,b){var c=this.position();null!=a&&(c.x+=a),null!=b&&(c.y+=b),this.position(c)}}})}(nx,nx.global),function(a){var b=a.geometry.Line;a.define("nx.data.Edge",a.data.ObservableObject,{events:["updateCoordinate"],properties:{source:{value:null},target:{value:null},sourceID:{value:null},targetID:{value:null},linkKey:{},reverseLinkKey:{},generated:{value:!1},updated:{value:!1},type:{value:"edge"},id:{},parentEdgeSet:{},line:{get:function(){return new b(this.source().vector(),this.target().vector())}},position:{get:function(){return{x1:this.source().get("x"),y1:this.source().get("y"),x2:this.target().get("x"),y2:this.target().get("y")}}},reverse:{value:!1},graph:{}},methods:{getData:function(){return this._data},attachEvent:function(){this.source().on("updateCoordinate",this._updateCoordinate,this),this.target().on("updateCoordinate",this._updateCoordinate,this)},_updateCoordinate:function(){this.fire("updateCoordinate")},dispose:function(){this.source().off("updateCoordinate",this._updateCoordinate,this),this.target().off("updateCoordinate",this._updateCoordinate,this),this.inherited()}}})}(nx,nx.global),function(a){a.util;a.define("nx.data.VertexSet",a.data.Vertex,{properties:{position:{get:function(){return{x:this._x||0,y:this._y||0}},set:function(b){var c=!1,d={x:this._x,y:this._y};if(void 0!==b.x&&this._x!==b.x&&(this._x=b.x,c=!0),void 0!==b.y&&this._y!==b.y&&(this._y=b.y,c=!0),c){this.positionSetter().call(this,{x:this._x,y:this._y});var e=this._x-d.x,f=this._y-d.y;a.each(this.vertices(),function(a){a.translate(e,f)}),a.each(this.vertexSet(),function(a){a.translate(e,f)}),this.fire("updateCoordinate",{oldPosition:d,newPosition:{x:this._x,y:this._y}}),this.notify("vector")}}},vertices:{value:function(){return{}}},vertexSet:{value:function(){return{}}},subVertices:{get:function(){var a={};return this.eachSubVertex(function(b,c){a[c]=b}),a}},subVertexSet:{get:function(){var a={};return this.eachSubVertexSet(function(b,c){a[c]=b}),a}},visible:{value:!0},inheritedVisible:{get:function(){var b=!0;return a.each(this.vertices(),function(a){a.visible()&&(b=!1)}),a.each(this.vertexSet(),function(a){a.visible()&&(b=!1)},this),!b}},type:{value:"vertexSet"},activated:{get:function(){return void 0!==this._activated?this._activated:!0},set:function(a){return this._activated!==a?(a?this._collapse():this._expand(),!0):!1}}},methods:{initNodes:function(){var b=this.graph(),c=this.get("nodes");a.each(c,function(a){var c=b.vertices().getItem(a)||b.vertexSets().getItem(a);if(c&&!c.restricted()){var d="vertex"==c.type()?this.vertices():this.vertexSet();d[a]=c,c.restricted(!0),c.parentVertexSet(this)}else console&&console.warn("NodeSet data error",this.id(),a)},this)},addVertex:function(a){var b=this.get("nodes");if(a){var c=a.id(),d="vertex"==a.type()?this.vertices():this.vertexSet();d[c]=a,a.restricted(!0);var e=a.parentVertexSet();e&&(e.removeVertex(c),e.updated(!0)),a.parentVertexSet(this),b.push(a.id()),this.updated(!0)}},removeVertex:function(a){var b=this.get("nodes"),c=this.vertices()[a]||this.vertexSet()[a];c&&(c.parentVertexSet(null),delete this.vertices()[a],delete this.vertexSet()[a],b.splice(b.indexOf(a),1),this.updated(!0))},eachSubVertex:function(b,c){a.each(this.vertices(),b,c||this),a.each(this.vertexSet(),function(a){a.eachSubVertex(b,c)},this)},eachSubVertexSet:function(b,c){a.each(this.vertexSet(),b,c||this),a.each(this.vertexSet(),function(a){a.eachSubVertexSet(b,c)},this)},getSubEdgeSets:function(){var b={};return this.eachSubVertex(function(c){a.each(c.edgeSets(),function(a,c){b[c]=a})},this),b},_expand:function(){var b=this.graph(),c=this.parentVertexSet();c&&c.activated(!1),this._activated=!1,a.each(this.edgeSetCollections(),function(a,c){b.deleteEdgeSetCollection(c)},this),a.each(this.vertices(),function(a){a.restricted(!1),a.visible()&&b.generateVertex(a)},this),a.each(this.vertexSet(),function(a){a.restricted(!1),a.visible()&&b.generateVertexSet(a)},this),this.visible(!1),this._generateConnection()},_collapse:function(){var b=this.graph();this._activated=!0,this.eachSubVertex(function(c){c.restricted(!0),c.generated()&&a.each(c.edgeSetCollections(),function(a,c){b.deleteEdgeSetCollection(c)})},this),a.each(this.vertexSet(),function(a,c){a.restricted(!0),a.generated()&&b.removeVertexSet(c,!1)},this),a.each(this.vertices(),function(a,c){a.restricted(!0),a.generated()&&b.removeVertex(c)},this),this.visible(!0),this._generateConnection()},_generateConnection:function(){var b=this.graph();a.each(this.getSubEdgeSets(),function(a){b._generateConnection(a)},this)}}})}(nx,nx.global),function(a){a.define("nx.data.EdgeSet",a.data.Edge,{properties:{edges:{value:function(){return{}}},type:{value:"edgeSet"},activated:{get:function(){return void 0!==this._activated?this._activated:!0 -},set:function(b){var c=this.graph();a.each(this.edges(),function(a,d){b?c.removeEdge(d,!1):c.generateEdge(a)},this),this._activated=b}}},methods:{addEdge:function(a){var b=this.edges();b[a.id()]=a},removeEdge:function(a){var b=this.edges();delete b[a]}}})}(nx,nx.global),function(a){a.define("nx.data.EdgeSetCollection",a.data.Edge,{properties:{edgeSets:{value:function(){return{}}},edges:{get:function(){var b={};return a.each(this.edgeSets(),function(c){a.extend(b,c.edges())}),b}},type:{value:"edgeSetCollection"},activated:{get:function(){return void 0!==this._activated?this._activated:!0},set:function(b){this.graph();a.each(this.edgeSets(),function(a){a.activated(b,{force:!0})}),this._activated=b}}},methods:{addEdgeSet:function(a){var b=this.edgeSets();b[a.linkKey()]=a},removeEdgeSet:function(a){var b=this.edgeSets();delete b[a]}}})}(nx,nx.global),function(a){a.util;a.define("nx.data.ObservableGraph.Vertices",a.data.ObservableObject,{events:["addVertex","removeVertex","deleteVertex","updateVertex","updateVertexCoordinate"],properties:{nodes:{get:function(){return this._nodes||[]},set:function(b){this._nodes&&a.is(this._nodes,a.data.ObservableCollection)&&this._nodes.off("change",this._nodesCollectionProcessor,this),this.vertices().clear(),a.is(b,a.data.ObservableCollection)?(b.on("change",this._nodesCollectionProcessor,this),b.each(function(a){this._addVertex(a)},this),this._nodes=b):b&&(a.each(b,this._addVertex,this),this._nodes=b.slice())}},vertexFilter:{},vertices:{value:function(){var b=new a.data.ObservableDictionary;return b.on("change",function(b,c){var d=c.action,e=c.items;"clear"==d&&a.each(e,function(a){this.deleteVertex(a.key())},this)},this),b}},visibleVertices:{get:function(){var a={};return this.eachVertex(function(b,c){b.visible()&&(a[c]=b)}),a}},vertexPositionGetter:{},vertexPositionSetter:{}},methods:{addVertex:function(b,c){{var d,e=this.nodes(),f=this.vertices();this.identityKey()}return a.is(e,a.data.ObservableCollection)?(e.add(b),d=f.getItem(f.count()-1)):(d=this._addVertex(b,c),d&&e.push(b)),d?(c&&d.sets(c),this.generateVertex(d),d):null},_addVertex:function(b){var c=this.vertices(),d=this.identityKey();("string"==typeof b||"number"==typeof b)&&(b={data:b});var e=a.path(b,d);if(e=void 0!==e?e:this.vertexSets().count()+this.vertices().count(),c.getItem(e))return null;var f=new a.data.Vertex(b),g=this.vertexPositionGetter(),h=this.vertexPositionSetter();if(g&&h&&(f.positionGetter(g),f.positionSetter(h)),f.sets({graph:this,id:e}),a.is(b,a.data.ObservableObject)){var i=b.set;b.set=function(a,c){i.call(b,a,c),-1==f.__properties__.indexOf(a)&&(f.has(a)?f[a].call(f,c):f.notify(a))}}f.position(f.positionGetter().call(f)),c.setItem(e,f);var j=this.vertexFilter();if(j&&a.is(j,Function)){var k=j.call(this,b,f);f.visible(k===!1)}return f},generateVertex:function(a){!a.visible()||a.generated()||a.restricted()||(a.on("updateCoordinate",this._updateVertexCoordinateFN,this),this.fire("addVertex",a),a.generated(!0))},_updateVertexCoordinateFN:function(a){this.fire("updateVertexCoordinate",a)},removeVertex:function(b){var c=this.vertices().getItem(b);return c?(a.each(c.edgeSets(),function(a,b){this.removeEdgeSet(b)},this),a.each(c.edgeSetCollections(),function(a,b){this.deleteEdgeSetCollection(b)},this),c.off("updateCoordinate",this._updateVertexCoordinateFN,this),c.generated(!1),this.fire("removeVertex",c),c):!1},deleteVertex:function(b){var c=this.nodes(),d=this.getVertex(b);if(d)if(a.is(c,a.data.ObservableCollection)){var e=d.getData();c.remove(e)}else{var f=this.nodes().indexOf(d.getData());-1!=f&&this.nodes().splice(f,1),this._deleteVertex(b)}},_deleteVertex:function(b){var c=this.vertices().getItem(b);if(!c)return!1;a.each(c.edgeSets(),function(a){this.deleteEdgeSet(a.linkKey())},this),a.each(c.edgeSetCollections(),function(a){this.deleteEdgeSetCollection(a.linkKey())},this);var d=c.parentVertexSet();d&&d.removeVertex(b),c.off("updateCoordinate",this._updateVertexCoordinateFN,this),c.generated(!1),this.fire("deleteVertex",c),this.vertices().removeItem(b),c.dispose()},eachVertex:function(a,b){this.vertices().each(function(c,d){a.call(b||this,c.value(),d)})},getVertex:function(a){return this.vertices().getItem(a)},_nodesCollectionProcessor:function(b,c){var d=c.items,e=c.action,f=this.identityKey();"add"==e?a.each(d,function(a){var b=this._addVertex(a);this.generateVertex(b)},this):"remove"==e?a.each(d,function(b){var c=a.path(b,f);this._deleteVertex(c)},this):"clear"==e&&this.vertices().clear()}}})}(nx,nx.global),function(a){a.define("nx.data.ObservableGraph.VertexSets",a.data.ObservableObject,{events:["addVertexSet","removeVertexSet","updateVertexSet","updateVertexSetCoordinate"],properties:{nodeSet:{get:function(){return this._nodeSet||[]},set:function(b){this._nodeSet&&a.is(this._nodeSet,a.data.ObservableCollection)&&this._nodeSet.off("change",this._nodeSetCollectionProcessor,this),this.vertexSets().clear(),a.is(b,a.data.ObservableCollection)?(b.on("change",this._nodeSetCollectionProcessor,this),b.each(function(a){this._addVertexSet(a)},this),this._nodeSet=b):b&&(a.each(b,this._addVertexSet,this),this._nodeSet=b.slice()),this.eachVertexSet(this.initVertexSet,this)}},vertexSets:{value:function(){var b=new a.data.ObservableDictionary;return b.on("change",function(b,c){var d=c.action,e=c.items;"clear"==d&&a.each(e,function(a){this.removeVertexSet(a.key())},this)},this),b}},visibleVertexSets:{get:function(){var a={};return this.eachVertexSet(function(b,c){b.visible()&&(a[c]=b)}),a}}},methods:{addVertexSet:function(b,c){var d,e=this.nodeSet(),f=this.vertexSets();if(a.is(e,a.data.ObservableCollection)?(e.add(b),d=f.getItem(f.count()-1)):(e.push(b),d=this._addVertexSet(b)),!d)return null;if(c&&d.sets(c),null!=c.parentVertexSetID){var g=this.getVertexSet(c.parentVertexSetID);g&&g.addVertex(d)}return this.initVertexSet(d),this.generateVertexSet(d),d.activated(!0,{force:!0}),this.updateVertexSet(d),d},_addVertexSet:function(b){var c=this.identityKey(),d=this.vertexSets();("string"==typeof b||"number"==typeof b)&&(b={data:b});var e=a.path(b,c);if(e=void 0!==e?e:this.vertexSets().count()+this.vertices().count(),d.getItem(e))return null;var f=new a.data.VertexSet(b),g=this.vertexPositionGetter(),h=this.vertexPositionSetter();if(g&&h&&(f.positionGetter(g),f.positionSetter(h)),f.sets({graph:this,type:"vertexSet",id:e}),a.is(b,a.data.ObservableObject)){var i=b.set;b.set=function(a,c){i.call(b,a,c),-1==f.__properties__.indexOf(a)&&(f.has(a)?f[a].call(f,c):f.notify(a))}}return f.position(f.positionGetter().call(f)),this.vertexSets().setItem(e,f),f},initVertexSet:function(a){a.initNodes()},generateVertexSet:function(a){a.visible()&&!a.generated()&&(a.generated(!0),a.on("updateCoordinate",this._updateVertexSetCoordinateFN,this),this.fire("addVertexSet",a))},_updateVertexSetCoordinateFN:function(a){this.fire("updateVertexSetCoordinate",a)},updateVertexSet:function(a){a.generated()&&(a.updated(!1),this.fire("updateVertexSet",a))},removeVertexSet:function(b){var c=this.vertexSets().getItem(b);return c?(c.activated(!0),a.each(c.edgeSets(),function(a,b){this.removeEdgeSet(b)},this),a.each(c.edgeSetCollections(),function(a,b){this.deleteEdgeSetCollection(b)},this),c.generated(!1),c.off("updateCoordinate",this._updateVertexSetCoordinateFN,this),void this.fire("removeVertexSet",c)):!1},deleteVertexSet:function(b){var c=this.nodeSet(),d=this.getVertexSet(b);if(d)if(a.is(c,a.data.ObservableCollection)){var e=d.getData();c.remove(e)}else{var f=this.nodeSet().indexOf(d.getData());-1!=f&&this.nodeSet().splice(f,1),this._deleteVertexSet(b)}},_deleteVertexSet:function(b){var c=this.vertexSets().getItem(b);if(!c)return!1;c.generated()&&c.activated(!1);var d=c.parentVertexSet();d&&d.removeVertex(b),a.each(c.vertices(),function(a){d?d.addVertex(a):a.parentVertexSet(null)}),a.each(c.vertexSet(),function(a){d?d.addVertex(a):a.parentVertexSet(null)}),c.off("updateCoordinate",this._updateVertexCoordinateFN,this),c.generated(!1),this.vertexSets().removeItem(b),this.fire("deleteVertexSet",c),c.dispose()},eachVertexSet:function(a,b){this.vertexSets().each(function(c,d){a.call(b||this,c.value(),d)})},getVertexSet:function(a){return this.vertexSets().getItem(a)},_nodeSetCollectionProcessor:function(b,c){var d=c.items,e=c.action,f=this.identityKey();"add"==e?a.each(d,function(a){var b=this._addVertexSet(a);this.generateVertexSet(b)},this):"remove"==e?a.each(d,function(b){var c=a.path(b,f);this._deleteVertexSet(c)},this):"clear"==e&&this.vertexSets().clear()}}})}(nx,nx.global),function(a){a.define("nx.data.ObservableGraph.Edges",a.data.ObservableObject,{events:["addEdge","removeEdge","deleteEdge","updateEdge","updateEdgeCoordinate"],properties:{links:{get:function(){return this._links||[]},set:function(b){this._links&&a.is(this._links,a.data.ObservableCollection)&&this._links.off("change",this._linksCollectionProcessor,this),this.edgeSetCollections().clear(),this.edgeSets().clear(),this.edges().clear(),a.is(b,a.data.ObservableCollection)?(b.on("change",this._linksCollectionProcessor,this),b.each(function(a){this._addEdge(a)},this),this._links=b):b&&(a.each(b,this._addEdge,this),this._links=b.slice())}},edgeFilter:{},edges:{value:function(){var b=new a.data.ObservableDictionary;return b.on("change",function(b,c){var d=c.action,e=c.items;"clear"==d&&a.each(e,function(a){this.deleteEdge(a.key())},this)},this),b}}},methods:{addEdge:function(b,c){var d,e=this.links(),f=this.edges();if(null==b.source||null==b.target)return void 0;if(a.is(e,a.data.ObservableCollection)?(e.add(b),d=f.getItem(f.count()-1)):(d=this._addEdge(b),d&&e.push(b)),!d)return null;c&&d.sets(c);var g=d.parentEdgeSet();return g.generated()?this.updateEdgeSet(g):this.generateEdgeSet(g),d},_addEdge:function(b){{var c,d,e,f,g=this.edges();this.identityKey()}if(null==b.source||null==b.target)return void 0;if(e=null!=a.path(b,"source")?a.path(b,"source"):b.source,c=this.vertices().getItem(e),f=null!=a.path(b,"target")?a.path(b,"target"):b.source,d=this.vertices().getItem(f),c&&d){var h=new a.data.Edge(b),i=null!=a.path(b,"id")?a.path(b,"id"):h.__id__;if(g.getItem(i))return null;h.sets({id:i,source:c,target:d,sourceID:e,targetID:f,graph:this}),h.attachEvent(),g.setItem(i,h);var j=this.getEdgeSetBySourceAndTarget(e,f);j?j.updated(!0):j=this._addEdgeSet({source:c,target:d,sourceID:e,targetID:f}),h.sets({linkKey:j.linkKey(),reverseLinkKey:j.reverseLinkKey()}),j.addEdge(h),h.parentEdgeSet(j),h.reverse(e!==j.sourceID());var k=this.edgeFilter();if(k&&a.is(k,Function)){var l=k.call(this,b,h);h.visible(l===!1)}return h}return void(console&&console.warn("source node or target node is not defined, or linkMappingKey value error",b,c,d))},generateEdge:function(a){a.generated()||(a.on("updateCoordinate",this._updateEdgeCoordinate,this),this.fire("addEdge",a),a.generated(!0))},removeEdge:function(a,b){var c=this.edges().getItem(a);if(!c)return!1;if(c.generated(!1),c.off("updateCoordinate",this._updateEdgeCoordinate,this),this.fire("removeEdge",c),b!==!1){var d=c.parentEdgeSet();this.updateEdgeSet(d)}},deleteEdge:function(b,c){var d=this.getEdge(b);if(!d)return!1;var e=this.links();if(a.is(e,a.data.ObservableCollection))e.removeAt(d.getData());else{var f=e.indexOf(d.getData());-1!=f&&e.splice(f,1),this._deleteEdge(b,c)}},_deleteEdge:function(a,b){var c=this.getEdge(a);if(!c)return!1;if(c.off("updateCoordinate",this._updateEdgeCoordinate,this),b!==!1){var d=c.parentEdgeSet();d.removeEdge(a),this.updateEdgeSet(d)}this.fire("deleteEdge",c),this.edges().removeItem(a),c.dispose()},_updateEdgeCoordinate:function(a){this.fire("updateEdgeCoordinate",a)},getEdge:function(a){return this.edges().getItem(a)},getEdgesBySourceAndTarget:function(a,b){var c=this.getEdgeSetBySourceAndTarget(a,b);return c&&c.getEdges()},getEdgesByVertices:function(){},getInternalEdgesByVertices:function(){},getExternalEdgesByVertices:function(){},_linksCollectionProcessor:function(b,c){var d=c.items,e=c.action;if("add"==e)a.each(d,function(a){var b=this._addEdge(a),c=b.parentEdgeSet();c.generated()?this.updateEdgeSet(c):this.generateEdgeSet(c)},this);else if("remove"==e){var f=[];this.edges().each(function(a){var b=a.value();-1!=d.indexOf(b.getData())&&f.push(b.id())},this),a.each(f,function(a){this._deleteEdge(a)},this)}else"clear"==e&&this.edges().clear()}}})}(nx,nx.global),function(a){a.define("nx.data.ObservableGraph.EdgeSets",a.data.ObservableObject,{events:["addEdgeSet","updateEdgeSet","removeEdgeSet","deleteEdgeSet","updateEdgeSetCoordinate"],properties:{edgeSets:{value:function(){var b=new a.data.ObservableDictionary;return b.on("change",function(b,c){var d=c.action,e=c.items;"clear"==d&&a.each(e,function(a){this.deleteEdgeSet(a.key())},this)},this),b}}},methods:{_addEdgeSet:function(b){var c=new a.data.EdgeSet,d=c.__id__,e=b.sourceID+"_"+b.targetID,f=b.targetID+"_"+b.sourceID;return c.sets(b),c.sets({graph:this,linkKey:e,reverseLinkKey:f,id:d}),c.source().addEdgeSet(c,e),c.target().addEdgeSet(c,e),c.attachEvent(),this.edgeSets().setItem(e,c),c},generateEdgeSet:function(a){!a.generated()&&a.source().generated()&&a.target().generated()&&(a.generated(!0),a.on("updateCoordinate",this._updateEdgeSetCoordinate,this),this.fire("addEdgeSet",a))},updateEdgeSet:function(a){a.generated()&&a.source().generated()&&a.target().generated()&&(a.updated(!1),this.fire("updateEdgeSet",a))},removeEdgeSet:function(b){var c=this.edgeSets().getItem(b);return c?(c.off("updateCoordinate",this._updateEdgeSetCoordinate,this),a.each(c.edges(),function(a,b){this.removeEdge(b,!1)},this),c.generated(!1),c._activated=!0,void this.fire("removeEdgeSet",c)):!1},deleteEdgeSet:function(b){var c=this.edgeSets().getItem(b);return c?(c.off("updateCoordinate",this._updateEdgeSetCoordinate,this),a.each(c.edges(),function(a,b){this.deleteEdge(b,!1)},this),c.source().removeEdgeSet(b),c.target().removeEdgeSet(b),this.fire("deleteEdgeSet",c),this.edgeSets().removeItem(b),void c.dispose()):!1},_updateEdgeSetCoordinate:function(a){this.fire("updateEdgeSetCoordinate",a)},getEdgeSetBySourceAndTarget:function(b,c){var d=this.edgeSets(),e=a.is(b,a.data.Vertex)?b.id():b,f=a.is(c,a.data.Vertex)?c.id():c,g=e+"_"+f,h=f+"_"+e;return d.getItem(g)||d.getItem(h)},eachEdgeSet:function(a,b){this.edgeSets().each(function(c,d){a.call(b||this,c.value(),d)})}}})}(nx,nx.global),function(a){a.define("nx.data.ObservableGraph.EdgeSetCollections",a.data.ObservableObject,{events:["addEdgeSetCollection","removeEdgeSetCollection","deleteEdgeSetCollection","updateEdgeSetCollection","updateEdgeSetCollectionCoordinate"],properties:{edgeSetCollections:{value:function(){var b=new a.data.ObservableDictionary;return b.on("change",function(b,c){var d=c.action,e=c.items;"clear"==d&&a.each(e,function(a){a.value()&&this.deleteEdgeSetCollection(a.value().linkKey())},this)},this),b}}},methods:{_addEdgeSetCollection:function(b){var c=new a.data.EdgeSetCollection,d=c.__id__,e=b.sourceID+"_"+b.targetID,f=b.targetID+"_"+b.sourceID;return c.sets(b),c.sets({graph:this,linkKey:e,reverseLinkKey:f,id:d}),c.source().addEdgeSetCollection(c,e),c.target().addEdgeSetCollection(c,e),c.attachEvent(),this.edgeSetCollections().setItem(e,c),c},generateEdgeSetCollection:function(a){a.generated(!0),a.on("updateCoordinate",this._updateEdgeSetCollectionCoordinate,this),this.fire("addEdgeSetCollection",a)},updateEdgeSetCollection:function(a){a.updated(!0),this.fire("updateEdgeSetCollection",a)},removeEdgeSetCollection:function(a){var b=this.edgeSetCollections().getItem(a);return b?(b.generated(!1),b.off("updateCoordinate",this._updateEdgeSetCollectionCoordinate,this),void this.fire("removeEdgeSetCollection",b)):!1},deleteEdgeSetCollection:function(a){var b=this.edgeSetCollections().getItem(a);return b?(b.off("updateCoordinate",this._updateEdgeSetCollectionCoordinate,this),b.source().removeEdgeSetCollection(a),b.target().removeEdgeSetCollection(a),this.fire("deleteEdgeSetCollection",b),this.edgeSetCollections().removeItem(a),void b.dispose()):!1},getEdgeSetCollectionBySourceAndTarget:function(b,c){var d=this.edgeSetCollections(),e=a.is(b,a.data.Vertex)?b.id():b,f=a.is(c,a.data.Vertex)?c.id():c,g=e+"_"+f,h=f+"_"+e;return d.getItem(g)||d.getItem(h)},_updateEdgeSetCollectionCoordinate:function(a){this.fire("updateEdgeSetCollectionCoordinate",a)},eachEdgeCollections:function(a,b){this.edgeSetCollections().each(function(c,d){a.call(b||this,c.value(),d)})},_generateConnection:function(a){if(a.source().visible()&&a.target().visible()){var b=this._getGeneratedRootVertexSetOfEdgeSet(a);if(b.source&&b.target&&b.source!=b.target&&b.source.visible()&&b.target.visible())if(b.source.id()==a.sourceID()&&b.target.id()==a.targetID())this.generateEdgeSet(a);else{var c=this.getEdgeSetCollectionBySourceAndTarget(b.source.id(),b.target.id());c||(c=this._addEdgeSetCollection({source:b.source,target:b.target,sourceID:b.source.id(),targetID:b.target.id()}),this.generateEdgeSetCollection(c)),c.addEdgeSet(a),this.updateEdgeSetCollection(c)}}},_getGeneratedRootVertexSetOfEdgeSet:function(a){var b=a.source();b.generated()||(b=b.generatedRootVertexSet());var c=a.target();return c.generated()||(c=c.generatedRootVertexSet()),{source:b,target:c}}}})}(nx,nx.global),function(a){a.define("nx.data.ObservableGraph.NeXtForceProcessor",{methods:{process:function(b,c){var d=(new Date,{nodes:b.nodes,links:[]}),e={};a.each(b.nodes,function(a,b){e[a[c]]=b}),d.links=[],a.each(b.links,function(b){a.is(b.source,"Object")||void 0===e[b.source]||a.is(b.target,"Object")||void 0===e[b.target]||d.links.push({source:e[b.source],target:e[b.target]})});var f=new a.data.NextForce;if(f.setTopoData(b),console.log(d.nodes.length),d.nodes.length<50){for(;;)if(f.tick(),f.maxEnergy<.1*d.nodes.length)break}else for(var g=0; ++g<900;)f.tick();return console.log(f.maxEnergy),b}}})}(nx,nx.global,nx.logger),function(a){a.define("nx.data.ObservableGraph.ForceProcessor",{methods:{process:function(b, c){{var d;new Date}d={nodes:b.nodes,links:[]};var e={};a.each(b.nodes,function(a, b){e[a[c]]=b}),a.each(b.links,function(b){a.is(b.source,"Object")||void 0===e[b.source]||a.is(b.target,"Object")||void 0===e[b.target]||d.links.push("ixd"==c?{source:b.source,target:b.target}:{source:e[b.source],target:e[b.target]})});var f=new a.data.Force;for(f.nodes(d.nodes),f.links(d.links),f.start();f.alpha();)f.tick();return f.stop(),b}}})}(nx,nx.global,nx.logger),function(a){a.define("nx.data.ObservableGraph.QuickProcessor",{methods:{process:function(b,c,d){return a.each(b.nodes,function(a){a.x=Math.floor(Math.random()*d.width()),a.y=Math.floor(Math.random()*d.height())}),b}}})}(nx,nx.global),function(a){var b=a.define("nx.data.ObservableGraph.DataProcessor",{statics:{dataProcessor:{nextforce:new a.data.ObservableGraph.NeXtForceProcessor,force:new a.data.ObservableGraph.ForceProcessor,quick:new a.data.ObservableGraph.QuickProcessor},registerDataProcessor:function(a,b){GRAPH.dataProcessor[a]=b}},properties:{dataProcessor:{},width:{value:100},height:{value:100}},methods:{processData:function(a){var c=this._identityKey,d=this._dataProcessor;if(d){var e=b.dataProcessor[d];return e?e.process(a,c,this):a}return a}}})}(nx,nx.global),function(a){a.define("nx.data.ObservableGraph",a.data.ObservableObject,{mixins:[a.data.ObservableGraph.DataProcessor,a.data.ObservableGraph.Vertices,a.data.ObservableGraph.VertexSets,a.data.ObservableGraph.Edges,a.data.ObservableGraph.EdgeSets,a.data.ObservableGraph.EdgeSetCollections],event:["setTopoData","insertData","clear","startGenerate","endGenerate"],properties:{identityKey:{value:"index"},filter:{},groupBy:{}},methods:{init:function(a){this.inherited(a),this.nodeSet([]),this.nodes([]),this.links([]),this.sets(a),a&&a.data&&this.setTopoData(a.data)},setTopoData:function(a){this.processData(this.getJSON(a));this.clear(),this._generate(a),this.fire("setTopoData",a)},subordinates:function(b, c){"function"==typeof b&&(c=b,b=null);var d;return b?d=a.util.values(b.vertices()).concat(a.util.values(b.vertexSet())):(d=[],a.each(this.vertices(),function(a){var b=a.value();b.parentVertexSet()||d.push(b)}.bind(this)),a.each(this.vertexSets(),function(a){var b=a.value();b.parentVertexSet()||d.push(b)}.bind(this))),c&&a.each(d,c),d},insertData:function(b){var c=b;a.each(b.nodes,function(a){this.addVertex(a)},this),a.each(b.links,function(a){this.addEdge(a)},this),a.each(b.nodeSet,function(a){this.addVertexSet(a)},this),this.fire("insertData",c)},_generate:function(a){this.nodes(a.nodes),this.links(a.links),this.nodeSet(a.nodeSet);var b=this.filter();b&&b.call(this,this),this.fire("startGenerate"),this.eachVertex(this.generateVertex,this),this.eachVertexSet(this.generateVertexSet,this),this.eachEdgeSet(this.generateEdgeSet,this),this.eachVertexSet(function(a){a.activated(!0,{force:!0}),this.updateVertexSet(a)},this),this.fire("endGenerate")},getData:function(){return{nodes:this.nodes(),links:this.links(),nodeSet:this.nodeSet()}},getJSON:function(b){var c=b||this.getData(),d={nodes:[],links:[]};return a.is(c.nodes,a.data.ObservableCollection)?a.each(c.nodes,function(b){d.nodes.push(a.is(b,a.data.ObservableObject)?b.gets():b)}):d.nodes=c.nodes,a.is(c.links,a.data.ObservableCollection)?a.each(c.links,function(b){d.links.push(a.is(b,a.data.ObservableObject)?b.gets():b)}):d.links=c.links,c.nodeSet&&(a.is(c.nodeSet,a.data.ObservableCollection)?(d.nodeSet=[],a.each(c.nodeSet,function(b){d.nodeSet.push(a.is(b,a.data.ObservableObject)?b.gets():b)})):d.nodeSet=c.nodeSet),d},getBound:function(b){var c,d,e,f,g,h,i=b||a.util.values(this.visibleVertices()).concat(a.util.values(this.visibleVertexSets())),j=i[0];return j?(g=j.get?j.get("x"):j.x,h=j.get?j.get("y"):j.y,c=d=g||0,e=f=h||0):(c=d=0,e=f=0),a.each(i,function(a){g=a.get?a.get("x"):a.x,h=a.get?a.get("y"):a.y,c=Math.min(c,g||0),d=Math.max(d,g||0),e=Math.min(e,h||0),f=Math.max(f,h||0)}),{x:c,y:e,left:c,top:e,width:d-c,height:f-e,maxX:d,maxY:f}},getHierarchicalStructure:function(){var b=this.getJSON(),c={},d=[],e=this.identityKey();return a.each(b.nodes,function(b){var f=a.path(b,e),g={id:f,children:[]};d.push(g),c[f]=g}),a.each(b.nodeSet,function(b,f){var g=a.path(b,e),h={id:g,children:[]};b.nodes.forEach(function(a){c[a]?(~(f=d.indexOf(c[a]))&&d.splice(f,1),h.children.push(c[a])):h.children.push({id:a,children:[]})}),d.push(h),c[g]=h}),d},clear:function(){this.nodeSet([]),this.links([]),this.nodes([]),this.fire("clear")},dispose:function(){this.clear(),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.data.UniqObservableCollection",a.data.ObservableCollection,{methods:{add:function(a){return null==a||this.contains(a)?!1:this.inherited(a)},addRange:function(b){if(a.is(b,Array)){for(var c=a.util.uniq(b.slice()),d=0;d"}},theme:{get:function(){return this._theme||"blue"},set:function(a){this._theme=a,this.notify("themeClass")}},themeClass:{get:function(){return"n-topology-"+this.theme()}},showNavigation:{value:!0},showThumbnail:{value:!1},viewSettingPanel:{get:function(){return this.view("nav").view("customize")}},viewSettingPopover:{get:function(){return this.view("nav").view("settingPopover")}}},methods:{}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.Graph",{events:["beforeSetData","afterSetData","insertData","topologyGenerated"],properties:{identityKey:{get:function(){return this._identiyKey||"index"},set:function(a){this._identiyKey=a,this.graph().set("identityKey",a)}},data:{get:function(){return this.graph().getData()},set:function(b){if(null!=b&&a.is(b,Object)&&null!=b.nodes){var c=function(a){this.fire("beforeSetData",a),this.clear(),this.graph().sets({width:this.width(),height:this.height()}),this.graph().setTopoData(a),this.fire("afterSetData",a)};"appended"===this.status()||"generated"==this.status()?c.call(this,b):this.on("ready",function(){c.call(this,b)},this)}}},autoLayout:{get:function(){return this._autoLayout||!1},set:function(a){this._autoLayout=a,this.graph().dataProcessor(a?"force":"")}},vertexPositionGetter:{get:function(){return this._vertexPositionGetter},set:function(a){this._vertexPositionGetter=a,this.graph().set("vertexPositionGetter",a)}},vertexPositionSetter:{get:function(){return this._vertexPositionSetter},set:function(a){this._vertexPositionSetter=a,this.graph().set("vertexPositionSetter",a)}},dataProcessor:{get:function(){return this._dataProcessor},set:function(a){this._dataProcessor=a,this.graph().set("dataProcessor",a)}},graph:{value:function(){return new a.data.ObservableGraph}}},methods:{initGraph:function(){var a=this.graph();a.sets({vertexPositionGetter:this.vertexPositionGetter(),vertexPositionSetter:this.vertexPositionSetter(),identityKey:this.identityKey(),dataProcessor:this.dataProcessor()}),this.autoLayout()&&a.dataProcessor("force");var b=this.getLayer("nodes"),c=this.getLayer("links"),d=this.getLayer("nodeSet"),e=this.getLayer("linkSet");a.on("addVertex",function(a,c){b.addNode(c)},this),a.on("removeVertex",function(a,c){b.removeNode(c.id())},this),a.on("deleteVertex",function(a,c){b.removeNode(c.id())},this),a.on("updateVertex",function(a,c){b.updateNode(c.id())},this),a.on("updateVertexCoordinate",function(){},this),a.on("addEdge",function(a,b){c.addLink(b)},this),a.on("removeEdge",function(a,b){c.removeLink(b.id())},this),a.on("deleteEdge",function(a,b){c.removeLink(b.id())},this),a.on("updateEdge",function(a,b){c.updateLink(b.id())},this),a.on("updateEdgeCoordinate",function(a,b){c.updateLink(b.id())},this),a.on("addEdgeSet",function(a,b){this.supportMultipleLink()?e.addLinkSet(b):b.activated(!1)},this),a.on("removeEdgeSet",function(a,b){e.removeLinkSet(b.linkKey())},this),a.on("deleteEdgeSet",function(a,b){e.removeLinkSet(b.linkKey())},this),a.on("updateEdgeSet",function(a,b){e.updateLinkSet(b.linkKey())},this),a.on("updateEdgeSetCoordinate",function(a,b){this.supportMultipleLink()&&e.updateLinkSet(b.linkKey())},this),a.on("addVertexSet",function(a,b){d.addNodeSet(b)},this),a.on("removeVertexSet",function(a,b){d.removeNodeSet(b.id())},this),a.on("deleteVertexSet",function(a,b){d.removeNodeSet(b.id())},this),a.on("updateVertexSet",function(a, b){d.updateNodeSet(b.id())},this),a.on("updateVertexSetCoordinate",function(){},this),a.on("addEdgeSetCollection",function(a, b){e.addLinkSet(b)},this),a.on("removeEdgeSetCollection",function(a, b){e.removeLinkSet(b.linkKey())},this),a.on("deleteEdgeSetCollection",function(a, b){e.removeLinkSet(b.linkKey())},this),a.on("updateEdgeSetCollection",function(a, b){e.updateLinkSet(b.linkKey())},this),a.on("updateEdgeSetCollectionCoordinate",function(a, b){e.updateLinkSet(b.linkKey())},this),a.on("setTopoData",function(){},this),a.on("insertData",function(){},this),a.on("clear",function(){},this),a.on("startGenerate",function(){this.showLoading(),this.stage().hide()},this),a.on("endGenerate",function(){this._endGenerate()},this)},setTopoData:function(b, c, d){c&&this.on("topologyGenerated",function e(){c.call(d||this,this),this.off("topologyGenerated",e,this)},this),null!=b&&a.is(b,Object)&&null!=b.nodes&&this.data(b)},insertData:function(b){null!=b&&a.is(b,Object)&&(this.graph().insertData(b),this.fire("insertData",b))},getData:function(){return this.data()},_saveData:function(){var a=this.graph().getData();"[object Storage]"===Object.prototype.toString.call(window.localStorage)&&localStorage.setItem("topologyData",JSON.stringify(a))},_loadLastData:function(){if("[object Storage]"===Object.prototype.toString.call(window.localStorage)){var a=JSON.parse(localStorage.getItem("topologyData"));this.setTopoData(a)}},start:function(){},_endGenerate:function(){this.stage().resetFitMatrix();var a=this.layoutType();a?this.activateLayout(a,null,function(){this.__fit(),this.status("generated"),this.fire("topologyGenerated")}):(this.__fit(),this.status("generated"),this.fire("topologyGenerated"))},__fit:function(){this.stage().show(),this.autoFit()&&(this.stage().fit(null,null,!1),this.stage().resetFitMatrix(),this.stage().fit(null,null,!1),this.stage().resetFitMatrix(),this.stage().fit(null,null,!1)),this.hideLoading()}}})}(nx,nx.global),function(a){function b(a){return a.wheelDelta?a.wheelDelta:a.detail?-40*a.detail:void 0}a.define("nx.graphic.Topology.Event",{events:["clickStage","pressStage","dragStageStart","dragStage","dragStageEnd","stageTransitionEnd","zoomstart","zooming","zoomend","resetzooming","fitStage","up","down","left","right","esc","space","enter","pressA","pressS","pressF","pressM","pressR"],properties:{enableGradualScaling:{value:!0}},methods:{_mousewheel:function(a,c){if(this.scalable()){var d=8e3,e=b(c),f=this.stage(),g=e/d;null==this._zoomWheelDelta&&(this._zoomWheelDelta=0,this.fire("zoomstart")),this._zoomWheelDelta+=e/d,this._enableGradualScaling?Math.abs(this._zoomWheelDelta)<.3?f.disableUpdateStageScale(!0):(this._zoomWheelDelta=0,f.disableUpdateStageScale(!1)):f.disableUpdateStageScale(!0),f.applyStageScale(1+g,[void 0===c.offsetX?c.layerX:c.offsetX,void 0===c.offsetY?c.layerY:c.offsetY]),this._zooomEventTimer&&clearTimeout(this._zooomEventTimer),this._zooomEventTimer=setTimeout(function(){f.resetStageMatrix(),delete this._zoomWheelDelta,this.fire("zoomend")}.bind(this),200),this.fire("zooming")}return c.preventDefault(),!1},_contextmenu:function(a,b){b.preventDefault()},_clickStage:function(a,b){this.fire("clickStage",b)},_pressStage:function(a,b){this.fire("pressStage",b)},_dragStageStart:function(a,b){this.fire("dragStageStart",b)},_dragStage:function(a,b){this.fire("dragStage",b)},_dragStageEnd:function(a,b){this.fire("dragStageEnd",b)},_stageTransitionEnd:function(a,b){window.event=b,this.fire("stageTransitionEnd",b)},_key:function(a,b){var c=b.keyCode;switch(c){case 38:this.fire("up",b),b.preventDefault();break;case 40:this.fire("down",b),b.preventDefault();break;case 37:this.fire("left",b),b.preventDefault();break;case 39:this.fire("right",b),b.preventDefault();break;case 13:this.fire("enter",b),b.preventDefault();break;case 27:this.fire("esc",b),b.preventDefault();break;case 65:this.fire("pressA",b);break;case 70:this.fire("pressF",b);break;case 77:this.fire("pressM",b);break;case 82:this.fire("pressR",b);break;case 83:this.fire("pressS",b);break;case 32:this.fire("space",b),b.preventDefault()}return!1},blockEvent:function(b){b?a.dom.Document.body().addClass("n-userselect n-blockEvent"):(a.dom.Document.body().removeClass("n-userselect"),a.dom.Document.body().removeClass("n-blockEvent"))}}})}(nx,nx.global),function(a){var b=a.util;a.define("nx.graphic.Topology.NodeMixin",{events:["addNode","deleteNode","addNodeSet","deleteNodeSet","expandAll"],properties:{nodeInstanceClass:{value:"nx.graphic.Topology.Node"},nodeSetInstanceClass:{value:"nx.graphic.Topology.NodeSet"},nodeDraggable:{value:!0},enableSmartLabel:{value:!0},showIcon:{get:function(){return void 0!==this._showIcon?this._showIcon:!1},set:function(a){return this._showIcon!==a?(this._showIcon=a,"initializing"!==this.status()&&this.eachNode(function(b){b.showIcon(a)}),!0):!1}},nodeConfig:{},nodeSetConfig:{},selectedNodes:{value:function(){return new a.data.UniqObservableCollection}},activeNodes:{set:function(b){var c=this.getLayer("nodes"),d=this.getLayer("nodeSet"),e=this._activeNodesWatcher;e||(e=this._activeNodesWatcher=new a.graphic.Topology.NodeWatcher,e.topology(this),e.updater(function(){var b=e.getNodes();a.each(b,function(a){"vertex"==a.model().type()?c.activeElements().add(a):d.activeElements().add(a)},this)}.bind(this))),c.activeElements().clear(),d.activeElements().clear(),e.nodes(b),this._activeNodes=b}},highlightedNodes:{set:function(b){var c=this.getLayer("nodes"),d=this.getLayer("nodeSet"),e=this._highlightedNodesWatcher;e||(e=this._highlightedNodesWatcher=new a.graphic.Topology.NodeWatcher,e.topology(this),e.updater(function(){a.each(e.getNodes(),function(a){"vertex"==a.model().type()?c.highlightedElements().add(a):d.highlightedElements().add(a) -},this)}.bind(this))),c.highlightedElements().clear(),d.highlightedElements().clear(),e.nodes(b),this._highlightedNodes=b}},enableNodeSetAnimation:{value:!0},aggregationRule:{}},methods:{initNode:function(){var b=this.selectedNodes();b.on("change",function(c,d){"add"==d.action?a.each(d.items,function(a){a.selected(!0),a.on("remove",this._removeSelectedNode=function(){b.remove(a)},this)},this):"remove"==d.action?a.each(d.items,function(a){a.selected(!1),a.off("remove",this._removeSelectedNode,this)},this):"clear"==d.action&&a.each(d.items,function(a){a.selected(!1),a.off("remove",this._removeSelectedNode,this)},this)})},addNode:function(a,b){var c=this.graph().addVertex(a,b);if(c){var d=this.getNode(c.id());return this.fire("addNode",d),d}return null},removeNode:function(a){this.deleteNode(a)},deleteNode:function(b,c,d){var e=b;a.is(b,a.graphic.Topology.AbstractNode)&&(e=b.id());var f=this.graph().getVertex(e);if(f){var g=this.getNode(e);this.fire("deleteNode",g),this.graph().deleteVertex(e),c&&c.call(d||this)}},_getAggregationTargets:function(b){var c,d,e,f,g,h,i,j=this.graph(),k={},l=a.util.uuid(),m=b.slice();do for(i=!1,e=m.length-1;e>=0;e--){if(f=m[e],g=f.parentVertexSet(),h=g?g.id():l,k.hasOwnProperty(h)||(k[h]={vertex:g||j,finding:j.subordinates(g),found:[]}),c=k[h],c===!1||c.found.indexOf(f)>=0)throw"wrong input";c.found.push(f),m.splice(e,1),i=!0,c.finding.length===c.found.length&&c.vertex!==j&&(m.push(c.vertex),k[h]=!1)}while(i);for(c in k)k[c]||delete k[c];if(d=a.util.values(k),1!==d.length)throw a.graphic.Topology.i18n.cantAggregateNodesInDifferentNodeSet;return c=d[0],c.found},aggregationNodes:function(b,c){var d=[],e=[];a.each(b,function(b){if(a.is(b,a.graphic.Topology.AbstractNode)||(b=this.getNode(b)),!a.is(b,a.graphic.Topology.AbstractNode))throw"wrong input";d.push(b),e.push(b.model())}.bind(this));var f,g;if(f=this._getAggregationTargets(e),f.length<2)throw"wrong input. unable to aggregate.";g=[],a.each(f,function(a){g.push(a.id())});var h=this.aggregationRule();if(h&&a.is(h,"Function")){var i=h.call(this,d,c);if(i===!1)return}var j,k,l=null,m={};j={nodes:g,x:c&&"number"==typeof c.x?c.x:f[0].x(),y:c&&"number"==typeof c.y?c.y:f[0].y(),label:c&&c.label||[d[0].label(),d[d.length-1].label()].sort().join("-")},k=f[0].parentVertexSet(),k&&(m.parentVertexSetID=k.id(),l=this.getNode(k.id()));var n=this.addNodeSet(j,m,l);return this.stage().resetFitMatrix(),n},addNodeSet:function(a,b,c){var d=this.graph().addVertexSet(a,b);if(d){var e=this.getNode(d.id());return c&&e.parentNodeSet(c),this.fire("addNodeSet",e),e}return null},removeNodeSet:function(a){this.deleteNodeSet(a)},deleteNodeSet:function(b,c,d){if(b){var e=b;a.is(b,a.graphic.Topology.AbstractNode)&&(e=b.id());var f=this.getLayer("nodeSet").getNodeSet(e);f?f.collapsed()?(f.activated(!1),f.expandNodes(function(){this.fire("deleteNodeSet",f),this.graph().deleteVertexSet(e),c&&c.call(d||this)},this)):(this.fire("deleteNodeSet",f),this.graph().deleteVertexSet(e),c&&c.call(d||this)):(this.graph().deleteVertexSet(e),c&&c.call(d||this))}},eachNode:function(a,b){this.getLayer("nodes").eachNode(a,b||this),this.getLayer("nodeSet").eachNodeSet(a,b||this)},getNode:function(a){return this.getLayer("nodes").getNode(a)||this.getLayer("nodeSet").getNodeSet(a)},getNodes:function(){var a=this.getLayer("nodes").nodes(),b=this.getLayer("nodeSet").nodeSets();return b&&0!==b.length?a.concat(b):a},registerIcon:function(b,c,d,e){var f="http://www.w3.org/1999/xlink",g="http://www.w3.org/2000/svg",h=document.createElementNS(g,"image");h.setAttributeNS(f,"href",c),a.graphic.Icons.icons[b]={size:{width:d,height:e},icon:h.cloneNode(!0),name:b};var i=h.cloneNode(!0);i.setAttribute("height",e),i.setAttribute("width",d),i.setAttribute("data-device-type",b),i.setAttribute("id",b),i.setAttribute("class","deviceIcon"),this.stage().addDef(i)},highlightRelatedNode:function(c){var d;if(null!=c&&(d=a.is(c,a.graphic.Topology.AbstractNode)?c:this.getNode(c))){var e=this.getLayer("nodeSet"),f=this.getLayer("nodes");a.is(d,"nx.graphic.Topology.NodeSet")?e.highlightedElements().add(d):f.highlightedElements().add(d),d.eachConnectedNode(function(b){a.is(b,"nx.graphic.Topology.NodeSet")?e.highlightedElements().add(b):f.highlightedElements().add(b)},this),this.getLayer("linkSet").highlightLinkSets(b.values(d.linkSets())),this.getLayer("links").highlightLinks(b.values(d.links())),this.fadeOut(!0)}},activeRelatedNode:function(c){var d;if(c&&(d=a.is(c,a.graphic.Topology.AbstractNode)?c:this.getNode(c))){var e=this.getLayer("nodeSet"),f=this.getLayer("nodes");a.is(d,"nx.graphic.Topology.NodeSet")?e.activeElements().add(d):f.activeElements().add(d),d.eachConnectedNode(function(b){a.is(b,"nx.graphic.Topology.NodeSet")?e.activeElements().add(b):f.activeElements().add(b)},this),this.getLayer("linkSet").activeLinkSets(b.values(d.linkSets())),this.getLayer("links").activeLinks(b.values(d.links())),this.fadeOut()}},zoomByNodes:function(b,c,d,e){a.is(b,Array)||(b=[b]);var f,g,h,i,j=this.stage(),k=this.getModelBoundByNodes(b),l=j.maxZoomLevel()*j.fitMatrixObject().scale();k&&(k.width*l<1&&k.height*l<1?(h=a.geometry.Vector.transform(k.center,j.matrix()),i=[j.width()/2-h[0],j.height()/2-h[1]],j.scalingLayer().setTransition(function(){this.adjustLayout(),c&&c.call(d||this),this.fire("zoomend")},this,.6),j.applyTranslate(i[0],i[1]),j.applyStageScale(j.maxZoomLevel()/j.zoomLevel()*e)):(f=a.geometry.Vector.transform([k.left,k.top],j.matrix()),g=a.geometry.Vector.transform([k.right,k.bottom],j.matrix()),k={left:f[0],top:f[1],width:Math.max(1,g[0]-f[0]),height:Math.max(1,g[1]-f[1])},e=1/(e||1),k.left+=k.width*(1-e)/2,k.top+=k.height*(1-e)/2,k.height*=e,k.width*=e,this.zoomByBound(k,function(){this.adjustLayout(),c&&c.call(d||this),this.fire("zoomend")},this)))},getModelBoundByNodes:function(b,c){var d,e,f,g;return a.each(b,function(b){var h;if(a.is(b,a.graphic.Topology.AbstractNode))h=b.model();else if(c)h=this.graph().getVertex(b)||this.graph().getVertexSet(b);else{var i=this.getNode(b);h=i&&i.model()}if(h){var j=h.x(),k=h.y();d=j>d?d:j,f=k>f?f:k,e=e>j?e:j,g=g>k?g:k}},this),void 0===d||void 0===f?void 0:{left:d,top:f,right:e,bottom:g,center:[(e+d)/2,(g+f)/2],width:e-d,height:g-f}},getBoundByNodes:function(b,c){(null==b||0===b.length)&&(b=this.getNodes());var d={left:0,top:0,x:0,y:0,width:0,height:0,maxX:0,maxY:0},e=[];a.each(b,function(b){var d;d=a.is(b,a.graphic.Topology.AbstractNode)?b:this.getNode(b),d&&d.visible()&&e.push(c?this.getInsideBound(d.getBound(!0)):this.getInsideBound(d.getBound()))},this);var f=e.length-1;return e.sort(function(a,b){return a.left-b.left}),d.x=d.left=e[0].left,d.maxX=e[f].left,e.sort(function(a,b){return a.left+a.width-(b.left+b.width)}),d.width=e[f].left+e[f].width-d.x,e.sort(function(a,b){return a.top-b.top}),d.y=d.top=e[0].top,d.maxY=e[f].top,e.sort(function(a,b){return a.top+a.height-(b.top+b.height)}),d.height=e[f].top+e[f].height-d.y,d},_moveSelectionNodes:function(b,c){if(this.nodeDraggable()){var d=this.selectedNodes().toArray(),e=this.stageScale();-1===d.indexOf(c)?c.move(b.drag.delta[0]*e,b.drag.delta[1]*e):a.each(d,function(a){a.move(b.drag.delta[0]*e,b.drag.delta[1]*e)})}},expandNodes:function(b,c,d,e,f){var g=a.is(b,Array)?b.length:a.util.keys(b).length;if(d=d||function(){},g>150||0===g||f===!1)d.call(e||this,this);else{var h=[];a.each(b,function(a){h.push({id:a.id(),position:a.position(),node:a}),a.position(c)},this),this._nodesAnimation&&this._nodesAnimation.stop();var i=this._nodesAnimation=new a.graphic.Animation({duration:600});i.callback(function(b){a.each(h,function(a){var d=a.position,e=a.node;e&&e.model()&&e.position({x:c.x+(d.x-c.x)*b,y:c.y+(d.y-c.y)*b})})}.bind(this)),i.complete(function(){d.call(e||this,this)}.bind(this)),i.start()}},collapseNodes:function(b,c,d,e,f){var g=a.is(b,Array)?b.length:a.util.keys(b).length;if(d=d||function(){},g>150||0===g||f===!1)d.call(e||this,this);else{var h=[];a.each(b,function(a){h.push({id:a.id(),position:a.position(),node:a,vertex:a.model(),vertexPosition:a.model().position()})},this),this._nodesAnimation&&this._nodesAnimation.stop();var i=this._nodesAnimation=new a.graphic.Animation({duration:600});i.callback(function(b){a.each(h,function(a){var d=a.position,e=a.node;e&&e.model()&&e.position({x:d.x-(d.x-c.x)*b,y:d.y-(d.y-c.y)*b})})}.bind(this)),i.complete(function(){a.each(h,function(a){a.vertex.position(a.vertexPosition)}),d.call(e||this,this)}.bind(this)),i.start()}},expandAll:function(){var a=this.getLayer("nodeSet"),b=function(c){var d=!0;a.eachNodeSet(function(a){a.visible()&&(a.animation(!1),a.collapsed(!1),d=!1)}),d?c():b(c)};this.showLoading(),setTimeout(function(){b(function(){a.eachNodeSet(function(a){a.animation(!0)}),this.stage().resetFitMatrix(),this.hideLoading(),this.fit(function(){this.blockEvent(!1),this.fire("expandAll")},this)}.bind(this))}.bind(this),100)}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.LinkMixin",{events:["addLink","deleteLink"],properties:{linkInstanceClass:{value:"nx.graphic.Topology.Link"},linkSetInstanceClass:{value:"nx.graphic.Topology.LinkSet"},supportMultipleLink:{value:!0},linkConfig:{},linkSetConfig:{}},methods:{addLink:function(a,b){if(null==a.source||null==a.target)return void 0;var c=this.graph().addEdge(a,b);if(c){var d=this.getLink(c.id());return this.fire("addLink",d),d}return null},removeLink:function(a){this.deleteLink(a)},deleteLink:function(b){var c=b;a.is(b,a.graphic.Topology.AbstractLink)&&(c=b.id()),this.fire("deleteLink",this.getLink(c)),this.graph().deleteEdge(c)},eachLink:function(a,b){this.getLayer("links").eachLink(a,b||this)},getLink:function(a){return this.getLayer("links").getLink(a)},getLinkSet:function(a,b){return this.getLayer("linkSet").getLinkSet(a,b)},getLinkSetByLinkKey:function(a){return this.getLayer("linkSet").getLinkSetByLinkKey(a)},getLinksByNode:function(a,b){var c=this.getLinkSet(a,b);return c?c.links():void 0}}})}(nx,nx.global),function(a,b){a.define("nx.graphic.Topology.LayerMixin",{events:[],properties:{layersMap:{value:function(){return{}}},layers:{value:function(){return[]}},fade:{dependencies:"forceFade",value:function(a){return a===!0||a===!1?a:this._fade}},fadeActivePriority:{value:!1,set:function(a){this.dom().addClass(a?"fade-active-priority":"fade-active-priority"),this._fadeActivePriority=!!a}},fadeUpdater_internal_:{dependencies:"fade",update:function(a){a?this.dom().addClass("fade-all"):this.dom().removeClass("fade-all")}},forceFade:{},layerResource_internal_:{value:function(){return{}}}},methods:{initLayer:function(){this.layersMap({}),this.layers([]),this.attachLayer("links","nx.graphic.Topology.LinksLayer"),this.attachLayer("linkSet","nx.graphic.Topology.LinkSetLayer"),this.attachLayer("groups","nx.graphic.Topology.GroupsLayer"),this.attachLayer("nodes","nx.graphic.Topology.NodesLayer"),this.attachLayer("nodeSet","nx.graphic.Topology.NodeSetLayer"),this.attachLayer("paths","nx.graphic.Topology.PathLayer")},_generateLayer:function(c,d){var e;if(c&&d){if(a.is(d,"String")){var f=a.path(b,d);f&&(e=new f)}else e=d;e.topology(this),e.draw(),a.each(e.__events__,function(b){a.Object.delegateEvent(e,b,this,b)},this)}return e},getLayer:function(a){var b=this.layersMap();return b[a]},appendLayer:function(a,b){return this.attachLayer(a,b)},attachLayer:function(b,c,d){var e,f=this.layersMap(),g=this.layers(),h=this._generateLayer(b,c),i={};return h&&(d>=0?(h.attach(this.stage(),d),g.splice(d,0,h)):(h.attach(this.stage()),g.push(h)),f[b]=h,e=this.layerResource_internal_(),e[b]=i,i.activeElementsChangeListener=function(){i.activeCount=h.activeElements().count();var b=0;a.each(e,function(a){b+=a.activeCount}),this.dom().setClass("fade-active-occur",b>0)},h.activeElements().on("change",i.activeElementsChangeListener,this)),h},prependLayer:function(a,b){return this.attachLayer(a,b,0)},insertLayerAfter:function(a,b,c){var d=this.layersMap()[c];if(d){var e=this.layers().indexOf(d);if(e>=0)return this.attachLayer(a,b,e+1)}},eachLayer:function(b,c){a.each(this.layersMap(),b,c)},fadeOut:function(a){a?this.forceFade(!0):this.forceFade()||this.fade(!0)},fadeIn:function(a){this.forceFade()===!0?a&&(this.forceFade(null),this.fade(!1)):this.fade(!1)},recoverActive:function(){a.each(this.layers(),function(a){a.activeElements&&a.activeElements().clear()},this),this.activeNodes([]),this.fadeIn()},recoverHighlight:function(){a.each(this.layers(),function(a){a.highlightedElements&&a.highlightedElements().clear()},this),this.highlightedNodes([]),this.fadeIn(!0)}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.StageMixin",{events:["fitStage","ready","resizeStage","afterFitStage"],properties:{width:{get:function(){return this._width||300+2*this.padding()},set:function(a){return this.resize(a)}},height:{get:function(){return this._height||300+2*this.padding()},set:function(a){this.resize(null,a)}},padding:{value:100},scalable:{value:!0},stageScale:{value:1},revisionScale:{value:1},matrix:{value:function(){return new a.geometry.Matrix(a.geometry.Matrix.I)}},adaptive:{value:!1},stage:{get:function(){return this.view("stage")}},enableSmartNode:{value:!0},autoFit:{value:!0}},methods:{initStage:function(){a.each(a.graphic.Icons.icons,function(a,b){if(a.icon){var c=a.icon.cloneNode(!0);c.setAttribute("height",a.size.height),c.setAttribute("width",a.size.width),c.setAttribute("data-device-type",b),c.setAttribute("id",b),c.setAttribute("class","deviceIcon"),this.stage().addDef(c)}},this)},_adaptiveTimer:function(){var b=this;if(this.adaptive()||0===this.width()||0===this.height())var c=setInterval(function(){a.dom.Document.body().contains(b.view().dom())&&(clearInterval(c),this._adaptToContainer(),this.status("appended"),this.fire("ready"))}.bind(this),10);else this.status("appended"),setTimeout(function(){this.fire("ready")}.bind(this),0)},_adaptToContainer:function(){var a=this.view().dom().parentNode().getBound();return 0===a.width||0===a.height?void(console&&console.warn("Please set height*width to topology's parent container")):void((this._width!==a.width||this._height!==a.height)&&this.resize(a.width,a.height))},adaptToContainer:function(){this.adaptive()&&(this._adaptToContainer(),this.fit())},getInsideBound:function(a){var b=a||this.stage().view("stage").getBound(),c=this.view().dom().getBound();return{left:b.left-c.left,top:b.top-c.top,width:b.width,height:b.height}},getAbsolutePosition:function(a){var b=this.matrix(),c=b.scale(),d=this.view().dom().getOffset();return{x:a.x*c+b.x()+d.left,y:a.y*c+b.y()+d.top}},fit:function(a,b,c){this.stage().fit(function(){this.adjustLayout(),a&&a.call(b||this),this.fire("afterFitStage")},this,null==c?!0:c),this.fire("fitStage")},zoom:function(){},zoomByBound:function(a,b,c,d){this.stage().zoomByBound(a,function(){this.adjustLayout(),b&&b.call(c||this),this.fire("zoomend")},this,void 0!==d?d:.9)},move:function(a,b,c){var d=this.stage();d.applyTranslate(a||0,b||0,c)},resize:function(a,b){var c=!1;if(null!=a&&a!=this._width){var d=Math.max(a,300+2*this.padding());d!=this._width&&(this._width=d,c=!0)}if(null!=b){var e=Math.max(b,300+2*this.padding());e!=this._height&&(this._height=e)}return c&&(this.notify("width"),this.notify("height"),this.stage().resetFitMatrix(),this.fire("resizeStage")),c},adjustLayout:function(){this.enableSmartNode()&&(this._adjustLayoutTimer&&clearTimeout(this._adjustLayoutTimer),this._adjustLayoutTimer=setTimeout(function(){var a=this.graph();if(a){var b=(new Date,this.matrix()),c=b.scale(),d=[];this.eachNode(function(a){if(!a.activated||a.activated()){var e=a.position();d[d.length]={x:e.x*c+b.x(),y:e.y*c+b.y()}}});var e=function(a){for(var b=a.length,c=1296,d=1024,e=function(a,b){var e=Math.pow(Math.abs(a.x-b.x),2)+Math.pow(Math.abs(a.y-b.y),2);return{iconOverlap:c>e,dotOverlap:d>e}},f=0,g=0,h=0;b>h;h++){for(var i=a[h],j=!1,k=!1,l=0;b>l;l++){var m=a[l];if(h!==l){var n=e(i,m);n.iconOverlap&&(j=!0),n.dotOverlap&&(k=!0)}}j&&f++,k&&g++}var o=1;return f/b>.2&&(o=.8,g/b>.8?o=.2:g/b>.5?o=.4:g/b>.15&&(o=.6)),o};if(window.Blob&&window.Worker){var f="onmessage = function(e) { self.postMessage(calc(e.data)); };";if(f+="var calc = "+e.toString(),!this.adjustWorker){var g=new Blob([f]),h=window.URL.createObjectURL(g),i=this.adjustWorker=new Worker(h);i.onmessage=function(a){var b=a.data;this.revisionScale(b)}.bind(this)}this.adjustWorker.postMessage(d)}}}.bind(this),200))}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.TooltipMixin",{events:[],properties:{tooltipManagerConfig:{get:function(){return this._tooltipManagerConfig||{}},set:function(a){var b=this.tooltipManager();b&&b.sets(a),this._tooltipManagerConfig=a}},tooltipManager:{value:function(){var b=this.tooltipManagerConfig();return new a.graphic.Topology.TooltipManager(a.extend({},{topology:this},b))}}},methods:{}})}(nx,nx.global),function(a,b){a.define("nx.graphic.Topology.SceneMixin",{events:[],properties:{scenesMap:{value:function(){return{}}},scenes:{value:function(){return[]}},currentScene:{},currentSceneName:{},sceneEnabled:{value:!0}},methods:{initScene:function(){this.registerScene("default","nx.graphic.Topology.DefaultScene"),this.registerScene("selection","nx.graphic.Topology.SelectionNodeScene"),this.registerScene("zoomBySelection","nx.graphic.Topology.ZoomBySelection"),this.activateScene("default"),this._registerEvents()},registerScene:function(c,d){var e;if(c&&d){var f,g=this.scenesMap(),h=this.scenes();a.is(d,"String")?(e=a.path(b,d),e&&(f=new e)):f=d,f&&(f.topology(this),g[c]=f,h.push(f))}},activateScene:function(a){var b=this.scenesMap(),c=a||"default",d=b[c]||b["default"];return this.deactivateScene(),this.currentScene(d),this.currentSceneName(c),d.activate(),this.fire("switchScene",{name:a,scene:d}),d},deactivateScene:function(){this.currentScene()&&this.currentScene().deactivate&&this.currentScene().deactivate(),this.currentScene(null)},disableCurrentScene:function(a){this.sceneEnabled(!a)},_registerEvents:function(){a.each(this.__events__,this._aop=function(a){this.upon(a,function(b,c){this.dispatchEvent(a,b,c)},this)},this)},dispatchEvent:function(a,b,c){if(this.sceneEnabled()){var d=this.currentScene();d.dispatch&&d.dispatch(a,b,c),d[a]&&d[a].call(d,b,c)}}}})}(nx,nx.global),function(a,b){{var c={USMap:"nx.graphic.Topology.USMapLayout",hierarchicalLayout:"nx.graphic.Topology.HierarchicalLayout"};a.define("nx.graphic.Topology.LayoutMixin",{events:[],properties:{layoutMap:{value:function(){return{}}},layoutType:{value:null},layoutConfig:{value:null}},methods:{initLayout:function(){var d=a.extend({},c,a.graphic.Topology.layouts);a.each(d,function(c,d){var e;if(a.is(c,"Function"))e=new c;else{var f=a.path(b,c);if(!f)throw"Error on instance node class";e=new f}this.registerLayout(d,e)},this)},registerLayout:function(a,b){var c=this.layoutMap();c[a]=b,b.topology&&b.topology(this)},getLayout:function(a){var b=this.layoutMap();return b[a]},activateLayout:function(a,b,c){var d=this.layoutMap(),e=a||this.layoutType(),f=b||this.layoutConfig();d[e]&&d[e].process&&(d[e].process(this.graph(),f,c),this.layoutType(e))},deactivateLayout:function(){}}})}}(nx,nx.global),function(a){a.define("nx.graphic.Topology.Categories",{events:[],properties:{},methods:{showLoading:function(){a.dom.Document.html().addClass("n-waitCursor"),this.view().dom().addClass("n-topology-loading"),this.view("loading").dom().setStyle("display","block")},hideLoading:function(){a.dom.Document.html().removeClass("n-waitCursor"),this.view().dom().removeClass("n-topology-loading"),this.view("loading").dom().setStyle("display","none")},exportPNG:function(){this.fit();var b=new XMLSerializer,c=this.stageScale(),d=topo.matrix().x(),e=topo.matrix().y(),f=this.stage().view().dom().$dom.querySelector(".stage").cloneNode(!0);a.each(f.querySelectorAll(".fontIcon"),function(a){a.remove()}),a.each(f.querySelectorAll(".link"),function(a){a.style.stroke="#26A1C5",a.style.fill="none",a.style.background="transparent"}),a.each(f.querySelectorAll("line.link-set-bg"),function(a){a.style.stroke="#26A1C5"}),a.each(f.querySelectorAll("text.node-label"),function(a){a.style.fontSize="12px",a.style.fontFamily="Tahoma"}),a.each(f.querySelectorAll(".n-hidden"),function(a){a.remove()}),a.each(f.querySelectorAll(".selectedBG"),function(a){a.remove()}),a.each(f.querySelectorAll('[data-nx-type="nx.graphic.Topology.GroupsLayer"]'),function(a){a.remove()});var g=b.serializeToString(f),h=''+g+"",i=window.btoa(h),j=this.view("img").dom().$dom;j.setAttribute("width",this.width()),j.setAttribute("height",this.height()),j.setAttribute("src","data:image/svg+xml;base64,"+i);var k=this.view("canvas").dom().$dom,l=k.getContext("2d"),m=this.revisionScale(),n=32*m;l.fillStyle="#fff",l.fillRect(0,0,this.width(),this.height()),l.drawImage(j,0,0),l.font=n+"px next-font",this.eachNode(function(b){var f=b.iconType(),g=a.graphic.Icons.get(f);l.fillStyle="#fff",l.fillText(g.font[1],b.x()/c+d-16*m,b.y()/c+e+16*m),l.fillStyle=b.color()||"#26A1C5",l.fillText(g.font[0],b.x()/c+d-16*m,b.y()/c+e+16*m)});var o=document.createElement("a");o.setAttribute("href",k.toDataURL()),o.setAttribute("download",(new Date).getTime()+".png");var p=document.createEvent("MouseEvents");p.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,0,null),o.dispatchEvent(p)},__drawBG:function(a){var b=a||this.stage().getContentBound(),c=this.stage().view("bg");c.sets({x:b.left,y:b.top,width:b.width,height:b.height,visible:!0}),c.set("visible",!0)}}})}(nx,nx.global),function(a){var b=a.Object.extendEvent,c=a.Object.extendProperty,d=a.Object.extendMethod,e=a.define("nx.graphic.Topology",a.ui.Component,{statics:{i18n:{cantAggregateExtraNode:"Can't aggregate extra node",cantAggregateNodesInDifferentNodeSet:"Can't aggregate nodes in different nodeSet"},extensions:[],registerExtension:function(f){var g=e.prototype,h=f.prototype;e.extensions.push(f),a.each(f.__events__,function(a){b(g,a)}),a.each(f.__properties__,function(a){c(g,a,h[a].__meta__)}),a.each(f.__methods__,function(a){"init"!==a&&d(g,a,h[a])})},layouts:{}},mixins:[a.graphic.Topology.Config,a.graphic.Topology.Graph,a.graphic.Topology.Event,a.graphic.Topology.StageMixin,a.graphic.Topology.NodeMixin,a.graphic.Topology.LinkMixin,a.graphic.Topology.LayerMixin,a.graphic.Topology.LayoutMixin,a.graphic.Topology.TooltipMixin,a.graphic.Topology.SceneMixin,a.graphic.Topology.Categories],events:["clear"],view:{props:{"class":["n-topology","{#themeClass}"],tabindex:"0",style:{width:"{#width}",height:"{#height}"}},content:[{name:"stage",type:"nx.graphic.Stage",props:{width:"{#width}",height:"{#height}",padding:"{#padding}",matrixObject:"{#matrix,direction=<>}",stageScale:"{#stageScale,direction=<>}"},events:{":mousedown":"{#_pressStage}",":touchstart":"{#_pressStage}",click:"{#_clickStage}",touchend:"{#_clickStage}",mousewheel:"{#_mousewheel}",DOMMouseScroll:"{#_mousewheel}",dragStageStart:"{#_dragStageStart}",dragStage:"{#_dragStage}",dragStageEnd:"{#_dragStageEnd}",stageTransitionEnd:"{#_stageTransitionEnd}"}},{name:"nav",type:"nx.graphic.Topology.Nav",props:{visible:"{#showNavigation}",showIcon:"{#showIcon,direction=<>}"}},{name:"loading",props:{"class":"n-topology-loading"},content:{tag:"ul",props:{items:new Array(10),template:{tag:"li"}}}},{name:"img",tag:"img",props:{style:{display:"none"}}},{name:"canvas",tag:"canvas",props:{width:"{#width}",height:"{#height}",style:{display:"none"}}}],events:{contextmenu:"{#_contextmenu}",keydown:"{#_key}"}},properties:{},methods:{init:function(b){this.inherited(b),this.sets(b),this.initStage(),this.initLayer(),this.initGraph(),this.initNode(),this.initScene(),this.initLayout(),a.each(e.extensions,function(a){var b=a.__ctor__;b&&b.call(this)},this)},attach:function(a){this.inherited(a),this._adaptiveTimer()},clear:function(){this.status("cleared"),this._nodesAnimation&&this._nodesAnimation.stop(),this.graph().clear(),this.tooltipManager().closeAll(),a.each(this.layers(),function(a){a.clear()}),this.blockEvent(!1),this.fire("clear"),this.width()&&this.height()&&this.status("appended")},dispose:function(){this.status("disposed"),this.tooltipManager().dispose(),this.graph().dispose(),a.each(this.layers(),function(a){a.dispose()}),this.blockEvent(!1),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.Layer",a.graphic.Group,{view:{type:"nx.graphic.Group",props:{"class":"layer"}},properties:{topology:{value:null},highlightedElements:{value:function(){return new a.data.UniqObservableCollection}},activeElements:{value:function(){return new a.data.UniqObservableCollection}},fade:{dependencies:"forceFade",value:function(a){return a===!0||a===!1?a:this._fade}},fadeUpdater_internal_:{dependencies:"fade",update:function(a){a?this.dom().addClass("fade-layer"):this.dom().removeClass("fade-layer")}},forceFade:{}},methods:{init:function(b){this.inherited(b),this.view().set("data-nx-type",this.__className__);var c=this.highlightedElements(),d=this.activeElements();c.on("change",function(b,e){"add"==e.action?a.each(e.items,function(a){a.dom().addClass("fade-highlight-item")}):("remove"==e.action||"clear"==e.action)&&a.each(e.items,function(a){a.dom()&&a.dom().removeClass("fade-highlight-item")}),0===c.count()&&0===d.count()?this.fadeIn():this.fadeOut()},this),d.on("change",function(b,e){"add"==e.action?a.each(e.items,function(a){a.dom().addClass("fade-active-item")}):("remove"==e.action||"clear"==e.action)&&a.each(e.items,function(a){a.dom()&&a.dom().removeClass("fade-active-item")}),0===c.count()&&0===d.count()?this.fadeIn():this.fadeOut()},this)},draw:function(){},show:function(){this.visible(!0)},hide:function(){this.visible(!1)},fadeOut:function(a){a?this.forceFade(!0):this.forceFade()||this.fade(!0)},fadeIn:function(a){this.forceFade()===!0?a&&(this.forceFade(null),this.fade(!1)):this.fade(!1)},recover:function(a,b,c){this.fadeIn(a,b,c)},clear:function(){this.highlightedElements().clear(),this.activeElements().clear(),this.view().dom().empty()},dispose:function(){this.clear(),this.highlightedElements().clear(),this.activeElements().clear(),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.NodeWatcher",a.Observable,{properties:{nodes:{get:function(){return this._nodes||[]},set:function(b){var c=this.updater(),d=this.vertices();if(0!==d.length&&(a.each(d,function(a){a.unwatch("generated",c,this)},this),d.length=0),b){var e=b;a.is(e,Array)||a.is(e,a.data.ObservableCollection)||(e=[e]),a.each(e,function(a){var b=this._getVertex(a);b&&-1==d.indexOf(b)&&d.push(b)},this),a.is(e,a.data.ObservableCollection)&&e.on("change",function(a,b){b.action,b.items});var f=this.observePosition();a.each(d,function(a){a.watch("generated",c,this),f&&a.on("updateCoordinate",c,this)},this),c(),this._nodes=e}}},updater:{value:function(){return function(){}}},topology:{set:function(a){if(a&&a.graph()){var b=a.graph();b.on("addVertexSet",this.update,this),b.on("removeVertexSet",this.update,this),b.on("deleteVertexSet",this.update,this),b.on("updateVertexSet",this.update,this)}this._topology=a}},vertices:{value:function(){return[]}},observePosition:{value:!1}},methods:{_getVertex:function(b){var c,d=this.topology();if(d&&d.graph()){var e=d.graph();a.is(b,a.graphic.Topology.AbstractNode)?c=b.model():e.getVertex(b)&&(c=e.getVertex(b))}return c},getNodes:function(b){var c=[],d=this.topology(),e=this.vertices();return a.each(e,function(a){var e=a.id(),f=d.getNode(e);if(b!==!1&&(!f||a.generated()===!1)){var g=a.generatedRootVertexSet();g&&(f=d.getNode(g.id()))}f&&c.indexOf(f)&&c.push(f)}),c},update:function(){var a=this.updater(),b=this.vertices();0!==b.length&&a()},dispose:function(){var a=this.topology();if(a&&a.graph()){var b=a.graph();b.off("addVertexSet",this.update,this),b.off("removeVertexSet",this.update,this),b.off("deleteVertexSet",this.update,this),b.off("updateVertexSet",this.update,this)}this.inherited()}}})}(nx,nx.global),function(a){var b=a.geometry.Vector;a.define("nx.graphic.Topology.AbstractNode",a.graphic.Group,{events:["updateNodeCoordinate","selectNode","remove"],properties:{position:{get:function(){return{x:this._x||0,y:this._y||0}},set:function(a){var b=!1;if(null==a.x||a.x===this._x||this._lockXAxle||(this._x=a.x,this.notify("x"),b=!0),null==a.y||a.y===this._y||this._lockYAxle||(this._y=a.y,this.notify("y"),b=!0),b){var c=this.model();c.position({x:this._x,y:this._y}),this.view().setTransform(this._x,this._y)}}},absolutePosition:{get:function(){var a=this.position(),b=this.topology().matrix(),c=b.scale();return{x:a.x*c+b.x(),y:a.y*c+b.y()}},set:function(a){if(null==a||null==a.x||null==a.y)return!1;var b=this.topology().matrix(),c=b.scale();this.position({x:(a.x-b.x())/c,y:(a.y-b.y())/c})}},matrix:{get:function(){var a=this.position(),b=this.stageScale();return[[b,0,0],[0,b,0],[a.x,a.y,1]]}},vector:{get:function(){return new b(this.x(),this.y())}},x:{get:function(){return this._x||0},set:function(a){return this.position({x:parseFloat(a)})}},y:{get:function(){return this._y||0},set:function(a){return this.position({y:parseFloat(a)})}},lockXAxle:{value:!1},lockYAxle:{value:!1},stageScale:{set:function(a){this.view().setTransform(null,null,a)}},topology:{},id:{get:function(){return this.model().id()}},selected:{value:!1},enable:{value:!0},node:{get:function(){return this}},showIcon:{value:!0},links:{get:function(){var a={};return this.eachLink(function(b,c){a[c]=b}),a}},linkSets:{get:function(){var a={};return this.eachLinkSet(function(b,c){a[c]=b}),a}},connectedNodes:{get:function(){var a={};return this.eachConnectedNode(function(b,c){a[c]=b}),a}}},view:{type:"nx.graphic.Group"},methods:{init:function(a){this.inherited(a),this.watch("selected",function(a,b){this.fire("selectNode",b)},this)},setModel:function(a){this.model(a),a.upon("updateCoordinate",function(a,b){this.position({x:b.newPosition.x,y:b.newPosition.y}),this.fire("updateNodeCoordinate")},this),this.setBinding("visible","model.visible,direction=<>",this),this.setBinding("selected","model.selected,direction=<>",this),this.position(a.position())},update:function(){},move:function(a,b){var c=this.position();this.position({x:c.x+a||0,y:c.y+b||0})},moveTo:function(a,b,c,d,e){if(d!==!1){var f={to:{},duration:e||400};f.to.x=a,f.to.y=b,c&&(f.complete=c),this.animate(f)}else this.position({x:a,y:b})},translateTo:function(){},eachLink:function(a,b){this.model(),this.topology();this.eachLinkSet(function(c){c.eachLink(a,b||this)})},eachLinkSet:function(b,c){var d=this.model(),e=this.topology();a.each(d.edgeSets(),function(a,d){var f=e.getLinkSetByLinkKey(d);f&&b.call(c||this,f,d)},this),a.each(d.edgeSetCollections(),function(a,d){var f=e.getLinkSetByLinkKey(d);f&&b.call(c||this,f,d)},this)},eachConnectedNode:function(a,b){var c=this.topology();this.model().eachConnectedVertex(function(d,e){var f=c.getNode(e);f&&a.call(b||this,f,e)})},dispose:function(){var a=this.model();a&&a.upon("updateCoordinate",null),this.fire("remove"),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.Node",a.graphic.Topology.AbstractNode,{events:["pressNode","clickNode","enterNode","leaveNode","dragNodeStart","dragNode","dragNodeEnd","selectNode"],properties:{label:{set:function(a){var b=this._processPropertyValue(a),c=this.view("label");c.set("text",b),null!=b&&this.calcLabelPosition(),this._label=b}},iconType:{get:function(){return this.view("icon").get("iconType")},set:function(a){var b=this._processPropertyValue(a);return b&&this._iconType!==b?(this._iconType=b,this.view("icon").set("iconType",b),!0):!1}},showIcon:{set:function(a){var b=this._processPropertyValue(a);this._showIcon=b,this.view("icon").set("showIcon",b),null!=this._label&&this.calcLabelPosition(),this._selected&&this.view("selectedBG").set("r",this.selectedRingRadius())}},enableSmartLabel:{value:!0},labelAngle:{value:90},labelVisibility:{value:!0,set:function(a){var b=this._processPropertyValue(a),c=this.view("label");c.visible(b),this._labelVisibility=b}},revisionScale:{set:function(a){var b=this.topology(),c=this.view("icon"); -c.set("scale",a),c.showIcon(b.showIcon()?a>.2:!1),a>.4?this.view("label").set("visible",null==this._labelVisibility?!0:this._labelVisibility):this.view("label").set("visible",!1),null!=this._label&&this.calcLabelPosition(),this._selected&&this.view("selectedBG").set("r",this.selectedRingRadius())}},color:{set:function(a){var b=this._processPropertyValue(a);this.view("label").dom().setStyle("fill",b),this.view("icon").set("color",b),this._color=b}},scale:{get:function(){return this.view("graphic").scale()},set:function(a){var b=this._processPropertyValue(a);this.view("graphic").setTransform(null,null,b),this.calcLabelPosition(!0)}},selectedRingRadius:{get:function(){var a=this.getBound(!0),b=Math.max(a.height,a.width)/2;return b+(this.selected()?10:-4)}},selected:{get:function(){return this._selected||!1},set:function(a){var b=this._processPropertyValue(a);return this._selected==b?!1:(this._selected=b,this.dom().setClass("node-selected",!!b),b&&this.view("selectedBG").set("r",this.selectedRingRadius()),!0)}},enable:{get:function(){return null!=this._enable?this._enable:!0},set:function(a){var b=this._processPropertyValue(a);this._enable=b,b?this.dom().removeClass("disable"):this.dom().addClass("disable")}},parentNodeSet:{get:function(){var a=this.model().parentVertexSet();return a?this.topology().getNode(a.id()):null}},rootNodeSet:{get:function(){var a=this.model();return a.rootVertexSet()?this.topology().getNode(a.rootVertexSet().id()):null}}},view:{type:"nx.graphic.Group",props:{"class":"node"},content:[{name:"label",type:"nx.graphic.Text",props:{"class":"node-label","alignment-baseline":"central",y:12}},{name:"selectedBG",type:"nx.graphic.Circle",props:{"class":"selectedBG",r:26}},{type:"nx.graphic.Group",name:"graphic",content:[{name:"icon",type:"nx.graphic.Icon",props:{"class":"icon",iconType:"unknown",showIcon:!1,scale:1}}],events:{mousedown:"{#_mousedown}",touchstart:"{#_mousedown}",mouseup:"{#_mouseup}",mouseenter:"{#_mouseenter}",mouseleave:"{#_mouseleave}",dragstart:"{#_dragstart}",dragmove:"{#_drag}",dragend:"{#_dragend}"}}]},methods:{translateTo:function(a,b,c,d){var e=this.view(),f=this.position();e.setTransition(function(){this.position({x:a,y:b}),this.calcLabelPosition(!0),c&&c.call(d||this)},this,.5),f.x==a&&f.y==b&&c?c.call(d||this):e.setTransform(a,b,null,.9)},getBound:function(a){return a?this.view("graphic").getBound():this.view().getBound()},_mousedown:function(a,b){this.enable()&&(this._prevPosition=this.position(),b.captureDrag(this.view("graphic"),this.topology().stage()),this.fire("pressNode",b))},_mouseup:function(a,b){if(this.enable()){var c=this.position();this._prevPosition&&c.x===this._prevPosition.x&&c.y===this._prevPosition.y&&this.fire("clickNode",b)}},_mouseenter:function(a,b){this.enable()&&(this.__enter||this._nodeDragging||(this.fire("enterNode",b),this.__enter=!0))},_mouseleave:function(a,b){this.enable()&&this.__enter&&!this._nodeDragging&&(this.fire("leaveNode",b),this.__enter=!1)},_dragstart:function(a,b){window.event=b,this._nodeDragging=!0,this.enable()&&this.fire("dragNodeStart",b)},_drag:function(a,b){window.event=b,this.enable()&&this.fire("dragNode",b)},_dragend:function(a,b){window.event=b,this._nodeDragging=!1,this.enable()&&(this.fire("dragNodeEnd",b),this.updateConnectedNodeLabelPosition())},updateConnectedNodeLabelPosition:function(){this.calcLabelPosition(!0),this.eachConnectedNode(function(a){a.calcLabelPosition()},this)},calcLabelPosition:function(a){this.enableSmartLabel()?(a,this._centralizedText()):this.updateByMaxObtuseAngle(this.labelAngle())},_centralizedText:function(){var b=this.model();if(void 0!==b){var c=b.id(),d=[];a.each(b.edgeSets(),function(a){d.push(a.sourceID()!==c?a.line().dir.negate():a.line().dir)},this),a.each(b.edgeSetCollections(),function(a){d.push(a.sourceID()!==c?a.line().dir.negate():a.line().dir)},this),d=d.sort(function(a,b){return a.circumferentialAngle()-b.circumferentialAngle()});var e,f=new a.geometry.Vector(1,0),g=0;if(0===d.length)e=90;else{d.push(d[0].rotate(359.9));for(var h=0;hi&&(i+=360),i>g&&(g=i,f=d[h])}e=g/2+f.circumferentialAngle(),e%=360}this.updateByMaxObtuseAngle(e)}},updateByMaxObtuseAngle:function(b){var c=this.view("label"),d=Math.floor(b/60),e="middle";5===d||0===d?e="start":(2===d||3===d)&&(e="end");var f=this.getBound(!0),g=Math.max(f.width/2,f.height/2)+(this.showIcon()?12:8),h=new a.geometry.Vector(g,0).rotate(b);c.set("x",h.x),c.set("y",h.y),c.set("text-anchor",e),this._labelAngle=b},dispose:function(){clearTimeout(this._centralizedTextTimer),this.inherited()}}})}(nx,nx.global),function(a,b){var c=a.util,d=a.define("nx.graphic.Topology.NodesLayer",a.graphic.Topology.Layer,{statics:{defaultConfig:{}},events:["clickNode","enterNode","leaveNode","dragNodeStart","dragNode","dragNodeEnd","hideNode","pressNode","selectNode","updateNodeCoordinate"],properties:{nodes:{get:function(){return this.nodeDictionary().values().toArray()}},nodesMap:{get:function(){return this.nodeDictionary().toObject()}},nodeDictionary:{value:function(){return new a.data.ObservableDictionary}}},methods:{attach:function(a){this.inherited(a);var b=this.topology();b.watch("stageScale",this.__watchStageScaleFN=function(a,b){this.nodeDictionary().each(function(a){a.value().stageScale(b)})},this),b.watch("revisionScale",this.__watchRevisionScale=function(a,b){this.nodeDictionary().each(function(a){a.value().revisionScale(b)},this)},this)},addNode:function(a){var b=a.id(),c=this._generateNode(a);return this.nodeDictionary().setItem(b,c),c},removeNode:function(a){var b=this.nodeDictionary(),c=b.getItem(a);c&&(c.dispose(),b.removeItem(a))},updateNode:function(a){var b=this.nodeDictionary(),c=b.getItem(a);c&&c.update()},_getNodeInstanceClass:function(c){var d,e=this.topology(),f=e.nodeInstanceClass();if(a.is(f,"Function")?(d=f.call(this,c),a.is(d,"String")&&(d=a.path(b,d))):d=a.path(b,f),!d)throw"Error on instance node class";return d},_generateNode:function(a){var b=a.id(),c=this.topology(),d=c.stageScale(),e=this._getNodeInstanceClass(a),f=new e({topology:c});return f.setModel(a),f.attach(this.view()),f.sets({"class":"node","data-id":b,stageScale:d}),this.updateDefaultSetting(f),f},updateDefaultSetting:function(b){var e=this.topology(),f=a.graphic.Component.__events__;a.each(b.__events__,function(a){-1==f.indexOf(a)&&b.on(a,function(c,d){d instanceof MouseEvent&&(window.event=d),this.fire(a,b)},this)},this);var g=this.nodeConfig=a.extend({enableSmartLabel:e.enableSmartLabel()},d.defaultConfig,e.nodeConfig());delete g.__owner__,a.each(g,function(a,d){c.setProperty(b,d,a,e)},this),c.setProperty(b,"showIcon",e.showIcon()),1!==e.revisionScale()&&b.revisionScale(e.revisionScale())},eachNode:function(a,b){this.nodeDictionary().each(function(c,d){a.call(b||this,c.value(),d)})},getNode:function(a){return this.nodeDictionary().getItem(a)},clear:function(){this.eachNode(function(a){a.dispose()}),this.nodeDictionary().clear(),this.inherited()},dispose:function(){this.clear();var a=this.topology();a&&(this.topology().unwatch("stageScale",this.__watchStageScaleFN,this),this.topology().unwatch("revisionScale",this.__watchRevisionScale,this),a._activeNodesWatcher&&a._activeNodesWatcher.dispose(),a._highlightedNodesWatcher&&a._highlightedNodesWatcher.dispose()),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.NodeSet",a.graphic.Topology.Node,{events:["expandNode","collapseNode","beforeExpandNode","beforeCollapseNode"],properties:{nodes:{get:function(){var b={},c=this.topology(),d=this.model();return this.model().activated()?void 0:(a.each(d.vertices(),function(a,d){var e=c.getNode(d);e&&(b[d]=e)}),a.each(d.vertexSet(),function(d,e){var f=c.getNode(e);f&&(f.activated()?b[e]=f:a.extend(b,f.nodes()))}),b)}},nodeSets:{get:function(){var a={},b=this.topology(),c=this.model();return c.eachSubVertexSet(function(c,d){var e=b.getNode(d);e&&(a[d]=e)},this),a}},collapsed:{get:function(){return void 0!==this._collapsed?this._collapsed:!0},set:function(a){var b=this._processPropertyValue(a);return this._collapsed!==b?(this._collapsed=b,b?this.collapse(this._animation):this.expand(this._animation),!0):!1}},activated:{value:!0},showIcon:{set:function(a){var b=this._processPropertyValue(a);this._showIcon=b,this.view("icon").set("showIcon",b),this.view("icon").set("visible",b),null!=this._label&&this.calcLabelPosition(),this._selected&&this.view("selectedBG").set("r",this.selectedRingRadius()),this._updateMinusIcon()}},revisionScale:{set:function(a){var b=this.topology(),c=this.view("icon");c.set("scale",a),b.showIcon()?(c.showIcon(a>.2),c.set("visible",a>.2)):(c.showIcon(!1),c.set("visible",!1)),this._updateMinusIcon(a),this._labelVisibility&&this.view("label").set("visible",a>.4)}},animation:{value:!0},expandable:{value:!0},collapsible:{value:!0}},view:{type:"nx.graphic.Group",props:{"class":"node"},content:[{name:"label",type:"nx.graphic.Text",props:{"class":"node-label","alignment-baseline":"central",y:12}},{name:"selectedBG",type:"nx.graphic.Circle",props:{"class":"selectedBG",r:26}},{type:"nx.graphic.Group",name:"graphic",content:[{name:"icon",type:"nx.graphic.Icon",props:{"class":"icon",iconType:"unknown",showIcon:!1,scale:1}},{name:"minus",type:"nx.graphic.Icon",props:{"class":"indicator",iconType:"expand",scale:1}}],events:{mousedown:"{#_mousedown}",touchstart:"{#_mousedown}",mouseup:"{#_mouseup}",mouseenter:"{#_mouseenter}",mouseleave:"{#_mouseleave}",dragstart:"{#_dragstart}",dragmove:"{#_drag}",dragend:"{#_dragend}"}}]},methods:{setModel:function(a){this.inherited(a),this.setBinding("activated","model.activated,direction=<>",this)},update:function(){},expand:function(a,b,c){if(this.fire("beforeExpandNode",this),this.expandable()){var d=this.animation();this.animation("boolean"==typeof a?a:d),this._collapsed=!1,this.selected(!1),this.model().activated(!1),this.topology().expandNodes(this.nodes(),this.position(),function(){this.fire("expandNode",this),b&&b.call(c,this,this)},this,this.animation()),this.animation(d)}},collapse:function(a,b,c){if(this.fire("beforeCollapseNode"),this.collapsible()){var d=this.animation();this.animation("boolean"==typeof a?a:d),this._collapsed=!0,this.selected(!1),this.model().activated(!1),this.topology().collapseNodes(this.nodes(),this.position(),function(){this.model().activated(!0),this.fire("collapseNode",this),b&&b.call(c,this,this)},this,this.animation()),this.animation(d)}},expandNodes:function(a,b){this.model().activated()||this.topology().expandNodes(this.nodes(),this.position(),a,b)},collapseNodes:function(a,b){this.topology().collapseNodes(this.nodes(),this.position(),a,b)},_updateMinusIcon:function(a){var b=this.view("icon"),c=this.view("minus");if(b.showIcon()){c.scale(.4==a?.8:1);var d=b.size(),e=b.scale();c.setTransform(d.width*e/2,d.height*e/2)}else c.setTransform(0,0)}}})}(nx,nx.global),function(a,b){var c=a.util,d=a.define("nx.graphic.Topology.NodeSetLayer",a.graphic.Topology.Layer,{statics:{defaultConfig:{iconType:"nodeSet",label:"model.label"}},events:["clickNodeSet","enterNodeSet","leaveNodeSet","dragNodeSetStart","dragNodeSet","dragNodeSetEnd","hideNodeSet","pressNodeSet","selectNodeSet","updateNodeSetCoordinate","expandNodeSet","collapseNodeSet","beforeExpandNodeSet","beforeCollapseNodeSet","updateNodeSet","removeNodeSet"],properties:{nodeSets:{get:function(){return this.nodeSetDictionary().values().toArray()}},nodeSetMap:{get:function(){return this.nodeSetDictionary().toObject()}},nodeSetDictionary:{value:function(){return new a.data.ObservableDictionary}}},methods:{attach:function(a,b){this.inherited(a,b);var c=this.topology();c.watch("stageScale",this.__watchStageScaleFN=function(a,b){this.eachNodeSet(function(a){a.stageScale(b)})},this),c.watch("revisionScale",this.__watchRevisionScale=function(a,b){this.eachNodeSet(function(a){a.revisionScale(b)},this)},this)},addNodeSet:function(a){var b=a.id(),c=this._generateNodeSet(a);return this.nodeSetDictionary().setItem(b,c),c},removeNodeSet:function(a){var b=this.nodeSetDictionary(),c=b.getItem(a);c&&(this.fire("removeNodeSet",c),c.dispose(),b.removeItem(a))},updateNodeSet:function(a){var b=this.nodeSetDictionary(),c=b.getItem(a);c&&(c.update(),this.fire("updateNodeSet",c))},_getNodeSetInstanceClass:function(c){var d,e=this.topology(),f=e.nodeSetInstanceClass();if(a.is(f,"Function")?(d=f.call(this,c),a.is(d,"String")&&(d=a.path(b,d))):d=a.path(b,f),!d)throw"Error on instance node set class";return d},_generateNodeSet:function(a){var b=a.id(),c=this.topology(),d=c.stageScale(),e=this._getNodeSetInstanceClass(a),f=new e({topology:c});return f.setModel(a),f.attach(this.view()),f.sets({"data-id":b,"class":"node nodeset",stageScale:d},c),this.updateDefaultSetting(f),f},updateDefaultSetting:function(b){var e=this.topology(),f=a.graphic.Component.__events__;a.each(b.__events__,function(a){-1==f.indexOf(a)&&b.on(a,function(c,d){d instanceof MouseEvent&&(window.event=d),this.fire(a.replace("Node","NodeSet"),b)},this)},this);var g=a.extend({enableSmartLabel:e.enableSmartLabel()},d.defaultConfig,e.nodeSetConfig());delete g.__owner__,a.each(g,function(a,d){c.setProperty(b,d,a,e)},this),c.setProperty(b,"showIcon",e.showIcon()),1!==e.revisionScale()&&b.revisionScale(e.revisionScale())},getNodeSet:function(a){return this.nodeSetDictionary().getItem(a)},eachNodeSet:function(a,b){this.nodeSetDictionary().each(function(c,d){var e=c.value();a.call(b||this,e,d)},this)},clear:function(){this.eachNodeSet(function(a){a.dispose()}),this.nodeSetDictionary().clear(),this.inherited()},dispose:function(){this.clear(),this.topology().unwatch("stageScale",this.__watchStageScaleFN,this),this.topology().unwatch("revisionScale",this.__watchRevisionScale,this),this.inherited()}}})}(nx,nx.global),function(a){var b=(a.geometry.Vector,a.geometry.Line);a.define("nx.graphic.Topology.AbstractLink",a.graphic.Group,{events:["hide","show","remove"],properties:{sourceNode:{get:function(){var a=this.topology(),b=this.model().source().id();return a.getNode(b)}},targetNode:{get:function(){var a=this.topology(),b=this.model().target().id();return a.getNode(b)}},sourcePosition:{get:function(){return this.sourceNode().position()}},targetPosition:{get:function(){return this.targetNode().position()}},sourceNodeID:{get:function(){return this.model().source().id()}},targetNodeID:{get:function(){return this.model().target().id()}},sourceX:{get:function(){return this.sourceNode().x()}},sourceY:{get:function(){return this.sourceNode().y()}},targetX:{get:function(){return this.targetNode().x()}},targetY:{get:function(){return this.targetNode().y()}},sourceVector:{get:function(){return this.sourceNode().vector()}},targetVector:{get:function(){return this.targetNode()?this.targetNode().vector():void 0}},position:{get:function(){var a=this.sourceNode().position(),b=this.targetNode().position();return{x1:a.x||0,x2:a.y||0,y1:b.x||0,y2:b.y||0}}},line:{get:function(){return new b(this.sourceVector(),this.targetVector())}},topology:{value:null},id:{get:function(){return this.model().id()}},linkKey:{get:function(){return this.model().linkKey()}},reverse:{get:function(){return this.model().reverse()}},centerPoint:{get:function(){return this.line().center()}},enable:{value:!0}},methods:{setModel:function(a,b){this.model(a),this.setBinding("visible","model.visible,direction=<>",this),b!==!1&&this.update()},update:function(){},dispose:function(){this.fire("remove"),this.inherited()}}})}(nx,nx.global),function(a){var b=a.geometry.Vector,c=(a.geometry.Line,5);a.define("nx.graphic.Topology.Link",a.graphic.Topology.AbstractLink,{events:["pressLink","clickLink","enterLink","leaveLink"],properties:{linkType:{get:function(){return void 0!==this._linkType?this._linkType:"parallel"},set:function(a){var b=this._processPropertyValue(a);return this._linkType!==b?(this._linkType=b,!0):!1}},offsetPercentage:{value:0},offsetRadix:{value:5},label:{set:function(a){var b=this._processPropertyValue(a),c=this.view("label");null!=b?c.append():c.remove(),this._label=b}},color:{set:function(a){var b=this._processPropertyValue(a);this.view("line").dom().setStyle("stroke",b),this.view("path").dom().setStyle("stroke",b),this._color=b}},width:{set:function(a){var b=this._processPropertyValue(a),c=(this._stageScale||1)*b;this.view("line").dom().setStyle("stroke-width",c),this.view("path").dom().setStyle("stroke-width",c),this._width=b}},stageScale:{set:function(a){var b=(this._width||1)*a;this.view("line").dom().setStyle("stroke-width",b),this.view("path").dom().setStyle("stroke-width",b),this._stageScale=a,this.update()}},dotted:{set:function(a){var b=this._processPropertyValue(a);b?this.view("path").dom().setStyle("stroke-dasharray","2, 5"):this.view("path").dom().setStyle("stroke-dasharray",""),this._dotted=b}},style:{set:function(a){var b=this._processPropertyValue(a);this.view("line").dom().setStyles(b),this.view("path").dom().setStyles(b)}},parentLinkSet:{},enable:{get:function(){return null!=this._enable?this._enable:!0},set:function(a){var b=this._processPropertyValue(a);this._enable=b,this.dom().setClass("disable",!b),this.update()}},drawMethod:{},revisionScale:{}},view:{type:"nx.graphic.Group",props:{"class":"link"},content:[{type:"nx.graphic.Group",content:[{name:"path",type:"nx.graphic.Path",props:{"class":"link"}},{name:"line_bg",type:"nx.graphic.Line",props:{"class":"link_bg"}},{name:"line",type:"nx.graphic.Line",props:{"class":"link"}}],events:{mouseenter:"{#_mouseenter}",mouseleave:"{#_mouseleave}",mousedown:"{#_mousedown}",touchstart:"{#_mousedown}",mouseup:"{#_mouseup}",touchend:"{#_mouseup}"}},{name:"label",type:"nx.graphic.Group",content:{name:"labelText",type:"nx.graphic.Text",props:{"alignment-baseline":"text-before-edge","text-anchor":"middle","class":"link-label"}}}]},methods:{update:function(){this.inherited();var a,c=this.getOffset(),d=new b(0,c),e=(this._width||1)*(this._stageScale||1),f=this.reverse()?this.line().negate():this.line(),g=this.view("path"),h=this.view("line"),i=this.view("line_bg");if(this.drawMethod())a=this.drawMethod().call(this,this.model(),this),g.setStyle("display","block"),g.set("d",a),g.dom().setStyle("stroke-width",e),h.setStyle("display","none"),i.setStyle("display","none");else if("curve"==this.linkType()){var j,k,l=[];j=f.normal().multiply(3*c),k=f.center().add(j),l.push("M",f.start.x,f.start.y),l.push("Q",k.x,k.y,f.end.x,f.end.y),a=l.join(" "),g.setStyle("display","block"),g.set("d",a),g.dom().setStyle("stroke-width",e),h.setStyle("display","none"),i.setStyle("display","none")}else{var m=f.translate(d);h.sets({x1:m.start.x,y1:m.start.y,x2:m.end.x,y2:m.end.y}),i.sets({x1:m.start.x,y1:m.start.y,x2:m.end.x,y2:m.end.y}),g.setStyle("display","none"),h.setStyle("display","block"),i.setStyle("display","block"),h.setStyle("stroke-width",e),i.setStyle("stroke-width",4*e)}this._updateLabel()},getPaddingLine:function(){var a=this.offset()*c,b=this.sourceNode().getBound(!0),d=Math.max(b.width,b.height)/1.3,e=this.targetNode().getBound(!0),f=Math.max(e.width,e.height)/1.3,g=this.line().pad(d,f),h=g.normal().multiply(a);return g.translate(h)},getOffset:function(){return"parallel"==this.linkType()?this.offsetPercentage()*this.offsetRadix()*this._stageScale:this.offsetPercentage()*this.offsetRadix()},_updateLabel:function(){var a,b,c=this.getOffset(),d=this.line(),e=d.normal().multiply(c);null!=this._label&&(a=this.view("label"),b=d.center().add(e),a.setTransform(b.x,b.y,this.stageScale()),this.view("labelText").set("text",this._label))},_mousedown:function(){this.enable()&&this.fire("pressLink")},_mouseup:function(){this.enable()&&this.fire("clickLink")},_mouseleave:function(){this.enable()&&this.fire("leaveLink")},_mouseenter:function(){this.enable()&&this.fire("enterLink")}}})}(nx,nx.global),function(a,b){var c=a.util,d=a.define("nx.graphic.Topology.LinksLayer",a.graphic.Topology.Layer,{statics:{defaultConfig:{linkType:"parallel",label:null,color:null,width:null,enable:!0}},events:["pressLink","clickLink","enterLink","leaveLink"],properties:{links:{get:function(){return this.linkDictionary().values().toArray()}},linkMap:{get:function(){return this.linkDictionary().toObject()}},linkDictionary:{value:function(){return new a.data.ObservableDictionary}}},methods:{attach:function(a){this.inherited(a);var b=this.topology();b.watch("stageScale",this.__watchStageScaleFN=function(a,b){this.eachLink(function(a){a.stageScale(b)})},this),b.watch("revisionScale",this.__watchRevisionScale=function(a,b){this.eachLink(function(a){a.revisionScale(b)})},this)},addLink:function(a){var b=a.id(),c=this._generateLink(a);return this.linkDictionary().setItem(b,c),c},removeLink:function(a){var b=this.linkDictionary(),c=b.getItem(a);c&&(c.dispose(),b.removeItem(a))},updateLink:function(a){this.linkDictionary().getItem(a).update()},_getLinkInstanceClass:function(c){var d,e=this.topology(),f=e.linkInstanceClass();if(a.is(f,"Function")?(d=f.call(this,c),a.is(d,"String")&&(d=a.path(b,d))):d=a.path(b,f),!d)throw"Error on instance link class";return d},_generateLink:function(a){var b=a.id(),c=this.topology(),d=this._getLinkInstanceClass(a),e=new d({topology:c});return e.setModel(a,!1),e.attach(this.view()),e.view().sets({"class":"link","data-id":b}),this.updateDefaultSetting(e),e},updateDefaultSetting:function(b){var e=this.topology(),f=a.graphic.Component.__events__;a.each(b.__events__,function(a){-1==f.indexOf(a)&&b.on(a,function(){this.fire(a,b)},this)},this);var g=a.extend({},d.defaultConfig,e.linkConfig());if(delete g.__owner__,a.each(g,function(a,d){c.setProperty(b,d,a,e)},this),a.DEBUG){var h=b.model();b.view().sets({"data-linkKey":h.linkKey(),"data-source-node-id":h.source().id(),"data-target-node-id":h.target().id()})}b.stageScale(e.stageScale()),b.update()},eachLink:function(a,b){this.linkDictionary().each(function(c,d){a.call(b||this,c.value(),d)})},getLink:function(a){return this.linkDictionary().getItem(a)},highlightLinks:function(a){this.highlightedElements().addRange(a)},activeLinks:function(a){this.activeElements().addRange(a)},clear:function(){this.eachLink(function(a){a.dispose()}),this.linkDictionary().clear(),this.inherited()},dispose:function(){this.clear(),this.topology().unwatch("stageScale",this.__watchStageScaleFN,this),this.inherited()}}})}(nx,nx.global),function(a){a.geometry.Vector,a.geometry.Line;a.define("nx.graphic.Topology.LinkSet",a.graphic.Topology.AbstractLink,{events:["pressLinkSetNumber","clickLinkSetNumber","enterLinkSetNumber","leaveLinkSetNumber","collapseLinkSet","expandLinkSet"],properties:{linkType:{get:function(){return this._linkType||"parallel"},set:function(a){var b=this._processPropertyValue(a);return this._linkType!==b?(this._linkType=b,!0):!1}},links:{get:function(){var a={};return this.eachLink(function(b,c){a[c]=b},this),a}},color:{set:function(a){var b=this._processPropertyValue(a);this.view("numBg").dom().setStyle("fill",b),this.view("path").dom().setStyle("stroke",b),this._color=b}},stageScale:{set:function(a){this.view("path").dom().setStyle("stroke-width",a),this.view("number").setTransform(null,null,a),this.model()&&this._updateLinksOffset(),this._stageScale=a}},enable:{get:function(){return void 0===this._enable?!0:this._enable},set:function(a){var b=this._processPropertyValue(a);this.dom().setClass("disable",!b),this._enable=b,this.eachLink(function(a){a.enable(b)})}},collapsedRule:{value:!1},activated:{value:!0},revisionScale:{set:function(a){var b=.6>a?8:12;this.view("numBg").dom().setStyle("stroke-width",b);var c=.6>a?8:10;this.view("num").dom().setStyle("font-size",c),this.view("number").visible(.2!==a)}}},view:{type:"nx.graphic.Group",props:{"data-type":"links-sum","class":"link-set"},content:[{name:"path",type:"nx.graphic.Line",props:{"class":"link-set-bg"}},{name:"number",type:"nx.graphic.Group",content:[{name:"numBg",type:"nx.graphic.Rect",props:{"class":"link-set-circle",height:1},events:{mousedown:"{#_number_mouseup}",touchstart:"{#_number_mouseup}",mouseenter:"{#_number_mouseenter}",mouseleave:"{#_number_mouseleave}"}},{name:"num",type:"nx.graphic.Text",props:{"class":"link-set-text",y:1}}]}]},methods:{setModel:function(a,b){this.inherited(a,b),this.setBinding("activated","model.activated,direction=<>",this)},update:function(){if(this._activated){var a=this.line();this.view("path").sets({x1:a.start.x,y1:a.start.y,x2:a.end.x,y2:a.end.y});var b=this.centerPoint();this.view("number").setTransform(b.x,b.y)}},updateLinkSet:function(){var a=this._processPropertyValue(this.collapsedRule());this.model().activated(a,{force:!0}),a?(this.append(),this.update(),this._updateLinkNumber(),this.fire("collapseLinkSet")):(this.parent()&&this.remove(),this._updateLinksOffset(),this.fire("expandLinkSet"))},eachLink:function(b,c){var d=this.topology(),e=this.model();a.each(e.edges(),function(a,e){var f=d.getLink(e);f&&b.call(c||this,f,e)})},_updateLinkNumber:function(){var a=Object.keys(this.model().edges()),b=this.view("num"),c=this.view("numBg");if(1==a.length)b.visible(!1),c.visible(!1);else{b.sets({text:a.length,visible:!0});var d=b.getBound(),e=Math.max(d.width-6,1);c.sets({width:e,visible:!0}),c.setTransform(e/-2)}},_updateLinksOffset:function(){if(!this._activated){var b=this.links(),c=(Object.keys(b).length-1)/2,d=0;a.each(b,function(a){a.offsetPercentage(-1*d++ +c),a.update()},this)}},_number_mousedown:function(a,b){this.enable()&&this.fire("pressLinkSetNumber",b)},_number_mouseup:function(a,b){this.enable()&&this.fire("clickLinkSetNumber",b)},_number_mouseleave:function(a,b){this.enable()&&this.fire("numberleave",b)},_number_mouseenter:function(a,b){this.enable()&&this.fire("numberenter",b)}}})}(nx,nx.global),function(a,b){var c=a.util,d=a.define("nx.graphic.Topology.LinkSetLayer",a.graphic.Topology.Layer,{statics:{defaultConfig:{label:null,sourceLabel:null,targetLabel:null,color:null,width:null,dotted:!1,style:null,enable:!0,collapsedRule:function(a){if("edgeSetCollection"==a.type())return!0;var b=this.linkType(),c=Object.keys(a.edges()),d="curve"===b?9:5;return c.length>d}}},events:["pressLinkSetNumber","clickLinkSetNumber","enterLinkSetNumber","leaveLinkSetNumber","collapseLinkSet","expandLinkSet"],properties:{linkSets:{get:function(){return this.linkSetDictionary().values().toArray()}},linkSetMap:{get:function(){return this.linkSetDictionary().toObject()}},linkSetDictionary:{value:function(){return new a.data.ObservableDictionary}}},methods:{attach:function(a){this.inherited(a);var b=this.topology();b.watch("stageScale",this.__watchStageScaleFN=function(a,b){this.eachLinkSet(function(a){a.stageScale(b)})},this),b.watch("revisionScale",this.__watchRevisionScale=function(a,b){this.eachLinkSet(function(a){a.revisionScale(b)})},this)},addLinkSet:function(a){var b=this.linkSetDictionary(),c=this._generateLinkSet(a);return b.setItem(a.linkKey(),c),c},updateLinkSet:function(a){this.linkSetDictionary().getItem(a).updateLinkSet()},removeLinkSet:function(a){var b=this.linkSetDictionary(),c=b.getItem(a);return c?(c.dispose(),b.removeItem(a),!0):!1},_getLinkSetInstanceClass:function(c){var d,e=this.topology(),f=e.linkSetInstanceClass();if(a.is(f,"Function")?(d=f.call(this,c),a.is(d,"String")&&(d=a.path(b,d))):d=a.path(b,f),!d)throw"Error on instance linkSet class";return d},_generateLinkSet:function(a){var b=this.topology(),c=this._getLinkSetInstanceClass(a),d=new c({topology:b});return d.setModel(a,!1),d.attach(this.view()),this.updateDefaultSetting(d),d},updateDefaultSetting:function(b){var e=this.topology(),f=a.graphic.Component.__events__;a.each(b.__events__,function(a){-1==f.indexOf(a)&&b.on(a,function(){this.fire(a,b)},this)},this);var g=a.extend({},d.defaultConfig,e.linkSetConfig());if(delete g.__owner__,g.linkType=e.linkConfig()&&e.linkConfig().linkType||a.graphic.Topology.LinksLayer.defaultConfig.linkType,a.each(g,function(a,d){c.setProperty(b,d,a,e)},this),b.stageScale(e.stageScale()),a.DEBUG){var h=b.model();b.view().sets({"data-nx-type":"nx.graphic.Topology.LinkSet","data-linkKey":h.linkKey(),"data-source-node-id":h.source().id(),"data-target-node-id":h.target().id()})}return b.updateLinkSet(),b},eachLinkSet:function(a,b){this.linkSetDictionary().each(function(c,d){a.call(b||this,c.value(),d)})},getLinkSet:function(a,b){var c=this.topology(),d=c.graph(),e=d.getEdgeSetBySourceAndTarget(a,b)||d.getEdgeSetCollectionBySourceAndTarget(a,b);return e?this.getLinkSetByLinkKey(e.linkKey()):null},getLinkSetByLinkKey:function(a){return this.linkSetDictionary().getItem(a)},highlightLinkSets:function(a){this.highlightedElements().addRange(a)},activeLinkSets:function(a){this.activeElements().addRange(a)},clear:function(){this.eachLinkSet(function(a){a.dispose()}),this.linkSetDictionary().clear(),this.inherited()},dispose:function(){this.clear(),this.topology().unwatch("stageScale",this.__watchStageScaleFN,this),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.HierarchicalLayout",{properties:{topology:{},levelBy:{value:function(){return function(a){return a.model().get("role")}}},sortOrder:{value:function(){return[]}},direction:{value:"vertical"},order:{},nodesPositionObject:{},groups:{}},methods:{process:function(a,b,c){var d=this._group(a,b||{}),e=this._calc(d,b||{});this._layout(e,c)},_group:function(b,c){var d={__other__:[]},e=this.topology(),f=c.levelBy||this.levelBy();return e.eachNode(function(b){var c;if(c=a.is(f,"String")&&"model"==f.substr(5)?b.model().get(f.substring(6)):f.call(e,b,b.model())){var g=d[c]=d[c]||[];g.push(b)}else d.__other__.push(b)}),d},_calc:function(b,c){var d={},e=Object.keys(b),f=this.topology(),g=c.sortOrder||this.sortOrder()||[],h=[];a.each(g,function(a){var b=e.indexOf(a);-1!==b&&(h.push(a),e.splice(b,1))}),e.splice(e.indexOf("__other__"),1),h=h.concat(e,["__other__"]),b=this._sort(b,h);var i=f.padding(),j=f.width()-2*i,k=f.height()-2*i,l=this.direction(),m=k/(h.length+1),n=j/(h.length+1),o=n,p=m;return a.each(h,function(c){b[c]&&("vertical"==l?(n=j/(b[c].length+1),a.each(b[c],function(a,b){d[a.id()]={x:n*(b+1),y:p}}),p+=m):(m=k/(b[c].length+1),a.each(b[c],function(a,b){d[a.id()]={x:o,y:m*(b+1)}}),o+=n),delete b[c])}),this.order(h),d},_sort:function(b,c){var d=this.topology(),e=d.graph();b[c[0]].sort(function(a,b){return Object.keys(b.model().edgeSets()).length-Object.keys(a.model().edgeSets()).length});for(var f=0;f'+b+"","text/xml");a.view().dom().$dom.appendChild(document.importNode(d.documentElement.firstChild,!0))},updateMap:function(){}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.TooltipPolicy",{events:[],properties:{topology:{},tooltipManager:{}},methods:{init:function(a){this.inherited(a),this.sets(a),this._tm=this.tooltipManager()},pressStage:function(){this._tm.closeAll()},zoomstart:function(){this._tm.closeAll()},clickNode:function(a){this._tm.openNodeTooltip(a)},clickLinkSetNumber:function(a){this._tm.openLinkSetTooltip(a)},dragStageStart:function(){this._tm.closeAll()},clickLink:function(a){this._tm.openLinkTooltip(a)},resizeStage:function(){this._tm.closeAll()},fitStage:function(){this._tm.closeAll()},deleteNode:function(){this._tm.closeAll()},deleteNodeSet:function(){this._tm.closeAll()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.Tooltip",a.ui.Popover,{properties:{lazyClose:{value:!1},pin:{value:!1},listenWindow:{value:!0}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.NodeTooltipContent",a.ui.Component,{properties:{node:{set:function(b){var c=b.model();this.view("list").set("items",new a.data.Dictionary(c.getData())),this.title(b.label())}},topology:{},title:{}},view:{content:[{name:"header",props:{"class":"n-topology-tooltip-header"},content:[{tag:"span",props:{"class":"n-topology-tooltip-header-text"},name:"title",content:"{#title}"}]},{name:"content",props:{"class":"n-topology-tooltip-content n-list"},content:[{name:"list",tag:"ul",props:{"class":"n-list-wrap",template:{tag:"li",props:{"class":"n-list-item-i",role:"listitem"},content:[{tag:"label",content:"{key}: "},{tag:"span",content:"{value}"}]}}}]}]},methods:{init:function(a){this.inherited(a),this.sets(a)}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.LinkTooltipContent",a.ui.Component,{properties:{link:{set:function(b){var c=b.model();this.view("list").set("items",new a.data.Dictionary(c.getData()))}},topology:{},tooltipmanager:{}},view:{content:{props:{"class":"n-topology-tooltip-content n-list"},content:[{name:"list",tag:"ul",props:{"class":"n-list-wrap",template:{tag:"li",props:{"class":"n-list-item-i",role:"listitem"},content:[{tag:"label",content:"{key}: "},{tag:"span",content:"{value}"}]}}}]}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.LinkSetTooltipContent",a.ui.Component,{properties:{linkSet:{set:function(b){var c=[];a.each(b.model().edges(),function(a){c.push({item:"Source:"+a.sourceID()+" Target :"+a.targetID(),edge:a})}),this.view("list").items(c)}},topology:{}},view:[{props:{style:{maxHeight:"247px",overflow:"auto","overflow-x":"hidden"}},content:{name:"list",props:{"class":"list-group",style:"width:200px",template:{tag:"a",props:{"class":"list-group-item"},content:"{item}",events:{click:"{#_click}"}}}}}],methods:{_click:function(a){a.model().edge}}})}(nx,nx.global),function(a,b){a.define("nx.graphic.Topology.TooltipManager",{events:["openNodeToolTip","closeNodeToolTip","openLinkToolTip","closeLinkToolTip","openLinkSetTooltip","closeLinkSetToolTip"],properties:{topology:{value:null},tooltips:{value:function(){return new a.data.ObservableDictionary}},nodeTooltip:{},linkTooltip:{},linkSetTooltip:{},nodeSetTooltip:{},nodeTooltipClass:{value:"nx.graphic.Topology.Tooltip"},linkTooltipClass:{value:"nx.graphic.Topology.Tooltip"},linkSetTooltipClass:{value:"nx.graphic.Topology.Tooltip"},nodeSetTooltipClass:{value:"nx.graphic.Topology.Tooltip"},nodeTooltipContentClass:{value:"nx.graphic.Topology.NodeTooltipContent"},linkTooltipContentClass:{value:"nx.graphic.Topology.LinkTooltipContent"},linkSetTooltipContentClass:{value:"nx.graphic.Topology.LinkSetTooltipContent"},nodeSetTooltipContentClass:{value:"nx.graphic.Topology.NodeSetTooltipContent"},showNodeTooltip:{value:!0},showLinkTooltip:{value:!0},showLinkSetTooltip:{value:!0},showNodeSetTooltip:{value:!0},tooltipPolicyClass:{get:function(){return void 0!==this._tooltipPolicyClass?this._tooltipPolicyClass:"nx.graphic.Topology.TooltipPolicy"},set:function(c){if(this._tooltipPolicyClass!==c){this._tooltipPolicyClass=c;var d=this.topology(),e=a.path(b,this.tooltipPolicyClass());if(e){var f=new e({topology:d,tooltipManager:this});this.tooltipPolicy(f)}return!0}return!1}},tooltipPolicy:{value:function(){var b=this.topology();return new a.graphic.Topology.TooltipPolicy({topology:b,tooltipManager:this})}},activated:{get:function(){return void 0!==this._activated?this._activated:!0},set:function(a){return this._activated!==a?(this._activated=a,!0):!1}}},methods:{init:function(c){this.inherited(c),this.sets(c),this.registerTooltip("nodeTooltip",this.nodeTooltipClass()),this.registerTooltip("linkTooltip",this.linkTooltipClass()),this.registerTooltip("linkSetTooltip",this.linkSetTooltipClass()),this.registerTooltip("nodeSetTooltip",this.nodeSetTooltipClass());var d=this.getTooltip("nodeTooltip");d.on("close",function(){this.fire("closeNodeToolTip")},this),d.view().dom().addClass("n-topology-tooltip"),this.nodeTooltip(d);var e=this.getTooltip("linkTooltip");e.on("close",function(){this.fire("closeLinkToolTip",e)},this),e.view().dom().addClass("n-topology-tooltip"),this.linkTooltip(e);var f=this.getTooltip("linkSetTooltip");f.on("close",function(){this.fire("closeLinkSetToolTip",f)},this),f.view().dom().addClass("n-topology-tooltip"),this.linkSetTooltip(f);var g=this.getTooltip("nodeSetTooltip");g.on("close",function(){this.fire("closeNodeSetToolTip")},this),g.view().dom().addClass("n-topology-tooltip"),this.nodeSetTooltip(g);var h=this.topology(),i=a.path(b,this.tooltipPolicyClass());if(i){var j=new i({topology:h,tooltipManager:this});this.tooltipPolicy(j)}},registerTooltip:function(c,d){var e=this.tooltips(),f=this.topology(),g=d;a.is(g,"String")&&(g=a.path(b,d));var h=new g;h.sets({topology:f,tooltipManager:this,model:f.graph(),"data-tooltip-type":c}),e.setItem(c,h)},getTooltip:function(a){var b=this.tooltips();return b.getItem(a)},executeAction:function(a,b){if(this.activated()){var c=this.tooltipPolicy();c&&c[a]&&c[a].call(c,b)}},openNodeTooltip:function(c,d){var e,f=this.topology(),g=this.nodeTooltip();if(g.close(!0),this.showNodeTooltip()!==!1){var h=d||f.getAbsolutePosition(c.position()),i=a.path(b,this.nodeTooltipContentClass());i&&(e=new i,e.sets({topology:f,node:c,model:f.model()})),e&&(g.content(null),e.attach(g));var j=c.getBound(!0);g.open({target:h,offset:Math.max(j.height,j.width)/2}),this.fire("openNodeToolTip",c)}},openNodeSetTooltip:function(c,d){var e,f=this.topology(),g=this.nodeSetTooltip();if(g.close(!0),this.showNodeSetTooltip()!==!1){var h=d||f.getAbsolutePosition(c.position()),i=a.path(b,this.nodeSetTooltipContentClass());i&&(e=new i,e.sets({topology:f,nodeSet:c,model:f.model()})),e&&(g.content(null),e.attach(g));var j=c.getBound(!0);g.open({target:h,offset:Math.max(j.height,j.width)/2}),this.fire("openNodeSetToolTip",c)}},openLinkTooltip:function(c,d){var e,f=this.topology(),g=this.linkTooltip();if(g.close(!0),this.showLinkTooltip()!==!1){var h=d||f.getAbsolutePosition(c.centerPoint()),i=a.path(b,this.linkTooltipContentClass());i&&(e=new i,e.sets({topology:f,link:c,model:f.model()})),e&&(g.content(null),e.attach(g)),g.open({target:h,offset:4}),this.fire("openLinkToolTip",c)}},openLinkSetTooltip:function(c,d){var e,f=this.topology(),g=this.linkSetTooltip();if(g.close(!0),this.showLinkSetTooltip()!==!1){var h=d||f.getAbsolutePosition(c.centerPoint()),i=a.path(b,this.linkSetTooltipContentClass());i&&(e=new i,e.sets({topology:f,linkSet:c,model:f.model()})),e&&(g.content(null),e.attach(g)),g.open({target:h,offsetX:0,offsetY:8}),this.fire("openLinkSetToolTip",c)}},closeAll:function(){this.tooltips().each(function(a){a.value().close(!0)},this)},dispose:function(){this.tooltips().each(function(a){a.value().close(!0),a.value().dispose()},this),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.Scene",a.data.ObservableObject,{properties:{topology:{value:null}},methods:{init:function(a){this.sets(a)},activate:function(){},deactivate:function(){}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.DefaultScene",a.graphic.Topology.Scene,{events:[],methods:{activate:function(){this._topo=this.topology(),this._nodesLayer=this._topo.getLayer("nodes"),this._nodeSetLayer=this._topo.getLayer("nodeSet"),this._linksLayer=this._topo.getLayer("links"),this._linkSetLayer=this._topo.getLayer("linkSet"),this._groupsLayer=this._topo.getLayer("groups"),this._tooltipManager=this._topo.tooltipManager(),this._nodeDragging=!1,this._sceneTimer=null,this._interval=600},deactivate:function(){this._tooltipManager.closeAll()},dispatch:function(a,b,c){this._tooltipManager.executeAction(a,c)},pressStage:function(){},clickStage:function(a,b){b.target!=this._topo.stage().view().dom().$dom||b.shiftKey||this._topo.selectedNodes().clear()},dragStageStart:function(){var b=this._nodesLayer.nodes().length;b>300&&this._linksLayer.hide(),this._recover(),this._blockEvent(!0),a.dom.Document.html().addClass("n-moveCursor")},dragStage:function(a,b){var c=this._topo.stage();c.applyTranslate(b.drag.delta[0],b.drag.delta[1])},dragStageEnd:function(){this._linksLayer.show(),this._blockEvent(!1),a.dom.Document.html().removeClass("n-moveCursor")},projectionChange:function(){},zoomstart:function(){var a=this._nodesLayer.nodes().length;a>300&&this._linksLayer.setStyle("display","none"),this._recover()},zooming:function(){},zoomend:function(){this._linksLayer.setStyle("display","block"),this._topo.adjustLayout()},beforeSetData:function(){},afterSetData:function(){},insertData:function(){},ready:function(){},enterNode:function(b,c){clearTimeout(this._sceneTimer),this._nodeDragging||(this._sceneTimer=setTimeout(function(){this._nodeDragging||this._topo.activeRelatedNode(c)}.bind(this),this._interval),this._recover()),a.dom.Document.body().addClass("n-dragCursor")},leaveNode:function(){clearTimeout(this._sceneTimer),this._nodeDragging||this._recover(),a.dom.Document.body().removeClass("n-dragCursor")},hideNode:function(){},dragNodeStart:function(){this._nodeDragging=!0,this._blockEvent(!0),a.dom.Document.html().addClass("n-dragCursor"),setTimeout(this._recover.bind(this),0)},dragNode:function(a,b){this._topo._moveSelectionNodes(event,b)},dragNodeEnd:function(){this._nodeDragging=!1,this._blockEvent(!1),this._topo.stage().resetFitMatrix(),a.dom.Document.html().removeClass("n-dragCursor")},pressNode:function(){},clickNode:function(a,b){this._nodeDragging||(event.shiftKey||this._topo.selectedNodes().clear(),b.selected(!b.selected()))},selectNode:function(a,b){var c=this._topo.selectedNodes();b.selected()?-1==c.indexOf(b)&&this._topo.selectedNodes().add(b):-1!==c.indexOf(b)&&this._topo.selectedNodes().remove(b)},updateNodeCoordinate:function(){},enterLink:function(){},pressNodeSet:function(){},clickNodeSet:function(a,b){clearTimeout(this._sceneTimer),this._recover(),event.shiftKey?b.selected(!b.selected()):b.collapsed(!1)},enterNodeSet:function(a,b){clearTimeout(this._sceneTimer),this._nodeDragging||(this._sceneTimer=setTimeout(function(){this._topo.activeRelatedNode(b)}.bind(this),this._interval))},leaveNodeSet:function(){clearTimeout(this._sceneTimer),this._nodeDragging||this._recover()},beforeExpandNodeSet:function(b,c){this._blockEvent(!0);for(var d=c.parentNodeSet();d&&d.group;){var e=d.group;e.clear(),e.nodes(a.util.values(d.nodes())),e.draw(),d=d.parentNodeSet()}this._recover()},expandNodeSet:function(b,c){clearTimeout(this._sceneTimer),this._recover(),this._topo.stage().resetFitMatrix(),this._topo.fit(function(){c.group=this._groupsLayer.addGroup({shapeType:"nodeSetPolygon",nodeSet:c,nodes:a.util.values(c.nodes()),label:c.label(),color:"#9BB150",id:c.id()});for(var b=c.parentNodeSet();b&&b.group;)b.group.draw(),b=b.parentNodeSet();this._blockEvent(!1),this._topo.adjustLayout()},this,c.animation()?1.5:!1)},beforeCollapseNodeSet:function(b,c){this._blockEvent(!0),c.group&&(this._groupsLayer.removeGroup(c.id()),delete c.group),a.each(c.nodeSets(),function(a){a.group&&(this._groupsLayer.removeGroup(a.id()),delete a.group)},this),this._topo.fadeIn(),this._recover()},collapseNodeSet:function(b,c){for(var d=c.parentNodeSet();d&&d.group;){var e=d.group;e.clear(),e.nodes(a.util.values(d.nodes())),d=d.parentNodeSet()}this._topo.stage().resetFitMatrix(),this._topo.fit(function(){this._blockEvent(!1)},this,c.animation()?1.5:!1)},removeNodeSet:function(a,b){b.group&&(this._groupsLayer.removeGroup(b.id()),delete b.group),this._topo.stage().resetFitMatrix()},updateNodeSet:function(b,c){c.group&&(c.group.clear(),c.group.nodes(a.util.values(c.nodes())))},dragNodeSetStart:function(){this._nodeDragging=!0,this._recover(),this._blockEvent(!0),a.dom.Document.html().addClass("n-dragCursor")},dragNodeSet:function(a,b){this._topo._moveSelectionNodes(event,b)},dragNodeSetEnd:function(){this._nodeDragging=!1,this._blockEvent(!1),a.dom.Document.html().removeClass("n-dragCursor"),this._topo.stage().resetFitMatrix()},selectNodeSet:function(a,b){var c=this._topo.selectedNodes();b.selected()?-1==c.indexOf(b)&&this._topo.selectedNodes().add(b):-1!==c.indexOf(b)&&this._topo.selectedNodes().remove(b)},addNode:function(){this._topo.stage().resetFitMatrix(),this._topo.adjustLayout()},addNodeSet:function(){this._topo.stage().resetFitMatrix(),this._topo.adjustLayout()},removeNode:function(){this._topo.adjustLayout()},dragGroupStart:function(){},dragGroup:function(a,b){if(event){var c=this._topo.stageScale();b.updateNodesPosition(event.drag.delta[0],event.drag.delta[1]),b.move(event.drag.delta[0]*c,event.drag.delta[1]*c)}},dragGroupEnd:function(){},clickGroupLabel:function(){},collapseNodeSetGroup:function(a,b){var c=b.nodeSet();c&&c.collapsed(!0)},enterGroup:function(b,c){if(a.is(c,"nx.graphic.Topology.NodeSetPolygonGroup")){var d=c.nodeSet();this._topo.activeNodes(a.util.values(d.nodes())),this._topo.fadeOut(),this._groupsLayer.fadeOut(),c.view().dom().addClass("fade-active-item")}},leaveGroup:function(a,b){b.view().dom().removeClass("fade-active-item"),this._topo.fadeIn(),this._topo.recoverActive()},right:function(){this._topo.move(30,null,.5)},left:function(){this._topo.move(-30,null,.5)},up:function(){this._topo.move(null,-30,.5)},down:function(){this._topo.move(null,30,.5)},pressR:function(){a.DEBUG&&this._topo.activateLayout("force")},pressA:function(){if(a.DEBUG){var b=this._topo.selectedNodes().toArray();this._topo.selectedNodes().clear(),this._topo.aggregationNodes(b)}},pressS:function(){a.DEBUG&&this._topo.activateScene("selection")},pressM:function(){a.DEBUG&&this._topo.activateScene("default")},pressF:function(){a.DEBUG&&this._topo.fit()},topologyGenerated:function(){this._topo.adjustLayout()},_recover:function(){this._topo.fadeIn(),this._topo.recoverActive()},_blockEvent:function(a){this._topo.blockEvent(a)}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.SelectionScene",a.graphic.Topology.DefaultScene,{methods:{activate:function(a){this.appendRect(),this.inherited(a),this.topology().dom().addClass("n-crosshairCursor")},deactivate:function(){this.inherited(),this.rect.dispose(),delete this.rect,this.topology().dom().removeClass("n-crosshairCursor"),a.dom.Document.html().removeClass("n-crosshairCursor")},_dispatch:function(a,b,c){this[a]&&this[a].call(this,b,c)},appendRect:function(){var b=this.topology();this.rect||(this.rect=new a.graphic.Rect({"class":"selectionRect"}),this.rect.attach(b.stage().staticLayer())),this.rect.sets({x:0,y:0,width:0,height:0})},dragStageStart:function(){this.rect.set("visible",!0),this._blockEvent(!0),a.dom.Document.html().addClass("n-crosshairCursor")},dragStage:function(a,b){var c=this.rect,d=b.drag.origin,e=b.drag.offset;e[0]<0?(c.set("x",d[0]+e[0]),c.set("width",-e[0])):(c.set("x",d[0]),c.set("width",e[0])),e[1]<0?(c.set("y",d[1]+e[1]),c.set("height",-e[1])):(c.set("y",d[1]),c.set("height",e[1]))},dragStageEnd:function(){this._stageTranslate=null,this.rect.set("visible",!1),this._blockEvent(!1),a.dom.Document.html().removeClass("n-crosshairCursor")},_getRectBound:function(){var a=this.rect.getBoundingClientRect(),b=this.topology().getBound();return{top:a.top-b.top,left:a.left-b.left,width:a.width,height:a.height,bottom:a.bottom-b.top,right:a.right-b.left}},esc:{},clickNodeSet:function(){},dragNode:function(){},dragNodeSet:function(){},_blockEvent:function(b){b?(this.topology().scalable(!1),a.dom.Document.body().addClass("n-userselect n-blockEvent")):(this.topology().scalable(!0),a.dom.Document.body().removeClass("n-userselect"),a.dom.Document.body().removeClass("n-blockEvent"))}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.SelectionNodeScene",a.graphic.Topology.SelectionScene,{properties:{selectedNodes:{get:function(){return this.topology().selectedNodes()}}},methods:{activate:function(){this.inherited();var a=this._tooltipManager;a.activated(!1)},deactivate:function(){this.inherited();var a=this._tooltipManager;a.activated(!0)},pressStage:function(a,b){var c=this.selectedNodes(),d=this._multi=b.metaKey||b.ctrlKey||b.shiftKey;d||c.clear(),b.captureDrag(a.stage().view(),this.topology().stage())},enterNode:function(){},clickNode:function(){},dragStageStart:function(a,b){this.inherited(a,b);var c=this.selectedNodes(),d=this._multi=b.metaKey||b.ctrlKey||b.shiftKey;d||c.clear(),this._prevSelectedNodes=this.selectedNodes().toArray().slice()},dragStage:function(a,b){this.inherited(a,b),this.selectNodeByRect(this.rect.getBound())},selectNode:function(a,b){b.selected()?this._topo.selectedNodes().add(b):this._topo.selectedNodes().remove(b)},selectNodeSet:function(a,b){b.selected()?this._topo.selectedNodes().add(b):this._topo.selectedNodes().remove(b)},pressNode:function(a,b){if(b.enable()){var c=this.selectedNodes();this._multi=event.metaKey||event.ctrlKey||event.shiftKey,this._multi||c.clear(),b.selected(!b.selected())}},pressNodeSet:function(a,b){if(b.enable()){var c=this.selectedNodes();this._multi=event.metaKey||event.ctrlKey||event.shiftKey,this._multi||c.clear(),b.selected(!b.selected())}},selectNodeByRect:function(b){this.topology().eachNode(function(c){if("vertexSet"!=c.model().type()||c.collapsed()){var d=c.getBound();if(a.util.isFirefox()){var e=[c.x(),c.y()],f=this.topology().stage().dom().getBound(),g=this.topology().stage().matrix();e=a.geometry.Vector.transform(e,g),d.x=d.left=e[0]+f.left-d.width/2,d.right=d.left+d.width,d.y=d.top=e[1]+f.top-d.height/2,d.bottom=d.top+d.height}var h=c.selected();this._hittest(b,d)?h||c.selected(!0):this._multi?-1==this._prevSelectedNodes.indexOf(c)&&h&&c.selected(!1):h&&c.selected(!1)}},this)},collapseNodeSetGroup:function(){},enterGroup:function(){},_hittest:function(a,b){var c=b.top>=a.top&&b.top<=a.top+a.height,d=b.left>=a.left&&b.left<=a.left+a.width,e=a.top+a.height>=b.top+b.height&&b.top+b.height>=a.top,f=a.left+a.width>=b.left+b.width&&b.left+b.width>=a.left,g=a.top>=b.top&&a.top+a.height<=b.top+b.height,h=a.left>=b.left&&a.left+a.width<=b.left+b.width;return c&&d||e&&f||c&&f||e&&d||c&&h||e&&h||d&&g||f&&g}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.ZoomBySelection",a.graphic.Topology.SelectionScene,{events:["finish"],properties:{},methods:{activate:function(b){this.inherited(b),a.dom.Document.html().addClass("n-zoomInCursor")},deactivate:function(){this.inherited(),a.dom.Document.html().removeClass("n-zoomInCursor")},dragStageEnd:function(a,b){var c=this.rect.getBound();this.inherited(a,b),this.fire("finish",c)},esc:function(){this.fire("finish")}}})}(nx,nx.global),function(a,b){var c={rect:"nx.graphic.Topology.RectGroup",circle:"nx.graphic.Topology.CircleGroup",polygon:"nx.graphic.Topology.PolygonGroup",nodeSetPolygon:"nx.graphic.Topology.NodeSetPolygonGroup"},d=["#C3A5E4","#75C6EF","#CBDA5C","#ACAEB1 ","#2CC86F"];a.define("nx.graphic.Topology.GroupsLayer",a.graphic.Topology.Layer,{statics:{colorTable:d},events:["dragGroupStart","dragGroup","dragGroupEnd","clickGroupLabel","enterGroup","leaveGroup","collapseNodeSetGroup"],properties:{shapeType:"polygon",groupItems:{value:function(){var b=new a.data.ObservableDictionary;return b.on("change",function(b,c){var d=c.action,e=c.items;"clear"==d&&a.each(e,function(a){var b=a.value();b&&b.dispose()})},this),b}},groups:{get:function(){return this._groups||[]},set:function(b){a.is(b,Array)&&(a.each(b,function(a){this.addGroup(a)},this),this._groups=b)}}},methods:{registerGroupItem:function(a,b){c[a]=b},attach:function(a){this.inherited(a);var b=this.topology();b.on("afterFitStage",this._redraw.bind(this),this),b.on("zoomend",this._redraw.bind(this),this),b.on("collapseNode",this._redraw.bind(this),this),b.on("expandNode",this._redraw.bind(this),this),b.watch("revisionScale",this._redraw.bind(this),this),b.watch("showIcon",this._redraw.bind(this),this)},addGroup:function(e){var f=this.groupItems(),g=e.shapeType||this.shapeType(),h=e.nodes,i=a.path(b,c[g]),j=new i({topology:this.topology()}),k=a.clone(e);k.color||(k.color=d[f.count()%5]),delete k.nodes,delete k.shapeType,j.sets(k),j.attach(this),j.nodes(h);var l=k.id||j.__id__;f.setItem(l,j);var m=["dragGroupStart","dragGroup","dragGroupEnd","clickGroupLabel","enterGroup","leaveGroup","collapseNodeSetGroup"];return a.each(m,function(a){j.on(a,function(b,c){c instanceof MouseEvent&&(window.event=c),this.fire(a,j)},this)},this),j},_redraw:function(){this.groupItems().each(function(a){a.value()._draw()},this)},removeGroup:function(a){var b=this.groupItems(),c=b.getItem(a);c&&(c.dispose(),b.removeItem(a))},getGroup:function(a){return this.groupItems().getItem(a)},eachGroupItem:function(a,b){this.groupItems().each(function(c){a.call(b||this,c.value(),c.key())},this)},clear:function(){this.groupItems().clear(),this.inherited()},dispose:function(){this.clear();var a=this.topology();a.off("collapseNode",this._redraw.bind(this),this),a.off("expandNode",this._redraw.bind(this),this),a.off("zoomend",this._redraw.bind(this),this),a.off("fitStage",this._redraw.bind(this),this),a.unwatch("revisionScale",this._redraw.bind(this),this),a.unwatch("showIcon",this._redraw.bind(this),this),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.GroupItem",a.graphic.Group,{events:[],properties:{topology:{},nodes:{get:function(){return this._nodes||[]},set:function(b){var c=this.topology(),d=c.graph(),e=this.vertices();(a.is(b,Array)||a.is(b,a.data.ObservableCollection))&&(a.each(b,function(b){var c;a.is(b,a.graphic.Topology.AbstractNode)?c=b.model():d.getVertex(b)&&(c=d.getVertex(b)),c&&-1==e.indexOf(c)&&e.push(c)},this),a.each(e,function(a){this.attachEvent(a)},this),this.draw()),this._nodes=b}},vertices:{value:function(){return[]}},color:{},label:{},blockDrawing:{value:!1}},view:{},methods:{attachEvent:function(a){a.watch("generated",this._draw,this),a.on("updateCoordinate",this._draw,this)},detachEvent:function(a){a.unwatch("generated",this._draw,this),a.off("updateCoordinate",this._draw,this)},getNodes:function(){var b=[],c=this.topology();return a.each(this.vertices(),function(a){if(a.generated()){var d=c.getNode(a.id());d&&b.push(d)}}),b},addNode:function(b){var c,d=this.topology(),e=d.graph(),f=this.vertices();a.is(b,a.graphic.Topology.AbstractNode)?c=b.model():e.getVertex(b)&&(c=e.getVertex(b)),c&&-1==f.indexOf(c)&&(f.push(c),this.attachEvent(c),this.draw())},removeNode:function(b){var c,d=this.topology(),e=d.graph(),f=this.vertices(),g=this.nodes();if(a.is(b,a.graphic.Topology.AbstractNode)?c=b.model():e.getVertex(b)&&(c=e.getVertex(b)),c&&-1!=f.indexOf(c)){if(f.splice(f.indexOf(c),1),this.detachEvent(c),a.is(g,Array)){var h=c.id(),i=d.getNode(h);-1!==g.indexOf(h)?g.splice(g.indexOf(h),1):i&&-1!==g.indexOf(i)&&g.splice(g.indexOf(i),1)}this.draw()}},_draw:function(){this.blockDrawing()||this.draw()},draw:function(){0===this.getNodes().length?this.hide():this.show()},updateNodesPosition:function(b,c){var d=this.topology().stageScale();a.each(this.getNodes(),function(a){a.move(b*d,c*d)})},clear:function(){a.each(this.vertices(),function(a){this.detachEvent(a)},this),this.vertices([]),this.nodes([])},dispose:function(){this.clear(),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.RectGroup",a.graphic.Topology.GroupItem,{events:["dragGroupStart","dragGroup","dragGroupEnd","clickGroupLabel","enterGroup","leaveGroup"],view:{type:"nx.graphic.Group",props:{"class":"group"},content:[{name:"shape",type:"nx.graphic.Rect",props:{"class":"bg"},events:{mousedown:"{#_mousedown}",dragstart:"{#_dragstart}",dragmove:"{#_drag}",dragend:"{#_dragend}"}},{name:"text",type:"nx.graphic.Group",content:{name:"label",type:"nx.graphic.Text",props:{"class":"groupLabel",text:"{#label}"},events:{click:"{#_clickLabel}"}}}]},properties:{},methods:{draw:function(){this.inherited(),this.setTransform(0,0);var a=this.topology(),b=a.stageScale(),c=(a.revisionScale(),{x:a.matrix().x(),y:a.matrix().y()}),d=a.getBoundByNodes(this.getNodes());if(null!=d){d.left-=c.x,d.top-=c.y;var e=this.view("shape");e.sets({x:d.left,y:d.top,width:d.width,height:d.height,fill:this.color(),stroke:this.color(),scale:a.stageScale()});var f=this.view("text");f.setTransform((d.left+d.width/2)*b,(d.top-12)*b,b),f.view().dom().setStyle("fill",this.color()),this.view("label").view().dom().setStyle("font-size",11)}},_clickLabel:function(){this.fire("clickGroupLabel")},_mousedown:function(a,b){b.captureDrag(this.view("shape"),this.topology().stage())},_dragstart:function(a,b){this.blockDrawing(!0),this.fire("dragGroupStart",b)},_drag:function(a,b){this.fire("dragGroup",b)},_dragend:function(a,b){this.blockDrawing(!1),this.fire("dragGroupEnd",b)}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.CircleGroup",a.graphic.Topology.GroupItem,{events:["dragGroupStart","dragGroup","dragGroupEnd","clickGroupLabel","enterGroup","leaveGroup"],view:{type:"nx.graphic.Group",props:{"class":"group"},content:[{name:"shape",type:"nx.graphic.Circle",props:{"class":"bg"},events:{mousedown:"{#_mousedown}",touchstart:"{#_mousedown}",dragstart:"{#_dragstart}",dragmove:"{#_drag}",dragend:"{#_dragend}"}},{name:"text",type:"nx.graphic.Group",content:{name:"label",type:"nx.graphic.Text",props:{"class":"groupLabel",text:"{#label}"},events:{click:"{#_clickLabel}"}}}]},methods:{draw:function(){this.inherited(),this.setTransform(0,0);var a=this.topology(),b=(a.revisionScale(),{x:a.matrix().x(),y:a.matrix().y()}),c=a.getBoundByNodes(this.getNodes());if(null!=c){var d=Math.sqrt(Math.pow(c.width/2,2)+Math.pow(c.height/2,2)),e=this.view("shape");e.sets({cx:c.left-b.x+c.width/2,cy:c.top-b.y+c.height/2,r:d,fill:this.color(),stroke:this.color(),scale:a.stageScale()});var f=this.view("text"),g=a.stageScale();c.left-=b.x,c.top-=b.y,f.setTransform((c.left+c.width/2)*g,(c.top+c.height/2-d-12)*g,g),f.view().dom().setStyle("fill",this.color()),this.view("label").view().dom().setStyle("font-size",11),this.setTransform(0,0)}},_clickLabel:function(){this.fire("clickGroupLabel")},_mousedown:function(a,b){b.captureDrag(this.view("shape"),this.topology().stage())},_dragstart:function(a,b){this.blockDrawing(!0),this.fire("dragGroupStart",b)},_drag:function(a,b){this.fire("dragGroup",b)},_dragend:function(a,b){this.blockDrawing(!1),this.fire("dragGroupEnd",b)}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.PolygonGroup",a.graphic.Topology.GroupItem,{events:["dragGroupStart","dragGroup","dragGroupEnd","clickGroupLabel","enterGroup","leaveGroup"],view:{type:"nx.graphic.Group",props:{"class":"group"},content:[{name:"shape",type:"nx.graphic.Polygon",props:{"class":"bg"},events:{mousedown:"{#_mousedown}",dragstart:"{#_dragstart}",dragmove:"{#_drag}",dragend:"{#_dragend}"}},{name:"text",type:"nx.graphic.Group",content:{name:"label",type:"nx.graphic.Text",props:{"class":"nodeSetGroupLabel",text:"{#label}",style:{"alignment-baseline":"central","text-anchor":"middle","font-size":12}},events:{click:"{#_clickLabel}"}}}],events:{mouseenter:"{#_mouseenter}",mouseleave:"{#_mouseleave}"}},properties:{shape:{get:function(){return this.view("shape")}}},methods:{draw:function(){this.inherited(),this.setTransform(0,0);var b=this.topology(),c=b.stageScale(),d=b.revisionScale(),e={x:b.matrix().x(),y:b.matrix().y()},f=[];a.each(this.getNodes(),function(a){a.visible()&&f.push({x:a.model().x(),y:a.model().y()})});var g=this.view("shape");g.sets({fill:this.color()}),g.dom().setStyle("stroke",this.color()),g.dom().setStyle("stroke-width",60*c*d),g.nodes(f);var h=b.getInsideBound(g.getBound());h.left-=e.x,h.top-=e.y,h.left*=c,h.top*=c,h.width*=c,h.height*=c;var i=this.view("text");i.setTransform(h.left+h.width/2,h.top-40*c*d,c),this.view("label").view().dom().setStyle("font-size",11),i.view().dom().setStyle("fill",this.color())},_clickLabel:function(){this.fire("clickGroupLabel")},_mousedown:function(a,b){b.captureDrag(this.view("shape"),this.topology().stage())},_dragstart:function(a,b){this.blockDrawing(!0),this.fire("dragGroupStart",b)},_drag:function(a,b){this.fire("dragGroup",b)},_dragend:function(a,b){this.blockDrawing(!1),this.fire("dragGroupEnd",b)}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.NodeSetPolygonGroup",a.graphic.Topology.GroupItem,{events:["dragGroupStart","dragGroup","dragGroupEnd","clickGroupLabel","enterGroup","leaveGroup","collapseNodeSetGroup"],view:{type:"nx.graphic.Group",props:{"class":"group aggregationGroup"},content:[{name:"shape",type:"nx.graphic.Polygon",props:{"class":"bg"}},{name:"icons",type:"nx.graphic.Group",content:[{name:"minus",type:"nx.graphic.Group",content:{name:"minusIcon",type:"nx.graphic.Icon",props:{iconType:"collapse"}},events:{click:"{#_collapse}"}},{name:"nodeIcon",type:"nx.graphic.Group",content:{name:"nodeIconImg",type:"nx.graphic.Icon",props:{iconType:"nodeSet",scale:1}}},{name:"labelContainer",type:"nx.graphic.Group",content:{name:"label",type:"nx.graphic.Text",props:{"class":"nodeSetGroupLabel",text:"{#label}",style:{"alignment-baseline":"central","text-anchor":"start","font-size":12},visible:!1},events:{click:"{#_clickLabel}"}},events:{}}],events:{mouseenter:"{#_mouseenter}",mouseleave:"{#_mouseleave}",mousedown:"{#_mousedown}",touchstart:"{#_mousedown}",dragstart:"{#_dragstart}",dragmove:"{#_drag}",dragend:"{#_dragend}"}}]},properties:{nodeSet:{},topology:{},opacity:{set:function(a){Math.max(a,.1);this._opacity=a}},shape:{get:function(){return this.view("shape")}}},methods:{getNodes:function(){return a.util.values(this.nodeSet().nodes())},draw:function(){this.inherited(),this.setTransform(0,0);var b=this.topology(),c=b.stageScale(),d={x:b.matrix().x(),y:b.matrix().y()},e=[];a.each(this.getNodes(),function(a){a.visible()&&e.push({x:a.model().x(),y:a.model().y()})});var f=this.view("shape");f.nodes(e);var g=b.getInsideBound(f.getBound());g.left-=d.x,g.top-=d.y,g.left*=c,g.top*=c,g.width*=c,g.height*=c;{var h=this.view("minus"),i=this.view("label"),j=this.view("nodeIcon"),k=this.view("nodeIconImg"); -this.view("labelContainer")}if(b.showIcon()&&b.revisionScale()>.6){f.dom().setStyle("stroke-width",60*c),k.set("iconType",this.nodeSet().iconType());var l=k.size();j.visible(!0),a.util.isFirefox()?(h.setTransform(g.left+g.width/2,g.top-l.height*c/2+8*c,1*c),j.setTransform(g.left+g.width/2+3*c+l.width*c/2,g.top-l.height*c/2-0*c,.5*c)):(h.setTransform(g.left+g.width/2,g.top-l.height*c/2-22*c,1*c),j.setTransform(g.left+g.width/2+3*c+l.width*c/2,g.top-l.height*c/2-22*c,.5*c)),i.sets({x:g.left+g.width/2-3*c+l.width*c,y:g.top-l.height*c/2-22*c}),i.view().dom().setStyle("font-size",16*c)}else f.dom().setStyle("stroke-width",30*c),a.util.isFirefox()?h.setTransform(g.left+g.width/2,g.top-29*c/2,c):h.setTransform(g.left+g.width/2,g.top-45*c/2,c),j.visible(!1),i.sets({x:g.left+g.width/2+12*c,y:g.top-45*c/2}),i.view().dom().setStyle("font-size",16*c)},_clickLabel:function(){this.fire("clickGroupLabel")},_mousedown:function(a,b){b.captureDrag(this.view("icons"),this.topology().stage())},_dragstart:function(a,b){this.blockDrawing(!0),this.fire("dragGroupStart",b)},_drag:function(a,b){this.fire("dragGroup",b),this.view("minus").dom().$dom.contains(b.srcElement)||(this._dragMinusIcon=!0)},_dragend:function(a,b){this.blockDrawing(!1),this.fire("dragGroupEnd",b)},_collapse:function(){this._dragMinusIcon||this.fire("collapseNodeSetGroup",event),this._dragMinusIcon=!1},_mouseenter:function(){this.fire("enterGroup")},_mouseleave:function(){this.fire("leaveGroup")}}})}(nx,nx.global),function(a){var b=a.geometry.Vector,c=a.geometry.Line,d=0,e=["#b2e47f","#e4e47f","#bec2f9","#b6def7","#89f0de"];a.define("nx.graphic.Topology.Path",a.graphic.Component,{view:{type:"nx.graphic.Group",content:{name:"path",type:"nx.graphic.Path"}},properties:{pathStyle:{value:{stroke:"#666","stroke-width":"0px"}},pathWidth:{value:"auto"},pathGutter:{value:13},pathPadding:{value:"auto"},arrow:{value:"none"},links:{value:[],set:function(b){this._links=b,this.edgeIdCollection().clear();var c=[];(a.is(b,"Array")||a.is(b,a.data.Collection))&&(a.each(b,function(a){c.push(a.model().id())}.bind(this)),this.edgeIdCollection().addRange(c)),this.draw()}},edgeIdCollection:{value:function(){var b,c=new a.data.ObservableCollection,d=function(){this.draw()}.bind(this);return c.on("change",function(e,f){var g=function(e,h){if(h){this.unwatch("topology",g),b=b||a.path(this,"topology.graph.edges"),verticesIdCollection=this.verticesIdCollection();var i=[];"add"===f.action?(a.each(f.items,function(a){var c=b.getItem(a);c.watch("generated",d),i.push(c.sourceID()),i.push(c.targetID())}.bind(this)),a.each(i,function(a){verticesIdCollection.contains(a)||verticesIdCollection.add(a)})):(a.each(f.items,function(a){var c=b.getItem(a);c.unwatch("generated",d)}.bind(this)),verticesIdCollection.clear(),a.each(c,function(a){var c=b.getItem(a);verticesIdCollection.contains(c.sourceID())&&verticesIdCollection.add(c.sourceID()),verticesIdCollection.contains(c.targetID())&&verticesIdCollection.add(c.targetID())}.bind(this)))}}.bind(this);this.topology()?g("topology",this.topology()):this.watch("topology",g)}.bind(this)),c}},verticesIdCollection:{value:function(){var b,c=new a.data.ObservableCollection,d=function(){this.draw()}.bind(this);return c.on("change",function(c,e){b=b||a.path(this,"topology.graph.vertices"),"add"===e.action?a.each(e.items,function(a){var c=b.getItem(a);c.watch("position",d)}.bind(this)):a.each(e.items,function(a){var c=b.getItem(a);c.unwatch("position",d)}.bind(this))}.bind(this)),c}},reverse:{value:!1},owner:{},topology:{}},methods:{init:function(a){this.inherited(a);var b=this.pathStyle();this.view("path").sets(b),b.fill||this.view("path").setStyle("fill",e[d++%5])},draw:function(){if(this.topology()){var c=!0,d=this.topology(),e=a.path(this,"topology.graph.edges"),f=a.path(this,"topology.graph.vertices");if(a.each(this.verticesIdCollection(),function(a){var b=f.getItem(a);return b.generated()?void 0:(c=!1,!1)}.bind(this)),a.each(this.edgeIdCollection(),function(a){var b=e.getItem(a);return b.generated()?void 0:(c=!1,!1)}.bind(this)),!c)return void this.view("path").set("d","M0 0");var g,h,i,j,k,l,m,n,o=[],p=[],q=this.topology().stageScale(),r=this.pathWidth(),s=this.pathPadding(),t=this.arrow(),u=this.edgeIdCollection(),v=[];a.each(u,function(a){v.push(d.getLink(a))});var w=this._serializeLinks(v),x=v.length,y=v[0],z=y.getOffset();if(y.reverse()&&(z*=-1),z=new b(0,this.reverse()?-1*z:z),h=w[0].translate(z),"auto"===s?(k=Math.min(y.sourceNode().showIcon()?24:4,h.length()/4/q),l=Math.min(y.targetNode().showIcon()?24:4,h.length()/4/q)):a.is(s,"Array")?(k=s[0],l=s[1]):k=l=s,"string"==typeof k&&k.indexOf("%")>0&&(k=h.length()*q*parseInt(k,10)/100/q),"auto"===r&&(r=Math.min(10,Math.max(3,Math.round(3/q)))),m=new b(0,r/2*q),n=new b(0,-r/2*q),k*=q,j=h.translate(m).pad(k,0).start,o.push("M",j.x,j.y),j=h.translate(n).pad(k,0).start,p.unshift("L",j.x,j.y,"Z"),v.length>1)for(var A=1;x>A;A++)g=v[A],i=w[A].translate(new b(0,g.getOffset())),j=h.translate(m).intersection(i.translate(m)),isFinite(j.x)&&isFinite(j.y)&&o.push("L",j.x,j.y),j=h.translate(n).intersection(i.translate(n)),isFinite(j.x)&&isFinite(j.y)&&p.unshift("L",j.x,j.y),h=i;else i=h;"string"==typeof l&&l.indexOf("%")>0&&(l=i.length()*parseInt(l,10)/100/q),l*=q,"cap"==t?(j=i.translate(m).pad(0,2.5*r+l).end,o.push("L",j.x,j.y),j=j.add(i.normal().multiply(r/2)),o.push("L",j.x,j.y),j=i.translate(n).pad(0,2.5*r+l).end,p.unshift("L",j.x,j.y),j=j.add(i.normal().multiply(-r/2)),p.unshift("L",j.x,j.y),j=i.pad(0,l).end,o.push("L",j.x,j.y)):"end"==t?(j=i.translate(m).pad(0,2*r+l).end,o.push("L",j.x,j.y),j=i.translate(n).pad(0,2*r+l).end,p.unshift("L",j.x,j.y),j=i.pad(0,l).end,o.push("L",j.x,j.y)):"full"==t?(j=i.pad(0,l).end,o.push("L",j.x,j.y)):(j=i.translate(m).pad(0,l).end,o.push("L",j.x,j.y),j=i.translate(n).pad(0,l).end,p.unshift("L",j.x,j.y)),this.view("path").set("d",o.concat(p).join(" "))}},_serializeLinks:function(a){var b=[],d=a.length;b.push(this.reverse()?new c(a[0].targetVector(),a[0].sourceVector()):new c(a[0].sourceVector(),a[0].targetVector()));for(var e=1;d>e;e++){var f=a[e-1],g=a[e],h=f.sourceVector(),i=f.targetVector(),j=g.sourceVector(),k=g.targetVector();f.targetNodeID()==g.sourceNodeID()?b.push(new c(j,k)):f.targetNodeID()==g.targetNodeID()?b.push(new c(k,j)):f.sourceNodeID()==g.sourceNodeID()?(b.pop(),b.push(new c(i,h)),b.push(new c(j,k))):(b.pop(),b.push(new c(i,h)),b.push(new c(k,j)))}return this.reverse()&&b.reverse(),b},isEqual:function(a,b){return a.x==b.x&&a.y==b.y},dispose:function(){a.each(this.nodes,function(a){a.off("updateNodeCoordinate",this.draw,this)},this),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.BasePath",a.graphic.Component,{events:[],properties:{nodes:{},pathGenerator:{value:function(){return function(){}}},pathStyle:{value:function(){return{stroke:"#666","stroke-width":2,fill:"none"}}},topology:{}},view:{type:"nx.graphic.Group",content:{name:"path",type:"nx.graphic.Path",props:{}}},methods:{attach:function(b){this.inherited(b);var c=this._nodesWatcher=new a.graphic.Topology.NodeWatcher;c.observePosition(!0),c.topology(this.topology()),c.updater(this._draw.bind(this)),c.nodes(this.nodes()),this.view("path").dom().setStyles(this.pathStyle())},_draw:function(){var a=this.view("path"),b=this._nodesWatcher.getNodes();if(b.length==this.nodes().length){var c=this.topology(),d=this.pathStyle(),e=this.pathGenerator().call(this);if(e){a.set("d",e),a.visible(!0);var f=parseInt(d["stroke-width"],10)||1;a.dom().setStyle("stroke-width",f*c.stageScale())}}else a.visible(!1)},draw:function(){this._draw()}}})}(nx,nx.global),function(a){a.util;a.define("nx.graphic.Topology.PathLayer",a.graphic.Topology.Layer,{properties:{paths:{value:function(){return[]}}},methods:{attach:function(){this.attach.__super__.apply(this,arguments);var a=this.topology();a.on("zoomend",this._draw,this),a.watch("revisionScale",this._draw,this)},_draw:function(){a.each(this.paths(),function(a){a.draw()})},addPath:function(a){this.paths().push(a),a.topology(this.topology()),a.attach(this),a.draw()},removePath:function(a){this.paths().splice(this.paths().indexOf(a),1),a.dispose()},clear:function(){a.each(this.paths(),function(a){a.dispose()}),this.paths([]),this.inherited()},dispose:function(){this.clear();var a=this.topology();a.off("zoomend",this._draw,this),a.unwatch("revisionScale",this._draw,this),this.inherited()}}})}(nx,nx.global),function(a){a.define("nx.graphic.Topology.Nav",a.ui.Component,{properties:{topology:{get:function(){return this.owner()}},scale:{},showIcon:{value:!1},visible:{get:function(){return void 0!==this._visible?this._visible:!0},set:function(a){this.view().dom().setStyle("display",a?"":"none"),this.view().dom().setStyle("pointer-events",a?"all":"none"),this._visible=a}}},view:{props:{"class":"n-topology-nav"},content:[{name:"icons",tag:"ul",content:[{tag:"li",content:{name:"mode",tag:"ul",props:{"class":"n-topology-nav-mode"},content:[{name:"selectionMode",tag:"li",content:{props:{"class":"n-icon-selectnode",title:"Select node mode"},tag:"span"},events:{mousedown:"{#_switchSelectionMode}",touchstart:"{#_switchSelectionMode}"}},{name:"moveMode",tag:"li",props:{"class":"n-topology-nav-mode-selected"},content:{props:{"class":"n-icon-movemode",title:"Move mode"},tag:"span"},events:{mousedown:"{#_switchMoveMode}",touchstart:"{#_switchMoveMode}"}}]}},{tag:"li",props:{"class":"n-topology-nav-zoom"},content:[{name:"zoomin",tag:"span",props:{"class":"n-topology-nav-zoom-in n-icon-zoomin-plus",title:"Zoom out"},events:{touchend:"{#_in}"}},{name:"zoomout",tag:"span",props:{"class":"n-topology-nav-zoom-out n-icon-zoomout-minus",title:"Zoom in"},events:{touchend:"{#_out}"}}]},{tag:"li",name:"zoomselection",props:{"class":"n-topology-nav-zoom-selection n-icon-zoombyselection",title:"Zoom by selection"},events:{click:"{#_zoombyselection}",touchend:"{#_zoombyselection}"}},{tag:"li",name:"fit",props:{"class":"n-topology-nav-fit n-icon-fitstage",title:"Fit stage"},events:{click:"{#_fit}",touchend:"{#_fit}"}},{tag:"li",name:"agr",props:{"class":"n-topology-nav-agr n-icon-aggregation",title:"Aggregation"},events:{click:"{#_agr}",touchend:"{#_agr}"}},{tag:"li",name:"fullscreen",props:{"class":"n-topology-nav-full n-icon-fullscreen",title:"Enter full screen mode"},events:{click:"{#_full}",touchend:"{#_full}"}},{tag:"li",name:"setting",content:[{name:"icon",tag:"span",props:{"class":"n-topology-nav-setting-icon n-icon-viewsetting"},events:{mouseenter:"{#_openPopover}",mouseleave:"{#_closePopover}"}},{name:"settingPopover",type:"nx.ui.Popover",props:{title:"Topology Setting",direction:"right",lazyClose:!0},content:[{tag:"h5",content:"Display icons as dots :"},{tag:"label",content:[{tag:"input",props:{type:"radio",checked:"{#showIcon,converter=inverted,direction=<>}"}},{tag:"span",content:"Always"}],props:{"class":"radio-inline"}},{tag:"label",content:[{tag:"input",props:{type:"radio",checked:"{#showIcon,direction=<>}"}},{tag:"span",content:"Auto-resize"}],props:{"class":"radio-inline"}},{name:"displayLabelSetting",tag:"h5",content:[{tag:"span",content:"Display Label : "},{tag:"input",props:{"class":"toggleLabelCheckBox",type:"checkbox",checked:!0},events:{click:"{#_toggleNodeLabel}",touchend:"{#_toggleNodeLabel}"}}]},{tag:"h5",content:"Theme :"},{props:{"class":"btn-group"},content:[{tag:"button",props:{"class":"btn btn-default",value:"blue"},content:"Blue"},{tag:"button",props:{"class":"btn btn-default",value:"green"},content:"Green"},{tag:"button",props:{"class":"btn btn-default",value:"dark"},content:"Dark"},{tag:"button",props:{"class":"btn btn-default",value:"slate"},content:"Slate"},{tag:"button",props:{"class":"btn btn-default",value:"yellow"},content:"Yellow"}],events:{click:"{#_switchTheme}",touchend:"{#_switchTheme}"}},{name:"customize"}],events:{open:"{#_openSettingPanel}",close:"{#_closeSettingPanel}"}}],props:{"class":"n-topology-nav-setting"}}]}]},methods:{init:function(a){this.inherited(a),this.view("settingPopover").view().dom().addClass("n-topology-setting-panel"),window.top.frames.length&&this.view("fullscreen").style().set("display","none")},attach:function(a){this.inherited(a);var b=this.topology();b.watch("scale",function(a,c){var d=b.maxScale(),e=b.minScale(),f=this.view("zoomball").view(),g=65/(d-e);f.setStyles({top:72-(c-e)*g+14})},this),b.selectedNodes().watch("count",function(a,b){this.view("agr").dom().setStyle("display",b>1?"block":"none")},this),b.watch("currentSceneName",function(a,b){"selection"==b?(this.view("selectionMode").dom().addClass("n-topology-nav-mode-selected"),this.view("moveMode").dom().removeClass("n-topology-nav-mode-selected")):(this.view("selectionMode").dom().removeClass("n-topology-nav-mode-selected"),this.view("moveMode").dom().addClass("n-topology-nav-mode-selected"))},this),this.view("agr").dom().setStyle("display","none")},_switchSelectionMode:function(){var a=this.topology(),b=a.currentSceneName();"selection"!=b&&(a.activateScene("selection"),this._prevSceneName=b)},_switchMoveMode:function(){var a=this.topology(),b=a.currentSceneName();"selection"==b&&(a.activateScene(this._prevSceneName||"default"),this._prevSceneName=null)},_fit:function(a){this._fitTimer||(this.topology().fit(),a.dom().setStyle("opacity","0.1"),this._fitTimer=!0,setTimeout(function(){a.dom().setStyle("opacity","1"),this._fitTimer=!1}.bind(this),1200))},_zoombyselection:function(a){var b=a,c=this.topology(),d=c.currentSceneName();if("zoomBySelection"==d)b.dom().removeClass("n-topology-nav-zoom-selection-selected"),c.activateScene("default");else{var e=c.activateScene("zoomBySelection");e.upon("finish",function f(a,g){g&&c.zoomByBound(c.getInsideBound(g)),c.activateScene(d),b.dom().removeClass("n-topology-nav-zoom-selection-selected"),e.off("finish",f,this)},this),b.dom().addClass("n-topology-nav-zoom-selection-selected")}},_in:function(a,b){var c=this.topology();c.stage().zoom(1.2,c.adjustLayout,c),b.preventDefault()},_out:function(a,b){var c=this.topology();c.stage().zoom(.8,c.adjustLayout,c),b.preventDefault()},_full:function(a,b){this.toggleFull(b.target)},_enterSetting:function(){this.view("setting").addClass("n-topology-nav-setting-open")},_leaveSetting:function(){this.view("setting").removeClass("n-topology-nav-setting-open")},cancelFullScreen:function(a){var b=a.cancelFullScreen||a.webkitCancelFullScreen||a.mozCancelFullScreen||a.exitFullscreen;if(b)b.call(a);else if("undefined"!=typeof window.ActiveXObject){var c=new ActiveXObject("WScript.Shell");null!==c&&c.SendKeys("{F11}")}},requestFullScreen:function(){return document.body.webkitRequestFullscreen.call(document.body),!1},toggleFull:function(){var a=document.body,b=document.fullScreenElement&&null!==document.fullScreenElement||document.mozFullScreen||document.webkitIsFullScreen;return b?(this.cancelFullScreen(document),this.fire("leaveFullScreen")):(this.requestFullScreen(a),this.fire("enterFullScreen")),!1},_openPopover:function(a){this.view("settingPopover").open({target:a.dom(),offsetY:3}),this.view("icon").dom().addClass("n-topology-nav-setting-icon-selected")},_closePopover:function(){this.view("settingPopover").close()},_closeSettingPanel:function(){this.view("icon").dom().removeClass("n-topology-nav-setting-icon-selected")},_togglePopover:function(){var a=this.view("settingPopover");a._closed?a.open():a.close()},_switchTheme:function(a,b){this.topology().theme(b.target.value)},_toggleNodeLabel:function(b){var c=b.get("checked");this.topology().eachNode(function(a){a.labelVisibility(c)}),a.graphic.Topology.NodesLayer.defaultConfig.labelVisibility=c,a.graphic.Topology.NodeSetLayer.defaultConfig.labelVisibility=c},_agr:function(){var a=this.topology(),b=a.selectedNodes().toArray();a.selectedNodes().clear(),a.aggregationNodes(b)}}})}(nx,nx.global); \ No newline at end of file -- cgit 1.2.3-korg