mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-14 03:07:57 +01:00
cb2ca74a20
Core-js, web2d and mindplot working baseline * fix .eslintignore remove Raphael dependency * Fix to avoid crashes in _plotPrediction whitout Raphael * Fix minplot basic code inspections * Fix last inspections errors * Inital refactor copying files * Clean up. * Fix web2d cyclic dependencies remove only-warn eslint plugin set import/no-extraneous-dependencies to warn (incorrectly complaining about root package) * Fix web2d Point references (no need to assign it to core) Fix web2d imports in mindplot and update Point refs * Merge 'feature/mindplot_tests' into web2d-coreJS-solutions * mindplot fixes and add viewmode.html playground setup playground config to run the map-render examples fix mindplot components export mootools Static was not working so refactored it fix some references to _peer fix messages __bundle undefined add web2d missing export: Image downgrade cypress to avoid SIGSEGV error Approved-by: Paulo Veiga
14 lines
18 KiB
JavaScript
14 lines
18 KiB
JavaScript
// Underscore.js 1.6.0
|
|
// http://underscorejs.org
|
|
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
// Underscore may be freely distributed under the MIT license.
|
|
(function () {
|
|
const n = this; const t = n._; const r = {}; const e = Array.prototype; const u = Object.prototype; const i = Function.prototype; const a = e.push; const o = e.slice; const c = e.concat; const l = u.toString; const f = u.hasOwnProperty; const s = e.forEach; const p = e.map; const h = e.reduce; const v = e.reduceRight; const g = e.filter; const d = e.every; const m = e.some; const y = e.indexOf; const b = e.lastIndexOf; const x = Array.isArray; const w = Object.keys; const _ = i.bind; var j = function (n) { return n instanceof j ? n : this instanceof j ? void (this._wrapped = n) : new j(n); }; typeof exports !== 'undefined' ? (typeof module !== 'undefined' && module.exports && (exports = module.exports = j), exports._ = j) : n._ = j, j.VERSION = '1.6.0'; const A = j.each = j.forEach = function (n, t, e) { if (n == null) return n; if (s && n.forEach === s)n.forEach(t, e); else if (n.length === +n.length) { for (var u = 0, i = n.length; i > u; u++) if (t.call(e, n[u], u, n) === r) return; } else for (var a = j.keys(n), u = 0, i = a.length; i > u; u++) if (t.call(e, n[a[u]], a[u], n) === r) return; return n; }; j.map = j.collect = function (n, t, r) { const e = []; return n == null ? e : p && n.map === p ? n.map(t, r) : (A(n, (n, u, i) => { e.push(t.call(r, n, u, i)); }), e); }; const O = 'Reduce of empty array with no initial value'; j.reduce = j.foldl = j.inject = function (n, t, r, e) { let u = arguments.length > 2; if (n == null && (n = []), h && n.reduce === h) return e && (t = j.bind(t, e)), u ? n.reduce(t, r) : n.reduce(t); if (A(n, (n, i, a) => { u ? r = t.call(e, r, n, i, a) : (r = n, u = !0); }), !u) throw new TypeError(O); return r; }, j.reduceRight = j.foldr = function (n, t, r, e) { let u = arguments.length > 2; if (n == null && (n = []), v && n.reduceRight === v) return e && (t = j.bind(t, e)), u ? n.reduceRight(t, r) : n.reduceRight(t); let i = n.length; if (i !== +i) { var a = j.keys(n); i = a.length; } if (A(n, (o, c, l) => { c = a ? a[--i] : --i, u ? r = t.call(e, r, n[c], c, l) : (r = n[c], u = !0); }), !u) throw new TypeError(O); return r; }, j.find = j.detect = function (n, t, r) { let e; return k(n, (n, u, i) => (t.call(r, n, u, i) ? (e = n, !0) : void 0)), e; }, j.filter = j.select = function (n, t, r) { const e = []; return n == null ? e : g && n.filter === g ? n.filter(t, r) : (A(n, (n, u, i) => { t.call(r, n, u, i) && e.push(n); }), e); }, j.reject = function (n, t, r) { return j.filter(n, (n, e, u) => !t.call(r, n, e, u), r); }, j.every = j.all = function (n, t, e) { t || (t = j.identity); let u = !0; return n == null ? u : d && n.every === d ? n.every(t, e) : (A(n, (n, i, a) => ((u = u && t.call(e, n, i, a)) ? void 0 : r)), !!u); }; var k = j.some = j.any = function (n, t, e) { t || (t = j.identity); let u = !1; return n == null ? u : m && n.some === m ? n.some(t, e) : (A(n, (n, i, a) => (u || (u = t.call(e, n, i, a)) ? r : void 0)), !!u); }; j.contains = j.include = function (n, t) { return n == null ? !1 : y && n.indexOf === y ? n.indexOf(t) != -1 : k(n, (n) => n === t); }, j.invoke = function (n, t) { const r = o.call(arguments, 2); const e = j.isFunction(t); return j.map(n, (n) => (e ? t : n[t]).apply(n, r)); }, j.pluck = function (n, t) { return j.map(n, j.property(t)); }, j.where = function (n, t) { return j.filter(n, j.matches(t)); }, j.findWhere = function (n, t) { return j.find(n, j.matches(t)); }, j.max = function (n, t, r) { if (!t && j.isArray(n) && n[0] === +n[0] && n.length < 65535) return Math.max.apply(Math, n); let e = -1 / 0; let u = -1 / 0; return A(n, (n, i, a) => { const o = t ? t.call(r, n, i, a) : n; o > u && (e = n, u = o); }), e; }, j.min = function (n, t, r) { if (!t && j.isArray(n) && n[0] === +n[0] && n.length < 65535) return Math.min.apply(Math, n); let e = 1 / 0; let u = 1 / 0; return A(n, (n, i, a) => { const o = t ? t.call(r, n, i, a) : n; u > o && (e = n, u = o); }), e; }, j.shuffle = function (n) { let t; let r = 0; const e = []; return A(n, (n) => { t = j.random(r++), e[r - 1] = e[t], e[t] = n; }), e; }, j.sample = function (n, t, r) { return t == null || r ? (n.length !== +n.length && (n = j.values(n)), n[j.random(n.length - 1)]) : j.shuffle(n).slice(0, Math.max(0, t)); }; const E = function (n) { return n == null ? j.identity : j.isFunction(n) ? n : j.property(n); }; j.sortBy = function (n, t, r) { return t = E(t), j.pluck(j.map(n, (n, e, u) => ({ value: n, index: e, criteria: t.call(r, n, e, u) })).sort((n, t) => { const r = n.criteria; const e = t.criteria; if (r !== e) { if (r > e || r === void 0) return 1; if (e > r || e === void 0) return -1; } return n.index - t.index; }), 'value'); }; const F = function (n) { return function (t, r, e) { const u = {}; return r = E(r), A(t, (i, a) => { const o = r.call(e, i, a, t); n(u, o, i); }), u; }; }; j.groupBy = F((n, t, r) => { j.has(n, t) ? n[t].push(r) : n[t] = [r]; }), j.indexBy = F((n, t, r) => { n[t] = r; }), j.countBy = F((n, t) => { j.has(n, t) ? n[t]++ : n[t] = 1; }), j.sortedIndex = function (n, t, r, e) { r = E(r); for (var u = r.call(e, t), i = 0, a = n.length; a > i;) { const o = i + a >>> 1; r.call(e, n[o]) < u ? i = o + 1 : a = o; } return i; }, j.toArray = function (n) { return n ? j.isArray(n) ? o.call(n) : n.length === +n.length ? j.map(n, j.identity) : j.values(n) : []; }, j.size = function (n) { return n == null ? 0 : n.length === +n.length ? n.length : j.keys(n).length; }, j.first = j.head = j.take = function (n, t, r) { return n == null ? void 0 : t == null || r ? n[0] : t < 0 ? [] : o.call(n, 0, t); }, j.initial = function (n, t, r) { return o.call(n, 0, n.length - (t == null || r ? 1 : t)); }, j.last = function (n, t, r) { return n == null ? void 0 : t == null || r ? n[n.length - 1] : o.call(n, Math.max(n.length - t, 0)); }, j.rest = j.tail = j.drop = function (n, t, r) { return o.call(n, t == null || r ? 1 : t); }, j.compact = function (n) { return j.filter(n, j.identity); }; var M = function (n, t, r) { return t && j.every(n, j.isArray) ? c.apply(r, n) : (A(n, (n) => { j.isArray(n) || j.isArguments(n) ? t ? a.apply(r, n) : M(n, t, r) : r.push(n); }), r); }; j.flatten = function (n, t) { return M(n, t, []); }, j.without = function (n) { return j.difference(n, o.call(arguments, 1)); }, j.partition = function (n, t) { const r = []; const e = []; return A(n, (n) => { (t(n) ? r : e).push(n); }), [r, e]; }, j.uniq = j.unique = function (n, t, r, e) { j.isFunction(t) && (e = r, r = t, t = !1); const u = r ? j.map(n, r, e) : n; const i = []; const a = []; return A(u, (r, e) => { (t ? e && a[a.length - 1] === r : j.contains(a, r)) || (a.push(r), i.push(n[e])); }), i; }, j.union = function () { return j.uniq(j.flatten(arguments, !0)); }, j.intersection = function (n) { const t = o.call(arguments, 1); return j.filter(j.uniq(n), (n) => j.every(t, (t) => j.contains(t, n))); }, j.difference = function (n) { const t = c.apply(e, o.call(arguments, 1)); return j.filter(n, (n) => !j.contains(t, n)); }, j.zip = function () { for (var n = j.max(j.pluck(arguments, 'length').concat(0)), t = new Array(n), r = 0; n > r; r++)t[r] = j.pluck(arguments, `${r}`); return t; }, j.object = function (n, t) { if (n == null) return {}; for (var r = {}, e = 0, u = n.length; u > e; e++)t ? r[n[e]] = t[e] : r[n[e][0]] = n[e][1]; return r; }, j.indexOf = function (n, t, r) { if (n == null) return -1; let e = 0; const u = n.length; if (r) { if (typeof r !== 'number') return e = j.sortedIndex(n, t), n[e] === t ? e : -1; e = r < 0 ? Math.max(0, u + r) : r; } if (y && n.indexOf === y) return n.indexOf(t, r); for (;u > e; e++) if (n[e] === t) return e; return -1; }, j.lastIndexOf = function (n, t, r) { if (n == null) return -1; const e = r != null; if (b && n.lastIndexOf === b) return e ? n.lastIndexOf(t, r) : n.lastIndexOf(t); for (let u = e ? r : n.length; u--;) if (n[u] === t) return u; return -1; }, j.range = function (n, t, r) { arguments.length <= 1 && (t = n || 0, n = 0), r = arguments[2] || 1; for (var e = Math.max(Math.ceil((t - n) / r), 0), u = 0, i = new Array(e); e > u;)i[u++] = n, n += r; return i; }; const R = function () {}; j.bind = function (n, t) { let r; let e; if (_ && n.bind === _) return _.apply(n, o.call(arguments, 1)); if (!j.isFunction(n)) throw new TypeError(); return r = o.call(arguments, 2), e = function () { if (!(this instanceof e)) return n.apply(t, r.concat(o.call(arguments))); R.prototype = n.prototype; const u = new R(); R.prototype = null; const i = n.apply(u, r.concat(o.call(arguments))); return Object(i) === i ? i : u; }; }, j.partial = function (n) { const t = o.call(arguments, 1); return function () { for (var r = 0, e = t.slice(), u = 0, i = e.length; i > u; u++)e[u] === j && (e[u] = arguments[r++]); for (;r < arguments.length;)e.push(arguments[r++]); return n.apply(this, e); }; }, j.bindAll = function (n) { const t = o.call(arguments, 1); if (t.length === 0) throw new Error('bindAll must be passed function names'); return A(t, (t) => { n[t] = j.bind(n[t], n); }), n; }, j.memoize = function (n, t) { const r = {}; return t || (t = j.identity), function () { const e = t.apply(this, arguments); return j.has(r, e) ? r[e] : r[e] = n.apply(this, arguments); }; }, j.delay = function (n, t) { const r = o.call(arguments, 2); return setTimeout(() => n.apply(null, r), t); }, j.defer = function (n) { return j.delay.apply(j, [n, 1].concat(o.call(arguments, 1))); }, j.throttle = function (n, t, r) { let e; let u; let i; let a = null; let o = 0; r || (r = {}); const c = function () { o = r.leading === !1 ? 0 : j.now(), a = null, i = n.apply(e, u), e = u = null; }; return function () { const l = j.now(); o || r.leading !== !1 || (o = l); const f = t - (l - o); return e = this, u = arguments, f <= 0 ? (clearTimeout(a), a = null, o = l, i = n.apply(e, u), e = u = null) : a || r.trailing === !1 || (a = setTimeout(c, f)), i; }; }, j.debounce = function (n, t, r) { let e; let u; let i; let a; let o; var c = function () { const l = j.now() - a; t > l ? e = setTimeout(c, t - l) : (e = null, r || (o = n.apply(i, u), i = u = null)); }; return function () { i = this, u = arguments, a = j.now(); const l = r && !e; return e || (e = setTimeout(c, t)), l && (o = n.apply(i, u), i = u = null), o; }; }, j.once = function (n) { let t; let r = !1; return function () { return r ? t : (r = !0, t = n.apply(this, arguments), n = null, t); }; }, j.wrap = function (n, t) { return j.partial(t, n); }, j.compose = function () { const n = arguments; return function () { for (var t = arguments, r = n.length - 1; r >= 0; r--)t = [n[r].apply(this, t)]; return t[0]; }; }, j.after = function (n, t) { return function () { return --n < 1 ? t.apply(this, arguments) : void 0; }; }, j.keys = function (n) { if (!j.isObject(n)) return []; if (w) return w(n); const t = []; for (const r in n)j.has(n, r) && t.push(r); return t; }, j.values = function (n) { for (var t = j.keys(n), r = t.length, e = new Array(r), u = 0; r > u; u++)e[u] = n[t[u]]; return e; }, j.pairs = function (n) { for (var t = j.keys(n), r = t.length, e = new Array(r), u = 0; r > u; u++)e[u] = [t[u], n[t[u]]]; return e; }, j.invert = function (n) { for (var t = {}, r = j.keys(n), e = 0, u = r.length; u > e; e++)t[n[r[e]]] = r[e]; return t; }, j.functions = j.methods = function (n) { const t = []; for (const r in n)j.isFunction(n[r]) && t.push(r); return t.sort(); }, j.extend = function (n) { return A(o.call(arguments, 1), (t) => { if (t) for (const r in t)n[r] = t[r]; }), n; }, j.pick = function (n) { const t = {}; const r = c.apply(e, o.call(arguments, 1)); return A(r, (r) => { r in n && (t[r] = n[r]); }), t; }, j.omit = function (n) { const t = {}; const r = c.apply(e, o.call(arguments, 1)); for (const u in n)j.contains(r, u) || (t[u] = n[u]); return t; }, j.defaults = function (n) { return A(o.call(arguments, 1), (t) => { if (t) for (const r in t)n[r] === void 0 && (n[r] = t[r]); }), n; }, j.clone = function (n) { return j.isObject(n) ? j.isArray(n) ? n.slice() : j.extend({}, n) : n; }, j.tap = function (n, t) { return t(n), n; }; var S = function (n, t, r, e) { if (n === t) return n !== 0 || 1 / n == 1 / t; if (n == null || t == null) return n === t; n instanceof j && (n = n._wrapped), t instanceof j && (t = t._wrapped); const u = l.call(n); if (u != l.call(t)) return !1; switch (u) { case '[object String]': return n == String(t); case '[object Number]': return n != +n ? t != +t : n == 0 ? 1 / n == 1 / t : n == +t; case '[object Date]': case '[object Boolean]': return +n == +t; case '[object RegExp]': return n.source == t.source && n.global == t.global && n.multiline == t.multiline && n.ignoreCase == t.ignoreCase; } if (typeof n !== 'object' || typeof t !== 'object') return !1; for (let i = r.length; i--;) if (r[i] == n) return e[i] == t; const a = n.constructor; const o = t.constructor; if (a !== o && !(j.isFunction(a) && a instanceof a && j.isFunction(o) && o instanceof o) && 'constructor' in n && 'constructor' in t) return !1; r.push(n), e.push(t); let c = 0; let f = !0; if (u == '[object Array]') { if (c = n.length, f = c == t.length) for (;c-- && (f = S(n[c], t[c], r, e));); } else { for (var s in n) if (j.has(n, s) && (c++, !(f = j.has(t, s) && S(n[s], t[s], r, e)))) break; if (f) { for (s in t) if (j.has(t, s) && !c--) break; f = !c; } } return r.pop(), e.pop(), f; }; j.isEqual = function (n, t) { return S(n, t, [], []); }, j.isEmpty = function (n) { if (n == null) return !0; if (j.isArray(n) || j.isString(n)) return n.length === 0; for (const t in n) if (j.has(n, t)) return !1; return !0; }, j.isElement = function (n) { return !(!n || n.nodeType !== 1); }, j.isArray = x || function (n) { return l.call(n) == '[object Array]'; }, j.isObject = function (n) { return n === Object(n); }, A(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], (n) => { j[`is${n}`] = function (t) { return l.call(t) == `[object ${n}]`; }; }), j.isArguments(arguments) || (j.isArguments = function (n) { return !(!n || !j.has(n, 'callee')); }), typeof /./ !== 'function' && (j.isFunction = function (n) { return typeof n === 'function'; }), j.isFinite = function (n) { return isFinite(n) && !isNaN(parseFloat(n)); }, j.isNaN = function (n) { return j.isNumber(n) && n != +n; }, j.isBoolean = function (n) { return n === !0 || n === !1 || l.call(n) == '[object Boolean]'; }, j.isNull = function (n) { return n === null; }, j.isUndefined = function (n) { return n === void 0; }, j.has = function (n, t) { return f.call(n, t); }, j.noConflict = function () { return n._ = t, this; }, j.identity = function (n) { return n; }, j.constant = function (n) { return function () { return n; }; }, j.property = function (n) { return function (t) { return t[n]; }; }, j.matches = function (n) { return function (t) { if (t === n) return !0; for (const r in n) if (n[r] !== t[r]) return !1; return !0; }; }, j.times = function (n, t, r) { for (var e = Array(Math.max(0, n)), u = 0; n > u; u++)e[u] = t.call(r, u); return e; }, j.random = function (n, t) { return t == null && (t = n, n = 0), n + Math.floor(Math.random() * (t - n + 1)); }, j.now = Date.now || function () { return (new Date()).getTime(); }; const T = {
|
|
escape: {
|
|
'&': '&', '<': '<', '>': '>', '"': '"', "'": ''',
|
|
},
|
|
}; T.unescape = j.invert(T.escape); const I = { escape: new RegExp(`[${j.keys(T.escape).join('')}]`, 'g'), unescape: new RegExp(`(${j.keys(T.unescape).join('|')})`, 'g') }; j.each(['escape', 'unescape'], (n) => { j[n] = function (t) { return t == null ? '' : (`${t}`).replace(I[n], (t) => T[n][t]); }; }), j.result = function (n, t) { if (n == null) return void 0; const r = n[t]; return j.isFunction(r) ? r.call(n) : r; }, j.mixin = function (n) { A(j.functions(n), (t) => { const r = j[t] = n[t]; j.prototype[t] = function () { const n = [this._wrapped]; return a.apply(n, arguments), z.call(this, r.apply(j, n)); }; }); }; let N = 0; j.uniqueId = function (n) { const t = `${++N}`; return n ? n + t : t; }, j.templateSettings = { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g }; const q = /(.)^/; const B = {
|
|
"'": "'", '\\': '\\', '\r': 'r', '\n': 'n', ' ': 't', '\u2028': 'u2028', '\u2029': 'u2029',
|
|
}; const D = /\\|'|\r|\n|\t|\u2028|\u2029/g; j.template = function (n, t, r) { let e; r = j.defaults({}, r, j.templateSettings); const u = new RegExp(`${[(r.escape || q).source, (r.interpolate || q).source, (r.evaluate || q).source].join('|')}|$`, 'g'); let i = 0; let a = "__p+='"; n.replace(u, (t, r, e, u, o) => (a += n.slice(i, o).replace(D, (n) => `\\${B[n]}`), r && (a += `'+\n((__t=(${r}))==null?'':_.escape(__t))+\n'`), e && (a += `'+\n((__t=(${e}))==null?'':__t)+\n'`), u && (a += `';\n${u}\n__p+='`), i = o + t.length, t)), a += "';\n", r.variable || (a = `with(obj||{}){\n${a}}\n`), a = `${"var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n"}${a}return __p;\n`; try { e = new Function(r.variable || 'obj', '_', a); } catch (o) { throw o.source = a, o; } if (t) return e(t, j); const c = function (n) { return e.call(this, n, j); }; return c.source = `function(${r.variable || 'obj'}){\n${a}}`, c; }, j.chain = function (n) { return j(n).chain(); }; var z = function (n) { return this._chain ? j(n).chain() : n; }; j.mixin(j), A(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], (n) => { const t = e[n]; j.prototype[n] = function () { const r = this._wrapped; return t.apply(r, arguments), n != 'shift' && n != 'splice' || r.length !== 0 || delete r[0], z.call(this, r); }; }), A(['concat', 'join', 'slice'], (n) => { const t = e[n]; j.prototype[n] = function () { return z.call(this, t.apply(this._wrapped, arguments)); }; }), j.extend(j.prototype, { chain() { return this._chain = !0, this; }, value() { return this._wrapped; } }), typeof define === 'function' && define.amd && define('underscore', [], () => j);
|
|
}).call(this);
|