Drawing slices, expanding and collapsing slices
Drawing forms
Added keybindings

Change-Id: Ic1f06eef20a6e1e7c0f1fea51752fe738f86d600
diff --git a/views/ngXosViews/mcord-slicing/.bowerrc b/views/ngXosViews/mcord-slicing/.bowerrc
new file mode 100644
index 0000000..e491038
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/.bowerrc
@@ -0,0 +1,3 @@
+{
+  "directory": "src/vendor/"
+}
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/.eslintrc b/views/ngXosViews/mcord-slicing/.eslintrc
new file mode 100644
index 0000000..c852748
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/.eslintrc
@@ -0,0 +1,42 @@
+{
+    "ecmaFeatures": {
+        "blockBindings": true,
+        "forOf": true,
+        "destructuring": true,
+        "arrowFunctions": true,
+        "templateStrings": true
+    },
+    "env": { 
+        "browser": true,
+        "node": true,
+        "es6": true
+    },
+    "plugins": [
+        //"angular"
+    ],
+    "rules": {
+        "quotes": [2, "single"],
+        "camelcase": [1, {"properties": "always"}],
+        "no-underscore-dangle": 1,
+        "eqeqeq": [2, "smart"],
+        "no-alert": 1,
+        "key-spacing": [1, { "beforeColon": false, "afterColon": true }],
+        "indent": [2, 2],
+        "no-irregular-whitespace": 1,
+        "eol-last": 0,
+        "max-nested-callbacks": [2, 4],
+        "comma-spacing": [1, {"before": false, "after": true}],
+        "no-trailing-spaces": [1, { skipBlankLines: true }],
+        "no-unused-vars": [1, {"vars": "all", "args": "after-used"}],
+        "new-cap": 0,
+
+        //"angular/ng_module_name": [2, '/^xos\.*[a-z]*$/'],
+        //"angular/ng_controller_name": [2, '/^[a-z].*Ctrl$/'],
+        //"angular/ng_service_name": [2, '/^[A-Z].*Service$/'],
+        //"angular/ng_directive_name": [2, '/^[a-z]+[[A-Z].*]*$/'],
+        //"angular/ng_di": [0, "function or array"]
+    },
+    "globals" :{
+        "angular": true
+    } 
+}
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/.gitignore b/views/ngXosViews/mcord-slicing/.gitignore
new file mode 100644
index 0000000..567aee4
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/.gitignore
@@ -0,0 +1,6 @@
+dist/
+src/vendor
+.tmp
+node_modules
+npm-debug.log
+dist/
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/bower.json b/views/ngXosViews/mcord-slicing/bower.json
new file mode 100644
index 0000000..8f0a0c9
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/bower.json
@@ -0,0 +1,41 @@
+{
+  "name": "xos-mcord-slicing",
+  "version": "0.0.0",
+  "authors": [
+    "Matteo Scandolo <matteo.scandolo@gmail.com>"
+  ],
+  "description": "The mcord-slicing view",
+  "license": "Apache-2.0",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "static/js/vendor/",
+    "test",
+    "tests"
+  ],
+  "dependencies": {
+    "graphlib": "~2.1.1"
+  },
+  "devDependencies": {
+    "jquery": "2.1.4",
+    "angular-mocks": "1.5.8",
+    "angular": "1.5.8",
+    "angular-ui-router": "0.2.15",
+    "angular-cookies": "1.5.8",
+    "angular-animate": "1.5.8",
+    "angular-resource": "1.5.8",
+    "lodash": "~4.11.1",
+    "bootstrap-css": "3.3.6",
+    "angular-chart.js": "~0.10.2",
+    "d3": "~3.5.17",
+    "angular-recursion": "~1.0.5",
+    "ng-xos-lib": "opencord/ng-xos-lib#9422c38b214229fa6afdf0eea7862ccb6ff53dd7"
+  },
+  "resolutions": {
+    "angular": "1.5.8",
+    "angular-cookies": "~1.5.8",
+    "angular-animate": "~1.5.8",
+    "angular-resource": "~1.5.8"
+  }
+}
diff --git a/views/ngXosViews/mcord-slicing/gulp/build.js b/views/ngXosViews/mcord-slicing/gulp/build.js
new file mode 100644
index 0000000..48938c8
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/gulp/build.js
@@ -0,0 +1,227 @@
+'use strict';
+
+// BUILD
+//
+// The only purpose of this gulpfile is to build a XOS view and copy the correct files into
+// .html => dashboards
+// .js (minified and concat) => static/js
+//
+// The template are parsed and added to js with angular $templateCache
+
+var gulp = require('gulp');
+var ngAnnotate = require('gulp-ng-annotate');
+var uglify = require('gulp-uglify');
+var templateCache = require('gulp-angular-templatecache');
+var runSequence = require('run-sequence');
+var concat = require('gulp-concat-util');
+var del = require('del');
+var wiredep = require('wiredep');
+var angularFilesort = require('gulp-angular-filesort');
+var _ = require('lodash');
+var eslint = require('gulp-eslint');
+var inject = require('gulp-inject');
+var rename = require('gulp-rename');
+var replace = require('gulp-replace');
+var postcss = require('gulp-postcss');
+var autoprefixer = require('autoprefixer');
+var mqpacker = require('css-mqpacker');
+var csswring = require('csswring');
+var yaml = require('js-yaml');
+var colors = require('colors/safe');
+var fs =  require('fs');
+
+const TEMPLATE_FOOTER = `
+angular.module('xos.mcord-slicing')
+.run(['$location', function(a){
+  a.path('/');
+}])
+`
+
+module.exports = function(options){
+  
+  // delete previous builded file
+  gulp.task('clean', function(){
+    return del(
+      [
+        options.dashboards + 'xosMcord-slicing.html',
+        options.static + 'css/xosMcord-slicing.css',
+        options.static + 'images/mcord-slicing-icon.png',
+        options.static + 'images/mcord-slicing-icon-active.png'
+      ],
+      {force: true}
+    );
+  });
+
+  // minify css
+  gulp.task('css', function () {
+    var processors = [
+      autoprefixer({browsers: ['last 1 version']}),
+      mqpacker,
+      csswring
+    ];
+
+    gulp.src([
+      `${options.css}**/*.css`,
+      `!${options.css}dev.css`
+    ])
+    .pipe(postcss(processors))
+    .pipe(gulp.dest(options.tmp + '/css/'));
+  });
+
+  // copy css in correct folder
+  gulp.task('copyCss', ['wait'], function(){
+    return gulp.src([`${options.tmp}/css/*.css`])
+    .pipe(concat('xosMcord-slicing.css'))
+    .pipe(gulp.dest(options.static + 'css/'))
+  });
+
+  // copy images in correct folder
+  gulp.task('copyImages', ['wait'], function(){
+    return gulp.src([`${options.icon}/mcord-slicing-icon.png`, `${options.icon}/mcord-slicing-icon-active.png`])
+    .pipe(gulp.dest(options.static + 'images/'))
+  });
+
+  // compile and minify scripts
+  gulp.task('scripts', function() {
+    return gulp.src([
+      options.tmp + '**/*.js'
+    ])
+    .pipe(ngAnnotate())
+    .pipe(angularFilesort())
+    .pipe(concat('xosMcord-slicing.js'))
+    .pipe(concat.header('//Autogenerated, do not edit!!!\n'))
+    .pipe(concat.footer(TEMPLATE_FOOTER))
+    .pipe(uglify())
+    .pipe(gulp.dest(options.static + 'js/'));
+  });
+
+  // set templates in cache
+  gulp.task('templates', function(){
+    return gulp.src('./src/templates/*.html')
+      .pipe(templateCache({
+        module: 'xos.mcord-slicing',
+        root: 'templates/'
+      }))
+      .pipe(gulp.dest(options.tmp));
+  });
+
+  // copy html index to Django Folder
+  gulp.task('copyHtml', function(){
+    return gulp.src(options.src + 'index.html')
+      // remove dev dependencies from html
+      .pipe(replace(/<!-- bower:css -->(\n^<link.*)*\n<!-- endbower -->/gmi, ''))
+      .pipe(replace(/<!-- bower:js -->(\n^<script.*)*\n<!-- endbower -->/gmi, ''))
+      // injecting minified files
+      .pipe(
+        inject(
+          gulp.src([
+            options.static + 'vendor/xosMcord-slicingVendor.js',
+            options.static + 'js/xosMcord-slicing.js',
+            options.static + 'css/xosMcord-slicing.css'
+          ]),
+          {ignorePath: '/../../../xos/core/xoslib'}
+        )
+      )
+      .pipe(rename('xosMcord-slicing.html'))
+      .pipe(gulp.dest(options.dashboards));
+  });
+
+  // minify vendor js files
+  gulp.task('wiredep', function(){
+    var bowerDeps = wiredep().js;
+    if(!bowerDeps){
+      return;
+    }
+
+    // remove angular (it's already loaded)
+    _.remove(bowerDeps, function(dep){
+      return dep.indexOf('angular/angular.js') !== -1;
+    });
+
+    return gulp.src(bowerDeps)
+      .pipe(concat('xosMcord-slicingVendor.js'))
+      .pipe(uglify())
+      .pipe(gulp.dest(options.static + 'vendor/'));
+  });
+
+  gulp.task('lint', function () {
+    return gulp.src(['src/js/**/*.js'])
+      .pipe(eslint())
+      .pipe(eslint.format())
+      .pipe(eslint.failAfterError());
+  });
+
+  gulp.task('wait', function (cb) {
+    // setTimeout could be any async task
+    setTimeout(function () {
+      cb();
+    }, 1000);
+  });
+
+  gulp.task('tosca', function (cb) {
+
+    // TOSCA to register the dashboard in the system
+    const dashboardJson = {};
+    dashboardJson['Mcord-slicing'] = {
+      type: 'tosca.nodes.DashboardView',
+      properties: {
+        url: 'template:xosMcord-slicing'
+      }
+    };
+
+    // check for custom icons
+    if(
+      fs.existsSync(`${options.icon}/mcord-slicing-icon.png`) &&
+      fs.existsSync(`${options.icon}/mcord-slicing-icon-active.png`)
+    ){
+      dashboardJson['Mcord-slicing'].properties.custom_icon = true;
+    }
+
+    const dashboardTosca = yaml.dump(dashboardJson).replace(/'/gmi, '');
+
+    // TOSCA to add the dashboard to the user
+    const userDashboardJson = {};
+    userDashboardJson['mcord-slicing_dashboard'] = {
+      node: 'Mcord-slicing',
+      relationship: 'tosca.relationships.UsesDashboard'
+    };
+    const userJson = {
+      'padmin@vicci.org': {
+        type: 'tosca.nodes.User',
+        properties: {
+          'no-create': true,
+          'no-delete': true
+        },
+        requirements: [userDashboardJson]
+      }
+    };
+    const userTosca = yaml.dump(userJson).replace(/'/gmi, '');
+
+
+    // the output is in a timeout so that it get printed after the gulp logs
+    setTimeout(function () {
+      console.log(colors.cyan('\n\n# You can use this recipe to load the dashboard in the system:'));
+      console.log(colors.yellow(dashboardTosca));
+      console.log(colors.cyan('# And this recipe to activate the dashboard for a user:'));
+      console.log(colors.yellow(userTosca));
+    }, 1000);
+    cb();
+  });
+
+  gulp.task('build', function() {
+    runSequence(
+      'clean',
+      'sass',
+      'templates',
+      'babel',
+      'scripts',
+      'wiredep',
+      'css',
+      'copyCss',
+      'copyImages',
+      'copyHtml',
+      'cleanTmp',
+      'tosca'
+    );
+  });
+};
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/gulp/server.js b/views/ngXosViews/mcord-slicing/gulp/server.js
new file mode 100644
index 0000000..7ff49c6
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/gulp/server.js
@@ -0,0 +1,176 @@
+'use strict';
+
+var gulp = require('gulp');
+var browserSync = require('browser-sync').create();
+var inject = require('gulp-inject');
+var runSequence = require('run-sequence');
+var angularFilesort = require('gulp-angular-filesort');
+var babel = require('gulp-babel');
+var wiredep = require('wiredep').stream;
+var httpProxy = require('http-proxy');
+var del = require('del');
+var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
+
+const environment = process.env.NODE_ENV;
+
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+  if(!environment){
+    throw new Error('You should define a default.js config in /views/env folder.');
+  }
+  else{
+    throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+  }
+}
+
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
+var proxy = httpProxy.createProxyServer({
+  target: conf.host
+});
+
+
+proxy.on('error', function(error, req, res) {
+  res.writeHead(500, {
+    'Content-Type': 'text/plain'
+  });
+
+  console.error('[Proxy]', error);
+});
+
+proxy.on('proxyRes', function (proxyRes, req, res) {
+  // console.log(JSON.stringify(res, true, 2));
+  // console.log(Object.keys(res), res.output);
+  // console.log(JSON.stringify(proxyRes, true, 2));
+  // console.log('RAW Response from the target', JSON.stringify(proxyRes.headers, true, 2));
+});
+
+module.exports = function(options){
+
+  gulp.task('browser', function() {
+    browserSync.init({
+      startPath: '#/',
+      snippetOptions: {
+        rule: {
+          match: /<!-- browserSync -->/i
+        }
+      },
+      server: {
+        baseDir: options.src,
+        routes: {
+          '/xos/core/static': options.static + '../../static/'
+        },
+        middleware: function(req, res, next){
+          if(
+            req.url.indexOf('/api/') !== -1
+          ){
+            if(conf.xoscsrftoken && conf.xossessionid){
+              req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
+              req.headers['x-csrftoken'] = conf.xoscsrftoken;
+            }
+            proxy.web(req, res);
+          }
+          else{
+            next();
+          }
+        }
+      }
+    });
+
+    gulp.watch(options.src + 'js/**/*.js', ['js-watch']);
+    gulp.watch(options.src + 'vendor/**/*.js', ['bower'], function(){
+      browserSync.reload();
+    });
+    gulp.watch(options.src + '**/*.html', function(){
+      browserSync.reload();
+    });
+    gulp.watch(options.css + '**/*.css', function(){
+      browserSync.reload();
+    });
+    gulp.watch(`${options.sass}/**/*.scss`, ['sass'], function(){
+      browserSync.reload();
+    });
+
+    gulp.watch([
+      options.helpers + 'ngXosHelpers.js',
+      options.static + '../../static/xosNgLib.css'
+    ], function(){
+      browserSync.reload();
+    });
+  });
+
+  // compile sass
+  gulp.task('sass', function () {
+    return gulp.src(`${options.sass}/**/*.scss`)
+      .pipe(sass().on('error', sass.logError))
+      .pipe(gulp.dest(options.css));
+  });
+
+  // transpile js with sourceMaps
+  gulp.task('babel', function(){
+    return gulp.src(options.scripts + '**/*.js')
+      .pipe(babel({sourceMaps: true}))
+      .pipe(gulp.dest(options.tmp));
+  });
+
+  // inject scripts
+  gulp.task('injectScript', ['cleanTmp', 'babel'], function(){
+    return gulp.src(options.src + 'index.html')
+      .pipe(
+        inject(
+          gulp.src([
+            options.tmp + '**/*.js',
+            options.helpers + 'ngXosHelpers.min.js'
+          ])
+          .pipe(angularFilesort()),
+          {
+            ignorePath: [options.src, '/../../ngXosLib']
+          }
+        )
+      )
+      .pipe(gulp.dest(options.src));
+  });
+
+  // inject CSS
+  gulp.task('injectCss', function(){
+    return gulp.src(options.src + 'index.html')
+      .pipe(
+        inject(
+          gulp.src([
+            options.src + 'css/*.css',
+            options.static + '../../static/xosNgLib.css'
+          ]),
+          {
+            ignorePath: [options.src]
+          }
+          )
+        )
+      .pipe(gulp.dest(options.src));
+  });
+
+  // inject bower dependencies with wiredep
+  gulp.task('bower', function () {
+    return gulp.src(options.src + 'index.html')
+    .pipe(wiredep({devDependencies: true}))
+    .pipe(gulp.dest(options.src));
+  });
+
+  gulp.task('js-watch', ['injectScript'], function(){
+    browserSync.reload();
+  });
+
+  gulp.task('cleanTmp', function(){
+    return del([options.tmp + '**/*']);
+  });
+
+  gulp.task('serve', function() {
+    runSequence(
+      'sass',
+      'bower',
+      'injectScript',
+      'injectCss',
+      ['browser']
+    );
+  });
+};
diff --git a/views/ngXosViews/mcord-slicing/gulpfile.js b/views/ngXosViews/mcord-slicing/gulpfile.js
new file mode 100644
index 0000000..c825df8
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/gulpfile.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var gulp = require('gulp');
+var wrench = require('wrench');
+
+var options = {
+  src: 'src/',
+  css: 'src/css/',
+  icon: 'src/icons',
+  sass: 'src/sass/',
+  scripts: 'src/js/',
+  tmp: 'src/.tmp',
+  dist: 'dist/',
+  api: '../../ngXosLib/api/',
+  helpers: './src/vendor/ng-xos-lib/dist/',
+  static: '../../../xos/core/xoslib/static/', // this is the django static folder
+  dashboards: '../../../xos/core/xoslib/dashboards/' // this is the django html folder
+};
+
+wrench.readdirSyncRecursive('./gulp')
+.map(function(file) {
+  require('./gulp/' + file)(options);
+});
+
+gulp.task('default', function () {
+  gulp.start('build');
+});
diff --git a/views/ngXosViews/mcord-slicing/karma.conf.js b/views/ngXosViews/mcord-slicing/karma.conf.js
new file mode 100644
index 0000000..e5abf39
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/karma.conf.js
@@ -0,0 +1,90 @@
+// Karma configuration
+// Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC)
+
+/* eslint indent: [2,2], quotes: [2, "single"]*/
+
+/*eslint-disable*/
+var wiredep = require('wiredep');
+var path = require('path');
+
+var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){
+  return path.relative(process.cwd(), file);
+});
+
+module.exports = function(config) {
+/*eslint-enable*/
+  config.set({
+
+    // base path that will be used to resolve all patterns (eg. files, exclude)
+    basePath: '',
+
+
+    // frameworks to use
+    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+    frameworks: ['jasmine'],
+
+
+    // list of files / patterns to load in the browser
+    files: bowerComponents.concat([
+      './src/vendor/ng-xos-lib/dist/ngXosVendor.min.js',
+      './src/vendor/ng-xos-lib/dist/ngXosHelpers.min.js',
+      'src/js/main.js',
+      'src/js/**/*.js',
+      'spec/**/*.mock.js',
+      'spec/**/*.test.js',
+      'src/**/*.html'
+    ]),
+
+
+    // list of files to exclude
+    exclude: [
+    ],
+
+
+    // preprocess matching files before serving them to the browser
+    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+    preprocessors: {
+      'src/js/**/*.js': ['babel'],
+      'spec/**/*.test.js': ['babel'],
+      'spec/**/*.mock.js': ['babel'],
+      'src/**/*.html': ['ng-html2js']
+    },
+
+    ngHtml2JsPreprocessor: {
+      stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
+      moduleName: 'templates' // define the template module name
+    },
+
+    // test results reporter to use
+    // possible values: 'dots', 'progress'
+    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+    reporters: ['mocha'],
+
+
+    // web server port
+    port: 9876,
+
+
+    // enable / disable colors in the output (reporters and logs)
+    colors: true,
+
+
+    // level of logging
+    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+    logLevel: config.LOG_INFO,
+
+
+    // enable / disable watching file and executing tests whenever any file changes
+    autoWatch: true,
+
+
+    // start these browsers
+    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+    browsers: ['PhantomJS'],
+
+
+    // Continuous Integration mode
+    // if true, Karma captures browsers, runs the tests and exits
+    singleRun: false
+  });
+};
diff --git a/views/ngXosViews/mcord-slicing/mock-cfg.json b/views/ngXosViews/mcord-slicing/mock-cfg.json
new file mode 100644
index 0000000..9361822
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/mock-cfg.json
@@ -0,0 +1,19 @@
+{
+  "endpoints": [
+    {
+      "url": "topology",
+      "base": "api/service/mcord_slicing_ui/",
+      "methods": ["GET"]
+    },
+    {
+      "url": "slicing/nodes",
+      "base": "api/service/mcord_slicing_ui/topology/",
+      "methods": ["POST"]
+    },
+    {
+      "url": "slicing/links",
+      "base": "api/service/mcord_slicing_ui/topology/",
+      "methods": ["POST"]
+    }
+  ]
+}
diff --git a/views/ngXosViews/mcord-slicing/mocks/topology.json b/views/ngXosViews/mcord-slicing/mocks/topology.json
new file mode 100644
index 0000000..48137bb
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/mocks/topology.json
@@ -0,0 +1,91 @@
+{
+    "nodes": [
+        {"id": 1, "name": "vRouter", "type": "upstream", "model_id": 1, "plane": "data"},
+
+
+
+
+
+        {"id": 21, "name": "ran-ru-1", "type": "ran-ru", "model_id": 1, "plane": "data"},
+        {"id": 22, "name": "ran-cu-1", "type": "ran-cu", "model_id": 1, "plane": "data"},
+        {"id": 23, "name": "sgw-1", "type": "sgw", "model_id": 1, "plane": "data"},
+        {"id": 24, "name": "pgw-1", "type": "pgw", "model_id": 1, "plane": "data"},
+
+        {"id": 25, "name": "ran-ru-1", "type": "ran-ru", "model_id": 1, "plane": "control", "model": {"DlSchedType": "RR", "DlAllocRBRate": 30, "UlSchedType": "RR", "UlAllocRBRate": 30}},
+        {"id": 26, "name": "ran-cu-1", "type": "ran-cu", "model_id": 1, "plane": "control", "model": {"AdmissionControl": 0,"HandHover": 10}},
+        {"id": 27, "name": "sgw-1", "type": "sgw", "model_id": 1, "plane": "control"},
+        {"id": 28, "name": "pgw-1", "type": "pgw", "model_id": 1, "plane": "control", "model": {"brand": "Quortus"}},
+        {"id": 29, "name": "mme-1", "type": "mme", "model_id": 1, "plane": "control"},
+
+        {"id": 210, "name": "profile-1", "type": "profile", "model_id": 1, "plane": "data", "model": {"start": "2016-01-01T08:00:00.000Z", "end": "2016-12-01T08:00:00.000Z"}},
+        {"id": 220, "name": "profile-2", "type": "profile", "model_id": 1, "plane": "data", "model": {"start": "2016-01-01T08:00:00.000Z", "end": "2016-12-01T08:00:00.000Z"}},
+
+        {"id": 211, "name": "ue-1", "type": "ue", "model_id": 1, "plane": "data", "model": {"id": 123}},
+        {"id": 212, "name": "ue-2", "type": "ue", "model_id": 1, "plane": "data", "model": {"id": 456}},
+        {"id": 221, "name": "ue-3", "type": "ue", "model_id": 1, "plane": "data", "model": {"id": 789}},
+
+
+
+
+        {"id": 31, "name": "ran-ru-2", "type": "ran-ru", "model_id": 1, "plane": "data"},
+        {"id": 32, "name": "ran-cu-2", "type": "ran-cu", "model_id": 1, "plane": "data"},
+        {"id": 33, "name": "sgw-2", "type": "sgw", "model_id": 1, "plane": "data"},
+        {"id": 34, "name": "pgw-2", "type": "pgw", "model_id": 1, "plane": "data"},
+
+        {"id": 35, "name": "ran-ru-2", "type": "ran-ru", "model_id": 1, "plane": "control", "model": {"DlSchedType": "RR", "DlAllocRBRate": 30, "UlSchedType": "RR", "UlAllocRBRate": 30}},
+        {"id": 36, "name": "ran-cu-2", "type": "ran-cu", "model_id": 1, "plane": "control", "model": {"AdmissionControl": 1,"HandHover": 10}},
+        {"id": 37, "name": "sgw-2", "type": "sgw", "model_id": 1, "plane": "control"},
+        {"id": 38, "name": "pgw-2", "type": "pgw", "model_id": 1, "plane": "control", "model": {"brand": "Radysis"}},
+        {"id": 39, "name": "mme-2", "type": "mme", "model_id": 1, "plane": "control"},
+
+        {"id": 310, "name": "profile-3", "type": "profile", "model_id": 1, "plane": "data", "model": {"start": "2016-01-01T08:00:00.000Z", "end": "2016-12-01T08:00:00.000Z"}},
+
+        {"id": 311, "name": "ue-4", "type": "ue", "model_id": 1, "plane": "data", "model": {"id": 321}},
+        {"id": 312, "name": "ue-5", "type": "ue", "model_id": 1, "plane": "data", "model": {"id": 654}}
+    ],
+    "links": [
+        {"id": 1, "source": 24, "target": 1, "plane": "data"},
+
+        {"id": 2, "source": 21, "target": 22, "plane": "data"},
+        {"id": 3, "source": 22, "target": 23, "plane": "data"},
+        {"id": 4, "source": 23, "target": 24, "plane": "data"},
+
+        {"id": 5, "source": 21, "target": 25, "plane": "control"},
+        {"id": 6, "source": 22, "target": 26, "plane": "control"},
+        {"id": 7, "source": 23, "target": 27, "plane": "control"},
+        {"id": 8, "source": 24, "target": 28, "plane": "control"},
+        {"id": 9, "source": 25, "target": 26, "plane": "control"},
+        {"id": 10, "source": 26, "target": 29, "plane": "control"},
+        {"id": 11, "source": 27, "target": 28, "plane": "control"},
+        {"id": 12, "source": 27, "target": 29, "plane": "control"},
+
+        {"id": 13, "source": 210, "target": 21, "plane": "data"},
+        {"id": 14, "source": 220, "target": 21, "plane": "data"},
+
+        {"id": 15, "source": 211, "target": 210, "plane": "data"},
+        {"id": 16, "source": 212, "target": 210, "plane": "data"},
+        {"id": 17, "source": 221, "target": 220, "plane": "data"},
+
+
+
+        {"id": 18, "source": 34, "target": 1, "plane": "data"},
+
+        {"id": 19, "source": 31, "target": 32, "plane": "data"},
+        {"id": 20, "source": 32, "target": 33, "plane": "data"},
+        {"id": 21, "source": 33, "target": 34, "plane": "data"},
+
+        {"id": 22, "source": 31, "target": 35, "plane": "control"},
+        {"id": 23, "source": 32, "target": 36, "plane": "control"},
+        {"id": 24, "source": 33, "target": 37, "plane": "control"},
+        {"id": 25, "source": 34, "target": 38, "plane": "control"},
+        {"id": 26, "source": 35, "target": 36, "plane": "control"},
+        {"id": 27, "source": 36, "target": 39, "plane": "control"},
+        {"id": 28, "source": 37, "target": 38, "plane": "control"},
+        {"id": 29, "source": 37, "target": 39, "plane": "control"},
+
+        {"id": 30, "source": 310, "target": 31, "plane": "data"},
+
+        {"id": 31, "source": 311, "target": 310, "plane": "data"},
+        {"id": 32, "source": 312, "target": 310, "plane": "data"}
+    ]
+}
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/package.json b/views/ngXosViews/mcord-slicing/package.json
new file mode 100644
index 0000000..fcea3a3
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/package.json
@@ -0,0 +1,67 @@
+{
+  "name": "xos-mcord-slicing",
+  "version": "1.0.0",
+  "description": "Angular Application for XOS, created with generator-xos",
+  "scripts": {
+    "prestart": "npm install && bower install",
+    "start": "gulp serve",
+    "tosca": "gulp tosca",
+    "prebuild": "npm install && bower install",
+    "build": "gulp",
+    "test": "karma start",
+    "test:ci": "karma start --single-run",
+    "lint": "eslint src/js/",
+    "mock": "easy-mocker -c mock-cfg.json -d mocks/"
+  },
+  "keywords": [
+    "XOS",
+    "Angular",
+    "XOSlib"
+  ],
+  "author": "Matteo Scandolo",
+  "license": "Apache-2.0",
+  "dependencies": {},
+  "devDependencies": {
+    "autoprefixer": "^6.3.3",
+    "browser-sync": "^2.9.11",
+    "colors": "^1.1.2",
+    "css-mqpacker": "^4.0.0",
+    "csswring": "^4.2.1",
+    "del": "^2.0.2",
+    "easy-mocker": "^1.3.1",
+    "eslint": "^1.8.0",
+    "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
+    "gulp": "^3.9.0",
+    "gulp-angular-filesort": "^1.1.1",
+    "gulp-angular-templatecache": "^1.8.0",
+    "gulp-babel": "^5.3.0",
+    "gulp-concat": "^2.6.0",
+    "gulp-concat-util": "^0.5.5",
+    "gulp-eslint": "^1.0.0",
+    "gulp-inject": "^3.0.0",
+    "gulp-minify-html": "^1.0.4",
+    "gulp-ng-annotate": "^1.1.0",
+    "gulp-postcss": "^6.0.1",
+    "gulp-rename": "^1.2.2",
+    "gulp-replace": "^0.5.4",
+    "gulp-sass": "^2.2.0",
+    "gulp-uglify": "^1.4.2",
+    "http-proxy": "^1.12.0",
+    "ink-docstrap": "^0.5.2",
+    "jasmine-core": "~2.3.4",
+    "js-yaml": "^3.6.1",
+    "karma": "^0.13.14",
+    "karma-babel-preprocessor": "~5.2.2",
+    "karma-coverage": "^0.5.3",
+    "karma-jasmine": "~0.3.6",
+    "karma-mocha-reporter": "~1.1.1",
+    "karma-ng-html2js-preprocessor": "^0.2.0",
+    "karma-phantomjs-launcher": "~0.2.1",
+    "lodash": "^3.10.1",
+    "phantomjs": "^1.9.19",
+    "proxy-middleware": "^0.15.0",
+    "run-sequence": "^1.1.4",
+    "wiredep": "^3.0.0-beta",
+    "wrench": "^1.5.8"
+  }
+}
diff --git a/views/ngXosViews/mcord-slicing/spec/sample.test.js b/views/ngXosViews/mcord-slicing/spec/sample.test.js
new file mode 100644
index 0000000..9976190
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/spec/sample.test.js
@@ -0,0 +1,35 @@
+'use strict';
+
+describe('The MCORD Slicing Topology', () => {
+  
+  var scope, element, isolatedScope, httpBackend;
+
+  beforeEach(module('xos.mcord-slicing'));
+  beforeEach(module('templates'));
+
+  beforeEach(inject(function($httpBackend, $compile, $rootScope){
+
+    httpBackend = $httpBackend;
+    // Setting up mock request
+    $httpBackend.expectGET('api/service/mcord_slicing_ui/topology/?no_hyperlinks=1').respond([
+      {
+        email: 'matteo.scandolo@gmail.com',
+        firstname: 'Matteo',
+        lastname: 'Scandolo'
+      }
+    ]);
+
+    scope = $rootScope.$new();
+    element = angular.element('<slicing-topo></slicing-topo>');
+    $compile(element)(scope);
+    scope.$digest();
+    isolatedScope = element.isolateScope().vm;
+  }));
+
+  xit('should create 1 svg', () => {
+    httpBackend.flush();
+    let svg = $(element).find('svg');
+    expect(svg.length).toBe(1);
+  });
+
+});
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/css/dev.css b/views/ngXosViews/mcord-slicing/src/css/dev.css
new file mode 100644
index 0000000..c8ed540
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/css/dev.css
@@ -0,0 +1,5 @@
+/*#xosMcord-slicing{
+  position: absolute;
+  top: 100px;
+  left: 200px;
+}*/
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/css/main.css b/views/ngXosViews/mcord-slicing/src/css/main.css
new file mode 100644
index 0000000..f35a9c9
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/css/main.css
@@ -0,0 +1,69 @@
+#xosMcord-slicing,
+#xosMcord-slicing > [ui-view],
+slicing-topo {
+  width: 100%;
+  height: 100%; }
+
+slicing-topo {
+  display: block; }
+
+#xosMcord-slicing .node {
+  stroke: #337ab7;
+  fill: white; }
+
+#xosMcord-slicing .node,
+#xosMcord-slicing .node + text {
+  cursor: pointer; }
+
+#xosMcord-slicing text {
+  pointer-events: none;
+  -webkit-user-select: none;
+  /* Chrome all / Safari all */
+  -moz-user-select: none;
+  /* Firefox all */
+  -ms-user-select: none;
+  /* IE 10+ */
+  user-select: none; }
+
+#xosMcord-slicing .node.control {
+  stroke-dasharray: 5;
+  stroke: #d9534f; }
+
+#xosMcord-slicing .node.button {
+  stroke: #5bc0de;
+  fill: #daf1f8; }
+
+#xosMcord-slicing .node.selected {
+  stroke-width: 5px;
+  stroke-dasharray: 5; }
+
+#xosMcord-slicing .link {
+  stroke: #286090;
+  stroke-width: 2px;
+  cursor: pointer; }
+
+#xosMcord-slicing .link.control {
+  stroke-dasharray: 5;
+  stroke: #d9534f; }
+
+#xosMcord-slicing .link.selected {
+  stroke-width: 5px;
+  stroke-dasharray: 5; }
+
+#xosMcord-slicing .dragline {
+  stroke-dasharray: 5;
+  stroke: #286090;
+  stroke-width: 2px; }
+
+#xosMcord-slicing .dragline.hidden {
+  stroke-width: 0; }
+
+#xosMcord-slicing div.element-form {
+  position: absolute;
+  border: 1px solid #5bc0de;
+  padding: 10px;
+  background: #fff; }
+
+#xosMcord-slicing .form-line {
+  stroke: #31b0d5;
+  stroke-width: 1px; }
diff --git a/views/ngXosViews/mcord-slicing/src/icons/README.md b/views/ngXosViews/mcord-slicing/src/icons/README.md
new file mode 100644
index 0000000..0d5a787
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/icons/README.md
@@ -0,0 +1,18 @@
+# Set icon for custom dashboard 
+
+## Path to add images : <dashboard-name>/src/icons
+
+### Add two images with name in following format 
+    <dashboard-name>-icon.png
+    <dashboard-name>-icon-active.png
+
+Examples: 
+    If your dashboard name is `slice`
+    then you will add the images with the name as
+        `slice-icon.png`
+        `slice-icon-active.png`
+        
+        
+        
+        
+Note: If you don't add the custom images, then dashboard will use the default images stored at `/xos/core/xoslib/static/images`
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/index.html b/views/ngXosViews/mcord-slicing/src/index.html
new file mode 100644
index 0000000..78bed2d
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/index.html
@@ -0,0 +1,41 @@
+<!-- browserSync -->
+<!-- bower:css -->
+<link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.min.css" />
+<link rel="stylesheet" href="vendor/angular-chart.js/dist/angular-chart.css" />
+<!-- endbower -->
+<!-- endcss -->
+<!-- inject:css -->
+<link rel="stylesheet" href="/css/dev.css">
+<link rel="stylesheet" href="/css/main.css">
+<link rel="stylesheet" href="/../../../xos/core/static/xosNgLib.css">
+<!-- endinject -->
+
+<div ng-app="xos.mcord-slicing" id="xosMcord-slicing" class="container-fluid">
+  <div ui-view></div>
+</div>
+
+<!-- bower:js -->
+<script src="vendor/lodash/lodash.js"></script>
+<script src="vendor/graphlib/dist/graphlib.core.js"></script>
+<script src="vendor/jquery/dist/jquery.js"></script>
+<script src="vendor/angular/angular.js"></script>
+<script src="vendor/angular-mocks/angular-mocks.js"></script>
+<script src="vendor/angular-ui-router/release/angular-ui-router.js"></script>
+<script src="vendor/angular-cookies/angular-cookies.js"></script>
+<script src="vendor/angular-animate/angular-animate.js"></script>
+<script src="vendor/angular-resource/angular-resource.js"></script>
+<script src="vendor/bootstrap-css/js/bootstrap.min.js"></script>
+<script src="vendor/Chart.js/Chart.js"></script>
+<script src="vendor/angular-chart.js/dist/angular-chart.js"></script>
+<script src="vendor/d3/d3.js"></script>
+<script src="vendor/angular-recursion/angular-recursion.js"></script>
+<script src="vendor/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js"></script>
+<!-- endbower -->
+<!-- endjs -->
+<!-- inject:js -->
+<script src="/vendor/ng-xos-lib/dist/ngXosHelpers.min.js"></script>
+<script src="/.tmp/main.js"></script>
+<script src="/.tmp/slicing-topo.directive.js"></script>
+<script src="/.tmp/graph.service.js"></script>
+<script src="/.tmp/form.service.js"></script>
+<!-- endinject -->
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/js/aa b/views/ngXosViews/mcord-slicing/src/js/aa
new file mode 100644
index 0000000..0d4d9ae
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/js/aa
@@ -0,0 +1 @@
+that was the approach since it is completely independent from CORD or XOS, but if you prefere we can follow the same release scheme of CORD and from master pull the latest
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/js/form.service.js b/views/ngXosViews/mcord-slicing/src/js/form.service.js
new file mode 100644
index 0000000..e18ab10
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/js/form.service.js
@@ -0,0 +1,178 @@
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 9/29/16.
+ */
+
+(function () {
+  'use strict';
+  angular.module('xos.mcord-slicing')
+  .service('FormHandler', function(LabelFormatter, XosFormHelpers){
+    const self = this;
+    const t = d3.transition()
+      .duration(500);
+
+    // draw a form nearby the node
+    this.drawForm = (node, linkGroup, formGroup) => {
+
+      // create an svg to draw a line from the node to the form
+      const line = linkGroup
+        .append('line')
+        .attr({
+          class: 'form-line',
+          id: `form-line-${node.type}-${node.id}`,
+          x1: node.x + 10,
+          y1: node.y,
+          x2: node.x + 10,
+          y2: node.y + 40,
+          opacity: 0,
+        });
+
+      line.transition(t)
+        .attr({
+          opacity: 1
+        });
+
+      // form container
+      const form = formGroup
+        .append('div')
+        .attr({
+          class: 'element-form',
+          id: `form-${node.type}-${node.id}`,
+        })
+        .style({
+          opacity: 0
+        });
+
+      const formEl = form
+        .append('form');
+
+      // cicle trough props (to be defined from rest)
+      this.addFormfields(node, formEl);
+
+      const buttonRow = formEl
+        .append('div')
+        .attr({
+          class: 'row'
+        });
+
+      buttonRow
+        .append('div')
+        .attr({
+          class: 'col-xs-6'
+        })
+        .append('a')
+        .attr({
+          class: 'btn btn-danger',
+          'data-parent-node-type': node.type,
+          'data-parent-node-id': node.id
+        })
+        .text('Close')
+        .on('click', function(){
+          self.removeForm(
+            d3.select(this).attr('data-parent-node-type'),
+            d3.select(this).attr('data-parent-node-id'),
+            linkGroup,
+            formGroup
+          );
+        });
+
+      buttonRow
+        .append('div')
+        .attr({
+          class: 'col-xs-6'
+        })
+        .append('button')
+        .attr({
+          type: 'button',
+          class: 'btn btn-success'
+        })
+        .text('Save')
+        .on('click', function(){
+          $(`#form-${node.type}-${node.id} input`).each(function(){
+            let input = $(this); // This is the jquery object of the input, do what you will
+            let val = input.val();
+            let name = input.attr('name');
+            console.log(name, val);
+          });
+        });
+
+      form.transition(t)
+        .style({
+          opacity: 1,
+          top: `${node.y + 95}px`,
+          left: `${node.x}px`
+        });
+    };
+
+    this.removeForm = (nodeType, nodeId, linkGroup, formGroup) => {
+      this.removeFormByParentNode({type: nodeType, id: nodeId}, linkGroup, formGroup);
+    };
+
+    // remove a form starting form his parent node
+    this.removeFormByParentNode = (node, linkGroup, formGroup) => {
+      // remove form
+      formGroup.selectAll(`#form-${node.type}-${node.id}`)
+        .transition(t)
+        .style({
+          opacity: 0
+        })
+        .remove();
+      // remove link
+      linkGroup.selectAll(`#form-line-${node.type}-${node.id}`)
+        .transition(t)
+        .attr({
+          opacity: 0
+        })
+        .remove();
+    };
+
+    this.getFieldValue = (val, fieldType) => {
+      if(fieldType === 'date'){
+        val = new Date(val);
+        val = `${val.getFullYear()}-${('0' + val.getMonth() + 1).slice(-2)}-${('0' + val.getDate()).slice(-2)}`
+      }
+      return val || '';
+    };
+
+    this.addFormField = (fieldName, fieldValue, formEl) => {
+      let fieldType = XosFormHelpers._getFieldFormat(fieldValue);
+      formEl
+        .append('div')
+        .attr({
+          class: 'row'
+        })
+        .append('div')
+        .attr({
+          class: 'col-xs-12'
+        })
+        .append('label')
+        .text(fieldName ? LabelFormatter.format(fieldName ) : 'test')
+        .append('input')
+        .attr({
+          type: fieldType,
+          name: fieldName,
+          value: this.getFieldValue(fieldValue, fieldType),
+          class: 'form-control'
+        });
+    };
+
+    this.addFormfields = (node, formEl) => {
+
+      this.addFormField('name', node.name, formEl);
+      // tmp check
+      if(!node.model){
+        return this.addFormField(null, null, formEl);
+      }
+
+      // create a list of fields to be printed
+      const fields = Object.keys(node.model);
+      _.forEach(fields, f => {
+        this.addFormField(f, node.model[f], formEl);
+      });
+    };
+  });
+})();
+
diff --git a/views/ngXosViews/mcord-slicing/src/js/graph.service.js b/views/ngXosViews/mcord-slicing/src/js/graph.service.js
new file mode 100644
index 0000000..223be9f
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/js/graph.service.js
@@ -0,0 +1,291 @@
+(function () {
+  'use strict';
+
+  angular.module('xos.mcord-slicing')
+  .service('SliceGraph', function(_, NodePositioner){
+    const g = new graphlib.Graph();
+
+    /**
+    * @ngdoc method
+    * @name xos.mcord-slicing.SliceGraph#buildGraph
+    * @methodOf xos.mcord-slicing.SliceGraph
+    * @description
+    * buildGraph
+    * @param {object} data An object in the for of {nodes: [], links: []} describing the graph
+    * @returns {null}
+    **/
+    this.buildGraph = (data) => {
+      _.forEach(data.nodes, n => g.setNode(n.id, n));
+      _.forEach(data.links, n => g.setEdge(n.source, n.target, n));
+    };
+
+    this.getLinks = () => {
+      return g.edges().map(e => {
+        return {
+          source: g.node(e.v),
+          target: g.node(e.w),
+          data: g.edge(e)
+        }
+      });
+    }
+
+    this.getGraph = () => g;
+
+    // find the successor of a node
+    this.getNodeSuccessors = (node) => {
+      return _.map(g.successors(node.id), n => {
+        return g.node(n);
+      })
+    };
+
+    this.getNodePredecessors = (node) => {
+      return _.map(g.predecessors(node.id), n => {
+        return g.node(n);
+      });
+    };
+
+    // get data plane successors of a node
+    this.getNodeDataPlaneSuccessors = (node) => {
+      return _.filter(this.getNodeSuccessors(node), n => {
+        return n.plane === 'data';
+      });
+    };
+
+    // find the end of the graph toward upstream
+    this.getUpstreamSinks = (el) => {
+      const sinks =  _.reduce(g.sinks(), (sinks, node, i) => {
+        let n = g.node(node);
+        if(n.type === 'upstream'){
+          sinks.push(n);
+        }
+        return sinks;
+      }, []);
+
+      return _.map(sinks, (s, i) => {
+        s.position = {
+          top: 0,
+          bottom: el.clientHeight,
+          total: sinks.length,
+          index: i + 1
+        };
+        return s;
+      })
+    };
+
+    this.positionGraph = (el) => {
+      // get root node
+      let nodes = this.getUpstreamSinks(el);
+
+      // find children, recursively
+      let children = [];
+      _.forEach(nodes, (n, i) => {
+        children = children.concat(this.findPredecessor(n));
+      });
+      nodes = nodes.concat(children);
+
+      // calculate the position for all nodes
+      nodes = _.map(nodes, r => {
+        return NodePositioner.getDataPlaneNodePos(r, el);
+      });
+
+      return nodes;
+    };
+
+    // this iterate on all the nodes, and add position information
+    this.findPredecessor = (node) => {
+      let preds = g.predecessors(node.id);
+
+      // saving predecessor information
+      preds = preds.map((p, i) => {
+        p = g.node(p);
+        const parentAvailableSpace = (node.position.bottom - node.position.top) / node.position.total;
+        const parentY = NodePositioner.getVpos(node);
+        p.position = {
+          top: parentY - (parentAvailableSpace / 2),
+          bottom: (parentY + (parentAvailableSpace / 2)),
+          total: preds.length,
+          index: i + 1
+        };
+        return p;
+      });
+
+      //recurse
+      const predsChild = _.reduce(preds, (list, p) => {
+        return list.concat(this.findPredecessor(p));
+      }, []);
+
+      return preds.concat(predsChild);
+    };
+
+    this.getGraphLinks = (nodes) => {
+      const links = [];
+      _.forEach(nodes, n => {
+        const edges = g.inEdges(n.id);
+        _.forEach(edges, e => {
+          links.push({
+            source: g.node(e.v),
+            target: g.node(e.w),
+            data: g.edge(e)
+          });
+        });
+      });
+      return links;
+    };
+
+    this.getDataPlaneForSlice = (ranRu, sliceId) => {
+      // hardcoded, likely to be improved
+      const ranCu = g.node(g.successors(ranRu.id)[0]);
+      const sgw = g.node(g.successors(ranCu.id)[0]);
+      const pgw = g.node(g.successors(sgw.id)[0]);
+
+      // augmenting nodes with sliceId
+      ranRu.sliceId = sliceId;
+      ranCu.sliceId = sliceId;
+      sgw.sliceId = sliceId;
+      pgw.sliceId = sliceId;
+      return [ranRu, ranCu, sgw, pgw];
+    };
+
+    this.getControlPlaneForSlice = (dataPlane, sliceId) => {
+      return _.reduce(dataPlane, (cp_nodes, dp_node) => {
+        // NOTE: looks that all the time the cplane version of the node is successors number 1, we may need to check
+        let cp_node = g.node(g.successors(dp_node.id)[1]);
+
+        // position relative to their data-plane node
+        cp_node = NodePositioner.getControlPlaneNodePos(cp_node, dp_node);
+        cp_node.sliceId = sliceId;
+        // hardcoded
+        // if control plane node is a sgw, there is an MME attached
+        if(cp_node.type === 'sgw'){
+          let mme = g.node(g.successors(cp_node.id)[1]);
+          // position relative to their data-plane node
+          mme = NodePositioner.getControlPlaneNodePos(mme, cp_node);
+          mme.sliceId = sliceId;
+          cp_nodes.push(mme);
+        }
+
+        return cp_nodes.concat(cp_node);
+      }, []);
+    };
+
+    this.activeSlices = [];
+    // this.usedSlicesId = [];
+    this.getSliceDetail= (node) => {
+      if(node.sliceId && this.activeSlices.indexOf(node.sliceId) > -1){
+        // the slice is already active, return an empty set
+        return [[], []];
+      }
+
+      // let sliceId;
+      // if (node.sliceId){
+      //   sliceId = node.sliceId;
+      // }
+      // else{
+        const sliceId = _.min(this.activeSlices) ? _.min(this.activeSlices) + 1 : 1;
+      // }
+      this.activeSlices.push(sliceId);
+      // this.usedSlicesId.push(sliceId);
+
+      // getting the beginning of the slice
+      const ranRu = (function getRanRu(n) {
+        if(n.type === 'ran-ru'){
+          return n;
+        }
+        // we assume that in the slice node have only one predecessor
+        const pred = g.predecessors(n.id);
+        return getRanRu(g.node(pred[0]));
+      })(node);
+
+      // get data plane nodes for this slice (need them to get the corresponding control plane)
+      const dp_nodes = this.getDataPlaneForSlice(ranRu, sliceId);
+      // get control plane nodes for this slice
+      const cp_nodes = this.getControlPlaneForSlice(dp_nodes, sliceId);
+
+      const links = this.getGraphLinks(cp_nodes);
+
+      // add a close button
+      let closeButton = {
+        name: 'Close',
+        id: `close-button-${sliceId}`,
+        type: 'button',
+        sliceId: sliceId
+      };
+      closeButton = NodePositioner.getControlPlaneNodePos(closeButton, cp_nodes[3]);
+      cp_nodes.push(closeButton);
+
+      return [cp_nodes, links];
+    };
+
+    this.removeActiveSlice = sliceId => {
+      // nodes are remove from the d3 nodes identified by id
+      this.activeSlices.splice(this.activeSlices.indexOf(sliceId), 1);
+    };
+
+  })
+  .service('NodePositioner', function(_, sliceElOrder){
+
+    let el;
+
+    this.storeEl = (_el) => {
+      el = _el;
+    };
+
+    this.getHpos = (node, el) => {
+      let elPos = sliceElOrder.indexOf(node.type) + 1;
+
+      // hardcoded
+      if(node.type === 'mme'){
+        elPos = sliceElOrder.indexOf('sgw') + 1
+      }
+      if(node.type === 'button'){
+        elPos = sliceElOrder.indexOf('pgw') + 1
+      }
+      let x = (el.clientWidth / (sliceElOrder.length + 1)) * elPos;
+      return x;
+    };
+
+    this.getVpos = (node) => {
+      // calculate the available space to distribute items
+      const availableSpace = node.position.bottom - node.position.top;
+
+      // calculate the distance between each item
+      const step = availableSpace / (node.position.total + 1);
+
+      // vertical position
+      const y = (step * node.position.index) + node.position.top;
+      return y;
+    };
+
+    // for nodes that are part of the data plane
+    this.getDataPlaneNodePos = (node) => {
+      const x = this.getHpos(node, el);
+      const y = this.getVpos(node);
+      node.x = x;
+      node.y = y;
+      node.transform = `translate(${x}, ${y})`;
+      node.fixed = true;
+      return node;
+    };
+
+    // control element nodes are positioned relatively to their corresponding data plane node
+    this.getControlPlaneNodePos = (cp_node, dp_node) => {
+      const x = this.getHpos(cp_node, el);
+      const y = dp_node.y - 75;
+      cp_node.x = x;
+      cp_node.y = y;
+      cp_node.transform = `translate(${x}, ${y})`;
+      cp_node.fixed = true;
+      return cp_node;
+    };
+
+  })
+  .value('sliceElOrder', [
+    'ue',
+    'profile',
+    'ran-ru',
+    'ran-cu',
+    'sgw',
+    'pgw',
+    'upstream'
+  ]);
+})();
diff --git a/views/ngXosViews/mcord-slicing/src/js/main.js b/views/ngXosViews/mcord-slicing/src/js/main.js
new file mode 100644
index 0000000..fbd9039
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/js/main.js
@@ -0,0 +1,93 @@
+'use strict';
+
+angular.module('xos.mcord-slicing', [
+  'ngResource',
+  'ngCookies',
+  'ui.router',
+  'xos.helpers'
+])
+.config(($stateProvider) => {
+  $stateProvider
+  .state('slicing-topo', {
+    url: '/',
+    template: '<slicing-topo></slicing-topo>'
+  })
+  .state('node-links', {
+    url: '/data',
+    template: '<node-links></node-links>'
+  });
+})
+.config(function($httpProvider){
+  $httpProvider.interceptors.push('NoHyperlinks');
+})
+.service('McordSlicingTopo', function($http, $q){
+  this.query = () => {
+    const d = $q.defer();
+
+    $http.get('api/service/mcord_slicing_ui/topology/')
+    .then((res) => {
+      let data;
+      if (res.data.hasOwnProperty('nodes')){
+        data = res.data;
+      }
+      else {
+        // INVESTIGATE why proxy change resposne
+        data = {
+          nodes: res.data[0],
+          links: res.data[1]
+        };
+      }
+      d.resolve(data);
+    })
+    .catch((e) => {
+      d.reject(e);
+    });
+
+    return {$promise: d.promise};
+  };
+})
+.directive('nodeLinks', function(){
+  return {
+    restrict: 'E',
+    scope: {},
+    bindToController: true,
+    controllerAs: 'vm',
+    templateUrl: 'templates/node-links.tpl.html',
+    controller: function(McordSlicingTopo){
+
+      this.tableConfig = {
+        columns: [
+          {
+            label: 'Id',
+            prop: 'id'
+          },
+          {
+            label: 'Name',
+            prop: 'name'
+          },
+          {
+            label: 'Type',
+            prop: 'type'
+          },
+          {
+            label: 'Plane',
+            prop: 'plane'
+          },
+          {
+            label: 'Model Id',
+            prop: 'model_id'
+          }
+        ]
+      };
+      
+      // retrieving user list
+      McordSlicingTopo.query().$promise
+      .then((users) => {
+        this.users = users.nodes;
+      })
+      .catch((e) => {
+        throw new Error(e);
+      });
+    }
+  };
+});
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/js/slicing-topo.directive.js b/views/ngXosViews/mcord-slicing/src/js/slicing-topo.directive.js
new file mode 100644
index 0000000..b91c8f4
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/js/slicing-topo.directive.js
@@ -0,0 +1,502 @@
+(function () {
+  'use strict';
+
+  angular.module('xos.mcord-slicing')
+  .directive('slicingTopo', function(){
+    return {
+      restrict: 'E',
+      scope: {},
+      bindToController: true,
+      controllerAs: 'vm',
+      templateUrl: 'templates/slicing-topo.tpl.html',
+      controller: function($element, SliceGraph, McordSlicingTopo, _, NodePositioner, FormHandler){
+
+        let svg;
+        let nodes, links;
+        let nodeGroup, linkGroup, formGroup;
+        let dragLine, dragStartNode, dragEndNode, selectedLink;
+        let selectedNode, nodeSiblings;
+
+        var t = d3.transition()
+          .duration(500);
+
+        this.activeSlices = [];
+
+        const resetDragInfo = () => {
+          // reset drag nodes
+          dragStartNode = null;
+          dragEndNode = null;
+
+          // hide dragLine
+          dragLine
+            .classed('hidden', true);
+        };
+
+        McordSlicingTopo.query().$promise
+        .then((topology) => {
+          NodePositioner.storeEl($element[0]);
+          handleSvg($element[0]);
+          SliceGraph.buildGraph(topology);
+          _nodes = SliceGraph.positionGraph($element[0]);
+          _links = SliceGraph.getGraphLinks(_nodes);
+          drawGraph();
+        })
+        .catch((e) => {
+          throw new Error(e);
+        });
+
+        const handleSvg = (el) => {
+          this.el = el;
+          d3.select(el).select('svg').remove();
+
+          svg = d3.select(el)
+          .append('svg')
+          .style('width', `${el.clientWidth}px`)
+          .style('height', `${el.clientHeight}px`);
+
+          linkGroup = svg.append('g')
+            .attr({
+              class: 'link-group'
+            });
+
+          nodeGroup = svg.append('g')
+            .attr({
+              class: 'node-group'
+            });
+
+          formGroup = d3.select(el)
+            .append('div')
+            .attr({
+              class: 'form-container'
+            });
+
+          // line displayed when dragging nodes
+          dragLine = svg.append('svg:path')
+            .attr('class', 'dragline hidden')
+            .attr('d', 'M0,0L0,0');
+        };
+
+        const tick = () => {
+          svg.selectAll('.link')
+            .attr('x1', d => d.source.x)
+            .attr('y1', d => d.source.y)
+            .attr('x2', d => d.target.x)
+            .attr('y2', d => d.target.y);
+        };
+
+        // prepare the data to show all slices
+        let _nodes = [];
+        let _links = [];
+
+        // attach slice details
+        const attachSliceDetails = n => {
+          let [newNodes, newLinks] = SliceGraph.getSliceDetail(n);
+          _nodes = _nodes.concat(newNodes);
+          _links = _links.concat(newLinks);
+          drawGraph();
+        };
+
+        // remove slice detail
+        const removeSliceDetails = sliceId => {
+
+          SliceGraph.removeActiveSlice(sliceId);
+
+          // if the selected node is part of the slice I'm closing
+          // deselect the node
+          if(selectedNode && selectedNode.sliceId === sliceId){
+            selectedNode = null;
+            nodeSiblings = null;
+          }
+
+          // remove control plane nodes related to this slice
+          _nodes = _.filter(_nodes, n => {
+            if(n.sliceId === sliceId && (n.plane === 'control' || n.type === 'button')){
+              // if I remove the node check that there is no form attached
+              FormHandler.removeFormByParentNode(n, linkGroup, formGroup);
+              return false;
+            }
+            return true;
+          });
+
+          // remove sliceId from data plane element
+          _nodes = _.map(_nodes, n => {
+            if(n.sliceId === sliceId){
+              delete n.sliceId;
+            }
+            return n;
+          });
+
+          // remove control plane links related to this slice
+          _links = _.filter(_links, l => {
+            if(_.findIndex(_nodes, {id: l.data.source}) === -1){
+              return false;
+            }
+            if(_.findIndex(_nodes, {id: l.data.target}) === -1){
+              return false;
+            }
+            return true;
+          });
+          drawGraph();
+        };
+
+        const deleteLink = linkId => {
+          // TODO
+          // [ ] delete from graphlib
+          // [ ] delete from backend
+          console.log(_links);
+          _.remove(_links, (l) => {
+            return l.data.id === linkId;
+          });
+          console.log(_links);
+          drawGraph();
+        };
+
+        const expandNode = (n) => {
+          console.log('exp', n);
+          resetDragInfo();
+          const sliceComponents = ['ran-ru', 'ran-cu', 'pgw', 'sgw'];
+          if(sliceComponents.indexOf(n.type) > -1 && n.plane === 'data' && !n.sliceId){
+            attachSliceDetails(n);
+          }
+          else if (n.type === 'button'){
+            removeSliceDetails(n.sliceId);
+          }
+          else if (!n.formAttached && n.model){
+            n.formAttached = true;
+            FormHandler.drawForm(n, linkGroup, formGroup);
+          }
+          else if (n.formAttached){
+            n.formAttached = false;
+            FormHandler.removeFormByParentNode(n, linkGroup, formGroup);
+          }
+        };
+
+        const selectNextNode = () => {
+          if(!selectedNode){
+            selectedNode = _nodes[0];
+            selectedNode.selected = true;
+          }
+          else {
+            // TODO if no sliceId check only data plane successors
+            nodeSiblings = SliceGraph.getNodeSuccessors(selectedNode);
+
+            if(nodeSiblings.length === 0){
+              return;
+            };
+            // reset current selected node
+            selectedNode.selected = false;
+            // find next node
+            let nextNodeId = _.findIndex(_nodes, {id: nodeSiblings[0].id});
+            selectedNode = _nodes[nextNodeId];
+            selectedNode.selected = true;
+
+            // NOTE I need to update sibling with successor of the parent
+            // to enable vertical navigation
+            let parents = SliceGraph.getNodeSuccessors(selectedNode);
+            if(parents.lenght > 0){
+              nodeSiblings = SliceGraph.getNodePredecessors(parents[0]);
+            }
+            else {
+              nodeSiblings = null;
+            }
+          }
+          drawGraph();
+        };
+
+        const selectPrevNode = () => {
+          if(!selectedNode){
+            selectedNode = _nodes[0];
+            selectedNode.selected = true;
+          }
+          else {
+            nodeSiblings = SliceGraph.getNodePredecessors(selectedNode);
+
+            if(nodeSiblings.length === 0){
+              return;
+            };
+            // reset current selected node
+            selectedNode.selected = false;
+            // find next node
+            let prev = _.findIndex(_nodes, {id: nodeSiblings[0].id});
+
+            if(prev < 0){
+              prev = _nodes.length - 1;
+            }
+            selectedNode = _nodes[prev];
+            selectedNode.selected = true;
+          }
+          drawGraph();
+        };
+
+        const sortByY = (a, b) => {
+          if (a.y < b.y)
+            return 1;
+          if (a.y > b.y)
+            return -1;
+          return 0;
+        };
+
+        const getSameTypeNodes = (selectedNode) => {
+          return _.filter(_nodes, n => {
+            if(selectedNode.type === 'pgw' && n.type === 'button'){
+              return true;
+            }
+            if(selectedNode.type === 'button' && n.type === 'pgw'){
+              return true;
+            }
+            if (selectedNode.type === 'sgw' && n.type === 'mme'){
+              return true;
+            }
+            if (selectedNode.type === 'mme' && n.type === 'sgw'){
+              return true;
+            }
+            return n.type === selectedNode.type;
+          }).sort(sortByY);
+        };
+
+        const selectNextSibling = () => {
+          if(!selectedNode){
+            selectedNode = _nodes[0];
+            selectedNode.selected = true;
+          }
+          else {
+            // reset current selected node
+            selectedNode.selected = false;
+
+            // find next node
+            let sameTypeNodes = getSameTypeNodes(selectedNode);
+
+            let nextSiblingId = _.findIndex(sameTypeNodes, {id: selectedNode.id}) + 1;
+            if(nextSiblingId === sameTypeNodes.length){
+              nextSiblingId = 0;
+            }
+            let nextNodeId = _.findIndex(_nodes, {id: sameTypeNodes[nextSiblingId].id});
+            selectedNode = _nodes[nextNodeId];
+            selectedNode.selected = true;
+          }
+          drawGraph();
+        };
+
+        const selectPrevSibling = () => {
+          if(!selectedNode){
+            selectedNode = _nodes[0];
+            selectedNode.selected = true;
+          }
+          else {
+            // reset current selected node
+            selectedNode.selected = false;
+
+            // find next node
+            let sameTypeNodes = getSameTypeNodes(selectedNode);
+
+            let nextSiblingId = _.findIndex(sameTypeNodes, {id: selectedNode.id}) - 1;
+            if(nextSiblingId < 0){
+              nextSiblingId = sameTypeNodes.length - 1;
+            }
+            let nextNodeId = _.findIndex(_nodes, {id: sameTypeNodes[nextSiblingId].id});
+            selectedNode = _nodes[nextNodeId];
+            selectedNode.selected = true;
+          }
+          drawGraph();
+        };
+
+        const drawGraph = () => {
+
+          // svg.selectAll('.node-container').remove();
+          // svg.selectAll('.link-container').remove();
+
+          var force = d3.layout.force()
+            .nodes(_nodes)
+            .links(_links)
+            .charge(-1060)
+            .gravity(0.1)
+            .linkDistance(200)
+            .size([this.el.clientWidth, this.el.clientHeight])
+            .on('tick', tick)
+            .start();
+
+          links = linkGroup.selectAll('.link-container')
+            .data(_links, d => d.data.id)
+            .enter()
+            .insert('g')
+            .attr({
+              class: 'link-container',
+              opacity: 0
+            });
+
+          links
+            .transition(t)
+            .attr({
+              opacity: 1
+            });
+
+          links.insert('line')
+            .attr('class', d => `link ${d.data.plane}`)
+            .on('click', function(link ){
+              selectedLink = link;
+
+              // deselect all other links
+              d3.selectAll('.link').classed('selected', false);
+
+              d3.select(this).classed('selected', true);
+            });
+
+          nodes = nodeGroup.selectAll('.node')
+            .data(_nodes, d => d.id)
+            .attr({
+              class: d => `node ${d.plane} ${d.type} ${d.selected ? 'selected': ''}`,
+            });
+
+          nodes
+            .enter()
+            .append('g')
+            .attr({
+              class: 'node-container',
+              transform: d => d.transform,
+              opacity: 0
+            });
+
+          nodes.transition(t)
+            .attr({
+              opacity: 1
+            });
+
+          nodes.append('rect')
+            .attr({
+              class: d => `node ${d.plane} ${d.type} ${d.selected ? 'selected': ''}`,
+              width: 100,
+              height: 50,
+              x: -50,
+              y: -25
+            });
+
+          nodes.append('text')
+            .attr({
+              'text-anchor': 'middle',
+              'alignment-baseline': 'middle'
+            })
+            // .text(d => `${d.id} ${d.name}`);
+            .text(d => `${d.name}`);
+
+          nodes.on('click', (n) => {
+            expandNode(n);
+          });
+
+          nodes
+            .on('mousedown', (n) => {
+              // save a reference to dragStart
+              dragStartNode = n;
+
+              dragLine
+                .classed('hidden', false)
+                .attr('d', 'M' + dragStartNode.x + ',' + dragStartNode.y + 'L' + dragStartNode.x + ',' + dragStartNode.y);
+            })
+            .on('mouseover', (n) => {
+              if(dragStartNode){
+                dragEndNode = n;
+              }
+            });
+
+          svg
+            .on('mousemove', function(){
+              if(!dragStartNode){
+                return;
+              }
+              dragLine.attr('d', 'M' + dragStartNode.x + ',' + dragStartNode.y + 'L' + d3.mouse(this)[0] + ',' + d3.mouse(this)[1]);
+            })
+            .on('mouseup', () => {
+              if(!dragStartNode || !dragEndNode){
+                resetDragInfo();
+                return;
+              }
+
+              // TODO
+              // [X] check that I can connect the two nodes
+              // [X] check link direction
+              // [ ] save the new link in the BE
+
+              // check that I can connect the 2 nodes
+              const successorType = SliceGraph.getNodeDataPlaneSuccessors(dragStartNode)[0].type;
+              if(dragEndNode.type !== successorType){
+                resetDragInfo();
+                return;
+              }
+
+              // create the link
+              _links.push({
+                source: dragStartNode,
+                target: dragEndNode,
+                data: {
+                  id: `${dragStartNode.id}.${dragEndNode.id}`,
+                  source: dragStartNode.id,
+                  target: dragEndNode.id
+                }
+              });
+
+              // update the graph
+              // TODO recalculate graph positions
+              drawGraph();
+
+              resetDragInfo();
+            });
+
+          // remove exiting nodes
+          svg.selectAll('.node-container')
+            .data(_nodes, d => d.id)
+            .exit()
+            .transition(t)
+            .attr({
+              opacity: 0
+            })
+            .remove();
+
+          // remove exiting links
+          svg.selectAll('.link-container')
+            .data(_links, d => d.data.id)
+            .exit()
+            .transition(t)
+            .attr({
+              opacity: 0
+            })
+            .remove();
+        };
+
+        d3.select('body')
+          .on('keydown', function(){
+            // console.log(d3.event.code);
+            if(d3.event.code === 'Backspace' && selectedLink){
+              // delete link
+              deleteLink(selectedLink.data.id);
+            }
+            if(d3.event.code === 'Enter' && selectedNode){
+              d3.event.preventDefault();
+              expandNode(selectedNode);
+            }
+            if(d3.event.code === 'Escape' && selectedNode){
+              selectedNode.selected = false;
+              selectedNode = null;
+              nodeSiblings = null;
+              drawGraph();
+            }
+            if(d3.event.code === 'ArrowRight'){
+              d3.event.preventDefault();
+              selectNextNode();
+            }
+            if(d3.event.code === 'ArrowLeft'){
+              d3.event.preventDefault();
+              selectPrevNode();
+            }
+            if(d3.event.code === 'ArrowUp'){
+              d3.event.preventDefault();
+              selectNextSibling();
+            }
+            if(d3.event.code === 'ArrowDown'){
+              d3.event.preventDefault();
+              selectPrevSibling();
+            }
+
+          });
+      }
+    }
+  });
+})();
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/sass/main.scss b/views/ngXosViews/mcord-slicing/src/sass/main.scss
new file mode 100644
index 0000000..7224300
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/sass/main.scss
@@ -0,0 +1,88 @@
+@import '../../../../style/sass/lib/_variables.scss';
+
+#xosMcord-slicing,
+#xosMcord-slicing > [ui-view],
+slicing-topo {
+  width: 100%;
+  height: 100%;
+}
+
+slicing-topo {
+  display: block;
+}
+
+#xosMcord-slicing {
+  .node {
+    stroke: $brand-primary;
+    fill: white;
+  }
+
+  .node,
+  .node + text {
+    cursor: pointer;
+  }
+
+  text {
+    pointer-events: none;
+    -webkit-user-select: none;  /* Chrome all / Safari all */
+    -moz-user-select: none;     /* Firefox all */
+    -ms-user-select: none;      /* IE 10+ */
+    user-select: none;
+  }
+
+  .node.control {
+    stroke-dasharray: 5;
+    stroke: $brand-danger;
+  }
+
+  .node.button {
+    //stroke-dasharray: 5;
+    stroke: $brand-info;
+    fill: lighten($brand-info, 30)
+  }
+
+  .node.selected{
+    stroke-width: 5px;
+    stroke-dasharray: 5;
+  }
+
+  .link {
+    stroke: darken($brand-primary, 10);
+    stroke-width: 2px;
+    cursor: pointer;
+  }
+
+  .link.control {
+    stroke-dasharray: 5;
+    stroke: $brand-danger;
+  }
+
+  .link.selected {
+    stroke-width: 5px;
+    stroke-dasharray: 5;
+  }
+
+  // drag line
+  .dragline {
+    stroke-dasharray: 5;
+    stroke: darken($brand-primary, 10);
+    stroke-width: 2px;
+  }
+
+  .dragline.hidden {
+    stroke-width: 0;
+  }
+
+  // form styling
+  div.element-form {
+    position: absolute;
+    border: 1px solid $brand-info;
+    padding: 10px;
+    background: #fff;
+  }
+
+  .form-line {
+    stroke: darken($brand-info, 10);
+    stroke-width: 1px;
+  }
+}
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/templates/node-links.tpl.html b/views/ngXosViews/mcord-slicing/src/templates/node-links.tpl.html
new file mode 100644
index 0000000..e15da33
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/templates/node-links.tpl.html
@@ -0,0 +1,6 @@
+<div class="row">
+  <div class="col-sm-12">
+    <xos-table config="vm.tableConfig" data="vm.users"></xos-table>
+  </div>
+  <div class="col-sm-12"></div>
+</div>
\ No newline at end of file
diff --git a/views/ngXosViews/mcord-slicing/src/templates/slicing-topo.tpl.html b/views/ngXosViews/mcord-slicing/src/templates/slicing-topo.tpl.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/views/ngXosViews/mcord-slicing/src/templates/slicing-topo.tpl.html
diff --git a/xos/core/xoslib/dashboards/xosMcord-slicing.html b/xos/core/xoslib/dashboards/xosMcord-slicing.html
new file mode 100644
index 0000000..fd5335b
--- /dev/null
+++ b/xos/core/xoslib/dashboards/xosMcord-slicing.html
@@ -0,0 +1,17 @@
+<!-- browserSync -->
+
+<!-- endcss -->
+<!-- inject:css -->
+<link rel="stylesheet" href="/static/css/xosMcord-slicing.css">
+<!-- endinject -->
+
+<div ng-app="xos.mcord-slicing" id="xosMcord-slicing" class="container-fluid">
+  <div ui-view></div>
+</div>
+
+
+<!-- endjs -->
+<!-- inject:js -->
+<script src="/static/vendor/xosMcord-slicingVendor.js"></script>
+<script src="/static/js/xosMcord-slicing.js"></script>
+<!-- endinject -->
\ No newline at end of file
diff --git a/xos/core/xoslib/static/css/xosMcord-slicing.css b/xos/core/xoslib/static/css/xosMcord-slicing.css
new file mode 100644
index 0000000..dafb31c
--- /dev/null
+++ b/xos/core/xoslib/static/css/xosMcord-slicing.css
@@ -0,0 +1 @@
+#xosMcord-slicing,#xosMcord-slicing>[ui-view],slicing-topo{width:100%;height:100%}slicing-topo{display:block}#xosMcord-slicing .node{stroke:#337ab7;fill:white}#xosMcord-slicing .node,#xosMcord-slicing .node+text{cursor:pointer}#xosMcord-slicing text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#xosMcord-slicing .node.control{stroke-dasharray:5;stroke:#d9534f}#xosMcord-slicing .node.button{stroke:#5bc0de;fill:#daf1f8}#xosMcord-slicing .node.selected{stroke-width:5px;stroke-dasharray:5}#xosMcord-slicing .link{stroke:#286090;stroke-width:2px;cursor:pointer}#xosMcord-slicing .link.control{stroke-dasharray:5;stroke:#d9534f}#xosMcord-slicing .link.selected{stroke-width:5px;stroke-dasharray:5}#xosMcord-slicing .dragline{stroke-dasharray:5;stroke:#286090;stroke-width:2px}#xosMcord-slicing .dragline.hidden{stroke-width:0}#xosMcord-slicing div.element-form{position:absolute;border:1px solid #5bc0de;padding:10px;background:#fff}#xosMcord-slicing .form-line{stroke:#31b0d5;stroke-width:1px}
\ No newline at end of file
diff --git a/xos/core/xoslib/static/js/xosMcord-slicing.js b/xos/core/xoslib/static/js/xosMcord-slicing.js
new file mode 100644
index 0000000..c86714f
--- /dev/null
+++ b/xos/core/xoslib/static/js/xosMcord-slicing.js
@@ -0,0 +1 @@
+"use strict";angular.module("xos.mcord-slicing",["ngResource","ngCookies","ui.router","xos.helpers"]).config(["$stateProvider",function(e){e.state("slicing-topo",{url:"/",template:"<slicing-topo></slicing-topo>"}).state("node-links",{url:"/data",template:"<node-links></node-links>"})}]).config(["$httpProvider",function(e){e.interceptors.push("NoHyperlinks")}]).service("McordSlicingTopo",["$http","$q",function(e,t){this.query=function(){var n=t.defer();return e.get("api/service/mcord_slicing_ui/topology/").then(function(e){var t=void 0;t=e.data.hasOwnProperty("nodes")?e.data:{nodes:e.data[0],links:e.data[1]},n.resolve(t)})["catch"](function(e){n.reject(e)}),{$promise:n.promise}}}]).directive("nodeLinks",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/node-links.tpl.html",controller:["McordSlicingTopo",function(e){var t=this;this.tableConfig={columns:[{label:"Id",prop:"id"},{label:"Name",prop:"name"},{label:"Type",prop:"type"},{label:"Plane",prop:"plane"},{label:"Model Id",prop:"model_id"}]},e.query().$promise.then(function(e){t.users=e.nodes})["catch"](function(e){throw new Error(e)})}]}}),angular.module("xos.mcord-slicing").run(["$templateCache",function(e){e.put("templates/node-links.tpl.html",'<div class="row">\n  <div class="col-sm-12">\n    <xos-table config="vm.tableConfig" data="vm.users"></xos-table>\n  </div>\n  <div class="col-sm-12"></div>\n</div>'),e.put("templates/slicing-topo.tpl.html","")}]);var _slicedToArray=function(){function e(e,t){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(c){r=!0,i=c}finally{try{!o&&s["return"]&&s["return"]()}finally{if(r)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();!function(){angular.module("xos.mcord-slicing").directive("slicingTopo",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/slicing-topo.tpl.html",controller:["$element","SliceGraph","McordSlicingTopo","_","NodePositioner","FormHandler",function(e,t,n,o,r,i){var a=this,s=void 0,c=void 0,d=void 0,l=void 0,u=void 0,p=void 0,f=void 0,v=void 0,m=void 0,g=void 0,h=void 0,y=void 0,x=d3.transition().duration(500);this.activeSlices=[];var b=function(){v=null,m=null,f.classed("hidden",!0)};n.query().$promise.then(function(n){r.storeEl(e[0]),w(e[0]),t.buildGraph(n),k=t.positionGraph(e[0]),S=t.getGraphLinks(k),H()})["catch"](function(e){throw new Error(e)});var w=function(e){a.el=e,d3.select(e).select("svg").remove(),s=d3.select(e).append("svg").style("width",e.clientWidth+"px").style("height",e.clientHeight+"px"),u=s.append("g").attr({"class":"link-group"}),l=s.append("g").attr({"class":"node-group"}),p=d3.select(e).append("div").attr({"class":"form-container"}),f=s.append("svg:path").attr("class","dragline hidden").attr("d","M0,0L0,0")},P=function(){s.selectAll(".link").attr("x1",function(e){return e.source.x}).attr("y1",function(e){return e.source.y}).attr("x2",function(e){return e.target.x}).attr("y2",function(e){return e.target.y})},k=[],S=[],F=function(e){var n=t.getSliceDetail(e),o=_slicedToArray(n,2),r=o[0],i=o[1];k=k.concat(r),S=S.concat(i),H()},I=function(e){t.removeActiveSlice(e),h&&h.sliceId===e&&(h=null,y=null),k=o.filter(k,function(t){return t.sliceId!==e||"control"!==t.plane&&"button"!==t.type||(i.removeFormByParentNode(t,u,p),!1)}),k=o.map(k,function(t){return t.sliceId===e&&delete t.sliceId,t}),S=o.filter(S,function(e){return o.findIndex(k,{id:e.data.source})!==-1&&o.findIndex(k,{id:e.data.target})!==-1}),H()},N=function(e){console.log(S),o.remove(S,function(t){return t.data.id===e}),console.log(S),H()},A=function(e){console.log("exp",e),b();var t=["ran-ru","ran-cu","pgw","sgw"];t.indexOf(e.type)>-1&&"data"===e.plane&&!e.sliceId?F(e):"button"===e.type?I(e.sliceId):!e.formAttached&&e.model?(e.formAttached=!0,i.drawForm(e,u,p)):e.formAttached&&(e.formAttached=!1,i.removeFormByParentNode(e,u,p))},E=function(){if(h){if(y=t.getNodeSuccessors(h),0===y.length)return;h.selected=!1;var e=o.findIndex(k,{id:y[0].id});h=k[e],h.selected=!0;var n=t.getNodeSuccessors(h);y=n.lenght>0?t.getNodePredecessors(n[0]):null}else h=k[0],h.selected=!0;H()},D=function(){if(h){if(y=t.getNodePredecessors(h),0===y.length)return;h.selected=!1;var e=o.findIndex(k,{id:y[0].id});e<0&&(e=k.length-1),h=k[e],h.selected=!0}else h=k[0],h.selected=!0;H()},C=function(e,t){return e.y<t.y?1:e.y>t.y?-1:0},$=function(e){return o.filter(k,function(t){return"pgw"===e.type&&"button"===t.type||("button"===e.type&&"pgw"===t.type||("sgw"===e.type&&"mme"===t.type||("mme"===e.type&&"sgw"===t.type||t.type===e.type)))}).sort(C)},G=function(){if(h){h.selected=!1;var e=$(h),t=o.findIndex(e,{id:h.id})+1;t===e.length&&(t=0);var n=o.findIndex(k,{id:e[t].id});h=k[n],h.selected=!0}else h=k[0],h.selected=!0;H()},O=function(){if(h){h.selected=!1;var e=$(h),t=o.findIndex(e,{id:h.id})-1;t<0&&(t=e.length-1);var n=o.findIndex(k,{id:e[t].id});h=k[n],h.selected=!0}else h=k[0],h.selected=!0;H()},H=function L(){d3.layout.force().nodes(k).links(S).charge(-1060).gravity(.1).linkDistance(200).size([a.el.clientWidth,a.el.clientHeight]).on("tick",P).start();d=u.selectAll(".link-container").data(S,function(e){return e.data.id}).enter().insert("g").attr({"class":"link-container",opacity:0}),d.transition(x).attr({opacity:1}),d.insert("line").attr("class",function(e){return"link "+e.data.plane}).on("click",function(e){g=e,d3.selectAll(".link").classed("selected",!1),d3.select(this).classed("selected",!0)}),c=l.selectAll(".node").data(k,function(e){return e.id}).attr({"class":function(e){return"node "+e.plane+" "+e.type+" "+(e.selected?"selected":"")}}),c.enter().append("g").attr({"class":"node-container",transform:function(e){return e.transform},opacity:0}),c.transition(x).attr({opacity:1}),c.append("rect").attr({"class":function(e){return"node "+e.plane+" "+e.type+" "+(e.selected?"selected":"")},width:100,height:50,x:-50,y:-25}),c.append("text").attr({"text-anchor":"middle","alignment-baseline":"middle"}).text(function(e){return""+e.name}),c.on("click",function(e){A(e)}),c.on("mousedown",function(e){v=e,f.classed("hidden",!1).attr("d","M"+v.x+","+v.y+"L"+v.x+","+v.y)}).on("mouseover",function(e){v&&(m=e)}),s.on("mousemove",function(){v&&f.attr("d","M"+v.x+","+v.y+"L"+d3.mouse(this)[0]+","+d3.mouse(this)[1])}).on("mouseup",function(){if(!v||!m)return void b();var e=t.getNodeDataPlaneSuccessors(v)[0].type;return m.type!==e?void b():(S.push({source:v,target:m,data:{id:v.id+"."+m.id,source:v.id,target:m.id}}),L(),void b())}),s.selectAll(".node-container").data(k,function(e){return e.id}).exit().transition(x).attr({opacity:0}).remove(),s.selectAll(".link-container").data(S,function(e){return e.data.id}).exit().transition(x).attr({opacity:0}).remove()};d3.select("body").on("keydown",function(){"Backspace"===d3.event.code&&g&&N(g.data.id),"Enter"===d3.event.code&&h&&(d3.event.preventDefault(),A(h)),"Escape"===d3.event.code&&h&&(h.selected=!1,h=null,y=null,H()),"ArrowRight"===d3.event.code&&(d3.event.preventDefault(),E()),"ArrowLeft"===d3.event.code&&(d3.event.preventDefault(),D()),"ArrowUp"===d3.event.code&&(d3.event.preventDefault(),G()),"ArrowDown"===d3.event.code&&(d3.event.preventDefault(),O())})}]}})}(),function(){angular.module("xos.mcord-slicing").service("SliceGraph",["_","NodePositioner",function(e,t){var n=this,o=new graphlib.Graph;this.buildGraph=function(t){e.forEach(t.nodes,function(e){return o.setNode(e.id,e)}),e.forEach(t.links,function(e){return o.setEdge(e.source,e.target,e)})},this.getLinks=function(){return o.edges().map(function(e){return{source:o.node(e.v),target:o.node(e.w),data:o.edge(e)}})},this.getGraph=function(){return o},this.getNodeSuccessors=function(t){return e.map(o.successors(t.id),function(e){return o.node(e)})},this.getNodePredecessors=function(t){return e.map(o.predecessors(t.id),function(e){return o.node(e)})},this.getNodeDataPlaneSuccessors=function(t){return e.filter(n.getNodeSuccessors(t),function(e){return"data"===e.plane})},this.getUpstreamSinks=function(t){var n=e.reduce(o.sinks(),function(e,t,n){var r=o.node(t);return"upstream"===r.type&&e.push(r),e},[]);return e.map(n,function(e,o){return e.position={top:0,bottom:t.clientHeight,total:n.length,index:o+1},e})},this.positionGraph=function(o){var r=n.getUpstreamSinks(o),i=[];return e.forEach(r,function(e,t){i=i.concat(n.findPredecessor(e))}),r=r.concat(i),r=e.map(r,function(e){return t.getDataPlaneNodePos(e,o)})},this.findPredecessor=function(r){var i=o.predecessors(r.id);i=i.map(function(e,n){e=o.node(e);var a=(r.position.bottom-r.position.top)/r.position.total,s=t.getVpos(r);return e.position={top:s-a/2,bottom:s+a/2,total:i.length,index:n+1},e});var a=e.reduce(i,function(e,t){return e.concat(n.findPredecessor(t))},[]);return i.concat(a)},this.getGraphLinks=function(t){var n=[];return e.forEach(t,function(t){var r=o.inEdges(t.id);e.forEach(r,function(e){n.push({source:o.node(e.v),target:o.node(e.w),data:o.edge(e)})})}),n},this.getDataPlaneForSlice=function(e,t){var n=o.node(o.successors(e.id)[0]),r=o.node(o.successors(n.id)[0]),i=o.node(o.successors(r.id)[0]);return e.sliceId=t,n.sliceId=t,r.sliceId=t,i.sliceId=t,[e,n,r,i]},this.getControlPlaneForSlice=function(n,r){return e.reduce(n,function(e,n){var i=o.node(o.successors(n.id)[1]);if(i=t.getControlPlaneNodePos(i,n),i.sliceId=r,"sgw"===i.type){var a=o.node(o.successors(i.id)[1]);a=t.getControlPlaneNodePos(a,i),a.sliceId=r,e.push(a)}return e.concat(i)},[])},this.activeSlices=[],this.getSliceDetail=function(r){if(r.sliceId&&n.activeSlices.indexOf(r.sliceId)>-1)return[[],[]];var i=e.min(n.activeSlices)?e.min(n.activeSlices)+1:1;n.activeSlices.push(i);var a=function(e){for(var t=!0;t;){var n=e;if(t=!1,"ran-ru"===n.type)return n;var r=o.predecessors(n.id);e=o.node(r[0]),t=!0,r=void 0}}(r),s=n.getDataPlaneForSlice(a,i),c=n.getControlPlaneForSlice(s,i),d=n.getGraphLinks(c),l={name:"Close",id:"close-button-"+i,type:"button",sliceId:i};return l=t.getControlPlaneNodePos(l,c[3]),c.push(l),[c,d]},this.removeActiveSlice=function(e){n.activeSlices.splice(n.activeSlices.indexOf(e),1)}}]).service("NodePositioner",["_","sliceElOrder",function(e,t){var n=this,o=void 0;this.storeEl=function(e){o=e},this.getHpos=function(e,n){var o=t.indexOf(e.type)+1;"mme"===e.type&&(o=t.indexOf("sgw")+1),"button"===e.type&&(o=t.indexOf("pgw")+1);var r=n.clientWidth/(t.length+1)*o;return r},this.getVpos=function(e){var t=e.position.bottom-e.position.top,n=t/(e.position.total+1),o=n*e.position.index+e.position.top;return o},this.getDataPlaneNodePos=function(e){var t=n.getHpos(e,o),r=n.getVpos(e);return e.x=t,e.y=r,e.transform="translate("+t+", "+r+")",e.fixed=!0,e},this.getControlPlaneNodePos=function(e,t){var r=n.getHpos(e,o),i=t.y-75;return e.x=r,e.y=i,e.transform="translate("+r+", "+i+")",e.fixed=!0,e}}]).value("sliceElOrder",["ue","profile","ran-ru","ran-cu","sgw","pgw","upstream"])}(),function(){angular.module("xos.mcord-slicing").service("FormHandler",["LabelFormatter","XosFormHelpers",function(e,t){var n=this,o=this,r=d3.transition().duration(500);this.drawForm=function(e,t,i){var a=t.append("line").attr({"class":"form-line",id:"form-line-"+e.type+"-"+e.id,x1:e.x+10,y1:e.y,x2:e.x+10,y2:e.y+40,opacity:0});a.transition(r).attr({opacity:1});var s=i.append("div").attr({"class":"element-form",id:"form-"+e.type+"-"+e.id}).style({opacity:0}),c=s.append("form");n.addFormfields(e,c);var d=c.append("div").attr({"class":"row"});d.append("div").attr({"class":"col-xs-6"}).append("a").attr({"class":"btn btn-danger","data-parent-node-type":e.type,"data-parent-node-id":e.id}).text("Close").on("click",function(){o.removeForm(d3.select(this).attr("data-parent-node-type"),d3.select(this).attr("data-parent-node-id"),t,i)}),d.append("div").attr({"class":"col-xs-6"}).append("button").attr({type:"button","class":"btn btn-success"}).text("Save").on("click",function(){$("#form-"+e.type+"-"+e.id+" input").each(function(){var e=$(this),t=e.val(),n=e.attr("name");console.log(n,t)})}),s.transition(r).style({opacity:1,top:e.y+95+"px",left:e.x+"px"})},this.removeForm=function(e,t,o,r){n.removeFormByParentNode({type:e,id:t},o,r)},this.removeFormByParentNode=function(e,t,n){n.selectAll("#form-"+e.type+"-"+e.id).transition(r).style({opacity:0}).remove(),t.selectAll("#form-line-"+e.type+"-"+e.id).transition(r).attr({opacity:0}).remove()},this.getFieldValue=function(e,t){return"date"===t&&(e=new Date(e),e=e.getFullYear()+"-"+("0"+e.getMonth()+1).slice(-2)+"-"+("0"+e.getDate()).slice(-2)),e||""},this.addFormField=function(o,r,i){var a=t._getFieldFormat(r);i.append("div").attr({"class":"row"}).append("div").attr({"class":"col-xs-12"}).append("label").text(o?e.format(o):"test").append("input").attr({type:a,name:o,value:n.getFieldValue(r,a),"class":"form-control"})},this.addFormfields=function(e,t){if(n.addFormField("name",e.name,t),!e.model)return n.addFormField(null,null,t);var o=Object.keys(e.model);_.forEach(o,function(o){n.addFormField(o,e.model[o],t)})}}])}(),angular.module("xos.mcord-slicing").run(["$location",function(e){e.path("/")}]);
diff --git a/xos/core/xoslib/static/vendor/xosMcord-slicingVendor.js b/xos/core/xoslib/static/vendor/xosMcord-slicingVendor.js
new file mode 100644
index 0000000..261453d
--- /dev/null
+++ b/xos/core/xoslib/static/vendor/xosMcord-slicingVendor.js
@@ -0,0 +1,3 @@
+(function(){function n(n,t){return n.set(t[0],t[1]),n}function t(n,t){return n.add(t),n}function r(n,t,r){var e=r.length;switch(e){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function e(n,t,r,e){for(var i=-1,u=n.length;++i<u;){var o=n[i];t(e,o,r(o),n)}return e}function i(n,t){for(var r=-1,e=n.length,i=-1,u=t.length,o=Array(e+u);++r<e;)o[r]=n[r];for(;++i<u;)o[r++]=t[i];return o}function u(n,t){for(var r=-1,e=n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function o(n,t){for(var r=n.length;r--&&t(n[r],r,n)!==!1;);return n}function a(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function f(n,t){for(var r=-1,e=n.length,i=0,u=[];++r<e;){var o=n[r];t(o,r,n)&&(u[i++]=o)}return u}function c(n,t){return!!n.length&&y(n,t,0)>-1}function s(n,t,r){for(var e=-1,i=n.length;++e<i;)if(r(t,n[e]))return!0;return!1}function l(n,t){for(var r=-1,e=n.length,i=Array(e);++r<e;)i[r]=t(n[r],r,n);return i}function h(n,t){for(var r=-1,e=t.length,i=n.length;++r<e;)n[i+r]=t[r];return n}function p(n,t,r,e){var i=-1,u=n.length;for(e&&u&&(r=n[++i]);++i<u;)r=t(r,n[i],i,n);return r}function v(n,t,r,e){var i=n.length;for(e&&i&&(r=n[--i]);i--;)r=t(r,n[i],i,n);return r}function _(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function d(n,t,r,e){var i;return r(n,function(n,r,u){if(t(n,r,u))return i=e?r:n,!1}),i}function g(n,t,r){for(var e=n.length,i=r?e:-1;r?i--:++i<e;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){if(t!==t)return U(n,r);for(var e=r-1,i=n.length;++e<i;)if(n[e]===t)return e;return-1}function w(n,t,r,e){for(var i=r-1,u=n.length;++i<u;)if(e(n[i],t))return i;return-1}function b(n,t){var r=n?n.length:0;return r?j(n,t)/r:bn}function m(n,t,r,e,i){return i(n,function(n,i,u){r=e?(e=!1,n):t(r,n,i,u)}),r}function x(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function j(n,t){for(var r,e=-1,i=n.length;++e<i;){var u=t(n[e]);u!==V&&(r=r===V?u:r+u)}return r}function k(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function E(n,t){return l(t,function(t){return[t,n[t]]})}function A(n){return function(t){return n(t)}}function O(n,t){return l(t,function(t){return n[t]})}function I(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function N(n){return n&&n.Object===Object?n:null}function L(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&e++;return e}function R(n){return xr[n]}function S(n){return jr[n]}function W(n){return"\\"+Ar[n]}function U(n,t,r){for(var e=n.length,i=t+(r?0:-1);r?i--:++i<e;){var u=n[i];if(u!==u)return i}return-1}function D(n){var t=!1;if(null!=n&&"function"!=typeof n.toString)try{t=!!(n+"")}catch(r){}return t}function F(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function z(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function M(n,t){for(var r=-1,e=n.length,i=0,u=[];++r<e;){var o=n[r];o!==t&&o!==J||(n[r]=J,u[i++]=r)}return u}function B(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n}),r}function P(n){if(!n||!dr.test(n))return n.length;for(var t=vr.lastIndex=0;vr.test(n);)t++;return t}function $(n){return n.match(vr)}function T(n){return kr[n]}function q(N){function Ct(n){if(ca(n)&&!tl(n)&&!(n instanceof Rt)){if(n instanceof Lt)return n;if(_c.call(n,"__wrapped__"))return tu(n)}return new Lt(n)}function Nt(){}function Lt(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=V}function Rt(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=mn,this.__views__=[]}function St(){var n=new Rt(this.__wrapped__);return n.__actions__=Je(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Je(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Je(this.__views__),n}function Wt(){if(this.__filtered__){var n=new Rt(this);n.__dir__=-1,n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Ut(){var n=this.__wrapped__.value(),t=this.__dir__,r=tl(n),e=t<0,i=r?n.length:0,u=Si(0,i,this.__views__),o=u.start,a=u.end,f=a-o,c=e?a:o-1,s=this.__iteratees__,l=s.length,h=0,p=Bc(f,this.__takeCount__);if(!r||i<Z||i==f&&p==f)return Le(n,this.__actions__);var v=[];n:for(;f--&&h<p;){c+=t;for(var _=-1,d=n[c];++_<l;){var g=s[_],y=g.iteratee,w=g.type,b=y(d);if(w==_n)d=b;else if(!b){if(w==vn)continue n;break n}}v[h++]=d}return v}function Dt(){}function Ft(n,t){return Mt(n,t)&&delete n[t]}function zt(n,t){if(Qc){var r=n[t];return r===Y?V:r}return _c.call(n,t)?n[t]:V}function Mt(n,t){return Qc?n[t]!==V:_c.call(n,t)}function Bt(n,t,r){n[t]=Qc&&r===V?Y:r}function Pt(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function $t(){this.__data__={hash:new Dt,map:Zc?new Zc:[],string:new Dt}}function Tt(n){var t=this.__data__;return qi(n)?Ft("string"==typeof n?t.string:t.hash,n):Zc?t.map["delete"](n):rr(t.map,n)}function qt(n){var t=this.__data__;return qi(n)?zt("string"==typeof n?t.string:t.hash,n):Zc?t.map.get(n):er(t.map,n)}function Vt(n){var t=this.__data__;return qi(n)?Mt("string"==typeof n?t.string:t.hash,n):Zc?t.map.has(n):ir(t.map,n)}function Gt(n,t){var r=this.__data__;return qi(n)?Bt("string"==typeof n?r.string:r.hash,n,t):Zc?r.map.set(n,t):or(r.map,n,t),this}function Zt(n){var t=-1,r=n?n.length:0;for(this.__data__=new Pt;++t<r;)this.push(n[t])}function Kt(n,t){var r=n.__data__;if(qi(t)){var e=r.__data__,i="string"==typeof t?e.string:e.hash;return i[t]===Y}return r.has(t)}function Yt(n){var t=this.__data__;if(qi(n)){var r=t.__data__,e="string"==typeof n?r.string:r.hash;e[n]=Y}else t.set(n,Y)}function Jt(n){var t=-1,r=n?n.length:0;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Qt(){this.__data__={array:[],map:null}}function Ht(n){var t=this.__data__,r=t.array;return r?rr(r,n):t.map["delete"](n)}function Xt(n){var t=this.__data__,r=t.array;return r?er(r,n):t.map.get(n)}function nr(n){var t=this.__data__,r=t.array;return r?ir(r,n):t.map.has(n)}function tr(n,t){var r=this.__data__,e=r.array;e&&(e.length<Z-1?or(e,n,t):(r.array=null,r.map=new Pt(e)));var i=r.map;return i&&i.set(n,t),this}function rr(n,t){var r=ur(n,t);if(r<0)return!1;var e=n.length-1;return r==e?n.pop():Rc.call(n,r,1),!0}function er(n,t){var r=ur(n,t);return r<0?V:n[r][1]}function ir(n,t){return ur(n,t)>-1}function ur(n,t){for(var r=n.length;r--;)if(Go(n[r][0],t))return r;return-1}function or(n,t,r){var e=ur(n,t);e<0?n.push([t,r]):n[e][1]=r}function ar(n,t,r,e){return n===V||Go(n,hc[r])&&!_c.call(e,r)?t:n}function fr(n,t,r){(r===V||Go(n[t],r))&&("number"!=typeof t||r!==V||t in n)||(n[t]=r)}function cr(n,t,r){var e=n[t];_c.call(n,t)&&Go(e,r)&&(r!==V||t in n)||(n[t]=r)}function sr(n,t,r,e){return cs(n,function(n,i,u){t(e,n,r(n),u)}),e}function lr(n,t){return n&&Qe(t,Za(t),n)}function vr(n,t){for(var r=-1,e=null==n,i=t.length,u=Array(i);++r<i;)u[r]=e?V:qa(n,t[r]);return u}function xr(n,t,r){return n===n&&(r!==V&&(n=n<=r?n:r),t!==V&&(n=n>=t?n:t)),n}function jr(n,t,r,e,i,o,a){var f;if(e&&(f=o?e(n,i,o,a):e(n)),f!==V)return f;if(!fa(n))return n;var c=tl(n);if(c){if(f=Ui(n),!t)return Je(n,f)}else{var s=Ri(n),l=s==Cn||s==Nn;if(rl(n))return ze(n,t);if(s==Sn||s==kn||l&&!o){if(D(n))return o?n:{};if(f=Di(l?{}:n),!t)return He(n,lr(f,n))}else{if(!mr[s])return o?n:{};f=Fi(n,s,jr,t)}}a||(a=new Jt);var h=a.get(n);if(h)return h;if(a.set(n,f),!c)var p=r?ji(n):Za(n);return u(p||n,function(i,u){p&&(u=i,i=n[u]),cr(f,u,jr(i,t,r,e,u,n,a))}),f}function kr(n){var t=Za(n),r=t.length;return function(e){if(null==e)return!r;for(var i=r;i--;){var u=t[i],o=n[u],a=e[u];if(a===V&&!(u in Object(e))||!o(a))return!1}return!0}}function Er(n){return fa(n)?Cc(n):{}}function Ar(n,t,r){if("function"!=typeof n)throw new sc(K);return Lc(function(){n.apply(V,r)},t)}function Cr(n,t,r,e){var i=-1,u=c,o=!0,a=n.length,f=[],h=t.length;if(!a)return f;r&&(t=l(t,A(r))),e?(u=s,o=!1):t.length>=Z&&(u=Kt,o=!1,t=new Zt(t));n:for(;++i<a;){var p=n[i],v=r?r(p):p;if(p=e||0!==p?p:0,o&&v===v){for(var _=h;_--;)if(t[_]===v)continue n;f.push(p)}else u(t,v,e)||f.push(p)}return f}function Nr(n,t){var r=!0;return cs(n,function(n,e,i){return r=!!t(n,e,i)}),r}function Rr(n,t,r){for(var e=-1,i=n.length;++e<i;){var u=n[e],o=t(u);if(null!=o&&(a===V?o===o&&!ja(o):r(o,a)))var a=o,f=u}return f}function Sr(n,t,r,e){var i=n.length;for(r=Ca(r),r<0&&(r=-r>i?0:i+r),e=e===V||e>i?i:Ca(e),e<0&&(e+=i),e=r>e?0:Na(e);r<e;)n[r++]=t;return n}function Wr(n,t){var r=[];return cs(n,function(n,e,i){t(n,e,i)&&r.push(n)}),r}function Ur(n,t,r,e,i){var u=-1,o=n.length;for(r||(r=Mi),i||(i=[]);++u<o;){var a=n[u];t>0&&r(a)?t>1?Ur(a,t-1,r,e,i):h(i,a):e||(i[i.length]=a)}return i}function zr(n,t){return n&&ls(n,t,Za)}function Mr(n,t){return n&&hs(n,t,Za)}function Br(n,t){return f(t,function(t){return ua(n[t])})}function Pr(n,t){t=Ti(t,n)?[t]:De(t);for(var r=0,e=t.length;null!=n&&r<e;)n=n[Xi(t[r++])];return r&&r==e?n:V}function $r(n,t,r){var e=t(n);return tl(n)?e:h(e,r(n))}function Tr(n,t){return n>t}function qr(n,t){return _c.call(n,t)||"object"==typeof n&&t in n&&null===Ni(n)}function Vr(n,t){return t in Object(n)}function Gr(n,t,r){return n>=Bc(t,r)&&n<Mc(t,r)}function Zr(n,t,r){for(var e=r?s:c,i=n[0].length,u=n.length,o=u,a=Array(u),f=1/0,h=[];o--;){var p=n[o];o&&t&&(p=l(p,A(t))),f=Bc(p.length,f),a[o]=!r&&(t||i>=120&&p.length>=120)?new Zt(o&&p):V}p=n[0];var v=-1,_=a[0];n:for(;++v<i&&h.length<f;){var d=p[v],g=t?t(d):d;if(d=r||0!==d?d:0,!(_?Kt(_,g):e(h,g,r))){for(o=u;--o;){var y=a[o];if(!(y?Kt(y,g):e(n[o],g,r)))continue n}_&&_.push(g),h.push(d)}}return h}function Kr(n,t,r,e){return zr(n,function(n,i,u){t(e,r(n),i,u)}),e}function Yr(n,t,e){Ti(t,n)||(t=De(t),n=Qi(n,t),t=bu(t));var i=null==n?n:n[Xi(t)];return null==i?V:r(i,n,e)}function Jr(n,t,r,e,i){return n===t||(null==n||null==t||!fa(n)&&!ca(t)?n!==n&&t!==t:Qr(n,t,Jr,r,e,i))}function Qr(n,t,r,e,i,u){var o=tl(n),a=tl(t),f=En,c=En;o||(f=Ri(n),f=f==kn?Sn:f),a||(c=Ri(t),c=c==kn?Sn:c);var s=f==Sn&&!D(n),l=c==Sn&&!D(t),h=f==c;if(h&&!s)return u||(u=new Jt),o||ka(n)?bi(n,t,r,e,i,u):mi(n,t,f,r,e,i,u);if(!(i&cn)){var p=s&&_c.call(n,"__wrapped__"),v=l&&_c.call(t,"__wrapped__");if(p||v){var _=p?n.value():n,d=v?t.value():t;return u||(u=new Jt),r(_,d,e,i,u)}}return!!h&&(u||(u=new Jt),xi(n,t,r,e,i,u))}function Hr(n,t,r,e){var i=r.length,u=i,o=!e;if(null==n)return!u;for(n=Object(n);i--;){var a=r[i];if(o&&a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++i<u;){a=r[i];var f=a[0],c=n[f],s=a[1];if(o&&a[2]){if(c===V&&!(f in n))return!1}else{var l=new Jt;if(e)var h=e(c,s,f,n,t,l);if(!(h===V?Jr(s,c,e,fn|cn,l):h))return!1}}return!0}function Xr(n){return"function"==typeof n?n:null==n?Mf:"object"==typeof n?tl(n)?ue(n[0],n[1]):ie(n):Zf(n)}function ne(n){return zc(Object(n))}function te(n){n=null==n?n:Object(n);var t=[];for(var r in n)t.push(r);return t}function re(n,t){return n<t}function ee(n,t){var r=-1,e=Yo(n)?Array(n.length):[];return cs(n,function(n,i,u){e[++r]=t(n,i,u)}),e}function ie(n){var t=Oi(n);return 1==t.length&&t[0][2]?Ki(t[0][0],t[0][1]):function(r){return r===n||Hr(r,n,t)}}function ue(n,t){return Ti(n)&&Zi(t)?Ki(Xi(n),t):function(r){var e=qa(r,n);return e===V&&e===t?Ga(r,n):Jr(t,e,V,fn|cn)}}function oe(n,t,r,e,i){if(n!==t){if(!tl(t)&&!ka(t))var o=Ka(t);u(o||t,function(u,a){if(o&&(a=u,u=t[a]),fa(u))i||(i=new Jt),ae(n,t,a,r,oe,e,i);else{var f=e?e(n[a],u,a+"",n,t,i):V;f===V&&(f=u),fr(n,a,f)}})}}function ae(n,t,r,e,i,u,o){var a=n[r],f=t[r],c=o.get(f);if(c)return void fr(n,r,c);var s=u?u(a,f,r+"",n,t,o):V,l=s===V;l&&(s=f,tl(f)||ka(f)?tl(a)?s=a:Jo(a)?s=Je(a):(l=!1,s=jr(f,!0)):ya(f)||Zo(f)?Zo(a)?s=Ra(a):!fa(a)||e&&ua(a)?(l=!1,s=jr(f,!0)):s=a:l=!1),o.set(f,s),l&&i(s,f,e,u,o),o["delete"](f),fr(n,r,s)}function fe(n,t){var r=n.length;if(r)return t+=t<0?r:0,Pi(t,r)?n[t]:V}function ce(n,t,r){var e=-1;t=l(t.length?t:[Mf],A(Ai()));var i=ee(n,function(n,r,i){var u=l(t,function(t){return t(n)});return{criteria:u,index:++e,value:n}});return x(i,function(n,t){return Ze(n,t,r)})}function se(n,t){return n=Object(n),p(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function le(n,t){for(var r=-1,e=ki(n),i=e.length,u={};++r<i;){var o=e[r],a=n[o];t(a,o)&&(u[o]=a)}return u}function he(n){return function(t){return null==t?V:t[n]}}function pe(n){return function(t){return Pr(t,n)}}function ve(n,t,r,e){var i=e?w:y,u=-1,o=t.length,a=n;for(r&&(a=l(n,A(r)));++u<o;)for(var f=0,c=t[u],s=r?r(c):c;(f=i(a,s,f,e))>-1;)a!==n&&Rc.call(a,f,1),Rc.call(n,f,1);return n}function _e(n,t){for(var r=n?t.length:0,e=r-1;r--;){var i=t[r];if(r==e||i!==u){var u=i;if(Pi(i))Rc.call(n,i,1);else if(Ti(i,n))delete n[Xi(i)];else{var o=De(i),a=Qi(n,o);null!=a&&delete a[Xi(bu(o))]}}}return n}function de(n,t){return n+Wc($c()*(t-n+1))}function ge(n,t,r,e){for(var i=-1,u=Mc(Sc((t-n)/(r||1)),0),o=Array(u);u--;)o[e?u:++i]=n,n+=r;return o}function ye(n,t){var r="";if(!n||t<1||t>yn)return r;do t%2&&(r+=n),t=Wc(t/2),t&&(n+=n);while(t);return r}function we(n,t,r,e){t=Ti(t,n)?[t]:De(t);for(var i=-1,u=t.length,o=u-1,a=n;null!=a&&++i<u;){var f=Xi(t[i]);if(fa(a)){var c=r;if(i!=o){var s=a[f];c=e?e(s,f,a):V,c===V&&(c=null==s?Pi(t[i+1])?[]:{}:s)}cr(a,f,c)}a=a[f]}return n}function be(n,t,r){var e=-1,i=n.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var u=Array(i);++e<i;)u[e]=n[e+t];return u}function me(n,t){var r;return cs(n,function(n,e,i){return r=t(n,e,i),!r}),!!r}function xe(n,t,r){var e=0,i=n?n.length:e;if("number"==typeof t&&t===t&&i<=jn){for(;e<i;){var u=e+i>>>1,o=n[u];null!==o&&!ja(o)&&(r?o<=t:o<t)?e=u+1:i=u}return i}return je(n,t,Mf,r)}function je(n,t,r,e){t=r(t);for(var i=0,u=n?n.length:0,o=t!==t,a=null===t,f=ja(t),c=t===V;i<u;){var s=Wc((i+u)/2),l=r(n[s]),h=l!==V,p=null===l,v=l===l,_=ja(l);if(o)var d=e||v;else d=c?v&&(e||h):a?v&&h&&(e||!p):f?v&&h&&!p&&(e||!_):!p&&!_&&(e?l<=t:l<t);d?i=s+1:u=s}return Bc(u,xn)}function ke(n,t){for(var r=-1,e=n.length,i=0,u=[];++r<e;){var o=n[r],a=t?t(o):o;if(!r||!Go(a,f)){var f=a;u[i++]=0===o?0:o}}return u}function Ee(n){return"number"==typeof n?n:ja(n)?bn:+n}function Ae(n){if("string"==typeof n)return n;if(ja(n))return fs?fs.call(n):"";var t=n+"";return"0"==t&&1/n==-gn?"-0":t}function Oe(n,t,r){var e=-1,i=c,u=n.length,o=!0,a=[],f=a;if(r)o=!1,i=s;else if(u>=Z){var l=t?null:vs(n);if(l)return B(l);o=!1,i=Kt,f=new Zt}else f=t?[]:a;n:for(;++e<u;){var h=n[e],p=t?t(h):h;if(h=r||0!==h?h:0,o&&p===p){for(var v=f.length;v--;)if(f[v]===p)continue n;t&&f.push(p),a.push(h)}else i(f,p,r)||(f!==a&&f.push(p),a.push(h))}return a}function Ie(n,t){t=Ti(t,n)?[t]:De(t),n=Qi(n,t);var r=Xi(bu(t));return!(null!=n&&qr(n,r))||delete n[r]}function Ce(n,t,r,e){return we(n,t,r(Pr(n,t)),e)}function Ne(n,t,r,e){for(var i=n.length,u=e?i:-1;(e?u--:++u<i)&&t(n[u],u,n););return r?be(n,e?0:u,e?u+1:i):be(n,e?u+1:0,e?i:u)}function Le(n,t){var r=n;return r instanceof Rt&&(r=r.value()),p(t,function(n,t){return t.func.apply(t.thisArg,h([n],t.args))},r)}function Re(n,t,r){for(var e=-1,i=n.length;++e<i;)var u=u?h(Cr(u,n[e],t,r),Cr(n[e],u,t,r)):n[e];return u&&u.length?Oe(u,t,r):[]}function Se(n,t,r){for(var e=-1,i=n.length,u=t.length,o={};++e<i;){var a=e<u?t[e]:V;r(o,n[e],a)}return o}function We(n){return Jo(n)?n:[]}function Ue(n){return"function"==typeof n?n:Mf}function De(n){return tl(n)?n:ws(n)}function Fe(n,t,r){var e=n.length;return r=r===V?e:r,!t&&r>=e?n:be(n,t,r)}function ze(n,t){if(t)return n.slice();var r=new n.constructor(n.length);return n.copy(r),r}function Me(n){var t=new n.constructor(n.byteLength);return new kc(t).set(new kc(n)),t}function Be(n,t){var r=t?Me(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}function Pe(t,r,e){var i=r?e(z(t),!0):z(t);return p(i,n,new t.constructor)}function $e(n){var t=new n.constructor(n.source,wt.exec(n));return t.lastIndex=n.lastIndex,t}function Te(n,r,e){var i=r?e(B(n),!0):B(n);return p(i,t,new n.constructor)}function qe(n){return as?Object(as.call(n)):{}}function Ve(n,t){var r=t?Me(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}function Ge(n,t){if(n!==t){var r=n!==V,e=null===n,i=n===n,u=ja(n),o=t!==V,a=null===t,f=t===t,c=ja(t);if(!a&&!c&&!u&&n>t||u&&o&&f&&!a&&!c||e&&o&&f||!r&&f||!i)return 1;if(!e&&!u&&!c&&n<t||c&&r&&i&&!e&&!u||a&&r&&i||!o&&i||!f)return-1}return 0}function Ze(n,t,r){for(var e=-1,i=n.criteria,u=t.criteria,o=i.length,a=r.length;++e<o;){var f=Ge(i[e],u[e]);if(f){if(e>=a)return f;var c=r[e];return f*("desc"==c?-1:1)}}return n.index-t.index}function Ke(n,t,r,e){for(var i=-1,u=n.length,o=r.length,a=-1,f=t.length,c=Mc(u-o,0),s=Array(f+c),l=!e;++a<f;)s[a]=t[a];for(;++i<o;)(l||i<u)&&(s[r[i]]=n[i]);for(;c--;)s[a++]=n[i++];return s}function Ye(n,t,r,e){for(var i=-1,u=n.length,o=-1,a=r.length,f=-1,c=t.length,s=Mc(u-a,0),l=Array(s+c),h=!e;++i<s;)l[i]=n[i];for(var p=i;++f<c;)l[p+f]=t[f];for(;++o<a;)(h||i<u)&&(l[p+r[o]]=n[i++]);return l}function Je(n,t){var r=-1,e=n.length;for(t||(t=Array(e));++r<e;)t[r]=n[r];return t}function Qe(n,t,r,e){r||(r={});for(var i=-1,u=t.length;++i<u;){var o=t[i],a=e?e(r[o],n[o],o,r,n):n[o];cr(r,o,a)}return r}function He(n,t){return Qe(n,Li(n),t)}function Xe(n,t){return function(r,i){var u=tl(r)?e:sr,o=t?t():{};return u(r,n,Ai(i),o)}}function ni(n){return Do(function(t,r){var e=-1,i=r.length,u=i>1?r[i-1]:V,o=i>2?r[2]:V;for(u="function"==typeof u?(i--,u):V,o&&$i(r[0],r[1],o)&&(u=i<3?V:u,i=1),t=Object(t);++e<i;){var a=r[e];a&&n(t,a,e,u)}return t})}function ti(n,t){return function(r,e){if(null==r)return r;if(!Yo(r))return n(r,e);for(var i=r.length,u=t?i:-1,o=Object(r);(t?u--:++u<i)&&e(o[u],u,o)!==!1;);return r}}function ri(n){return function(t,r,e){for(var i=-1,u=Object(t),o=e(t),a=o.length;a--;){var f=o[n?a:++i];if(r(u[f],f,u)===!1)break}return t}}function ei(n,t,r){function e(){var t=this&&this!==Dr&&this instanceof e?u:n;return t.apply(i?r:this,arguments)}var i=t&Q,u=oi(n);return e}function ii(n){return function(t){t=Wa(t);var r=dr.test(t)?$(t):V,e=r?r[0]:t.charAt(0),i=r?Fe(r,1).join(""):t.slice(1);return e[n]()+i}}function ui(n){return function(t){return p(Uf(_f(t).replace(hr,"")),n,"")}}function oi(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Er(n.prototype),e=n.apply(r,t);return fa(e)?e:r}}function ai(n,t,e){function i(){for(var o=arguments.length,a=Array(o),f=o,c=Ci(i);f--;)a[f]=arguments[f];var s=o<3&&a[0]!==c&&a[o-1]!==c?[]:M(a,c);if(o-=s.length,o<e)return gi(n,t,ci,i.placeholder,V,a,s,V,V,e-o);var l=this&&this!==Dr&&this instanceof i?u:n;return r(l,this,a)}var u=oi(n);return i}function fi(n){return Do(function(t){t=Ur(t,1);var r=t.length,e=r,i=Lt.prototype.thru;for(n&&t.reverse();e--;){var u=t[e];if("function"!=typeof u)throw new sc(K);if(i&&!o&&"wrapper"==Ei(u))var o=new Lt([],(!0))}for(e=o?e:r;++e<r;){u=t[e];var a=Ei(u),f="wrapper"==a?_s(u):V;o=f&&Vi(f[0])&&f[1]==(un|nn|rn|on)&&!f[4].length&&1==f[9]?o[Ei(f[0])].apply(o,f[3]):1==u.length&&Vi(u)?o[a]():o.thru(u)}return function(){var n=arguments,e=n[0];if(o&&1==n.length&&tl(e)&&e.length>=Z)return o.plant(e).value();for(var i=0,u=r?t[i].apply(this,n):e;++i<r;)u=t[i].call(this,u);return u}})}function ci(n,t,r,e,i,u,o,a,f,c){function s(){for(var g=arguments.length,y=g,w=Array(g);y--;)w[y]=arguments[y];if(v)var b=Ci(s),m=L(w,b);if(e&&(w=Ke(w,e,i,v)),u&&(w=Ye(w,u,o,v)),g-=m,v&&g<c){var x=M(w,b);return gi(n,t,ci,s.placeholder,r,w,x,a,f,c-g)}var j=h?r:this,k=p?j[n]:n;return g=w.length,a?w=Hi(w,a):_&&g>1&&w.reverse(),l&&f<g&&(w.length=f),this&&this!==Dr&&this instanceof s&&(k=d||oi(k)),k.apply(j,w)}var l=t&un,h=t&Q,p=t&H,v=t&(nn|tn),_=t&an,d=p?V:oi(n);return s}function si(n,t){return function(r,e){return Kr(r,n,t(e),{})}}function li(n){return function(t,r){var e;if(t===V&&r===V)return 0;if(t!==V&&(e=t),r!==V){if(e===V)return r;"string"==typeof t||"string"==typeof r?(t=Ae(t),r=Ae(r)):(t=Ee(t),r=Ee(r)),e=n(t,r)}return e}}function hi(n){return Do(function(t){return t=1==t.length&&tl(t[0])?l(t[0],A(Ai())):l(Ur(t,1,Bi),A(Ai())),Do(function(e){var i=this;return n(t,function(n){return r(n,i,e)})})})}function pi(n,t){t=t===V?" ":Ae(t);var r=t.length;if(r<2)return r?ye(t,n):t;var e=ye(t,Sc(n/P(t)));return dr.test(t)?Fe($(e),0,n).join(""):e.slice(0,n)}function vi(n,t,e,i){function u(){for(var t=-1,f=arguments.length,c=-1,s=i.length,l=Array(s+f),h=this&&this!==Dr&&this instanceof u?a:n;++c<s;)l[c]=i[c];for(;f--;)l[c++]=arguments[++t];return r(h,o?e:this,l)}var o=t&Q,a=oi(n);return u}function _i(n){return function(t,r,e){return e&&"number"!=typeof e&&$i(t,r,e)&&(r=e=V),t=La(t),t=t===t?t:0,r===V?(r=t,t=0):r=La(r)||0,e=e===V?t<r?1:-1:La(e)||0,ge(t,r,e,n)}}function di(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=La(t),r=La(r)),n(t,r)}}function gi(n,t,r,e,i,u,o,a,f,c){var s=t&nn,l=s?o:V,h=s?V:o,p=s?u:V,v=s?V:u;t|=s?rn:en,t&=~(s?en:rn),t&X||(t&=~(Q|H));var _=[n,t,i,p,l,v,h,a,f,c],d=r.apply(V,_);return Vi(n)&&ys(d,_),d.placeholder=e,d}function yi(n){var t=fc[n];return function(n,r){if(n=La(n),r=Ca(r)){var e=(Wa(n)+"e").split("e"),i=t(e[0]+"e"+(+e[1]+r));return e=(Wa(i)+"e").split("e"),+(e[0]+"e"+(+e[1]-r))}return t(n)}}function wi(n,t,r,e,i,u,o,a){var f=t&H;if(!f&&"function"!=typeof n)throw new sc(K);var c=e?e.length:0;if(c||(t&=~(rn|en),e=i=V),o=o===V?o:Mc(Ca(o),0),a=a===V?a:Ca(a),c-=i?i.length:0,t&en){var s=e,l=i;e=i=V}var h=f?V:_s(n),p=[n,t,r,e,i,s,l,u,o,a];if(h&&Yi(p,h),n=p[0],t=p[1],r=p[2],e=p[3],i=p[4],a=p[9]=null==p[9]?f?0:n.length:Mc(p[9]-c,0),!a&&t&(nn|tn)&&(t&=~(nn|tn)),t&&t!=Q)v=t==nn||t==tn?ai(n,t,a):t!=rn&&t!=(Q|rn)||i.length?ci.apply(V,p):vi(n,t,r,e);else var v=ei(n,t,r);var _=h?ps:ys;return _(v,p)}function bi(n,t,r,e,i,u){var o=-1,a=i&cn,f=i&fn,c=n.length,s=t.length;if(c!=s&&!(a&&s>c))return!1;var l=u.get(n);if(l)return l==t;var h=!0;for(u.set(n,t);++o<c;){var p=n[o],v=t[o];if(e)var d=a?e(v,p,o,t,n,u):e(p,v,o,n,t,u);if(d!==V){if(d)continue;h=!1;break}if(f){if(!_(t,function(n){return p===n||r(p,n,e,i,u)})){h=!1;break}}else if(p!==v&&!r(p,v,e,i,u)){h=!1;break}}return u["delete"](n),h}function mi(n,t,r,e,i,u,o){switch(r){case $n:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case Pn:return!(n.byteLength!=t.byteLength||!e(new kc(n),new kc(t)));case An:case On:return+n==+t;case In:return n.name==t.name&&n.message==t.message;case Rn:return n!=+n?t!=+t:n==+t;case Un:case Fn:return n==t+"";case Ln:var a=z;case Dn:var f=u&cn;if(a||(a=B),n.size!=t.size&&!f)return!1;var c=o.get(n);return c?c==t:(u|=fn,o.set(n,t),bi(a(n),a(t),e,i,u,o));case zn:if(as)return as.call(n)==as.call(t)}return!1}function xi(n,t,r,e,i,u){var o=i&cn,a=Za(n),f=a.length,c=Za(t),s=c.length;if(f!=s&&!o)return!1;for(var l=f;l--;){var h=a[l];if(!(o?h in t:qr(t,h)))return!1}var p=u.get(n);if(p)return p==t;var v=!0;u.set(n,t);for(var _=o;++l<f;){h=a[l];var d=n[h],g=t[h];if(e)var y=o?e(g,d,h,t,n,u):e(d,g,h,n,t,u);if(!(y===V?d===g||r(d,g,e,i,u):y)){v=!1;break}_||(_="constructor"==h)}if(v&&!_){var w=n.constructor,b=t.constructor;w!=b&&"constructor"in n&&"constructor"in t&&!("function"==typeof w&&w instanceof w&&"function"==typeof b&&b instanceof b)&&(v=!1)}return u["delete"](n),v}function ji(n){return $r(n,Za,Li)}function ki(n){return $r(n,Ka,gs)}function Ei(n){for(var t=n.name+"",r=ns[t],e=_c.call(ns,t)?r.length:0;e--;){var i=r[e],u=i.func;if(null==u||u==n)return i.name}return t}function Ai(){var n=Ct.iteratee||Bf;return n=n===Bf?Xr:n,arguments.length?n(arguments[0],arguments[1]):n}function Oi(n){for(var t=rf(n),r=t.length;r--;)t[r][2]=Zi(t[r][1]);return t}function Ii(n,t){var r=n[t];return va(r)?r:V}function Ci(n){var t=_c.call(Ct,"placeholder")?Ct:n;return t.placeholder}function Ni(n){return Uc(Object(n))}function Li(n){return Oc(Object(n))}function Ri(n){return yc.call(n)}function Si(n,t,r){for(var e=-1,i=r.length;++e<i;){var u=r[e],o=u.size;switch(u.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=Bc(t,n+o);break;case"takeRight":n=Mc(n,t-o)}}return{start:n,end:t}}function Wi(n,t,r){t=Ti(t,n)?[t]:De(t);for(var e,i=-1,u=t.length;++i<u;){var o=Xi(t[i]);if(!(e=null!=n&&r(n,o)))break;n=n[o]}if(e)return e;var u=n?n.length:0;return!!u&&aa(u)&&Pi(o,u)&&(tl(n)||xa(n)||Zo(n))}function Ui(n){var t=n.length,r=n.constructor(t);return t&&"string"==typeof n[0]&&_c.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Di(n){return"function"!=typeof n.constructor||Gi(n)?{}:Er(Ni(n))}function Fi(n,t,r,e){var i=n.constructor;switch(t){case Pn:return Me(n);case An:case On:return new i((+n));case $n:return Be(n,e);case Tn:case qn:case Vn:case Gn:case Zn:case Kn:case Yn:case Jn:case Qn:return Ve(n,e);case Ln:return Pe(n,e,r);case Rn:case Fn:return new i(n);case Un:return $e(n);case Dn:return Te(n,e,r);case zn:return qe(n)}}function zi(n){var t=n?n.length:V;return aa(t)&&(tl(n)||xa(n)||Zo(n))?k(t,String):null}function Mi(n){return Jo(n)&&(tl(n)||Zo(n))}function Bi(n){return tl(n)&&!(2==n.length&&!ua(n[0]))}function Pi(n,t){return t=null==t?yn:t,!!t&&("number"==typeof n||Et.test(n))&&n>-1&&n%1==0&&n<t}function $i(n,t,r){if(!fa(r))return!1;var e=typeof t;return!!("number"==e?Yo(r)&&Pi(t,r.length):"string"==e&&t in r)&&Go(r[t],n)}function Ti(n,t){if(tl(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!ja(n))||(ct.test(n)||!ft.test(n)||null!=t&&n in Object(t))}function qi(n){var t=typeof n;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n}function Vi(n){var t=Ei(n),r=Ct[t];if("function"!=typeof r||!(t in Rt.prototype))return!1;if(n===r)return!0;var e=_s(r);return!!e&&n===e[0]}function Gi(n){var t=n&&n.constructor,r="function"==typeof t&&t.prototype||hc;return n===r}function Zi(n){return n===n&&!fa(n)}function Ki(n,t){return function(r){return null!=r&&(r[n]===t&&(t!==V||n in Object(r)))}}function Yi(n,t){var r=n[1],e=t[1],i=r|e,u=i<(Q|H|un),o=e==un&&r==nn||e==un&&r==on&&n[7].length<=t[8]||e==(un|on)&&t[7].length<=t[8]&&r==nn;if(!u&&!o)return n;e&Q&&(n[2]=t[2],i|=r&Q?0:X);var a=t[3];if(a){var f=n[3];n[3]=f?Ke(f,a,t[4]):a,n[4]=f?M(n[3],J):t[4]}return a=t[5],a&&(f=n[5],n[5]=f?Ye(f,a,t[6]):a,n[6]=f?M(n[5],J):t[6]),a=t[7],a&&(n[7]=a),e&un&&(n[8]=null==n[8]?t[8]:Bc(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=i,n}function Ji(n,t,r,e,i,u){return fa(n)&&fa(t)&&oe(n,t,V,Ji,u.set(t,n)),n}function Qi(n,t){return 1==t.length?n:Pr(n,be(t,0,-1))}function Hi(n,t){for(var r=n.length,e=Bc(t.length,r),i=Je(n);e--;){var u=t[e];n[e]=Pi(u,r)?i[u]:V}return n}function Xi(n){if("string"==typeof n||ja(n))return n;var t=n+"";return"0"==t&&1/n==-gn?"-0":t}function nu(n){if(null!=n){try{return vc.call(n)}catch(t){}try{return n+""}catch(t){}}return""}function tu(n){if(n instanceof Rt)return n.clone();var t=new Lt(n.__wrapped__,n.__chain__);return t.__actions__=Je(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function ru(n,t,r){t=(r?$i(n,t,r):t===V)?1:Mc(Ca(t),0);var e=n?n.length:0;if(!e||t<1)return[];for(var i=0,u=0,o=Array(Sc(e/t));i<e;)o[u++]=be(n,i,i+=t);return o}function eu(n){for(var t=-1,r=n?n.length:0,e=0,i=[];++t<r;){var u=n[t];u&&(i[e++]=u)}return i}function iu(){var n=arguments.length,t=Po(arguments[0]);if(n<2)return n?Je(t):[];for(var r=Array(n-1);n--;)r[n-1]=arguments[n];return i(t,Ur(r,1))}function uu(n,t,r){var e=n?n.length:0;return e?(t=r||t===V?1:Ca(t),be(n,t<0?0:t,e)):[]}function ou(n,t,r){var e=n?n.length:0;return e?(t=r||t===V?1:Ca(t),t=e-t,be(n,0,t<0?0:t)):[]}function au(n,t){return n&&n.length?Ne(n,Ai(t,3),!0,!0):[]}function fu(n,t){return n&&n.length?Ne(n,Ai(t,3),!0):[]}function cu(n,t,r,e){var i=n?n.length:0;return i?(r&&"number"!=typeof r&&$i(n,t,r)&&(r=0,e=i),Sr(n,t,r,e)):[]}function su(n,t){return n&&n.length?g(n,Ai(t,3)):-1}function lu(n,t){return n&&n.length?g(n,Ai(t,3),!0):-1}function hu(n){var t=n?n.length:0;return t?Ur(n,1):[]}function pu(n){var t=n?n.length:0;return t?Ur(n,gn):[]}function vu(n,t){var r=n?n.length:0;return r?(t=t===V?1:Ca(t),Ur(n,t)):[]}function _u(n){for(var t=-1,r=n?n.length:0,e={};++t<r;){var i=n[t];e[i[0]]=i[1]}return e}function du(n){return n&&n.length?n[0]:V}function gu(n,t,r){var e=n?n.length:0;return e?(r=Ca(r),r<0&&(r=Mc(e+r,0)),y(n,t,r)):-1}function yu(n){return ou(n,1)}function wu(n,t){return n?Fc.call(n,t):""}function bu(n){var t=n?n.length:0;return t?n[t-1]:V}function mu(n,t,r){var e=n?n.length:0;if(!e)return-1;var i=e;if(r!==V&&(i=Ca(r),i=(i<0?Mc(e+i,0):Bc(i,e-1))+1),t!==t)return U(n,i,!0);for(;i--;)if(n[i]===t)return i;return-1}function xu(n,t){return n&&n.length?fe(n,Ca(t)):V}function ju(n,t){return n&&n.length&&t&&t.length?ve(n,t):n}function ku(n,t,r){return n&&n.length&&t&&t.length?ve(n,t,Ai(r)):n}function Eu(n,t,r){return n&&n.length&&t&&t.length?ve(n,t,V,r):n}function Au(n,t){var r=[];if(!n||!n.length)return r;var e=-1,i=[],u=n.length;for(t=Ai(t,3);++e<u;){var o=n[e];t(o,e,n)&&(r.push(o),i.push(e))}return _e(n,i),r}function Ou(n){return n?qc.call(n):n}function Iu(n,t,r){var e=n?n.length:0;return e?(r&&"number"!=typeof r&&$i(n,t,r)?(t=0,r=e):(t=null==t?0:Ca(t),r=r===V?e:Ca(r)),be(n,t,r)):[]}function Cu(n,t){return xe(n,t)}function Nu(n,t,r){return je(n,t,Ai(r))}function Lu(n,t){var r=n?n.length:0;if(r){var e=xe(n,t);if(e<r&&Go(n[e],t))return e}return-1}function Ru(n,t){return xe(n,t,!0)}function Su(n,t,r){return je(n,t,Ai(r),!0)}function Wu(n,t){var r=n?n.length:0;if(r){var e=xe(n,t,!0)-1;if(Go(n[e],t))return e}return-1}function Uu(n){return n&&n.length?ke(n):[]}function Du(n,t){return n&&n.length?ke(n,Ai(t)):[]}function Fu(n){return uu(n,1)}function zu(n,t,r){return n&&n.length?(t=r||t===V?1:Ca(t),be(n,0,t<0?0:t)):[]}function Mu(n,t,r){var e=n?n.length:0;return e?(t=r||t===V?1:Ca(t),t=e-t,be(n,t<0?0:t,e)):[]}function Bu(n,t){return n&&n.length?Ne(n,Ai(t,3),!1,!0):[]}function Pu(n,t){return n&&n.length?Ne(n,Ai(t,3)):[]}function $u(n){return n&&n.length?Oe(n):[]}function Tu(n,t){return n&&n.length?Oe(n,Ai(t)):[]}function qu(n,t){return n&&n.length?Oe(n,V,t):[]}function Vu(n){if(!n||!n.length)return[];var t=0;return n=f(n,function(n){if(Jo(n))return t=Mc(n.length,t),!0}),k(t,function(t){return l(n,he(t))})}function Gu(n,t){if(!n||!n.length)return[];var e=Vu(n);return null==t?e:l(e,function(n){return r(t,V,n)})}function Zu(n,t){return Se(n||[],t||[],cr)}function Ku(n,t){return Se(n||[],t||[],we)}function Yu(n){var t=Ct(n);return t.__chain__=!0,t}function Ju(n,t){return t(n),n}function Qu(n,t){return t(n)}function Hu(){return Yu(this)}function Xu(){return new Lt(this.value(),this.__chain__)}function no(){this.__values__===V&&(this.__values__=Ia(this.value()));var n=this.__index__>=this.__values__.length,t=n?V:this.__values__[this.__index__++];return{done:n,value:t}}function to(){return this}function ro(n){for(var t,r=this;r instanceof Nt;){var e=tu(r);e.__index__=0,e.__values__=V,t?i.__wrapped__=e:t=e;var i=e;r=r.__wrapped__}return i.__wrapped__=n,t}function eo(){var n=this.__wrapped__;if(n instanceof Rt){var t=n;return this.__actions__.length&&(t=new Rt(this)),t=t.reverse(),t.__actions__.push({func:Qu,args:[Ou],thisArg:V}),new Lt(t,this.__chain__)}return this.thru(Ou)}function io(){return Le(this.__wrapped__,this.__actions__)}function uo(n,t,r){var e=tl(n)?a:Nr;return r&&$i(n,t,r)&&(t=V),e(n,Ai(t,3))}function oo(n,t){var r=tl(n)?f:Wr;return r(n,Ai(t,3))}function ao(n,t){if(t=Ai(t,3),tl(n)){var r=g(n,t);return r>-1?n[r]:V}return d(n,t,cs)}function fo(n,t){if(t=Ai(t,3),tl(n)){var r=g(n,t,!0);return r>-1?n[r]:V}return d(n,t,ss)}function co(n,t){return Ur(_o(n,t),1)}function so(n,t){return Ur(_o(n,t),gn)}function lo(n,t,r){return r=r===V?1:Ca(r),Ur(_o(n,t),r)}function ho(n,t){return"function"==typeof t&&tl(n)?u(n,t):cs(n,Ai(t))}function po(n,t){return"function"==typeof t&&tl(n)?o(n,t):ss(n,Ai(t))}function vo(n,t,r,e){n=Yo(n)?n:cf(n),r=r&&!e?Ca(r):0;var i=n.length;return r<0&&(r=Mc(i+r,0)),xa(n)?r<=i&&n.indexOf(t,r)>-1:!!i&&y(n,t,r)>-1;
+}function _o(n,t){var r=tl(n)?l:ee;return r(n,Ai(t,3))}function go(n,t,r,e){return null==n?[]:(tl(t)||(t=null==t?[]:[t]),r=e?V:r,tl(r)||(r=null==r?[]:[r]),ce(n,t,r))}function yo(n,t,r){var e=tl(n)?p:m,i=arguments.length<3;return e(n,Ai(t,4),r,i,cs)}function wo(n,t,r){var e=tl(n)?v:m,i=arguments.length<3;return e(n,Ai(t,4),r,i,ss)}function bo(n,t){var r=tl(n)?f:Wr;return t=Ai(t,3),r(n,function(n,r,e){return!t(n,r,e)})}function mo(n){var t=Yo(n)?n:cf(n),r=t.length;return r>0?t[de(0,r-1)]:V}function xo(n,t,r){var e=-1,i=Ia(n),u=i.length,o=u-1;for(t=(r?$i(n,t,r):t===V)?1:xr(Ca(t),0,u);++e<t;){var a=de(e,o),f=i[a];i[a]=i[e],i[e]=f}return i.length=t,i}function jo(n){return xo(n,mn)}function ko(n){if(null==n)return 0;if(Yo(n)){var t=n.length;return t&&xa(n)?P(n):t}if(ca(n)){var r=Ri(n);if(r==Ln||r==Dn)return n.size}return Za(n).length}function Eo(n,t,r){var e=tl(n)?_:me;return r&&$i(n,t,r)&&(t=V),e(n,Ai(t,3))}function Ao(n,t){if("function"!=typeof t)throw new sc(K);return n=Ca(n),function(){if(--n<1)return t.apply(this,arguments)}}function Oo(n,t,r){return t=r?V:t,t=n&&null==t?n.length:t,wi(n,un,V,V,V,V,t)}function Io(n,t){var r;if("function"!=typeof t)throw new sc(K);return n=Ca(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=V),r}}function Co(n,t,r){t=r?V:t;var e=wi(n,nn,V,V,V,V,V,t);return e.placeholder=Co.placeholder,e}function No(n,t,r){t=r?V:t;var e=wi(n,tn,V,V,V,V,V,t);return e.placeholder=No.placeholder,e}function Lo(n,t,r){function e(t){var r=h,e=p;return h=p=V,y=t,_=n.apply(e,r)}function i(n){return y=n,d=Lc(a,t),w?e(n):_}function u(n){var r=n-g,e=n-y,i=t-r;return b?Bc(i,v-e):i}function o(n){var r=n-g,e=n-y;return!g||r>=t||r<0||b&&e>=v}function a(){var n=qs();return o(n)?f(n):void(d=Lc(a,u(n)))}function f(n){return Ec(d),d=V,m&&h?e(n):(h=p=V,_)}function c(){d!==V&&Ec(d),g=y=0,h=p=d=V}function s(){return d===V?_:f(qs())}function l(){var n=qs(),r=o(n);if(h=arguments,p=this,g=n,r){if(d===V)return i(g);if(b)return Ec(d),d=Lc(a,t),e(g)}return d===V&&(d=Lc(a,t)),_}var h,p,v,_,d,g=0,y=0,w=!1,b=!1,m=!0;if("function"!=typeof n)throw new sc(K);return t=La(t)||0,fa(r)&&(w=!!r.leading,b="maxWait"in r,v=b?Mc(La(r.maxWait)||0,t):v,m="trailing"in r?!!r.trailing:m),l.cancel=c,l.flush=s,l}function Ro(n){return wi(n,an)}function So(n,t){if("function"!=typeof n||t&&"function"!=typeof t)throw new sc(K);var r=function(){var e=arguments,i=t?t.apply(this,e):e[0],u=r.cache;if(u.has(i))return u.get(i);var o=n.apply(this,e);return r.cache=u.set(i,o),o};return r.cache=new(So.Cache||Pt),r}function Wo(n){if("function"!=typeof n)throw new sc(K);return function(){return!n.apply(this,arguments)}}function Uo(n){return Io(2,n)}function Do(n,t){if("function"!=typeof n)throw new sc(K);return t=Mc(t===V?n.length-1:Ca(t),0),function(){for(var e=arguments,i=-1,u=Mc(e.length-t,0),o=Array(u);++i<u;)o[i]=e[t+i];switch(t){case 0:return n.call(this,o);case 1:return n.call(this,e[0],o);case 2:return n.call(this,e[0],e[1],o)}var a=Array(t+1);for(i=-1;++i<t;)a[i]=e[i];return a[t]=o,r(n,this,a)}}function Fo(n,t){if("function"!=typeof n)throw new sc(K);return t=t===V?0:Mc(Ca(t),0),Do(function(e){var i=e[t],u=Fe(e,0,t);return i&&h(u,i),r(n,this,u)})}function zo(n,t,r){var e=!0,i=!0;if("function"!=typeof n)throw new sc(K);return fa(r)&&(e="leading"in r?!!r.leading:e,i="trailing"in r?!!r.trailing:i),Lo(n,t,{leading:e,maxWait:t,trailing:i})}function Mo(n){return Oo(n,1)}function Bo(n,t){return t=null==t?Mf:t,Js(t,n)}function Po(){if(!arguments.length)return[];var n=arguments[0];return tl(n)?n:[n]}function $o(n){return jr(n,!1,!0)}function To(n,t){return jr(n,!1,!0,t)}function qo(n){return jr(n,!0,!0)}function Vo(n,t){return jr(n,!0,!0,t)}function Go(n,t){return n===t||n!==n&&t!==t}function Zo(n){return Jo(n)&&_c.call(n,"callee")&&(!Nc.call(n,"callee")||yc.call(n)==kn)}function Ko(n){return ca(n)&&yc.call(n)==Pn}function Yo(n){return null!=n&&aa(ds(n))&&!ua(n)}function Jo(n){return ca(n)&&Yo(n)}function Qo(n){return n===!0||n===!1||ca(n)&&yc.call(n)==An}function Ho(n){return ca(n)&&yc.call(n)==On}function Xo(n){return!!n&&1===n.nodeType&&ca(n)&&!ya(n)}function na(n){if(Yo(n)&&(tl(n)||xa(n)||ua(n.splice)||Zo(n)||rl(n)))return!n.length;if(ca(n)){var t=Ri(n);if(t==Ln||t==Dn)return!n.size}for(var r in n)if(_c.call(n,r))return!1;return!(Xc&&Za(n).length)}function ta(n,t){return Jr(n,t)}function ra(n,t,r){r="function"==typeof r?r:V;var e=r?r(n,t):V;return e===V?Jr(n,t,r):!!e}function ea(n){return!!ca(n)&&(yc.call(n)==In||"string"==typeof n.message&&"string"==typeof n.name)}function ia(n){return"number"==typeof n&&Dc(n)}function ua(n){var t=fa(n)?yc.call(n):"";return t==Cn||t==Nn}function oa(n){return"number"==typeof n&&n==Ca(n)}function aa(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=yn}function fa(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function ca(n){return!!n&&"object"==typeof n}function sa(n){return ca(n)&&Ri(n)==Ln}function la(n,t){return n===t||Hr(n,t,Oi(t))}function ha(n,t,r){return r="function"==typeof r?r:V,Hr(n,t,Oi(t),r)}function pa(n){return ga(n)&&n!=+n}function va(n){if(!fa(n))return!1;var t=ua(n)||D(n)?bc:jt;return t.test(nu(n))}function _a(n){return null===n}function da(n){return null==n}function ga(n){return"number"==typeof n||ca(n)&&yc.call(n)==Rn}function ya(n){if(!ca(n)||yc.call(n)!=Sn||D(n))return!1;var t=Ni(n);if(null===t)return!0;var r=_c.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&vc.call(r)==gc}function wa(n){return fa(n)&&yc.call(n)==Un}function ba(n){return oa(n)&&n>=-yn&&n<=yn}function ma(n){return ca(n)&&Ri(n)==Dn}function xa(n){return"string"==typeof n||!tl(n)&&ca(n)&&yc.call(n)==Fn}function ja(n){return"symbol"==typeof n||ca(n)&&yc.call(n)==zn}function ka(n){return ca(n)&&aa(n.length)&&!!br[yc.call(n)]}function Ea(n){return n===V}function Aa(n){return ca(n)&&Ri(n)==Mn}function Oa(n){return ca(n)&&yc.call(n)==Bn}function Ia(n){if(!n)return[];if(Yo(n))return xa(n)?$(n):Je(n);if(Ic&&n[Ic])return F(n[Ic]());var t=Ri(n),r=t==Ln?z:t==Dn?B:cf;return r(n)}function Ca(n){if(!n)return 0===n?n:0;if(n=La(n),n===gn||n===-gn){var t=n<0?-1:1;return t*wn}var r=n%1;return n===n?r?n-r:n:0}function Na(n){return n?xr(Ca(n),0,mn):0}function La(n){if("number"==typeof n)return n;if(ja(n))return bn;if(fa(n)){var t=ua(n.valueOf)?n.valueOf():n;n=fa(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(pt,"");var r=xt.test(n);return r||kt.test(n)?Ir(n.slice(2),r?2:8):mt.test(n)?bn:+n}function Ra(n){return Qe(n,Ka(n))}function Sa(n){return xr(Ca(n),-yn,yn)}function Wa(n){return null==n?"":Ae(n)}function Ua(n,t){var r=Er(n);return t?lr(r,t):r}function Da(n,t){return d(n,Ai(t,3),zr,!0)}function Fa(n,t){return d(n,Ai(t,3),Mr,!0)}function za(n,t){return null==n?n:ls(n,Ai(t),Ka)}function Ma(n,t){return null==n?n:hs(n,Ai(t),Ka)}function Ba(n,t){return n&&zr(n,Ai(t))}function Pa(n,t){return n&&Mr(n,Ai(t))}function $a(n){return null==n?[]:Br(n,Za(n))}function Ta(n){return null==n?[]:Br(n,Ka(n))}function qa(n,t,r){var e=null==n?V:Pr(n,t);return e===V?r:e}function Va(n,t){return null!=n&&Wi(n,t,qr)}function Ga(n,t){return null!=n&&Wi(n,t,Vr)}function Za(n){var t=Gi(n);if(!t&&!Yo(n))return ne(n);var r=zi(n),e=!!r,i=r||[],u=i.length;for(var o in n)!qr(n,o)||e&&("length"==o||Pi(o,u))||t&&"constructor"==o||i.push(o);return i}function Ka(n){for(var t=-1,r=Gi(n),e=te(n),i=e.length,u=zi(n),o=!!u,a=u||[],f=a.length;++t<i;){var c=e[t];o&&("length"==c||Pi(c,f))||"constructor"==c&&(r||!_c.call(n,c))||a.push(c)}return a}function Ya(n,t){var r={};return t=Ai(t,3),zr(n,function(n,e,i){r[t(n,e,i)]=n}),r}function Ja(n,t){var r={};return t=Ai(t,3),zr(n,function(n,e,i){r[e]=t(n,e,i)}),r}function Qa(n,t){return t=Ai(t),le(n,function(n,r){return!t(n,r)})}function Ha(n,t){return null==n?{}:le(n,Ai(t))}function Xa(n,t,r){t=Ti(t,n)?[t]:De(t);var e=-1,i=t.length;for(i||(n=V,i=1);++e<i;){var u=null==n?V:n[Xi(t[e])];u===V&&(e=i,u=r),n=ua(u)?u.call(n):u}return n}function nf(n,t,r){return null==n?n:we(n,t,r)}function tf(n,t,r,e){return e="function"==typeof e?e:V,null==n?n:we(n,t,r,e)}function rf(n){return E(n,Za(n))}function ef(n){return E(n,Ka(n))}function uf(n,t,r){var e=tl(n)||ka(n);if(t=Ai(t,4),null==r)if(e||fa(n)){var i=n.constructor;r=e?tl(n)?new i:[]:ua(i)?Er(Ni(n)):{}}else r={};return(e?u:zr)(n,function(n,e,i){return t(r,n,e,i)}),r}function of(n,t){return null==n||Ie(n,t)}function af(n,t,r){return null==n?n:Ce(n,t,Ue(r))}function ff(n,t,r,e){return e="function"==typeof e?e:V,null==n?n:Ce(n,t,Ue(r),e)}function cf(n){return n?O(n,Za(n)):[]}function sf(n){return null==n?[]:O(n,Ka(n))}function lf(n,t,r){return r===V&&(r=t,t=V),r!==V&&(r=La(r),r=r===r?r:0),t!==V&&(t=La(t),t=t===t?t:0),xr(La(n),t,r)}function hf(n,t,r){return t=La(t)||0,r===V?(r=t,t=0):r=La(r)||0,n=La(n),Gr(n,t,r)}function pf(n,t,r){if(r&&"boolean"!=typeof r&&$i(n,t,r)&&(t=r=V),r===V&&("boolean"==typeof t?(r=t,t=V):"boolean"==typeof n&&(r=n,n=V)),n===V&&t===V?(n=0,t=1):(n=La(n)||0,t===V?(t=n,n=0):t=La(t)||0),n>t){var e=n;n=t,t=e}if(r||n%1||t%1){var i=$c();return Bc(n+i*(t-n+Or("1e-"+((i+"").length-1))),t)}return de(n,t)}function vf(n){return Al(Wa(n).toLowerCase())}function _f(n){return n=Wa(n),n&&n.replace(At,R).replace(pr,"")}function df(n,t,r){n=Wa(n),t=Ae(t);var e=n.length;return r=r===V?e:xr(Ca(r),0,e),r-=t.length,r>=0&&n.indexOf(t,r)==r}function gf(n){return n=Wa(n),n&&it.test(n)?n.replace(rt,S):n}function yf(n){return n=Wa(n),n&&ht.test(n)?n.replace(lt,"\\$&"):n}function wf(n,t,r){n=Wa(n),t=Ca(t);var e=t?P(n):0;if(!t||e>=t)return n;var i=(t-e)/2;return pi(Wc(i),r)+n+pi(Sc(i),r)}function bf(n,t,r){n=Wa(n),t=Ca(t);var e=t?P(n):0;return t&&e<t?n+pi(t-e,r):n}function mf(n,t,r){n=Wa(n),t=Ca(t);var e=t?P(n):0;return t&&e<t?pi(t-e,r)+n:n}function xf(n,t,r){return r||null==t?t=0:t&&(t=+t),n=Wa(n).replace(pt,""),Pc(n,t||(bt.test(n)?16:10))}function jf(n,t,r){return t=(r?$i(n,t,r):t===V)?1:Ca(t),ye(Wa(n),t)}function kf(){var n=arguments,t=Wa(n[0]);return n.length<3?t:Tc.call(t,n[1],n[2])}function Ef(n,t,r){return r&&"number"!=typeof r&&$i(n,t,r)&&(t=r=V),(r=r===V?mn:r>>>0)?(n=Wa(n),n&&("string"==typeof t||null!=t&&!wa(t))&&(t=Ae(t),""==t&&dr.test(n))?Fe($(n),0,r):Vc.call(n,t,r)):[]}function Af(n,t,r){return n=Wa(n),r=xr(Ca(r),0,n.length),n.lastIndexOf(Ae(t),r)==r}function Of(n,t,r){var e=Ct.templateSettings;r&&$i(n,t,r)&&(t=V),n=Wa(n),t=al({},t,e,ar);var i,u,o=al({},t.imports,e.imports,ar),a=Za(o),f=O(o,a),c=0,s=t.interpolate||Ot,l="__p += '",h=cc((t.escape||Ot).source+"|"+s.source+"|"+(s===at?yt:Ot).source+"|"+(t.evaluate||Ot).source+"|$","g"),p="//# sourceURL="+("sourceURL"in t?t.sourceURL:"lodash.templateSources["+ ++wr+"]")+"\n";n.replace(h,function(t,r,e,o,a,f){return e||(e=o),l+=n.slice(c,f).replace(It,W),r&&(i=!0,l+="' +\n__e("+r+") +\n'"),a&&(u=!0,l+="';\n"+a+";\n__p += '"),e&&(l+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),c=f+t.length,t}),l+="';\n";var v=t.variable;v||(l="with (obj) {\n"+l+"\n}\n"),l=(u?l.replace(Hn,""):l).replace(Xn,"$1").replace(nt,"$1;"),l="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(u?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var _=Ol(function(){return Function(a,p+"return "+l).apply(V,f)});if(_.source=l,ea(_))throw _;return _}function If(n){return Wa(n).toLowerCase()}function Cf(n){return Wa(n).toUpperCase()}function Nf(n,t,r){if(n=Wa(n),n&&(r||t===V))return n.replace(pt,"");if(!n||!(t=Ae(t)))return n;var e=$(n),i=$(t),u=I(e,i),o=C(e,i)+1;return Fe(e,u,o).join("")}function Lf(n,t,r){if(n=Wa(n),n&&(r||t===V))return n.replace(_t,"");if(!n||!(t=Ae(t)))return n;var e=$(n),i=C(e,$(t))+1;return Fe(e,0,i).join("")}function Rf(n,t,r){if(n=Wa(n),n&&(r||t===V))return n.replace(vt,"");if(!n||!(t=Ae(t)))return n;var e=$(n),i=I(e,$(t));return Fe(e,i).join("")}function Sf(n,t){var r=sn,e=ln;if(fa(t)){var i="separator"in t?t.separator:i;r="length"in t?Ca(t.length):r,e="omission"in t?Ae(t.omission):e}n=Wa(n);var u=n.length;if(dr.test(n)){var o=$(n);u=o.length}if(r>=u)return n;var a=r-P(e);if(a<1)return e;var f=o?Fe(o,0,a).join(""):n.slice(0,a);if(i===V)return f+e;if(o&&(a+=f.length-a),wa(i)){if(n.slice(a).search(i)){var c,s=f;for(i.global||(i=cc(i.source,Wa(wt.exec(i))+"g")),i.lastIndex=0;c=i.exec(s);)var l=c.index;f=f.slice(0,l===V?a:l)}}else if(n.indexOf(Ae(i),a)!=a){var h=f.lastIndexOf(i);h>-1&&(f=f.slice(0,h))}return f+e}function Wf(n){return n=Wa(n),n&&et.test(n)?n.replace(tt,T):n}function Uf(n,t,r){return n=Wa(n),t=r?V:t,t===V&&(t=gr.test(n)?_r:dt),n.match(t)||[]}function Df(n){var t=n?n.length:0,e=Ai();return n=t?l(n,function(n){if("function"!=typeof n[1])throw new sc(K);return[e(n[0]),n[1]]}):[],Do(function(e){for(var i=-1;++i<t;){var u=n[i];if(r(u[0],this,e))return r(u[1],this,e)}})}function Ff(n){return kr(jr(n,!0))}function zf(n){return function(){return n}}function Mf(n){return n}function Bf(n){return Xr("function"==typeof n?n:jr(n,!0))}function Pf(n){return ie(jr(n,!0))}function $f(n,t){return ue(n,jr(t,!0))}function Tf(n,t,r){var e=Za(t),i=Br(t,e);null!=r||fa(t)&&(i.length||!e.length)||(r=t,t=n,n=this,i=Br(t,Za(t)));var o=!(fa(r)&&"chain"in r&&!r.chain),a=ua(n);return u(i,function(r){var e=t[r];n[r]=e,a&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__),i=r.__actions__=Je(this.__actions__);return i.push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,h([this.value()],arguments))})}),n}function qf(){return Dr._===this&&(Dr._=wc),this}function Vf(){}function Gf(n){return n=Ca(n),Do(function(t){return fe(t,n)})}function Zf(n){return Ti(n)?he(Xi(n)):pe(n)}function Kf(n){return function(t){return null==n?V:Pr(n,t)}}function Yf(n,t){if(n=Ca(n),n<1||n>yn)return[];var r=mn,e=Bc(n,mn);t=Ai(t),n-=mn;for(var i=k(e,t);++r<n;)t(r);return i}function Jf(n){return tl(n)?l(n,Xi):ja(n)?[n]:Je(ws(n))}function Qf(n){var t=++dc;return Wa(n)+t}function Hf(n){return n&&n.length?Rr(n,Mf,Tr):V}function Xf(n,t){return n&&n.length?Rr(n,Ai(t),Tr):V}function nc(n){return b(n,Mf)}function tc(n,t){return b(n,Ai(t))}function rc(n){return n&&n.length?Rr(n,Mf,re):V}function ec(n,t){return n&&n.length?Rr(n,Ai(t),re):V}function ic(n){return n&&n.length?j(n,Mf):0}function uc(n,t){return n&&n.length?j(n,Ai(t)):0}N=N?Fr.defaults({},N,Fr.pick(Dr,yr)):Dr;var oc=N.Date,ac=N.Error,fc=N.Math,cc=N.RegExp,sc=N.TypeError,lc=N.Array.prototype,hc=N.Object.prototype,pc=N.String.prototype,vc=N.Function.prototype.toString,_c=hc.hasOwnProperty,dc=0,gc=vc.call(Object),yc=hc.toString,wc=Dr._,bc=cc("^"+vc.call(_c).replace(lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mc=Lr?N.Buffer:V,xc=N.Reflect,jc=N.Symbol,kc=N.Uint8Array,Ec=N.clearTimeout,Ac=xc?xc.enumerate:V,Oc=Object.getOwnPropertySymbols,Ic="symbol"==typeof(Ic=jc&&jc.iterator)?Ic:V,Cc=Object.create,Nc=hc.propertyIsEnumerable,Lc=N.setTimeout,Rc=lc.splice,Sc=fc.ceil,Wc=fc.floor,Uc=Object.getPrototypeOf,Dc=N.isFinite,Fc=lc.join,zc=Object.keys,Mc=fc.max,Bc=fc.min,Pc=N.parseInt,$c=fc.random,Tc=pc.replace,qc=lc.reverse,Vc=pc.split,Gc=Ii(N,"DataView"),Zc=Ii(N,"Map"),Kc=Ii(N,"Promise"),Yc=Ii(N,"Set"),Jc=Ii(N,"WeakMap"),Qc=Ii(Object,"create"),Hc=Jc&&new Jc,Xc=!Nc.call({valueOf:1},"valueOf"),ns={},ts=nu(Gc),rs=nu(Zc),es=nu(Kc),is=nu(Yc),us=nu(Jc),os=jc?jc.prototype:V,as=os?os.valueOf:V,fs=os?os.toString:V;Ct.templateSettings={escape:ut,evaluate:ot,interpolate:at,variable:"",imports:{_:Ct}},Ct.prototype=Nt.prototype,Ct.prototype.constructor=Ct,Lt.prototype=Er(Nt.prototype),Lt.prototype.constructor=Lt,Rt.prototype=Er(Nt.prototype),Rt.prototype.constructor=Rt,Dt.prototype=Qc?Qc(null):hc,Pt.prototype.clear=$t,Pt.prototype["delete"]=Tt,Pt.prototype.get=qt,Pt.prototype.has=Vt,Pt.prototype.set=Gt,Zt.prototype.push=Yt,Jt.prototype.clear=Qt,Jt.prototype["delete"]=Ht,Jt.prototype.get=Xt,Jt.prototype.has=nr,Jt.prototype.set=tr;var cs=ti(zr),ss=ti(Mr,!0),ls=ri(),hs=ri(!0);Ac&&!Nc.call({valueOf:1},"valueOf")&&(te=function(n){return F(Ac(n))});var ps=Hc?function(n,t){return Hc.set(n,t),n}:Mf,vs=Yc&&1/B(new Yc([,-0]))[1]==gn?function(n){return new Yc(n)}:Vf,_s=Hc?function(n){return Hc.get(n)}:Vf,ds=he("length");Oc||(Li=function(){return[]});var gs=Oc?function(n){for(var t=[];n;)h(t,Li(n)),n=Ni(n);return t}:Li;(Gc&&Ri(new Gc(new ArrayBuffer(1)))!=$n||Zc&&Ri(new Zc)!=Ln||Kc&&Ri(Kc.resolve())!=Wn||Yc&&Ri(new Yc)!=Dn||Jc&&Ri(new Jc)!=Mn)&&(Ri=function(n){var t=yc.call(n),r=t==Sn?n.constructor:V,e=r?nu(r):V;if(e)switch(e){case ts:return $n;case rs:return Ln;case es:return Wn;case is:return Dn;case us:return Mn}return t});var ys=function(){var n=0,t=0;return function(r,e){var i=qs(),u=pn-(i-t);if(t=i,u>0){if(++n>=hn)return r}else n=0;return ps(r,e)}}(),ws=So(function(n){var t=[];return Wa(n).replace(st,function(n,r,e,i){t.push(e?i.replace(gt,"$1"):r||n)}),t}),bs=Do(function(n,t){return Jo(n)?Cr(n,Ur(t,1,Jo,!0)):[]}),ms=Do(function(n,t){var r=bu(t);return Jo(r)&&(r=V),Jo(n)?Cr(n,Ur(t,1,Jo,!0),Ai(r)):[]}),xs=Do(function(n,t){var r=bu(t);return Jo(r)&&(r=V),Jo(n)?Cr(n,Ur(t,1,Jo,!0),V,r):[]}),js=Do(function(n){var t=l(n,We);return t.length&&t[0]===n[0]?Zr(t):[]}),ks=Do(function(n){var t=bu(n),r=l(n,We);return t===bu(r)?t=V:r.pop(),r.length&&r[0]===n[0]?Zr(r,Ai(t)):[]}),Es=Do(function(n){var t=bu(n),r=l(n,We);return t===bu(r)?t=V:r.pop(),r.length&&r[0]===n[0]?Zr(r,V,t):[]}),As=Do(ju),Os=Do(function(n,t){t=Ur(t,1);var r=n?n.length:0,e=vr(n,t);return _e(n,l(t,function(n){return Pi(n,r)?+n:n}).sort(Ge)),e}),Is=Do(function(n){return Oe(Ur(n,1,Jo,!0))}),Cs=Do(function(n){var t=bu(n);return Jo(t)&&(t=V),Oe(Ur(n,1,Jo,!0),Ai(t))}),Ns=Do(function(n){var t=bu(n);return Jo(t)&&(t=V),Oe(Ur(n,1,Jo,!0),V,t)}),Ls=Do(function(n,t){return Jo(n)?Cr(n,t):[]}),Rs=Do(function(n){return Re(f(n,Jo))}),Ss=Do(function(n){var t=bu(n);return Jo(t)&&(t=V),Re(f(n,Jo),Ai(t))}),Ws=Do(function(n){var t=bu(n);return Jo(t)&&(t=V),Re(f(n,Jo),V,t)}),Us=Do(Vu),Ds=Do(function(n){var t=n.length,r=t>1?n[t-1]:V;return r="function"==typeof r?(n.pop(),r):V,Gu(n,r)}),Fs=Do(function(n){n=Ur(n,1);var t=n.length,r=t?n[0]:0,e=this.__wrapped__,i=function(t){return vr(t,n)};return!(t>1||this.__actions__.length)&&e instanceof Rt&&Pi(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:Qu,args:[i],thisArg:V}),new Lt(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(V),n})):this.thru(i)}),zs=Xe(function(n,t,r){_c.call(n,r)?++n[r]:n[r]=1}),Ms=Xe(function(n,t,r){_c.call(n,r)?n[r].push(t):n[r]=[t]}),Bs=Do(function(n,t,e){var i=-1,u="function"==typeof t,o=Ti(t),a=Yo(n)?Array(n.length):[];return cs(n,function(n){var f=u?t:o&&null!=n?n[t]:V;a[++i]=f?r(f,n,e):Yr(n,t,e)}),a}),Ps=Xe(function(n,t,r){n[r]=t}),$s=Xe(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Ts=Do(function(n,t){if(null==n)return[];var r=t.length;return r>1&&$i(n,t[0],t[1])?t=[]:r>2&&$i(t[0],t[1],t[2])&&(t=[t[0]]),t=1==t.length&&tl(t[0])?t[0]:Ur(t,1,Bi),ce(n,t,[])}),qs=oc.now,Vs=Do(function(n,t,r){var e=Q;if(r.length){var i=M(r,Ci(Vs));e|=rn}return wi(n,e,t,r,i)}),Gs=Do(function(n,t,r){var e=Q|H;if(r.length){var i=M(r,Ci(Gs));e|=rn}return wi(t,e,n,r,i)}),Zs=Do(function(n,t){return Ar(n,1,t)}),Ks=Do(function(n,t,r){return Ar(n,La(t)||0,r)});So.Cache=Pt;var Ys=Do(function(n,t){t=1==t.length&&tl(t[0])?l(t[0],A(Ai())):l(Ur(t,1,Bi),A(Ai()));var e=t.length;return Do(function(i){for(var u=-1,o=Bc(i.length,e);++u<o;)i[u]=t[u].call(this,i[u]);return r(n,this,i)})}),Js=Do(function(n,t){var r=M(t,Ci(Js));return wi(n,rn,V,t,r)}),Qs=Do(function(n,t){var r=M(t,Ci(Qs));return wi(n,en,V,t,r)}),Hs=Do(function(n,t){return wi(n,on,V,V,V,Ur(t,1))}),Xs=di(Tr),nl=di(function(n,t){return n>=t}),tl=Array.isArray,rl=mc?function(n){return n instanceof mc}:zf(!1),el=di(re),il=di(function(n,t){return n<=t}),ul=ni(function(n,t){if(Xc||Gi(t)||Yo(t))return void Qe(t,Za(t),n);for(var r in t)_c.call(t,r)&&cr(n,r,t[r])}),ol=ni(function(n,t){if(Xc||Gi(t)||Yo(t))return void Qe(t,Ka(t),n);for(var r in t)cr(n,r,t[r])}),al=ni(function(n,t,r,e){Qe(t,Ka(t),n,e)}),fl=ni(function(n,t,r,e){Qe(t,Za(t),n,e)}),cl=Do(function(n,t){return vr(n,Ur(t,1))}),sl=Do(function(n){return n.push(V,ar),r(al,V,n)}),ll=Do(function(n){return n.push(V,Ji),r(dl,V,n)}),hl=si(function(n,t,r){n[t]=r},zf(Mf)),pl=si(function(n,t,r){_c.call(n,t)?n[t].push(r):n[t]=[r]},Ai),vl=Do(Yr),_l=ni(function(n,t,r){oe(n,t,r)}),dl=ni(function(n,t,r,e){oe(n,t,r,e)}),gl=Do(function(n,t){return null==n?{}:(t=l(Ur(t,1),Xi),se(n,Cr(ki(n),t)))}),yl=Do(function(n,t){return null==n?{}:se(n,l(Ur(t,1),Xi))}),wl=ui(function(n,t,r){return t=t.toLowerCase(),n+(r?vf(t):t)}),bl=ui(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),ml=ui(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),xl=ii("toLowerCase"),jl=ui(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),kl=ui(function(n,t,r){return n+(r?" ":"")+Al(t)}),El=ui(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Al=ii("toUpperCase"),Ol=Do(function(n,t){try{return r(n,V,t)}catch(e){return ea(e)?e:new ac(e)}}),Il=Do(function(n,t){return u(Ur(t,1),function(t){t=Xi(t),n[t]=Vs(n[t],n)}),n}),Cl=fi(),Nl=fi(!0),Ll=Do(function(n,t){return function(r){return Yr(r,n,t)}}),Rl=Do(function(n,t){return function(r){return Yr(n,r,t)}}),Sl=hi(l),Wl=hi(a),Ul=hi(_),Dl=_i(),Fl=_i(!0),zl=li(function(n,t){return n+t}),Ml=yi("ceil"),Bl=li(function(n,t){return n/t}),Pl=yi("floor"),$l=li(function(n,t){return n*t}),Tl=yi("round"),ql=li(function(n,t){return n-t});return Ct.after=Ao,Ct.ary=Oo,Ct.assign=ul,Ct.assignIn=ol,Ct.assignInWith=al,Ct.assignWith=fl,Ct.at=cl,Ct.before=Io,Ct.bind=Vs,Ct.bindAll=Il,Ct.bindKey=Gs,Ct.castArray=Po,Ct.chain=Yu,Ct.chunk=ru,Ct.compact=eu,Ct.concat=iu,Ct.cond=Df,Ct.conforms=Ff,Ct.constant=zf,Ct.countBy=zs,Ct.create=Ua,Ct.curry=Co,Ct.curryRight=No,Ct.debounce=Lo,Ct.defaults=sl,Ct.defaultsDeep=ll,Ct.defer=Zs,Ct.delay=Ks,Ct.difference=bs,Ct.differenceBy=ms,Ct.differenceWith=xs,Ct.drop=uu,Ct.dropRight=ou,Ct.dropRightWhile=au,Ct.dropWhile=fu,Ct.fill=cu,Ct.filter=oo,Ct.flatMap=co,Ct.flatMapDeep=so,Ct.flatMapDepth=lo,Ct.flatten=hu,Ct.flattenDeep=pu,Ct.flattenDepth=vu,Ct.flip=Ro,Ct.flow=Cl,Ct.flowRight=Nl,Ct.fromPairs=_u,Ct.functions=$a,Ct.functionsIn=Ta,Ct.groupBy=Ms,Ct.initial=yu,Ct.intersection=js,Ct.intersectionBy=ks,Ct.intersectionWith=Es,Ct.invert=hl,Ct.invertBy=pl,Ct.invokeMap=Bs,Ct.iteratee=Bf,Ct.keyBy=Ps,Ct.keys=Za,Ct.keysIn=Ka,Ct.map=_o,Ct.mapKeys=Ya,Ct.mapValues=Ja,Ct.matches=Pf,Ct.matchesProperty=$f,Ct.memoize=So,Ct.merge=_l,Ct.mergeWith=dl,Ct.method=Ll,Ct.methodOf=Rl,Ct.mixin=Tf,Ct.negate=Wo,Ct.nthArg=Gf,Ct.omit=gl,Ct.omitBy=Qa,Ct.once=Uo,Ct.orderBy=go,Ct.over=Sl,Ct.overArgs=Ys,Ct.overEvery=Wl,Ct.overSome=Ul,Ct.partial=Js,Ct.partialRight=Qs,Ct.partition=$s,Ct.pick=yl,Ct.pickBy=Ha,Ct.property=Zf,Ct.propertyOf=Kf,Ct.pull=As,Ct.pullAll=ju,Ct.pullAllBy=ku,Ct.pullAllWith=Eu,Ct.pullAt=Os,Ct.range=Dl,Ct.rangeRight=Fl,Ct.rearg=Hs,Ct.reject=bo,Ct.remove=Au,Ct.rest=Do,Ct.reverse=Ou,Ct.sampleSize=xo,Ct.set=nf,Ct.setWith=tf,Ct.shuffle=jo,Ct.slice=Iu,Ct.sortBy=Ts,Ct.sortedUniq=Uu,Ct.sortedUniqBy=Du,Ct.split=Ef,Ct.spread=Fo,Ct.tail=Fu,Ct.take=zu,Ct.takeRight=Mu,Ct.takeRightWhile=Bu,Ct.takeWhile=Pu,Ct.tap=Ju,Ct.throttle=zo,Ct.thru=Qu,Ct.toArray=Ia,Ct.toPairs=rf,Ct.toPairsIn=ef,Ct.toPath=Jf,Ct.toPlainObject=Ra,Ct.transform=uf,Ct.unary=Mo,Ct.union=Is,Ct.unionBy=Cs,Ct.unionWith=Ns,Ct.uniq=$u,Ct.uniqBy=Tu,Ct.uniqWith=qu,Ct.unset=of,Ct.unzip=Vu,Ct.unzipWith=Gu,Ct.update=af,Ct.updateWith=ff,Ct.values=cf,Ct.valuesIn=sf,Ct.without=Ls,Ct.words=Uf,Ct.wrap=Bo,Ct.xor=Rs,Ct.xorBy=Ss,Ct.xorWith=Ws,Ct.zip=Us,Ct.zipObject=Zu,Ct.zipObjectDeep=Ku,Ct.zipWith=Ds,Ct.entries=rf,Ct.entriesIn=ef,Ct.extend=ol,Ct.extendWith=al,Tf(Ct,Ct),Ct.add=zl,Ct.attempt=Ol,Ct.camelCase=wl,Ct.capitalize=vf,Ct.ceil=Ml,Ct.clamp=lf,Ct.clone=$o,Ct.cloneDeep=qo,Ct.cloneDeepWith=Vo,Ct.cloneWith=To,Ct.deburr=_f,Ct.divide=Bl,Ct.endsWith=df,Ct.eq=Go,Ct.escape=gf,Ct.escapeRegExp=yf,Ct.every=uo,Ct.find=ao,Ct.findIndex=su,Ct.findKey=Da,Ct.findLast=fo,Ct.findLastIndex=lu,Ct.findLastKey=Fa,Ct.floor=Pl,Ct.forEach=ho,Ct.forEachRight=po,Ct.forIn=za,Ct.forInRight=Ma,Ct.forOwn=Ba,Ct.forOwnRight=Pa,Ct.get=qa,Ct.gt=Xs,Ct.gte=nl,Ct.has=Va,Ct.hasIn=Ga,Ct.head=du,Ct.identity=Mf,Ct.includes=vo,Ct.indexOf=gu,Ct.inRange=hf,Ct.invoke=vl,Ct.isArguments=Zo,Ct.isArray=tl,Ct.isArrayBuffer=Ko,Ct.isArrayLike=Yo,Ct.isArrayLikeObject=Jo,Ct.isBoolean=Qo,Ct.isBuffer=rl,Ct.isDate=Ho,Ct.isElement=Xo,Ct.isEmpty=na,Ct.isEqual=ta,Ct.isEqualWith=ra,Ct.isError=ea,Ct.isFinite=ia,Ct.isFunction=ua,Ct.isInteger=oa,Ct.isLength=aa,Ct.isMap=sa,Ct.isMatch=la,Ct.isMatchWith=ha,Ct.isNaN=pa,Ct.isNative=va,Ct.isNil=da,Ct.isNull=_a,Ct.isNumber=ga,Ct.isObject=fa,Ct.isObjectLike=ca,Ct.isPlainObject=ya,Ct.isRegExp=wa,Ct.isSafeInteger=ba,Ct.isSet=ma,Ct.isString=xa,Ct.isSymbol=ja,Ct.isTypedArray=ka,Ct.isUndefined=Ea,Ct.isWeakMap=Aa,Ct.isWeakSet=Oa,Ct.join=wu,Ct.kebabCase=bl,Ct.last=bu,Ct.lastIndexOf=mu,Ct.lowerCase=ml,Ct.lowerFirst=xl,Ct.lt=el,Ct.lte=il,Ct.max=Hf,Ct.maxBy=Xf,Ct.mean=nc,Ct.meanBy=tc,Ct.min=rc,Ct.minBy=ec,Ct.multiply=$l,Ct.nth=xu,Ct.noConflict=qf,Ct.noop=Vf,Ct.now=qs,Ct.pad=wf,Ct.padEnd=bf,Ct.padStart=mf,Ct.parseInt=xf,Ct.random=pf,Ct.reduce=yo,Ct.reduceRight=wo,Ct.repeat=jf,Ct.replace=kf,Ct.result=Xa,Ct.round=Tl,Ct.runInContext=q,Ct.sample=mo,Ct.size=ko,Ct.snakeCase=jl,Ct.some=Eo,Ct.sortedIndex=Cu,Ct.sortedIndexBy=Nu,Ct.sortedIndexOf=Lu,Ct.sortedLastIndex=Ru,Ct.sortedLastIndexBy=Su,Ct.sortedLastIndexOf=Wu,Ct.startCase=kl,Ct.startsWith=Af,Ct.subtract=ql,Ct.sum=ic,Ct.sumBy=uc,Ct.template=Of,Ct.times=Yf,Ct.toInteger=Ca,Ct.toLength=Na,Ct.toLower=If,Ct.toNumber=La,Ct.toSafeInteger=Sa,Ct.toString=Wa,Ct.toUpper=Cf,Ct.trim=Nf,Ct.trimEnd=Lf,Ct.trimStart=Rf,Ct.truncate=Sf,Ct.unescape=Wf,Ct.uniqueId=Qf,Ct.upperCase=El,Ct.upperFirst=Al,Ct.each=ho,Ct.eachRight=po,Ct.first=du,Tf(Ct,function(){var n={};return zr(Ct,function(t,r){_c.call(Ct.prototype,r)||(n[r]=t)}),n}(),{chain:!1}),Ct.VERSION=G,u(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){Ct[n].placeholder=Ct}),u(["drop","take"],function(n,t){Rt.prototype[n]=function(r){var e=this.__filtered__;if(e&&!t)return new Rt(this);r=r===V?1:Mc(Ca(r),0);var i=this.clone();return e?i.__takeCount__=Bc(r,i.__takeCount__):i.__views__.push({size:Bc(r,mn),type:n+(i.__dir__<0?"Right":"")}),i},Rt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),u(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==vn||r==dn;Rt.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:Ai(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),u(["head","last"],function(n,t){var r="take"+(t?"Right":"");Rt.prototype[n]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Rt.prototype[n]=function(){return this.__filtered__?new Rt(this):this[r](1)}}),Rt.prototype.compact=function(){return this.filter(Mf)},Rt.prototype.find=function(n){return this.filter(n).head()},Rt.prototype.findLast=function(n){return this.reverse().find(n)},Rt.prototype.invokeMap=Do(function(n,t){return"function"==typeof n?new Rt(this):this.map(function(r){return Yr(r,n,t)})}),Rt.prototype.reject=function(n){return n=Ai(n,3),this.filter(function(t){return!n(t)})},Rt.prototype.slice=function(n,t){n=Ca(n);var r=this;return r.__filtered__&&(n>0||t<0)?new Rt(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==V&&(t=Ca(t),r=t<0?r.dropRight(-t):r.take(t-n)),r)},Rt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Rt.prototype.toArray=function(){return this.take(mn)},zr(Rt.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),i=Ct[e?"take"+("last"==t?"Right":""):t],u=e||/^find/.test(t);i&&(Ct.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,a=t instanceof Rt,f=o[0],c=a||tl(t),s=function(n){var t=i.apply(Ct,h([n],o));return e&&l?t[0]:t};c&&r&&"function"==typeof f&&1!=f.length&&(a=c=!1);var l=this.__chain__,p=!!this.__actions__.length,v=u&&!l,_=a&&!p;if(!u&&c){t=_?t:new Rt(this);var d=n.apply(t,o);return d.__actions__.push({func:Qu,args:[s],thisArg:V}),new Lt(d,l)}return v&&_?n.apply(this,o):(d=this.thru(s),v?e?d.value()[0]:d.value():d)})}),u(["pop","push","shift","sort","splice","unshift"],function(n){var t=lc[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);Ct.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var i=this.value();return t.apply(tl(i)?i:[],n)}return this[r](function(r){return t.apply(tl(r)?r:[],n)})}}),zr(Rt.prototype,function(n,t){var r=Ct[t];if(r){var e=r.name+"",i=ns[e]||(ns[e]=[]);i.push({name:t,func:r})}}),ns[ci(V,H).name]=[{name:"wrapper",func:V}],Rt.prototype.clone=St,Rt.prototype.reverse=Wt,Rt.prototype.value=Ut,Ct.prototype.at=Fs,Ct.prototype.chain=Hu,Ct.prototype.commit=Xu,Ct.prototype.next=no,Ct.prototype.plant=ro,Ct.prototype.reverse=eo,Ct.prototype.toJSON=Ct.prototype.valueOf=Ct.prototype.value=io,Ic&&(Ct.prototype[Ic]=to),Ct}var V,G="4.11.2",Z=200,K="Expected a function",Y="__lodash_hash_undefined__",J="__lodash_placeholder__",Q=1,H=2,X=4,nn=8,tn=16,rn=32,en=64,un=128,on=256,an=512,fn=1,cn=2,sn=30,ln="...",hn=150,pn=16,vn=1,_n=2,dn=3,gn=1/0,yn=9007199254740991,wn=1.7976931348623157e308,bn=NaN,mn=4294967295,xn=mn-1,jn=mn>>>1,kn="[object Arguments]",En="[object Array]",An="[object Boolean]",On="[object Date]",In="[object Error]",Cn="[object Function]",Nn="[object GeneratorFunction]",Ln="[object Map]",Rn="[object Number]",Sn="[object Object]",Wn="[object Promise]",Un="[object RegExp]",Dn="[object Set]",Fn="[object String]",zn="[object Symbol]",Mn="[object WeakMap]",Bn="[object WeakSet]",Pn="[object ArrayBuffer]",$n="[object DataView]",Tn="[object Float32Array]",qn="[object Float64Array]",Vn="[object Int8Array]",Gn="[object Int16Array]",Zn="[object Int32Array]",Kn="[object Uint8Array]",Yn="[object Uint8ClampedArray]",Jn="[object Uint16Array]",Qn="[object Uint32Array]",Hn=/\b__p \+= '';/g,Xn=/\b(__p \+=) '' \+/g,nt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,tt=/&(?:amp|lt|gt|quot|#39|#96);/g,rt=/[&<>"'`]/g,et=RegExp(tt.source),it=RegExp(rt.source),ut=/<%-([\s\S]+?)%>/g,ot=/<%([\s\S]+?)%>/g,at=/<%=([\s\S]+?)%>/g,ft=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ct=/^\w*$/,st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,lt=/[\\^$.*+?()[\]{}|]/g,ht=RegExp(lt.source),pt=/^\s+|\s+$/g,vt=/^\s+/,_t=/\s+$/,dt=/[a-zA-Z0-9]+/g,gt=/\\(\\)?/g,yt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,wt=/\w*$/,bt=/^0x/i,mt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,jt=/^\[object .+?Constructor\]$/,kt=/^0o[0-7]+$/i,Et=/^(?:0|[1-9]\d*)$/,At=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Ot=/($^)/,It=/['\n\r\u2028\u2029\\]/g,Ct="\\ud800-\\udfff",Nt="\\u0300-\\u036f\\ufe20-\\ufe23",Lt="\\u20d0-\\u20f0",Rt="\\u2700-\\u27bf",St="a-z\\xdf-\\xf6\\xf8-\\xff",Wt="\\xac\\xb1\\xd7\\xf7",Ut="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Dt="\\u2000-\\u206f",Ft=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",zt="A-Z\\xc0-\\xd6\\xd8-\\xde",Mt="\\ufe0e\\ufe0f",Bt=Wt+Ut+Dt+Ft,Pt="['’]",$t="["+Ct+"]",Tt="["+Bt+"]",qt="["+Nt+Lt+"]",Vt="\\d+",Gt="["+Rt+"]",Zt="["+St+"]",Kt="[^"+Ct+Bt+Vt+Rt+St+zt+"]",Yt="\\ud83c[\\udffb-\\udfff]",Jt="(?:"+qt+"|"+Yt+")",Qt="[^"+Ct+"]",Ht="(?:\\ud83c[\\udde6-\\uddff]){2}",Xt="[\\ud800-\\udbff][\\udc00-\\udfff]",nr="["+zt+"]",tr="\\u200d",rr="(?:"+Zt+"|"+Kt+")",er="(?:"+nr+"|"+Kt+")",ir="(?:"+Pt+"(?:d|ll|m|re|s|t|ve))?",ur="(?:"+Pt+"(?:D|LL|M|RE|S|T|VE))?",or=Jt+"?",ar="["+Mt+"]?",fr="(?:"+tr+"(?:"+[Qt,Ht,Xt].join("|")+")"+ar+or+")*",cr=ar+or+fr,sr="(?:"+[Gt,Ht,Xt].join("|")+")"+cr,lr="(?:"+[Qt+qt+"?",qt,Ht,Xt,$t].join("|")+")",hr=RegExp(Pt,"g"),pr=RegExp(qt,"g"),vr=RegExp(Yt+"(?="+Yt+")|"+lr+cr,"g"),_r=RegExp([nr+"?"+Zt+"+"+ir+"(?="+[Tt,nr,"$"].join("|")+")",er+"+"+ur+"(?="+[Tt,nr+rr,"$"].join("|")+")",nr+"?"+rr+"+"+ir,nr+"+"+ur,Vt,sr].join("|"),"g"),dr=RegExp("["+tr+Ct+Nt+Lt+Mt+"]"),gr=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,yr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","Reflect","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],wr=-1,br={};
+br[Tn]=br[qn]=br[Vn]=br[Gn]=br[Zn]=br[Kn]=br[Yn]=br[Jn]=br[Qn]=!0,br[kn]=br[En]=br[Pn]=br[An]=br[$n]=br[On]=br[In]=br[Cn]=br[Ln]=br[Rn]=br[Sn]=br[Un]=br[Dn]=br[Fn]=br[Mn]=!1;var mr={};mr[kn]=mr[En]=mr[Pn]=mr[$n]=mr[An]=mr[On]=mr[Tn]=mr[qn]=mr[Vn]=mr[Gn]=mr[Zn]=mr[Ln]=mr[Rn]=mr[Sn]=mr[Un]=mr[Dn]=mr[Fn]=mr[zn]=mr[Kn]=mr[Yn]=mr[Jn]=mr[Qn]=!0,mr[In]=mr[Cn]=mr[Mn]=!1;var xr={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},jr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},kr={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},Er={"function":!0,object:!0},Ar={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Or=parseFloat,Ir=parseInt,Cr=Er[typeof exports]&&exports&&!exports.nodeType?exports:V,Nr=Er[typeof module]&&module&&!module.nodeType?module:V,Lr=Nr&&Nr.exports===Cr?Cr:V,Rr=N(Cr&&Nr&&"object"==typeof global&&global),Sr=N(Er[typeof self]&&self),Wr=N(Er[typeof window]&&window),Ur=N(Er[typeof this]&&this),Dr=Rr||Wr!==(Ur&&Ur.window)&&Wr||Sr||Ur||Function("return this")(),Fr=q();(Wr||Sr||{})._=Fr,"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return Fr}):Cr&&Nr?(Lr&&((Nr.exports=Fr)._=Fr),Cr._=Fr):Dr._=Fr}).call(this),function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.graphlib=n()}}(function(){return function n(t,r,e){function i(o,a){if(!r[o]){if(!t[o]){var f="function"==typeof require&&require;if(!a&&f)return f(o,!0);if(u)return u(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var s=r[o]={exports:{}};t[o][0].call(s.exports,function(n){var r=t[o][1][n];return i(r?r:n)},s,s.exports,n,t,r,e)}return r[o].exports}for(var u="function"==typeof require&&require,o=0;o<e.length;o++)i(e[o]);return i}({1:[function(n,t,r){var e=n("./lib");t.exports={Graph:e.Graph,json:n("./lib/json"),alg:n("./lib/alg"),version:e.version}},{"./lib":17,"./lib/alg":8,"./lib/json":18}],2:[function(n,t,r){function e(n){function t(u){i.has(e,u)||(e[u]=!0,r.push(u),i.each(n.successors(u),t),i.each(n.predecessors(u),t))}var r,e={},u=[];return i.each(n.nodes(),function(n){r=[],t(n),r.length&&u.push(r)}),u}var i=n("../lodash");t.exports=e},{"../lodash":19}],3:[function(n,t,r){function e(n,t,r){u.isArray(t)||(t=[t]);var e=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],a={};return u.each(t,function(t){if(!n.hasNode(t))throw new Error("Graph does not have node: "+t);i(n,t,"post"===r,a,e,o)}),o}function i(n,t,r,e,o,a){u.has(e,t)||(e[t]=!0,r||a.push(t),u.each(o(t),function(t){i(n,t,r,e,o,a)}),r&&a.push(t))}var u=n("../lodash");t.exports=e},{"../lodash":19}],4:[function(n,t,r){function e(n,t,r){return u.transform(n.nodes(),function(e,u){e[u]=i(n,u,t,r)},{})}var i=n("./dijkstra"),u=n("../lodash");t.exports=e},{"../lodash":19,"./dijkstra":5}],5:[function(n,t,r){function e(n,t,r,e){return i(n,String(t),r||a,e||function(t){return n.outEdges(t)})}function i(n,t,r,e){var i,u,a={},f=new o,c=function(n){var t=n.v!==i?n.v:n.w,e=a[t],o=r(n),c=u.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+n+" Weight: "+o);c<e.distance&&(e.distance=c,e.predecessor=i,f.decrease(t,c))};for(n.nodes().forEach(function(n){var r=n===t?0:Number.POSITIVE_INFINITY;a[n]={distance:r},f.add(n,r)});f.size()>0&&(i=f.removeMin(),u=a[i],u.distance!==Number.POSITIVE_INFINITY);)e(i).forEach(c);return a}var u=n("../lodash"),o=n("../data/priority-queue");t.exports=e;var a=u.constant(1)},{"../data/priority-queue":15,"../lodash":19}],6:[function(n,t,r){function e(n){return i.filter(u(n),function(t){return t.length>1||1===t.length&&n.hasEdge(t[0],t[0])})}var i=n("../lodash"),u=n("./tarjan");t.exports=e},{"../lodash":19,"./tarjan":13}],7:[function(n,t,r){function e(n,t,r){return i(n,t||o,r||function(t){return n.outEdges(t)})}function i(n,t,r){var e={},i=n.nodes();return i.forEach(function(n){e[n]={},e[n][n]={distance:0},i.forEach(function(t){n!==t&&(e[n][t]={distance:Number.POSITIVE_INFINITY})}),r(n).forEach(function(r){var i=r.v===n?r.w:r.v,u=t(r);e[n][i]={distance:u,predecessor:n}})}),i.forEach(function(n){var t=e[n];i.forEach(function(r){var u=e[r];i.forEach(function(r){var e=u[n],i=t[r],o=u[r],a=e.distance+i.distance;a<o.distance&&(o.distance=a,o.predecessor=i.predecessor)})})}),e}var u=n("../lodash");t.exports=e;var o=u.constant(1)},{"../lodash":19}],8:[function(n,t,r){t.exports={components:n("./components"),dijkstra:n("./dijkstra"),dijkstraAll:n("./dijkstra-all"),findCycles:n("./find-cycles"),floydWarshall:n("./floyd-warshall"),isAcyclic:n("./is-acyclic"),postorder:n("./postorder"),preorder:n("./preorder"),prim:n("./prim"),tarjan:n("./tarjan"),topsort:n("./topsort")}},{"./components":2,"./dijkstra":5,"./dijkstra-all":4,"./find-cycles":6,"./floyd-warshall":7,"./is-acyclic":9,"./postorder":10,"./preorder":11,"./prim":12,"./tarjan":13,"./topsort":14}],9:[function(n,t,r){function e(n){try{i(n)}catch(t){if(t instanceof i.CycleException)return!1;throw t}return!0}var i=n("./topsort");t.exports=e},{"./topsort":14}],10:[function(n,t,r){function e(n,t){return i(n,t,"post")}var i=n("./dfs");t.exports=e},{"./dfs":3}],11:[function(n,t,r){function e(n,t){return i(n,t,"pre")}var i=n("./dfs");t.exports=e},{"./dfs":3}],12:[function(n,t,r){function e(n,t){function r(n){var r=n.v===e?n.w:n.v,i=c.priority(r);if(void 0!==i){var u=t(n);u<i&&(f[r]=e,c.decrease(r,u))}}var e,a=new u,f={},c=new o;if(0===n.nodeCount())return a;i.each(n.nodes(),function(n){c.add(n,Number.POSITIVE_INFINITY),a.setNode(n)}),c.decrease(n.nodes()[0],0);for(var s=!1;c.size()>0;){if(e=c.removeMin(),i.has(f,e))a.setEdge(e,f[e]);else{if(s)throw new Error("Input graph is not connected: "+n);s=!0}n.nodeEdges(e).forEach(r)}return a}var i=n("../lodash"),u=n("../graph"),o=n("../data/priority-queue");t.exports=e},{"../data/priority-queue":15,"../graph":16,"../lodash":19}],13:[function(n,t,r){function e(n){function t(a){var f=u[a]={onStack:!0,lowlink:r,index:r++};if(e.push(a),n.successors(a).forEach(function(n){i.has(u,n)?u[n].onStack&&(f.lowlink=Math.min(f.lowlink,u[n].index)):(t(n),f.lowlink=Math.min(f.lowlink,u[n].lowlink))}),f.lowlink===f.index){var c,s=[];do c=e.pop(),u[c].onStack=!1,s.push(c);while(a!==c);o.push(s)}}var r=0,e=[],u={},o=[];return n.nodes().forEach(function(n){i.has(u,n)||t(n)}),o}var i=n("../lodash");t.exports=e},{"../lodash":19}],14:[function(n,t,r){function e(n){function t(a){if(u.has(e,a))throw new i;u.has(r,a)||(e[a]=!0,r[a]=!0,u.each(n.predecessors(a),t),delete e[a],o.push(a))}var r={},e={},o=[];if(u.each(n.sinks(),t),u.size(r)!==n.nodeCount())throw new i;return o}function i(){}var u=n("../lodash");t.exports=e,e.CycleException=i},{"../lodash":19}],15:[function(n,t,r){function e(){this._arr=[],this._keyIndices={}}var i=n("../lodash");t.exports=e,e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return i.has(this._keyIndices,n)},e.prototype.priority=function(n){var t=this._keyIndices[n];if(void 0!==t)return this._arr[t].priority},e.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!i.has(r,n)){var e=this._arr,u=e.length;return r[n]=u,e.push({key:n,priority:t}),this._decrease(u),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,t){var r=this._keyIndices[n];if(t>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)},e.prototype._heapify=function(n){var t=this._arr,r=2*n,e=r+1,i=n;r<t.length&&(i=t[r].priority<t[i].priority?r:i,e<t.length&&(i=t[e].priority<t[i].priority?e:i),i!==n&&(this._swap(n,i),this._heapify(i)))},e.prototype._decrease=function(n){for(var t,r=this._arr,e=r[n].priority;0!==n&&(t=n>>1,!(r[t].priority<e));)this._swap(n,t),n=t},e.prototype._swap=function(n,t){var r=this._arr,e=this._keyIndices,i=r[n],u=r[t];r[n]=u,r[t]=i,e[u.key]=n,e[i.key]=t}},{"../lodash":19}],16:[function(n,t,r){"use strict";function e(n){this._isDirected=!c.has(n,"directed")||n.directed,this._isMultigraph=!!c.has(n,"multigraph")&&n.multigraph,this._isCompound=!!c.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=c.constant(void 0),this._defaultEdgeLabelFn=c.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[l]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(n,t){n[t]?n[t]++:n[t]=1}function u(n,t){--n[t]||delete n[t]}function o(n,t,r,e){var i=""+t,u=""+r;if(!n&&i>u){var o=i;i=u,u=o}return i+h+u+h+(c.isUndefined(e)?s:e)}function a(n,t,r,e){var i=""+t,u=""+r;if(!n&&i>u){var o=i;i=u,u=o}var a={v:i,w:u};return e&&(a.name=e),a}function f(n,t){return o(n,t.v,t.w,t.name)}var c=n("./lodash");t.exports=e;var s="\0",l="\0",h="";e.prototype._nodeCount=0,e.prototype._edgeCount=0,e.prototype.isDirected=function(){return this._isDirected},e.prototype.isMultigraph=function(){return this._isMultigraph},e.prototype.isCompound=function(){return this._isCompound},e.prototype.setGraph=function(n){return this._label=n,this},e.prototype.graph=function(){return this._label},e.prototype.setDefaultNodeLabel=function(n){return c.isFunction(n)||(n=c.constant(n)),this._defaultNodeLabelFn=n,this},e.prototype.nodeCount=function(){return this._nodeCount},e.prototype.nodes=function(){return c.keys(this._nodes)},e.prototype.sources=function(){return c.filter(this.nodes(),c.bind(function(n){return c.isEmpty(this._in[n])},this))},e.prototype.sinks=function(){return c.filter(this.nodes(),c.bind(function(n){return c.isEmpty(this._out[n])},this))},e.prototype.setNodes=function(n,t){var r=arguments;return c.each(n,c.bind(function(n){r.length>1?this.setNode(n,t):this.setNode(n)},this)),this},e.prototype.setNode=function(n,t){return c.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=t),this):(this._nodes[n]=arguments.length>1?t:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=l,this._children[n]={},this._children[l][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},e.prototype.node=function(n){return this._nodes[n]},e.prototype.hasNode=function(n){return c.has(this._nodes,n)},e.prototype.removeNode=function(n){var t=this;if(c.has(this._nodes,n)){var r=function(n){t.removeEdge(t._edgeObjs[n])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],c.each(this.children(n),c.bind(function(n){this.setParent(n)},this)),delete this._children[n]),c.each(c.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],c.each(c.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},e.prototype.setParent=function(n,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(c.isUndefined(t))t=l;else{t+="";for(var r=t;!c.isUndefined(r);r=this.parent(r))if(r===n)throw new Error("Setting "+t+" as parent of "+n+" would create create a cycle");this.setNode(t)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=t,this._children[t][n]=!0,this},e.prototype._removeFromParentsChildList=function(n){delete this._children[this._parent[n]][n]},e.prototype.parent=function(n){if(this._isCompound){var t=this._parent[n];if(t!==l)return t}},e.prototype.children=function(n){if(c.isUndefined(n)&&(n=l),this._isCompound){var t=this._children[n];if(t)return c.keys(t)}else{if(n===l)return this.nodes();if(this.hasNode(n))return[]}},e.prototype.predecessors=function(n){var t=this._preds[n];if(t)return c.keys(t)},e.prototype.successors=function(n){var t=this._sucs[n];if(t)return c.keys(t)},e.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return c.union(t,this.successors(n))},e.prototype.filterNodes=function(n){function t(n){var u=e.parent(n);return void 0===u||r.hasNode(u)?(i[n]=u,u):u in i?i[u]:t(u)}var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph()),c.each(this._nodes,c.bind(function(t,e){n(e)&&r.setNode(e,t)},this)),c.each(this._edgeObjs,c.bind(function(n){r.hasNode(n.v)&&r.hasNode(n.w)&&r.setEdge(n,this.edge(n))},this));var e=this,i={};return this._isCompound&&c.each(r.nodes(),function(n){r.setParent(n,t(n))}),r},e.prototype.setDefaultEdgeLabel=function(n){return c.isFunction(n)||(n=c.constant(n)),this._defaultEdgeLabelFn=n,this},e.prototype.edgeCount=function(){return this._edgeCount},e.prototype.edges=function(){return c.values(this._edgeObjs)},e.prototype.setPath=function(n,t){var r=this,e=arguments;return c.reduce(n,function(n,i){return e.length>1?r.setEdge(n,i,t):r.setEdge(n,i),i}),this},e.prototype.setEdge=function(){var n,t,r,e,u=!1,f=arguments[0];"object"==typeof f&&null!==f&&"v"in f?(n=f.v,t=f.w,r=f.name,2===arguments.length&&(e=arguments[1],u=!0)):(n=f,t=arguments[1],r=arguments[3],arguments.length>2&&(e=arguments[2],u=!0)),n=""+n,t=""+t,c.isUndefined(r)||(r=""+r);var s=o(this._isDirected,n,t,r);if(c.has(this._edgeLabels,s))return u&&(this._edgeLabels[s]=e),this;if(!c.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[s]=u?e:this._defaultEdgeLabelFn(n,t,r);var l=a(this._isDirected,n,t,r);return n=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][s]=l,this._out[n][s]=l,this._edgeCount++,this},e.prototype.edge=function(n,t,r){var e=1===arguments.length?f(this._isDirected,arguments[0]):o(this._isDirected,n,t,r);return this._edgeLabels[e]},e.prototype.hasEdge=function(n,t,r){var e=1===arguments.length?f(this._isDirected,arguments[0]):o(this._isDirected,n,t,r);return c.has(this._edgeLabels,e)},e.prototype.removeEdge=function(n,t,r){var e=1===arguments.length?f(this._isDirected,arguments[0]):o(this._isDirected,n,t,r),i=this._edgeObjs[e];return i&&(n=i.v,t=i.w,delete this._edgeLabels[e],delete this._edgeObjs[e],u(this._preds[t],n),u(this._sucs[n],t),delete this._in[t][e],delete this._out[n][e],this._edgeCount--),this},e.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var e=c.values(r);return t?c.filter(e,function(n){return n.v===t}):e}},e.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var e=c.values(r);return t?c.filter(e,function(n){return n.w===t}):e}},e.prototype.nodeEdges=function(n,t){var r=this.inEdges(n,t);if(r)return r.concat(this.outEdges(n,t))}},{"./lodash":19}],17:[function(n,t,r){t.exports={Graph:n("./graph"),version:n("./version")}},{"./graph":16,"./version":20}],18:[function(n,t,r){function e(n){var t={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:i(n),edges:u(n)};return a.isUndefined(n.graph())||(t.value=a.clone(n.graph())),t}function i(n){return a.map(n.nodes(),function(t){var r=n.node(t),e=n.parent(t),i={v:t};return a.isUndefined(r)||(i.value=r),a.isUndefined(e)||(i.parent=e),i})}function u(n){return a.map(n.edges(),function(t){var r=n.edge(t),e={v:t.v,w:t.w};return a.isUndefined(t.name)||(e.name=t.name),a.isUndefined(r)||(e.value=r),e})}function o(n){var t=new f(n.options).setGraph(n.value);return a.each(n.nodes,function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),a.each(n.edges,function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var a=n("./lodash"),f=n("./graph");t.exports={write:e,read:o}},{"./graph":16,"./lodash":19}],19:[function(n,t,r){var e;if("function"==typeof n)try{e=n("lodash")}catch(i){}e||(e=window._),t.exports=e},{lodash:void 0}],20:[function(n,t,r){t.exports="2.1.1"},{}]},{},[1])(1)});
\ No newline at end of file