Skip to content

Instantly share code, notes, and snippets.

@Inclushe
Created May 30, 2019 02:10
Show Gist options
  • Save Inclushe/3c0588bef21d4747e8d3791bcc8bfe58 to your computer and use it in GitHub Desktop.
Save Inclushe/3c0588bef21d4747e8d3791bcc8bfe58 to your computer and use it in GitHub Desktop.
dreamx3 package-refracted pretty print
function in_array(a, b, c) {
var d = '';
if (!c) {
for (d in b) if (b[d] == a) return !0
} else for (d in b) if (b[d] === a) return !0;
return !1
}
function ucFirst(a) {
return a ? a.charAt(0).toUpperCase() + a.slice(1) : a
}
function closeThisPr() {
Action.Project.Close()
}
function doscroll(a, b, c) {
var d = 6,
e = a - b;
return c += (c + e / (d * d)) / e,
newY = 1 == c ? b + e : b + e * (1 - Math.pow(2, - 20 * c / 1)),
c && window.scrollTo(0, newY),
c >= 1 || lastT == c || !c ? clearTimeout(timer) : timer = setTimeout('doscroll(' + a + ',' + b + ',' + c + ')', 1),
lastT = c,
!1
}
function number_format(a, b, c, d) {
a = (a + '').replace(/[^0-9+\-Ee.]/g, '');
var e = isFinite( + a) ? + a : 0,
f = isFinite( + b) ? Math.abs(b) : 0,
g = void 0 === d ? ',' : d,
h = void 0 === c ? '.' : c,
i = '',
j = function (a, b) {
var c = Math.pow(10, b);
return '' + (Math.round(a * c) / c).toFixed(b)
};
return i = (f ? j(e, f) : '' + Math.round(e)).split('.'),
i[0].length > 3 && (i[0] = i[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, g)),
(i[1] || '').length < f && (i[1] = i[1] || '', i[1] += new Array(f - i[1].length + 1).join('0')),
i.join(h)
}
!function (a, b, c) {
function d(a, b, c) {
return a.call.apply(a.bind, arguments)
}
function e(a, b, c) {
if (!a) throw Error();
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
return function () {
var c = Array.prototype.slice.call(arguments);
return Array.prototype.unshift.apply(c, d),
a.apply(b, c)
}
}
return function () {
return a.apply(b, arguments)
}
}
function f(a, b, c) {
return f = Function.prototype.bind && - 1 != Function.prototype.bind.toString().indexOf('native code') ? d : e,
f.apply(null, arguments)
}
function g(a, b) {
this.J = a,
this.w = b || a,
this.F = this.w.document
}
function h(a, c, d) {
a = a.F.getElementsByTagName(c) [0],
a || (a = b.documentElement),
a && a.lastChild && a.insertBefore(d, a.lastChild)
}
function i(a, b) {
function c() {
a.F.body ? b() : setTimeout(c, 0)
}
c()
}
function j(a, b, c) {
b = b || [
],
c = c || [
];
for (var d = a.className.split(/\s+/), e = 0; e < b.length; e += 1) {
for (var f = !1, g = 0; g < d.length; g += 1) if (b[e] === d[g]) {
f = !0;
break
}
f || d.push(b[e])
}
for (b = [
], e = 0; e < d.length; e += 1) {
for (f = !1, g = 0; g < c.length; g += 1) if (d[e] === c[g]) {
f = !0;
break
}
f || b.push(d[e])
}
a.className = b.join(' ').replace(/\s+/g, ' ').replace(/^\s+|\s+$/, '')
}
function k(a, b) {
for (var c = a.className.split(/\s+/), d = 0, e = c.length; d < e; d++) if (c[d] == b) return !0;
return !1
}
function l(a) {
if ('string' == typeof a.na) return a.na;
var b = a.w.location.protocol;
return 'about:' == b && (b = a.J.location.protocol),
'https:' == b ? 'https:' : 'http:'
}
function m(a, b) {
var c = a.createElement('link', {
rel: 'stylesheet',
href: b,
media: 'all'
}),
d = !1;
c.onload = function () {
d || (d = !0)
},
c.onerror = function () {
d || (d = !0)
},
h(a, 'head', c)
}
function n(b, c, d, e) {
var f = b.F.getElementsByTagName('head') [0];
if (f) {
var g = b.createElement('script', {
src: c
}),
h = !1;
return g.onload = g.onreadystatechange = function () {
h || this.readyState && 'loaded' != this.readyState && 'complete' != this.readyState || (h = !0, d && d(null), g.onload = g.onreadystatechange = null, 'HEAD' == g.parentNode.tagName && f.removeChild(g))
},
f.appendChild(g),
a.setTimeout(function () {
h || (h = !0, d && d(Error('Script load timeout')))
}, e || 5000),
g
}
return null
}
function o(a, b) {
this.N = a,
this.ga = b
}
function p(a, b, c, d) {
this.d = null != a ? a : null,
this.g = null != b ? b : null,
this.B = null != c ? c : null,
this.f = null != d ? d : null
}
function q(a) {
a = aa.exec(a);
var b = null,
c = null,
d = null,
e = null;
return a && (null !== a[1] && a[1] && (b = parseInt(a[1], 10)), null !== a[2] && a[2] && (c = parseInt(a[2], 10)), null !== a[3] && a[3] && (d = parseInt(a[3], 10)), null !== a[4] && a[4] && (e = /^[0-9]+$/.test(a[4]) ? parseInt(a[4], 10) : a[4])),
new p(b, c, d, e)
}
function r(a, b, c, d, e, f, g, h) {
this.L = a,
this.m = h
}
function s(a) {
this.a = a
}
function t(a) {
var b = w(a.a, /(iPod|iPad|iPhone|Android|Windows Phone|BB\d{2}|BlackBerry)/, 1);
return '' != b ? (/BB\d{2}/.test(b) && (b = 'BlackBerry'), b) : (a = w(a.a, /(Linux|Mac_PowerPC|Macintosh|Windows|CrOS|PlayStation|CrKey)/, 1), '' != a ? ('Mac_PowerPC' == a ? a = 'Macintosh' : 'PlayStation' == a && (a = 'Linux'), a) : 'Unknown')
}
function u(a) {
var b = w(a.a, /(OS X|Windows NT|Android) ([^;)]+)/, 2);
if (b || (b = w(a.a, /Windows Phone( OS)? ([^;)]+)/, 2)) || (b = w(a.a, /(iPhone )?OS ([\d_]+)/, 2))) return b;
if (b = w(a.a, /(?:Linux|CrOS|CrKey) ([^;)]+)/, 1)) for (var b = b.split(/\s/), c = 0; c < b.length; c += 1) if (/^[\d\._]+$/.test(b[c])) return b[c];
return (a = w(a.a, /(BB\d{2}|BlackBerry).*?Version\/([^\s]*)/, 2)) ? a : 'Unknown'
}
function v(a) {
var b = t(a),
c = q(u(a)),
d = q(w(a.a, /AppleWeb(?:K|k)it\/([\d\.\+]+)/, 1)),
e = 'Unknown',
f = new p,
f = 'Unknown',
g = !1;
return /OPR\/[\d.]+/.test(a.a) ? e = 'Opera' : - 1 != a.a.indexOf('Chrome') || - 1 != a.a.indexOf('CrMo') || - 1 != a.a.indexOf('CriOS') ? e = 'Chrome' : /Silk\/\d/.test(a.a) ? e = 'Silk' : 'BlackBerry' == b || 'Android' == b ? e = 'BuiltinBrowser' : - 1 != a.a.indexOf('PhantomJS') ? e = 'PhantomJS' : - 1 != a.a.indexOf('Safari') ? e = 'Safari' : - 1 != a.a.indexOf('AdobeAIR') ? e = 'AdobeAIR' : - 1 != a.a.indexOf('PlayStation') && (e = 'BuiltinBrowser'),
'BuiltinBrowser' == e ? f = 'Unknown' : 'Silk' == e ? f = w(a.a, /Silk\/([\d\._]+)/, 1) : 'Chrome' == e ? f = w(a.a, /(Chrome|CrMo|CriOS)\/([\d\.]+)/, 2) : - 1 != a.a.indexOf('Version/') ? f = w(a.a, /Version\/([\d\.\w]+)/, 1) : 'AdobeAIR' == e ? f = w(a.a, /AdobeAIR\/([\d\.]+)/, 1) : 'Opera' == e ? f = w(a.a, /OPR\/([\d.]+)/, 1) : 'PhantomJS' == e && (f = w(a.a, /PhantomJS\/([\d.]+)/, 1)),
f = q(f),
g = 'AdobeAIR' == e ? 2 < f.d || 2 == f.d && 5 <= f.g : 'BlackBerry' == b ? 10 <= c.d : 'Android' == b ? 2 < c.d || 2 == c.d && 1 < c.g : 526 <= d.d || 525 <= d.d && 13 <= d.g,
new r(e, 0, 0, 0, 0, 0, 0, new o(g, 536 > d.d || 536 == d.d && 11 > d.g))
}
function w(a, b, c) {
return (a = a.match(b)) && a[c] ? a[c] : ''
}
function x(a) {
this.ma = a || '-'
}
function y(a, b) {
this.L = a,
this.X = 4,
this.M = 'n';
var c = (b || 'n4').match(/^([nio])([1-9])$/i);
c && (this.M = c[1], this.X = parseInt(c[2], 10))
}
function z(a) {
return a.M + a.X
}
function A(a) {
var b = 4,
c = 'n',
d = null;
return a && ((d = a.match(/(normal|oblique|italic)/i)) && d[1] && (c = d[1].substr(0, 1).toLowerCase()), (d = a.match(/([1-9]00|normal|bold)/i)) && d[1] && (/bold/i.test(d[1]) ? b = 7 : /[1-9]00/.test(d[1]) && (b = parseInt(d[1].substr(0, 1), 10)))),
c + b
}
function B(a, b) {
this.c = a,
this.q = a.w.document.documentElement,
this.P = b,
this.j = 'wf',
this.h = new x('-'),
this.ha = !1 !== b.events,
this.C = !1 !== b.classes
}
function C(a) {
if (a.C) {
var b = k(a.q, a.h.f(a.j, 'active')),
c = [
],
d = [
a.h.f(a.j, 'loading')
];
b || c.push(a.h.f(a.j, 'inactive')),
j(a.q, c, d)
}
D(a, 'inactive')
}
function D(a, b, c) {
a.ha && a.P[b] && (c ? a.P[b](c.getName(), z(c)) : a.P[b]())
}
function E() {
this.ca = {
}
}
function F(a, b) {
this.c = a,
this.H = b,
this.k = this.c.createElement('span', {
'aria-hidden': 'true'
}, this.H)
}
function G(a) {
h(a.c, 'body', a.k)
}
function H(a) {
var b;
b = [
];
for (var c = a.L.split(/,\s*/), d = 0; d < c.length; d++) {
var e = c[d].replace(/['"]/g, '');
- 1 == e.indexOf(' ') ? b.push(e) : b.push('\'' + e + '\'')
}
return b = b.join(','),
c = 'normal',
'o' === a.M ? c = 'oblique' : 'i' === a.M && (c = 'italic'),
'display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:' + b + ';font-style:' + c + ';font-weight:' + a.X + '00;'
}
function I(a, b, c, d, e, f, g, h) {
this.Y = a,
this.ka = b,
this.c = c,
this.o = d,
this.m = e,
this.H = h || 'BESbswy',
this.v = {
},
this.W = f || 3000,
this.ba = g || null,
this.G = this.u = this.t = null,
this.t = new F(this.c, this.H),
this.u = new F(this.c, this.H),
this.G = new F(this.c, this.H),
a = new y('serif', z(this.o)),
a = H(a),
this.t.k.style.cssText = a,
a = new y('sans-serif', z(this.o)),
a = H(a),
this.u.k.style.cssText = a,
a = new y('monospace', z(this.o)),
a = H(a),
this.G.k.style.cssText = a,
G(this.t),
G(this.u),
G(this.G),
this.v.serif = this.t.k.offsetWidth,
this.v['sans-serif'] = this.u.k.offsetWidth,
this.v.monospace = this.G.k.offsetWidth
}
function J(a, b, c) {
for (var d in ca) if (ca.hasOwnProperty(d) && b === a.v[ca[d]] && c === a.v[ca[d]]) return !0;
return !1
}
function K(a) {
var b = a.t.k.offsetWidth,
c = a.u.k.offsetWidth;
b === a.v.serif && c === a.v['sans-serif'] || a.m.ga && J(a, b, c) ? _() - a.oa >= a.W ? a.m.ga && J(a, b, c) && (null === a.ba || a.ba.hasOwnProperty(a.o.getName())) ? M(a, a.Y) : M(a, a.ka) : L(a) : M(a, a.Y)
}
function L(a) {
setTimeout(f(function () {
K(this)
}, a), 50)
}
function M(a, b) {
a.t.remove(),
a.u.remove(),
a.G.remove(),
b(a.o)
}
function N(a, b, c, d) {
this.c = b,
this.A = c,
this.R = 0,
this.ea = this.aa = !1,
this.W = d,
this.m = a.m
}
function O(a, b, c, d, e) {
if (c = c || {
}, 0 === b.length && e) C(a.A);
else for (a.R += b.length, e && (a.aa = e), e = 0; e < b.length; e++) {
var g = b[e],
h = c[g.getName()],
i = a.A,
k = g;
i.C && j(i.q, [
i.h.f(i.j, k.getName(), z(k).toString(), 'loading')
]),
D(i, 'fontloading', k),
i = null,
i = new I(f(a.ia, a), f(a.ja, a), a.c, g, a.m, a.W, d, h),
i.start()
}
}
function P(a) {
0 == --a.R && a.aa && (a.ea ? (a = a.A, a.C && j(a.q, [
a.h.f(a.j, 'active')
], [
a.h.f(a.j, 'loading'),
a.h.f(a.j, 'inactive')
]), D(a, 'active')) : C(a.A))
}
function Q(a) {
this.J = a,
this.Z = new E,
this.pa = new s(a.navigator.userAgent),
this.a = this.pa.parse(),
this.T = this.U = 0,
this.Q = this.S = !0
}
function R(a, b) {
ja.Z.ca[a] = b
}
function S(a, b, c, d, e) {
var f = 0 == --a.U;
(a.Q || a.S) && setTimeout(function () {
O(b, c, d || null, e || null, f)
}, 0)
}
function T(a, b, c) {
this.O = a || b + da,
this.s = [
],
this.V = [
],
this.fa = c || ''
}
function U(a) {
this.s = a,
this.da = [
],
this.K = {
}
}
function V(a, b) {
this.a = new s(navigator.userAgent).parse(),
this.c = a,
this.e = b
}
function W(a, b) {
this.c = a,
this.e = b,
this.p = [
]
}
function X(a, b) {
this.c = a,
this.e = b,
this.p = [
]
}
function Y(a, b) {
this.c = a,
this.e = b,
this.p = [
]
}
function Z(a, b) {
this.c = a,
this.e = b
}
function $(a, b) {
this.c = a,
this.e = b
}
var _ = Date.now || function () {
return + new Date
};
g.prototype.createElement = function (a, b, c) {
if (a = this.F.createElement(a), b) for (var d in b) b.hasOwnProperty(d) && ('style' == d ? a.style.cssText = b[d] : a.setAttribute(d, b[d]));
return c && a.appendChild(this.F.createTextNode(c)),
a
};
var aa = /^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/;
p.prototype.compare = function (a) {
return this.d > a.d || this.d === a.d && this.g > a.g || this.d === a.d && this.g === a.g && this.B > a.B ? 1 : this.d < a.d || this.d === a.d && this.g < a.g || this.d === a.d && this.g === a.g && this.B < a.B ? - 1 : 0
},
p.prototype.toString = function () {
return [this.d,
this.g || '',
this.B || '',
this.f || ''].join('')
},
r.prototype.getName = function () {
return this.L
};
var ba = new r('Unknown', 0, 0, 0, 0, 0, 0, new o(!1, !1));
s.prototype.parse = function () {
var a;
if ( - 1 != this.a.indexOf('MSIE') || - 1 != this.a.indexOf('Trident/')) {
a = t(this);
var b = q(u(this)),
c = null,
d = w(this.a, /Trident\/([\d\w\.]+)/, 1),
c = q( - 1 != this.a.indexOf('MSIE') ? w(this.a, /MSIE ([\d\w\.]+)/, 1) : w(this.a, /rv:([\d\w\.]+)/, 1));
'' != d && q(d),
a = new r('MSIE', 0, 0, 0, 0, 0, 0, new o('Windows' == a && 6 <= c.d || 'Windows Phone' == a && 8 <= b.d, !1))
} else if ( - 1 != this.a.indexOf('Opera')) a: if (a = q(w(this.a, /Presto\/([\d\w\.]+)/, 1)), q(u(this)), null !== a.d || q(w(this.a, /rv:([^\)]+)/, 1)), - 1 != this.a.indexOf('Opera Mini/')) a = q(w(this.a, /Opera Mini\/([\d\.]+)/, 1)),
a = new r('OperaMini', 0, 0, 0, t(this), 0, 0, new o(!1, !1));
else {
if ( - 1 != this.a.indexOf('Version/') && (a = q(w(this.a, /Version\/([\d\.]+)/, 1)), null !== a.d)) {
a = new r('Opera', 0, 0, 0, t(this), 0, 0, new o(10 <= a.d, !1));
break a
}
a = q(w(this.a, /Opera[\/ ]([\d\.]+)/, 1)),
a = null !== a.d ? new r('Opera', 0, 0, 0, t(this), 0, 0, new o(10 <= a.d, !1)) : new r('Opera', 0, 0, 0, t(this), 0, 0, new o(!1, !1))
} else /OPR\/[\d.]+/.test(this.a) ? a = v(this) : /AppleWeb(K|k)it/.test(this.a) ? a = v(this) : - 1 != this.a.indexOf('Gecko') ? (a = 'Unknown', b = new p, q(u(this)), b = !1, - 1 != this.a.indexOf('Firefox') ? (a = 'Firefox', b = q(w(this.a, /Firefox\/([\d\w\.]+)/, 1)), b = 3 <= b.d && 5 <= b.g) : - 1 != this.a.indexOf('Mozilla') && (a = 'Mozilla'), c = q(w(this.a, /rv:([^\)]+)/, 1)), b || (b = 1 < c.d || 1 == c.d && 9 < c.g || 1 == c.d && 9 == c.g && 2 <= c.B), a = new r(a, 0, 0, 0, t(this), 0, 0, new o(b, !1))) : a = ba;
return a
},
x.prototype.f = function (a) {
for (var b = [
], c = 0; c < arguments.length; c++) b.push(arguments[c].replace(/[\W_]+/g, '').toLowerCase());
return b.join(this.ma)
},
y.prototype.getName = function () {
return this.L
},
F.prototype.remove = function () {
var a = this.k;
a.parentNode && a.parentNode.removeChild(a)
};
var ca = {
sa: 'serif',
ra: 'sans-serif',
qa: 'monospace'
};
I.prototype.start = function () {
this.oa = _();
var a = new y(this.o.getName() + ',serif', z(this.o)),
a = H(a);
this.t.k.style.cssText = a,
a = new y(this.o.getName() + ',sans-serif', z(this.o)),
a = H(a),
this.u.k.style.cssText = a,
K(this)
},
N.prototype.ia = function (a) {
var b = this.A;
b.C && j(b.q, [
b.h.f(b.j, a.getName(), z(a).toString(), 'active')
], [
b.h.f(b.j, a.getName(), z(a).toString(), 'loading'),
b.h.f(b.j, a.getName(), z(a).toString(), 'inactive')
]),
D(b, 'fontactive', a),
this.ea = !0,
P(this)
},
N.prototype.ja = function (a) {
var b = this.A;
if (b.C) {
var c = k(b.q, b.h.f(b.j, a.getName(), z(a).toString(), 'active')),
d = [
],
e = [
b.h.f(b.j, a.getName(), z(a).toString(), 'loading')
];
c || d.push(b.h.f(b.j, a.getName(), z(a).toString(), 'inactive')),
j(b.q, d, e)
}
D(b, 'fontinactive', a),
P(this)
},
Q.prototype.load = function (a) {
this.c = new g(this.J, a.context || this.J),
this.S = !1 !== a.events,
this.Q = !1 !== a.classes;
var b = new B(this.c, a),
c = [
],
d = a.timeout;
b.C && j(b.q, [
b.h.f(b.j, 'loading')
]),
D(b, 'loading');
var e,
c = this.Z,
h = this.c,
i = [
];
for (e in a) if (a.hasOwnProperty(e)) {
var k = c.ca[e];
k && i.push(k(a[e], h))
}
for (c = i, this.T = this.U = c.length, a = new N(this.a, this.c, b, d), d = 0, e = c.length; d < e; d++) h = c[d],
h.D(this.a, f(this.la, this, h, b, a))
},
Q.prototype.la = function (a, b, c, d) {
var e = this;
d ? a.load(function (a, b, d) {
S(e, c, a, b, d)
}) : (a = 0 == --this.U, this.T--, a && 0 == this.T ? C(b) : (this.Q || this.S) && O(c, [
], {
}, null, a))
};
var da = '//fonts.googleapis.com/css';
T.prototype.f = function () {
if (0 == this.s.length) throw Error('No fonts to load!');
if ( - 1 != this.O.indexOf('kit=')) return this.O;
for (var a = this.s.length, b = [
], c = 0; c < a; c++) b.push(this.s[c].replace(/ /g, '+'));
return a = this.O + '?family=' + b.join('%7C'),
0 < this.V.length && (a += '&subset=' + this.V.join(',')),
0 < this.fa.length && (a += '&text=' + encodeURIComponent(this.fa)),
a
};
var ea = {
latin: 'BESbswy',
cyrillic: '&#1081;&#1103;&#1046;',
greek: '&#945;&#946;&#931;',
khmer: '&#x1780;&#x1781;&#x1782;',
Hanuman: '&#x1780;&#x1781;&#x1782;'
},
fa = {
thin: '1',
extralight: '2',
'extra-light': '2',
ultralight: '2',
'ultra-light': '2',
light: '3',
regular: '4',
book: '4',
medium: '5',
'semi-bold': '6',
semibold: '6',
'demi-bold': '6',
demibold: '6',
bold: '7',
'extra-bold': '8',
extrabold: '8',
'ultra-bold': '8',
ultrabold: '8',
black: '9',
heavy: '9',
l: '3',
r: '4',
b: '7'
},
ga = {
i: 'i',
italic: 'i',
n: 'n',
normal: 'n'
},
ha = /^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
U.prototype.parse = function () {
for (var a = this.s.length, b = 0; b < a; b++) {
var c = this.s[b].split(':'),
d = c[0].replace(/\+/g, ' '),
e = [
'n4'
];
if (2 <= c.length) {
var f,
g = c[1];
if (f = [
], g) for (var g = g.split(','), h = g.length, i = 0; i < h; i++) {
var j;
if (j = g[i], j.match(/^[\w-]+$/)) {
j = ha.exec(j.toLowerCase());
var k = void 0;
if (null == j) k = '';
else {
if (k = void 0, null == (k = j[1]) || '' == k) k = '4';
else var l = fa[k],
k = l || (isNaN(k) ? '4' : k.substr(0, 1));
j = j[2],
k = [
null == j || '' == j ? 'n' : ga[j],
k
].join('')
}
j = k
} else j = '';
j && f.push(j)
}
0 < f.length && (e = f),
3 == c.length && (c = c[2], f = [
], c = c ? c.split(',') : f, 0 < c.length && (c = ea[c[0]]) && (this.K[d] = c))
}
for (this.K[d] || (c = ea[d]) && (this.K[d] = c), c = 0; c < e.length; c += 1) this.da.push(new y(d, e[c]))
}
};
var ia = {
Arimo: !0,
Cousine: !0,
Tinos: !0
};
V.prototype.D = function (a, b) {
b(a.m.N)
},
V.prototype.load = function (a) {
var b = this.c;
'MSIE' == this.a.getName() && 1 != this.e.blocking ? i(b, f(this.$, this, a)) : this.$(a)
},
V.prototype.$ = function (a) {
for (var b = this.c, c = new T(this.e.api, l(b), this.e.text), d = this.e.families, e = d.length, f = 0; f < e; f++) {
var g = d[f].split(':');
3 == g.length && c.V.push(g.pop());
var h = '';
2 == g.length && '' != g[1] && (h = ':'),
c.s.push(g.join(h))
}
d = new U(d),
d.parse(),
m(b, c.f()),
a(d.da, d.K, ia)
},
W.prototype.I = function (a) {
var b = this.c;
return l(this.c) + (this.e.api || '//f.fontdeck.com/s/css/js/') + (b.w.location.hostname || b.J.location.hostname) + '/' + a + '.js'
},
W.prototype.D = function (a, b) {
var c = this.e.id,
d = this.c.w,
e = this;
c ? (d.__webfontfontdeckmodule__ || (d.__webfontfontdeckmodule__ = {
}), d.__webfontfontdeckmodule__[c] = function (a, c) {
for (var d = 0, f = c.fonts.length; d < f; ++d) {
var g = c.fonts[d];
e.p.push(new y(g.name, A('font-weight:' + g.weight + ';font-style:' + g.style)))
}
b(a)
}, n(this.c, this.I(c), function (a) {
a && b(!1)
})) : b(!1)
},
W.prototype.load = function (a) {
a(this.p)
},
X.prototype.I = function (a) {
var b = l(this.c);
return (this.e.api || b + '//use.typekit.net') + '/' + a + '.js'
},
X.prototype.D = function (a, b) {
var c = this.e.id,
d = this.c.w,
e = this;
c ? n(this.c, this.I(c), function (a) {
if (a) b(!1);
else {
if (d.Typekit && d.Typekit.config && d.Typekit.config.fn) {
a = d.Typekit.config.fn;
for (var c = 0; c < a.length; c += 2) for (var f = a[c], g = a[c + 1], h = 0; h < g.length; h++) e.p.push(new y(f, g[h]));
try {
d.Typekit.load({
events: !1,
classes: !1
})
} catch (i) {
}
}
b(!0)
}
}, 2000) : b(!1)
},
X.prototype.load = function (a) {
a(this.p)
},
Y.prototype.D = function (a, b) {
var c = this,
d = c.e.projectId,
e = c.e.version;
if (d) {
var f = c.c.w;
n(this.c, c.I(d, e), function (e) {
if (e) b(!1);
else {
if (f['__mti_fntLst' + d] && (e = f['__mti_fntLst' + d]())) for (var g = 0; g < e.length; g++) c.p.push(new y(e[g].fontfamily));
b(a.m.N)
}
}).id = '__MonotypeAPIScript__' + d
} else b(!1)
},
Y.prototype.I = function (a, b) {
return l(this.c) + '//' + (this.e.api || 'fast.fonts.net/jsapi').replace(/^.*http(s?):(\/\/)?/, '') + '/' + a + '.js' + (b ? '?v=' + b : '')
},
Y.prototype.load = function (a) {
a(this.p)
},
Z.prototype.load = function (a) {
var b,
c,
d = this.e.urls || [
],
e = this.e.families || [
],
f = this.e.testStrings || {
};
for (b = 0, c = d.length; b < c; b++) m(this.c, d[b]);
for (d = [
], b = 0, c = e.length; b < c; b++) {
var g = e[b].split(':');
if (g[1]) for (var h = g[1].split(','), i = 0; i < h.length; i += 1) d.push(new y(g[0], h[i]));
else d.push(new y(g[0]))
}
a(d, f)
},
Z.prototype.D = function (a, b) {
return b(a.m.N)
},
$.prototype.load = function (a) {
var b,
c,
d = this.e.families || [
];
0 < d.length && '' !== (b = d.join('|')) && (b = b.replace(/ /g, ''), m(this.c, '/type/css?family=' + b));
var e = [
];
for (b = 0, c = d.length; b < c; b++) {
var f = d[b].split(':');
if (f[1]) for (var g = f[1].split(','), h = 0; h < g.length; h += 1) e.push(new y(f[0], g[h]));
else e.push(new y(f[0]))
}
a(e)
},
$.prototype.D = function (a, b) {
return b(a.m.N)
};
var ja = new Q(this);
R('custom', function (a, b) {
return new Z(b, a)
}),
R('Persona', function (a, b) {
return new $(b, a)
}),
R('fontdeck', function (a, b) {
return new W(b, a)
}),
R('monotype', function (a, b) {
return new Y(b, a)
}),
R('typekit', function (a, b) {
return new X(b, a)
}),
R('google', function (a, b) {
return new V(b, a)
}),
this.WebFont || (this.WebFont = {
}, this.WebFont.load = f(ja.load, ja), this.WebFontConfig && ja.load(this.WebFontConfig))
}(this, document);
var Cargo = {
};
Cargo.o = {
},
Cargo.o.model = {
},
Cargo.o.collection = {
},
Cargo.o.view = {
},
Cargo.Router = {
},
Cargo.Template = {
},
Cargo.Helper = {
},
Cargo.API = {
},
Cargo.Event = {
},
Cargo.Collection = {
},
Cargo.Model = {
},
Cargo.View = {
};
var Action = window.Action || {
},
Persona = {
};
Cargo.Core = {
log: function (a) {
'undefined' != typeof console && window.console && console.log(a)
},
KeyboardShortcut: {
Add: function (a, b, c) {
var d = {
type: 'keydown',
disable_in_input: !0,
propagate: !0,
keycode: b
};
shortcut.add(a, c, d)
},
Remove: function (a) {
shortcut.remove(a)
},
InitDefaults: function () {
Cargo.Helper.IsPersonaAdmin() || (this.Add('X', 88, function () {
Action.Project.Index()
}), this.Add('I', 73, function () {
Action.Project.Index()
})),
this.Add('Shift+B', 66, function () {
Cargo.Helper.IsPersonaAdmin() || Cargo.View.Backstage.Toggle()
}),
this.Add('Shift+A', 65, function () {
Cargo.Helper.GoToUrl('admin')
}),
this.Add('Shift+E', 69, function () {
Cargo.Model.Site.GetIsEditor() && Cargo.Model.Page.GetId() && parent.location == window.location && Cargo.Helper.GoToUrl('admin/' + Cargo.Model.Page.GetId())
}),
this.Add('Shift+H', 72, function () {
Cargo.Helper.GoToUrl('admin/design/html')
}),
this.Add('Shift+C', 67, function () {
Cargo.Helper.GoToUrl('admin/design/css')
}),
this.Add('Shift+D', 68, function () {
Cargo.Helper.GoToUrl('admin/design')
}),
this.Add('Shift+X', 88, function () {
Cargo.Helper.GoToUrl('')
}),
this.Add('Esc', 27, function () {
Cargo.View.Backstage.isActive() && !Cargo.Modal.isActive() && Cargo.View.Backstage.Toggle()
})
}
},
InitKeycodeListener: function () {
var a = _.bind(function (a) {
a.shiftKey || (83 == a.keyCode && (navigator.platform.match('Mac') ? a.metaKey : a.ctrlKey) && (a.preventDefault(), Cargo.Event.trigger('save_shortcut_triggered', a), Cargo.contentWindow || window.top.Cargo.Event.trigger('save_shortcut_triggered', a)), 13 == a.keyCode && Cargo.Event.trigger('enter_keycode_triggered', a), 27 == a.keyCode && Cargo.Event.trigger('esc_keycode_triggered', a))
}, this);
document.addEventListener('keydown', a, !1)
},
ReplaceLoadingAnims: {
init: function (a) {
$('.retinaSpinner').each(function () {
window.devicePixelRatio > 1 && $(this).addClass('rotating')
}),
setTimeout(function () {
if (Cargo.Helper && !Cargo.Helper.isOldIE()) {
for (var b = $('<div></div>'), c = 0; c < 8; c++) b.append('<div style="position: absolute; top: -2px;"><div class="spinner_circle part' + (c + 1) + '" style="-webkit-transform: rotate(' + 45 * c + 'deg) translate(6px, 0px); transform: rotate(' + 45 * c + 'deg) translate(6px, 0px);"></div></div>');
void 0 === a && $('img[src$="/loadingAnim.gif"]').length > 0 ? $('img[src$="/loadingAnim.gif"]').each(function () {
Cargo.Core.ReplaceLoadingAnims.replace(this, b)
}) : void 0 !== a && a.each(function () {
Cargo.Core.ReplaceLoadingAnims.replace(this, b)
}),
Cargo.Event.trigger('loading_anims_replaced')
}
}, 100)
},
replace: function (a, b) {
var c = b.clone();
c.attr('class', 'retinaSpinner ' + $(a).attr('class')),
c.attr('id', $(a).attr('id')),
c.attr('style', $(a).attr('style')),
c.attr('data-loading', $(a).attr('data-loading')),
window.devicePixelRatio > 1 && c.addClass('rotating'),
$(a).replaceWith(c)
}
},
ReseedPageModels: function () {
Cargo.API.Config.current_offset = 0,
Cargo.API.Config.current_page = 0,
Cargo.API.Config.site_recently_created = !1,
Cargo.Collection.Pages.url = Cargo.API.GetPagesPath(0),
Cargo.Collection.Pages.fetch({
reset: !0,
merge: !0,
complete: function () {
Cargo.Event.trigger('reseed_pages_complete')
}
})
}
},
Cargo.o.analytics = Backbone.View.extend({
initialize: function () {
},
pageview: function (a) {
'function' == typeof ga && a && (ga(function () {
ga.getAll().map(function (a) {
var b = a.get('name');
ga(b + '.send', 'pageview')
})
}), 'undefined' != typeof _gaq && _gaq.push(['_trackPageview',
document.location.pathname.replace(/\/$/, '')]))
}
}),
Cargo.o.api = Backbone.View.extend({
Config: {
Version: 'v0',
api_path: '/_api',
cargo_id: '',
cargo_url: '',
filter: '',
search_term: '',
route_name: '',
template_basename: 'design',
current_offset: 0,
current_page: 1,
start_project: null,
is_filter: !1,
is_search: !1,
is_editor: !1,
is_solo: !1,
is_direct_link: !1,
is_custom_route: !1,
admin_edit_project: !1,
first_load_finished: !1
},
initialize: function () {
_.extend(this.Config, $.parseJSON($('script[data-set=\'defaults\']').html()))
},
fetch: function (a, b) {
$.getJSON(a, b)
},
GetSitePath: function () {
var a = this.Config;
return a.api_path + '/' + a.Version + '/site/' + a.cargo_url
},
GetDesignPath: function () {
var a = this.Config;
return a.api_path + '/' + a.Version + '/designs/' + a.cargo_url
},
GetDesignPresetPath: function () {
var a = this.Config;
return a.api_path + '/' + a.Version + '/designpresets'
},
GetDesignFile: function (a) {
return this.GetDesignPath() + '?file=' + a
},
GetTemplatePath: function () {
var a = this.Config,
b = a.route_name ? a.route_name + '/' : '';
return this.GetDesignFile('.templates/' + a.template_basename + '/' + b)
},
GetFilesPath: function () {
var a = this.Config;
return a.api_path + '/' + a.Version + '/files'
},
GetDesignAndFile: function (a, b) {
var c = this.GetTemplatePath() + a;
return b && (c += '&to_var=true'),
c
},
GetDisplayOptionsPath: function () {
var a = this.Config;
return a.api_path + '/' + a.Version + '/displayoptions/' + a.cargo_url
},
GetImagesPath: function (a, b, c) {
a = a || this.Config.current_offset,
b = b || Cargo.Helper.GetPageLimit(),
c = c || 'newest';
var d = this.GetSitePath() + '/images';
return d += '?offset=' + a + '&limit=' + b + '&sort=' + c
},
GetPluginsPath: function () {
var a = this.Config;
return a.api_path + '/' + a.Version + '/backdrops'
},
GetPagesPath: function () {
return this.GetSitePath() + '/pages'
},
GetAdminListPath: function (a, b) {
return a = a || this.Config.current_offset,
b = b || Cargo.Helper.GetPageLimit(),
this.GetSitePath() + '/admincollection'
},
GetSinglePagePath: function () {
var a = this.Config;
return a.api_path + '/' + a.Version + '/projects/' + a.cargo_url
},
GetSiteFilesPutPath: function () {
return '/dispatch/files/putFile'
},
GetDataPackage: function (a, b) {
var c = {
site: Cargo.Model.Site.toJSON(),
display_options: Cargo.Model.DisplayOptions.toJSON(),
config: this.Config
};
return c[a] = b,
c
},
FetchPageCollection: function (a, b) {
a = a || this.Config.current_offset,
b = b || Cargo.Helper.GetPageLimit(),
Cargo.Collection.Pages.url = Cargo.API.GetPagesPath(a, b);
Cargo.Helper.GetTotalProjectsInMemory();
Cargo.Collection.Pages.fetch({
reset: !0
})
},
GetSinglePage: function (a, b) {
Cargo.Event.trigger('page_load_start', a),
void 0 === b && (b = Cargo.Collection.Pages);
var c = b.findWhere({
project_url: a
});
c || isNaN(a) || (c = b.findWhere({
id: parseInt(a)
})),
c && !this.Config.site_recently_created ? Cargo.Model.Page.set(c.toJSON()) : (Cargo.Core.log('No model found, async for ' + a), (new Cargo.Model.BasePage).fetch({
data: {
purl: a
},
error: function (a, b) {
try {
'no pid found' === $.parseJSON(b.responseText).message.toLowerCase() && (Cargo.Modal.Alert({
message: 'That page no longer exists',
confirm: function () {
window.history.back()
}
}), Cargo.Helper.HideLoadingAnimation())
} catch (c) {
}
},
success: function (a, b, c) {
Cargo.Collection.Pages.add(a.toJSON()),
Cargo.Model.Page.set(a.toJSON()),
Cargo.Event.trigger('page_load_complete', a.get('id'))
}
}))
},
PutSiteFile: function (a, b, c) {
$.ajax({
type: 'POST',
url: this.GetSiteFilesPutPath(),
context: this,
data: {
file: a,
data: b,
uid: Cargo.Model.Site.GetId()
},
dataType: 'json',
success: function (a) {
'function' == typeof c && c.call(this, a)
},
error: function (a) {
}
})
}
}),
Action = {
Project: {
Index: function () {
Cargo.View.Main.ShowIndex()
},
Close: function () {
Cargo.View.Main.ShowIndex()
},
Home: function () {
Cargo.View.Main.ShowHome()
}
},
Start: function (a) {
$('[data-example-start]').html('<div class="loading_animation pulsing white inline right"><div></div></div>'),
Cargo.API.Config.cookie_link && Cargo.API.Config.cookie_site_count > 0 ? Cargo.Modal.Alert({
message: '<em>You’re already logged in; you can create new Personas in your Settings panel.</em>',
confirm: function () {
top.document.location.href = Cargo.API.Config.cookie_link + '/admin'
}
}) : require(['/_jsapps/admin/_models/adminsite.js'], function (b) {
var c = new b;
c.bind('sync', function (a, b) {
document.location.href = b.redirect
}),
c.bind('error', function (a, b) {
var c = JSON.parse(b.responseText);
c && c.message ? Cargo.Modal.Alert({
message: c.message,
confirm: function () {
c.data.redirect && (document.location.href = c.data.redirect)
}
}) : Cargo.Modal.Alert({
message: 'There was a problem submitting. Refresh and try again.'
}),
$('[data-example-start]').html('Choose Style')
}),
a = a || Cargo.Model.Site.GetId(),
c.set({
preset_id: a
}),
c.save()
})
}
},
Cargo.Event = Cargo.Event || {
},
_.extend(Cargo.Event, Backbone.Events),
Cargo.Event.on('add_history', function (a, b) {
if (Cargo.Router.is_first_route = !1, (a = Cargo.Helper.NormalizeRouteLink(a)) == Cargo.Helper.GetCurrentProjectUrl()) return void (Cargo.Model.DisplayOptions.GetDisableProjectScroll() || Cargo.Helper.ScrollToTop());
Cargo.Helper.IsCurrentRoute(a) ? Cargo.Model.DisplayOptions.GetDisableProjectScroll() || Cargo.Helper.ScrollToTop() : (b = b || Cargo.Helper.GetPidFromPurl(a), 'admin' == a || /^backstage/.test(a) || Cargo.Helper.ShowLoadingAnimation(b, a)),
/^backstage/.test(Cargo.Router.previousRoute) || /^backstage/.test(Backbone.history.getFragment()) || !/^backstage/.test(a) || (Cargo.Router.previousSiteRoute = Backbone.history.getFragment()),
Cargo.Router.previousRoute = Backbone.history.getFragment(),
Cargo.Router.navigate(a, {
trigger: !0
})
}),
Cargo.Event.on('add_history_passive', function (a) {
a = Cargo.Helper.NormalizeRouteLink(a),
Cargo.Router.navigate(a, {
trigger: !1
})
}),
Cargo.Event.on('custom_route_loaded', function (a) {
}),
Cargo.Event.on('direct_link_loaded', function (a) {
}),
Cargo.Event.on('first_page_collection_reset', function () {
Cargo.API.Config.first_load_finished = !0
}),
Cargo.Event.on('hide_loading_anim', function () {
'object' == typeof Cargo.Helper && Cargo.Helper.HideLoadingAnimation()
}),
Cargo.Event.on('homepage_loaded', function () {
Cargo.View.Navigation && Cargo.View.Navigation.AddSetActive(),
Cargo.Model.DisplayOptions.GetDisableProjectScroll() || Cargo.Helper.ScrollToTop()
}),
Cargo.Event.on('loading_anims_replaced', function () {
}),
Cargo.Event.on('plugin_render', function (a) {
a.el.style.opacity = 0,
a.el.style.transition = 'opacity .5s',
a.el.style.webkitTransition = 'opacity .5s',
void 0 === a.deferredLoadEventName ? setTimeout(function () {
a.el.style.opacity = 1
}, 33) : Cargo.Event.once(a.deferredLoadEventName, function () {
a.el.style.opacity = 1
})
}),
Cargo.Event.on('page_change', function () {
}),
Cargo.Event.on('page_collection_reset', function () {
}),
Cargo.Event.on('page_load_complete', function (a) {
Cargo.Event.PageTransition = new $.Deferred,
Cargo.Model.DisplayOptions.GetDisableProjectScroll() || Cargo.Helper.ScrollToTop(),
Cargo.View.ProjectDetail && Cargo.View.ProjectDetail.ChangeBgColorFromModel(),
Cargo.View.Main && !Cargo.Helper.IsOnHomepage() && Cargo.View.Main.RemoveHomepageClass(),
Cargo.Helper.HideLoadingAnimation(),
Cargo.View.Main.SetWindowTitle(),
Cargo.API.Config.is_direct_link || Cargo.Helper.IsOnHomepage() || Cargo.Analytics.pageview(!0),
Cargo.Core.Slideshow.InitSlideshow(),
Cargo.View.Main.SetPageId(a),
Cargo.Event.trigger('project_load_complete', a)
}),
Cargo.Event.on('page_load_start', function (a) {
Cargo.Event.trigger('page_change')
}),
Cargo.Event.on('project_load_start', function (a) {
Cargo.Event.trigger('page_load_start', a)
}),
Cargo.Event.on('reseed_pages_complete', function (a) {
}),
Cargo.Event.on('show_index_complete', function (a) {
Cargo.View.Main.SetWindowTitle(!0),
Cargo.Event.IndexTransition = new $.Deferred
}),
Cargo.Event.on('show_index_start', function (a) {
Cargo.Event.trigger('page_change')
}),
Cargo.Event.on('show_loading_anim', function () {
Cargo.Helper.ShowLoadingAnimation(null, 'page')
}),
Cargo.Event.on('solo_link_loaded', function (a) {
}),
Cargo.Event.on('template_loaded', function (a) {
}),
Cargo.Event.PageTransition = new $.Deferred,
Cargo.Event.IndexTransition = new $.Deferred,
Cargo.Event.ShowPageTransition = function (a, b, c) {
return Cargo.Event.PageTransition.resolve(),
Cargo.Event.PageTransition.promise()
},
Cargo.Event.ShowIndexTransition = function (a, b) {
return Cargo.Event.IndexTransition.resolve(),
Cargo.Event.IndexTransition.promise()
},
window.addEventListener('popstate', function () {
'object' == typeof lightbox && void 0 !== lightbox.activeGallery && lightbox.activeGallery.close()
});
var preventScrollDuringPopstate = !1;
$(window).on('popstate', function () {
preventScrollDuringPopstate = !0,
setTimeout(function () {
preventScrollDuringPopstate = !1
}, 10)
}),
Cargo.Helper = {
Data: {
is_loading: !1,
loading_timout: 1000
},
FindCollectionByProjectUrl: function (a) {
var b = !1;
return _.each(Cargo.Collection.Page, function (c) {
if (!b) {
var d = new Backbone.Collection;
d.reset(c);
d.where({
project_url: a
}) [0] && (b = c)
}
}),
b
},
GetActiveIndex: function (a) {
var b = Cargo.Helper.GetHomeUrl(!0, !0);
return a ? location.protocol + '//' + this.GetBaseDomain() + b : b
},
GetBackboneCaseInsensitive: function (a, b) {
var c = {
};
for (var d in a) !a.hasOwnProperty(d) || 'function' != typeof a[d] && 'object' != typeof a[d] || (c[d.toLowerCase()] = d);
return b ? c[b.toLowerCase()] : ''
},
GetBaseUrl: function (a, b) {
if (Cargo.API.Config.is_domain) return b ? '/' : '';
var c = a ? Cargo.API.Config.cargo_url : '';
return b ? '/' + c : c
},
GetBaseCargoDomain: function () {
var a = Cargo.Model.Site.get('home_url');
return a ? a.replace(/(http(s)?:\/\/)/, '') : document.location.host
},
GetBaseDomain: function () {
return Cargo.Model.Site.get('home_url').replace(/(http(s)?:\/\/)/, '')
},
GetCurrentProjectUrl: function () {
return Cargo.Model.Page.GetProjectUrl()
},
GetCurrentProjectId: function () {
return Cargo.Model.Page.GetId()
},
GetCurrentRoute: function () {
return Backbone.history.fragment
},
GetDomainOrUrl: function () {
return Cargo.API.Config.is_domain ? this.GetUrl() : location.pathname.split('/') [1]
},
GetHomeUrl: function (a, b) {
var c = b ? '/' : '';
return Cargo.API.Config.set && Cargo.API.Config.filter ? Cargo.API.Config.is_domain ? c + Cargo.API.Config.set + '/filter/' + encodeURIComponent(Cargo.API.Config.filter) : this.GetBaseUrl(a, b) + '/' + Cargo.API.Config.set + '/filter/' + encodeURIComponent(Cargo.API.Config.filter) : Cargo.API.Config.route && Cargo.API.Config.filter ? Cargo.API.Config.is_domain ? Cargo.Helper.GetRouteUrl() + '/filter/' + encodeURIComponent(Cargo.API.Config.filter) : this.GetBaseUrl(a, !1) + Cargo.Helper.GetRouteUrl() + '/filter/' + encodeURIComponent(Cargo.API.Config.filter) : Cargo.API.Config.filter ? Cargo.API.Config.is_domain ? c + 'filter/' + encodeURIComponent(Cargo.API.Config.filter) : this.GetBaseUrl(a, b) + '/filter/' + encodeURIComponent(Cargo.API.Config.filter) : Cargo.API.Config.set ? Cargo.API.Config.is_domain ? c + Cargo.API.Config.set : this.GetBaseUrl(a, b) + '/' + Cargo.API.Config.set : Cargo.API.Config.route && Cargo.API.Config.is_domain ? Cargo.Helper.GetRouteUrl() : this.GetBaseUrl(a, b)
},
GetOffsetFromPage: function (a) {
var b = this.GetPageLimit();
return --a * b
},
GetPageLimit: function () {
var a = Cargo.Model.DisplayOptions.GetPaginationCount();
return a && Cargo.Model.DisplayOptions.GetIndexRouteName() && Cargo.Model.DisplayOptions.GetIndexRouteName().toUpperCase() == Cargo.Helper.GetRouteName().toUpperCase() && Cargo.Model.DisplayOptions.get('index_pagination_count') ? a = Cargo.Model.DisplayOptions.get('index_pagination_count') : Cargo.Model.DisplayOptions.get('mobile_pagination_count') && this.isMobile() && (a = Cargo.Model.DisplayOptions.get('mobile_pagination_count')),
a || 10
},
GetPidFromPurl: function (a) {
var b = Cargo.Collection.Pages.where({
project_url: a
});
return b[0] ? b[0].get('id') : 0
},
GetRouteName: function () {
var a = Cargo.API.Config.route_name;
return /display_options/.test(Cargo.API.Config.route) && (a = Cargo.Model.DisplayOptions.GetIndexRouteName()),
a
},
GetRouteUrl: function () {
var a = Cargo.API.Config.route_name;
return (/display_options/.test(Cargo.API.Config.route) || 'feed' == a || 'index' == a) && (a = Cargo.Model.DisplayOptions.GetIndexRouteUrl()),
a
},
GetStartProjectId: function () {
return Math.floor(Cargo.Model.Site.GetStartProjectId())
},
GetTotalProjectsInMemory: function () {
var a = Cargo.Collection.Pages.length;
if (Cargo.Helper.IsAutopaginate()) return a;
var b = 0;
return $.each(Cargo.Collection.Page, function () {
b += this.length
}),
a + b
},
GetUrl: function () {
return Cargo.API.Config.cargo_url
},
GoToUrl: function (a) {
top.document.location.href = document.location.origin + '/' + a
},
HideLoadingAnimation: function (a) {
this.Data.is_loading = !1,
$('[data-loading]').hide()
},
IsAdminEdit: function () {
var a = /\/adminedit/.test(document.location.pathname) || /\/admin/.test(document.location.pathname),
b = void 0 != Cargo.Editor;
return a || b
},
IsAdminBackdrop: function () {
return /\/adminbackdrop/.test(document.location.pathname)
},
IsCurrentRoute: function (a) {
return a = this.NormalizeRouteLink(a),
Cargo.Helper.GetCurrentRoute() == a
},
IsCustomRoute: function () {
return Cargo.API.Config.is_custom_route
},
isFirefox: function () {
return /Firefox\/\d+\.\d+/.test(navigator.userAgent)
},
isSafari: function () {
return - 1 != navigator.userAgent.indexOf('Safari') && - 1 == navigator.userAgent.indexOf('Chrome')
},
isIE: function () {
return /MSIE (\d+\.\d+);/.test(navigator.userAgent)
},
isEdge: function () {
return /Edge/.test(navigator.userAgent)
},
isIE8: function () {
var a = - 1;
if (this.isIE()) {
null != new RegExp('MSIE ([0-9]{1,}[.0-9]{0,})').exec(navigator.userAgent) && (a = parseFloat(RegExp.$1))
}
return a < 9 && a > 0
},
isIOS: function () {
return !!navigator.userAgent.match(/i(Phone|Pod|Pad)/i)
},
isMobile: function () {
if (this.isIOS()) return !0;
var a = !1,
b = navigator.userAgent || navigator.vendor || window.opera;
return function (b) {
(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(b) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(b.substr(0, 4))) && (a = !0)
}(b),
a = a || !a && /(android)/i.test(b.substr(0, 40))
},
IsOnHomepage: function () {
return '' == Cargo.Helper.GetCurrentRoute() && null != Cargo.Helper.GetStartProjectId()
},
isOldIE: function () {
var a = - 1;
if (this.isIE()) {
null != new RegExp('MSIE ([0-9]{1,}[.0-9]{0,})').exec(navigator.userAgent) && (a = parseFloat(RegExp.$1))
}
return a <= 9 && a > 0
},
IsPermalink: function (a, b) {
var c = !1,
d = !1,
e = !1,
f = this.GetRouteUrl() ? this.GetRouteUrl().replace(/\//, '') : '';
(this.IsCurrentProject(a) || this.IsCurrentProjectId(a) || this.IsCurrentRoute(a) || f == a || Cargo.Helper.GetRouteName() == f || 'Website-Offline-message' == a) && (c = !0),
Cargo.Helper.IsOnHomepage() && Cargo.Model.Page.GetProjectUrl() != a && (d = !0),
Cargo.Collection.Pages.models.length >= 1 && Cargo.Collection.Pages.models[0].id && (e = !0);
var g = Cargo.Model.Page.GetProjectUrl() == a || Cargo.Model.Page.GetId() == a || this.GetRouteName() == a || this.GetCurrentRoute() == a || 'Website-Offline-message' == a,
d = Cargo.Helper.IsOnHomepage() && Cargo.Model.Page.GetProjectUrl() != a,
h = !Cargo.API.Config.first_load_finished && (g || d);
return !Cargo.API.Config.first_load_finished && !e && (c || d) || d || this.IsAdminEdit() || !b || e || (h = !1),
h
},
IsPersonaAdmin: function () {
return /\/admin(\/|$)/.test(document.location.pathname)
},
IsPresetPreview: function () {
return /\/presetpreview(\/|$)/.test(document.location.pathname)
},
IsCurrentProject: function (a) {
return Cargo.Model.Page.GetProjectUrl() && a && Cargo.Model.Page.GetProjectUrl().toLowerCase() == a.toLowerCase()
},
IsCurrentProjectId: function (a) {
return Cargo.Model.Page.GetId() && a && Cargo.Model.Page.GetProjectUrl() == a
},
IsCurrentRoute: function (a) {
return this.GetRouteName() && a && this.GetRouteName().toLowerCase() == a.toLowerCase()
},
isTablet: function () {
return 'string' == typeof new MobileDetect(window.navigator.userAgent).tablet()
},
NormalizeRouteLink: function (a) {
if (!a) return a;
- 1 !== a.indexOf(Cargo.Helper.GetBaseDomain()) && (a = a.split(Cargo.Helper.GetBaseDomain()) [1]),
'/' == a.charAt(0) && (a = a.replace('/', '')),
/backstage/.test(a) || 0 != a.search(this.GetHomeUrl(!0)) || (a = a.replace(this.GetHomeUrl(!0) + '/', '')),
'/' == a.charAt(a.length - 1) && (a = a.substr(0, a.length - 1));
var b = Cargo.Collection.Pages.findWhere({
project_url: a
});
return void 0 !== b && b.get('id') == Cargo.Helper.GetStartProjectId() && (a = ''),
a
},
ScrollToTop: function () {
!0 !== preventScrollDuringPopstate && requestAnimationFrame(function () {
window.scrollTo(0, 0)
})
},
ShowLoadingAnimation: function (a, b) {
this.Data.is_loading = !0,
a ? _.delay(function () {
Cargo.Helper.ShowLoadingAnimationById(a)
}, Cargo.Helper.Data.loading_timout) : b && _.delay(function () {
Cargo.Helper.ShowLoadingAnimationById('page')
}, Cargo.Helper.Data.loading_timout),
$('*[data-loading=global], *[data-loading=global] .retinaSpinner').show()
},
ShowLoadingAnimationById: function (a) {
this.Data.is_loading && $('*[data-loading=' + a + '], *[data-loading=' + a + '] .retinaSpinner').show()
},
TestUrlCaseAndRedirect: function () {
if (!Cargo.API.Config.is_domain) {
var a = document.location.pathname.split('/') [1],
b = Cargo.API.Config.cargo_url;
a != b && a.toUpperCase() == b.toUpperCase() && history.replaceState(document.location.pathname.replace(a, b), Cargo.Model.Site.GetWebsiteTitle())
}
}
},
Cargo.o.router = Backbone.Router.extend({
routes: {
'': 'Home',
adminedit: 'Home',
admin: 'Admin',
backstage: 'Backstage',
'backstage/:section': 'Backstage',
'admin/:section': 'Admin',
'preview/:which': 'Home',
':purl': 'FirstSlashProxy',
':purl/solo': 'SoloLink',
':purl/adminedit': 'AdminEdit',
'*actions': 'defaultAction'
},
defaultAction: function (a) {
this.route(a)
},
FirstSlashProxy: function (a) {
this.RouteIsHome(a) ? this.Home() : Cargo.Helper.IsCustomRoute() ? this.CustomRoute(a) : /backstage/.test(a) ? this.Backstage() : this.ProjectDetail(a)
},
Home: function () {
this.CheckToggleBackstage(),
Cargo.Helper.GetStartProjectId() ? (this.ProjectDetail(Cargo.Helper.GetStartProjectId()), Cargo.View.Main && Cargo.View.Main.SetHomepageClass()) : Cargo.API.Config.offline ? Cargo.Event.trigger('page_load_complete') : (Cargo.Model.Page.clear(), Cargo.Event.trigger('homepage_loaded'))
},
Admin: function (a) {
0 == $('#content_frame').length && 'function' == typeof require && (this.CheckToggleBackstage(), Cargo.Helper.GoToUrl('admin'))
},
Backstage: function (a) {
Cargo.View.Backstage.loadSection(a)
},
ProjectDetail: function (a) {
if (this.CheckToggleBackstage(), a += '', a = a.replace(/\//g, ''), /\?/.test(a)) return void (document.location.href = document.location.href.replace(document.location.search, ''));
Cargo.Helper.IsPermalink(a, !0) ? Cargo.View.ProjectDetail && Cargo.View.ProjectDetail.Permalink(a) : a && 0 != a && (Cargo.View.ProjectDetail || Cargo.API.Config.offline ? Cargo.API.GetSinglePage(a) : Cargo.Helper.GoToUrl(a))
},
CustomRoute: function (a) {
this.CheckToggleBackstage(),
Cargo.Event.trigger('custom_route_loaded', a)
},
SoloLink: function (a) {
return this.CheckToggleBackstage(),
Cargo.API.Config.is_solo = !0,
Cargo.Event.trigger('solo_link_loaded', location.pathname),
this.ProjectDetail(a)
},
AdminEdit: function (a) {
return this.CheckToggleBackstage(),
Cargo.API.Config.admin_edit_project = !0,
this.ProjectDetail(a)
},
CheckToggleBackstage: function () {
!0 === Cargo.View.Backstage.isActive() && Cargo.View.Backstage.disable()
},
_routeToRegExp: function (a) {
return a = a.replace(/[-{}[\]+?.,\\^$|#\s]/g, '\\$&').replace(/\((.*?)\)/g, '(?:$1)?').replace(/:\w+/g, '([^/]+/?)').replace(/\*\w+/g, '(.*?)'),
new RegExp('^' + a + '$', 'i')
},
addroute: function (a, b, c) {
for (var d = [
'',
'/',
'?*querystring',
'/?*querystring'
], e = 0; e < d.length; e++) {
var f = d[e];
this.route(a + f, b, c)
}
},
RouteIsHome: function (a) {
var b = !1;
return Cargo.API.Config.is_domain || a.toLowerCase() != Cargo.Helper.GetDomainOrUrl().toLowerCase() || document.location.pathname.replace('/').split('/').length <= 1 && (b = !0),
b
}
}),
Cargo.o.templates = Backbone.View.extend({
Data: {
},
Get: function (a, b) {
if (a = Cargo.Helper.GetBackboneCaseInsensitive(this.Data, a), this.Data[a] && this.Data[a].template) return this.Data[a].template;
this.Load(a, b)
},
GetEl: function (a) {
if (a = Cargo.Helper.GetBackboneCaseInsensitive(this.Data, a), this.Data[a]) return this.Data[a].element;
this.Load(a)
},
Add: function (a, b, c, d) {
Cargo.Template.Data[a] = {
dataset: c,
setname: d,
element: b
}
},
FindAndAddViewStubs: function () {
$('[data-view]').each(function () {
var a = $(this).data('view'),
b = $(this).data('set'),
c = $(this).attr('id') ? '#' + $(this).attr('id') : '.' + $(this).attr('class'),
d = Cargo.Collection.Default;
if (b) {
var e = Cargo.Helper.GetBackboneCaseInsensitive(Cargo.Collection, b),
f = Cargo.Helper.GetBackboneCaseInsensitive(Cargo.Model, b);
e ? d = Cargo.Collection[e] : f && (d = Cargo.Model[f])
}
Cargo.Template.Add(a, c, d, b)
})
},
Load: function (which, file_path) {
if (!file_path) {
var file_name = which + '.handlebars';
file_path = Cargo.API.GetDesignAndFile(file_name, !1)
}
Cargo.Template.Data[which] && Cargo.Template.Data[which].loading || (Cargo.Template.Data[which] || (Cargo.Template.Data[which] = {
}), Cargo.Template.Data[which].loading = !0, $.loadFiles(file_path).done(function (template) {
if (template) {
try {
var template = eval(template)
} catch (err) {
}
Cargo.Template.Data[which].template = template
} else {
var template_var = 'templatesdesign' + file_name.replace(/(\/|\.)/g, '');
Cargo.Template.Data[which].template = window[template_var]
}
return Cargo.Event.trigger('template_loaded', which),
Cargo.Template.Data[which].template
}))
},
LoadAll: function () {
for (key in this.Data) void 0 === this.Data[key].template && this.Load(key)
},
LoadFoundViews: function () {
for (key in this.Data) {
var a = Cargo.Helper.GetBackboneCaseInsensitive(Cargo.o.view, key);
if ('function' == typeof Cargo.o.view[a] && void 0 === Cargo.View[a]) {
var b = this;
$('[data-view=\'' + key + '\']').each(function (c) {
var d = c > 0 ? a + '_' + c : a;
Cargo.View[d] = new Cargo.o.view[a]({
el: this,
collection: b.Data[key].dataset,
template: b.Data[key].template,
className: d
})
})
} else 'function' == typeof Cargo.View[a] ? Cargo.Core.log('A view for ' + a + ' already loaded') : void 0 === Cargo.o.view[a] && (Cargo.View[key] = new Cargo.o.view.Default({
el: this.Data[key].element,
collection: this.Data[key].dataset,
template: key,
datasetname: this.Data[key].setname,
className: key
}))
}
}
}),
Cargo.Core.Slideshow = {
idIndex: 0,
slideshowObjects: {
},
InitSlideshow: function () {
var a = this,
b = [
];
$('.slideshow[sid]').each(function () {
var a = this.getAttribute('sid');
- 1 == b.indexOf(a) ? b.push(a) : this.removeAttribute('sid')
}),
$('.slideshow').each(function () {
var b = $(this),
c = !1;
try {
parent.hasOwnProperty('Cargo') && (c = parent.Cargo.Helper.IsAdminEdit())
} catch (j) {
}
if (!1 === $(this).hasClass('slick-initialized')) {
this.setAttribute('contenteditable', !1),
c && $(this).on('drop', function (a) {
return a.preventDefault(),
!1
}).on('mousedown', function (a) {
a.preventDefault()
}),
$(this).children('img').wrap('<div />').each(function (a, b) {
b.parentNode.setSaveable(!0)
}),
this.hasAttribute('data-slick') && this.setAttribute('data-slick', decodeURIComponent(this.getAttribute('data-slick')));
var d = this.hasAttribute('sid') && a.slideshowObjects.hasOwnProperty(this.getAttribute('sid')),
e = d ? this.getAttribute('sid') : ++a.idIndex,
f = {
cssEase: 'ease-in-out',
useCSS: !0,
useTransform: !0,
adaptiveHeight: !0,
arrows: !1,
dots: !1,
accessibility: !c,
draggable: !c,
pauseOnHover: c,
touchMove: !c
};
d && (a.slideshowObjects[e].el = this, isNaN(a.slideshowObjects[e].currentSlide) || (f.initialSlide = a.slideshowObjects[e].currentSlide), a.slideshowObjects[e].storeOptionsOnElement()),
$(this).slick(f).on('afterChange', function (a, b, c, d) {
Cargo.Event.trigger('slideshow_update')
}).on('beforeChange', function (b, c, d, e) {
var f = this.getAttribute('sid');
a.slideshowObjects.hasOwnProperty(f) && (a.slideshowObjects[f].currentSlide = e, a.slideshowObjects[f].updateNav(e + 1))
}).on(c ? 'dblclick' : 'click', '.slick-list', function () {
b.slick('slickGoTo', parseInt(b.slick('slickCurrentSlide')) + 1)
}),
$(this).find('.slick-list').on('scroll', function (a) {
this.scrollLeft = 0
}),
$(this).prepend('<div class="slideshow-nav" style="display: none" contenteditable="false"><a href="#" data-prev>Prev</a> / <a href="#" data-next>Next</a> (<span data-current data-ignore-changes>1</span> of <span data-total data-ignore-changes>1</span>)</div>'),
$(this).find('.slideshow-nav [data-next]').on('click', _.bind(function (a) {
a.preventDefault(),
$(this).slick('slickNext')
}, this)),
$(this).find('.slideshow-nav [data-prev]').on('click', _.bind(function (a) {
a.preventDefault(),
$(this).slick('slickPrev')
}, this));
var g = $(this).slick('getSlick'),
h = scrollMonitor.create(this);
h.enterViewport(function () {
g.slickGetOption('autoplay') && g.play()
}),
h.exitViewport(function () {
g.slickGetOption('autoplay') && g.pause()
}),
d ? a.slideshowObjects[e].slickObj = g : (a.slideshowObjects[e] = {
el: this,
slickObj: g,
options: {
},
updateOptions: function (a) {
this.options = {
autoplay: this.slickObj.slickGetOption('autoplay'),
autoplaySpeed: this.slickObj.slickGetOption('autoplaySpeed'),
speed: this.slickObj.slickGetOption('speed'),
textNav: !!this.slickObj.slickGetOption('textNav'),
fade: this.slickObj.slickGetOption('fade')
},
!0 === a && this.storeOptionsOnElement()
},
storeOptionsOnElement: function () {
try {
this.el.setAttribute('data-slick', JSON.stringify(this.options))
} catch (j) {
console.log('unable to store slideshow settings', j)
}
},
reinit: function () {
var a = $(this.el).find('.slideshow-nav');
a.detach(),
this.slickObj.unload(),
this.slickObj.reinit(),
$(this.el).prepend(a)
},
refresh: function () {
var a = $(this.el).find('.slideshow-nav');
a.detach(),
this.slickObj.refresh(),
$(this.el).prepend(a)
},
updateNav: function (a) {
if (!0 === this.options.textNav) {
void 0 === a && (a = this.slickObj.currentSlide + 1);
$(this.el).closest('[contenteditable="true"]') [0];
$(this.el).find('.slideshow-nav [data-current]').text(a),
$(this.el).find('.slideshow-nav [data-total]').text(this.slickObj.slideCount)
}
}
}, this.setAttribute('sid', e), this.__slideshowObj = a.slideshowObjects[e]);
var i = $(this).find('.slideshow-nav');
setTimeout(function () {
a.slideshowObjects[e].updateOptions(),
a.slideshowObjects[e].updateNav(),
a.slideshowObjects[e].options.textNav && i.css('display', 'block')
}, 1),
c && i.on('drop', function (a) {
return a.preventDefault(),
!1
}).on('mousedown', function (a) {
a.preventDefault()
}),
Cargo.Event.on('handleAdminUIChange', _.bind(function (a) {
try {
$(this).slick('setPosition')
} catch (j) {
}
}, this)),
Cargo.Event.on('elementresizer_update_complete', _.bind(function (a) {
try {
$(this).slick('setPosition')
} catch (j) {
}
}, this)),
Cargo.Event.on('page_load_complete', _.bind(function (a) {
try {
$(this).slick('setPosition')
} catch (j) {
}
}, this))
}
})
}
},
Cargo.Core.Embeds = {
initialize: function () {
this.embeds = [
]
},
initializeTwitter: function (a) {
requirejs(['//platform.twitter.com/widgets.js'], a)
},
initializeBandsInTown: function (a) {
requirejs(['https://widget.bandsintown.com/main.min.js'], function () {
BIT.widgetInitializer ? a() : BIT.onReady = a
})
},
findEmbedsIn: function (a) {
_.each(a.querySelectorAll('cargo-embed, persona-embed'), this.add, this)
},
add: function (a) {
if (a && a.nodeType === Node.ELEMENT_NODE) {
var b = a.getAttribute('data-type');
if (b) switch (b) {
case 'tweet':
this.handleTwitterEmbed(a);
break;
case 'bandsintown':
this.handleBandsIntownEmbed(a)
}
}
},
handleBandsIntownEmbed: function (a) {
a && a.nodeType === Node.ELEMENT_NODE && - 1 === this.embeds.indexOf(a) && this.initializeBandsInTown(_.bind(function () {
if ( - 1 === this.embeds.indexOf(a)) {
var b = {
};
_.each(a.attributes, function (a) {
if (/^data-/.test(a.name) && 'data-type' !== a.name) {
var c = a.name.substr(5).replace(/-/g, '_');
b[c] = a.value
}
});
var c = document.createElement('div');
if (c.setAttribute('id', 'bit-widget-' + _.uniqueId()), c.setAttribute('class', 'bit-widget-initializer'), _.each(b, function (a, b) {
c.setAttribute('data-' + b.replace(/_/g, '-'), a)
}), a.appendChild(c), Cargo.Helper.IsAdminEdit()) {
var d = new MutationObserver(function (a) {
_.each(a, function (a) {
'childList' == a.type && a.addedNodes.forEach(function (a) {
a.setAttribute('contenteditable', !1),
a && a.classList.contains('bit-widget-container') && (a.style.pointerEvents = 'none', d.disconnect())
})
})
});
d.observe(a, {
childList: !0
})
}
BIT.widgetInitializer.append(c, {
})
}
}, this))
},
handleTwitterEmbed: function (a) {
if (a && a.nodeType === Node.ELEMENT_NODE && - 1 === this.embeds.indexOf(a)) {
var b = a.getAttribute('data-id');
b && '' !== b && this.initializeTwitter(_.bind(function () {
- 1 === this.embeds.indexOf(a) && (a.innerHTML = '', twttr.widgets.createTweet(b, a).then(function (a) {
a.setAttribute('contenteditable', 'false')
}), this.embeds.push(a))
}, this))
}
},
remove: function () {
}
},
Cargo.Core = window.Cargo.Core || {
},
Cargo.Core.Handlebars = {
Render: function (a, b) {
var c = Handlebars.compile(a);
return Handlebars.registerPartial('loading_animation', $('#loading_animation').html()),
this.RegisterHelper_Asset(),
this.RegisterHelper_AssetContents(),
this.RegisterHelper_Print(),
this.RegisterHelper_IfAny(),
this.RegisterHelper_IfAll(),
this.RegisterHelper_IfEqual(),
this.RegisterHelper_UnlessAny(),
this.RegisterHelper_UnlessAll(),
this.RegisterHelper_IfOption(),
this.RegisterHelper_UnlessOption(),
this.RegisterHelper_DisplayOptions(),
this.RegisterHelper_Truncate(),
c(b)
},
RenderOnlyAssets: function (a) {
var b = Handlebars.compile(a);
return this.RegisterHelper_Asset(),
b()
},
RegisterHelper_Asset: function () {
Handlebars.registerHelper('asset', function (a) {
var b = a.fn(this),
c = Cargo.Collection.Assets.where({
filename: b
}) [0];
return c ? Cargo.Model.Site.GetAssetPath(c.get('filename'), c.get('id')) : ''
})
},
RegisterHelper_AssetContents: function () {
Handlebars.registerHelper('asset_contents', function (a) {
var b = a.fn(this),
c = Cargo.Collection.Assets.where({
filename: b
}) [0],
d = c ? Cargo.Model.Site.GetAssetPath(c.get('filename'), c.get('id')) : '';
return $.get(d, function (a) {
$('file[data-url=\'' + d + '\']').after(a).remove()
}, 'text'),
'<file data-url="' + d + '"></file>'
})
},
RegisterHelper_Print: function () {
Handlebars.registerHelper('print', function (a, b) {
var c = wrapper_tail = '';
'project.content' != a && 'content' != a || (c = '<projectcontent>', wrapper_tail = '</projectcontent>'),
a = a.replace('project.', '');
var d = 'object' == typeof this.project ? this.project : this;
return new Handlebars.SafeString(c + d[a] + wrapper_tail)
})
},
RegisterHelper_IfAny: function () {
Handlebars.registerHelper('if_any', function () {
for (var a = !1, b = arguments[arguments.length - 1], c = arguments.length - 2; c >= 0; c--) if (arguments[c]) {
a = !0;
break
}
return a ? b.fn(this) : b.inverse(this)
})
},
RegisterHelper_IfAll: function () {
Handlebars.registerHelper('if_all', function () {
for (var a = !0, b = arguments[arguments.length - 1], c = arguments.length - 2; c >= 0; c--) if (!arguments[c]) {
a = !1;
break
}
return a ? b.fn(this) : b.inverse(this)
})
},
RegisterHelper_IfEqual: function () {
Handlebars.registerHelper('if_equal', function (a, b, c) {
return 3 != arguments.length ? '' : a == b ? c.fn(this) : c.inverse(this)
})
},
RegisterHelper_UnlessAny: function () {
Handlebars.registerHelper('unless_any', function () {
for (var a = !1, b = arguments[arguments.length - 1], c = arguments.length - 2; c >= 0; c--) if (!arguments[c]) {
a = !0;
break
}
return a ? b.fn(this) : b.inverse(this)
})
},
RegisterHelper_UnlessAll: function () {
Handlebars.registerHelper('unless_all', function () {
for (var a = !0, b = arguments[arguments.length - 1], c = arguments.length - 2; c >= 0; c--) if (arguments[c]) {
a = !1;
break
}
return a ? b.fn(this) : b.inverse(this)
})
},
RegisterHelper_DisplayOptions: function () {
Handlebars.registerHelper('displayoptions', function (a, b) {
var c = a.replace('display_options.', '').split('.'),
d = c.length,
e = !1;
return e = 1 == d ? Cargo.Model.DisplayOptions.get(c[0]) : 2 == d ? Cargo.Model.DisplayOptions.get(c[0]) [c[1]] : 3 == d ? Cargo.Model.DisplayOptions.get(c[0]) [c[1]][c[2]] : Cargo.Model.DisplayOptions.get(c[0]),
e ? b.fn(this) : b.inverse(this)
})
},
RegisterHelper_IfOption: function () {
Handlebars.registerHelper('if_option', function (a, b) {
var c = a.replace('display_options.', '').split('.'),
d = c.length,
e = !1;
return e = 1 == d ? Cargo.Model.DisplayOptions.get(c[0]) : 2 == d ? Cargo.Model.DisplayOptions.get(c[0]) [c[1]] : 3 == d ? Cargo.Model.DisplayOptions.get(c[0]) [c[1]][c[2]] : Cargo.Model.DisplayOptions.get(c[0]),
e ? b.fn(this) : b.inverse(this)
})
},
RegisterHelper_UnlessOption: function () {
Handlebars.registerHelper('unless_option', function (a, b) {
var c = a.replace('display_options.', '').split('.'),
d = c.length,
e = !1;
return e = 1 == d ? Cargo.Model.DisplayOptions.get(c[0]) : 2 == d ? Cargo.Model.DisplayOptions.get(c[0]) [c[1]] : 3 == d ? Cargo.Model.DisplayOptions.get(c[0]) [c[1]][c[2]] : Cargo.Model.DisplayOptions.get(c[0]),
e ? b.inverse(this) : b.fn(this)
})
},
RegisterHelper_Truncate: function () {
Handlebars.registerHelper('truncate', function (a, b) {
if (a.length > b && a.length > 0) {
var c = a + ' ';
return c = a.substr(0, b),
c = a.substr(0, c.lastIndexOf(' ')),
c = c.length > 0 ? c : a.substr(0, b),
new Handlebars.SafeString(c + '...')
}
return a
})
}
},
Cargo = Cargo || {
},
Cargo.utils = Cargo.utils || {
},
Cargo.utils.CargoXHR = function (a) {
var b = this;
if ($.extend(this.options = {
}, this.defaultOptions, a), void 0 === this.options.context && (this.options.context = this), void 0 === this.options.url) throw 'no URL given, define "url" in the contructor\'s options object';
this.retries = 0,
this.xhr = new XMLHttpRequest,
this.xhr.addEventListener('abort', function () {
b.options.abort.apply(b.options.context, arguments)
}, !1),
this.xhr.addEventListener('error', function () {
b.options.error.apply(b.options.context, arguments)
}, !1),
this.xhr.addEventListener('load', function () {
b.options.success.apply(b.options.context, arguments)
}, !1),
this.xhr.addEventListener('loadend', function () {
b.options.always.apply(b.options.context, arguments)
}, !1),
this.xhr.upload.addEventListener('progress', function (a) {
b.options.progress.apply(b.options.context, arguments)
}, !1),
this.send()
},
Cargo.utils.CargoXHR.prototype.send = function () {
this.xhr.open(this.options.type, this.options.url, this.options.async);
for (var a in this.options.headers) this.xhr.setRequestHeader(a, this.options.headers[a]);
this.xhr.responseType = this.options.dataType,
this.options.beforeSend.call(this, this.xhr),
this.xhr.send(this.options.data)
},
Cargo.utils.CargoXHR.prototype.retry = function () {
if (!(this.retries++ < this.options.maxRetries)) return this.abort(),
!1;
Cargo.utils.CargoXHR.prototype.send.apply(this, arguments)
},
Cargo.utils.CargoXHR.prototype.abort = function () {
'object' == typeof this.xhr && this.xhr.abort()
},
Cargo.utils.CargoXHR.prototype.defaultOptions = {
async: !0,
beforeSend: function (a) {
},
always: function (a) {
},
success: function (a) {
},
progress: function (a) {
},
error: function (a) {
},
abort: function (a) {
},
type: 'GET',
url: void 0,
dataType: 'text',
headers: {
},
data: null,
context: void 0,
maxRetries: 5
};
var lastT = 0,
timer = null;
$.fn.toggleInputError = function (a) {
return this.parent().toggleClass('error', a),
this
},
window.loading_animation = function (a) {
return _.template($('#loading_animation').html()) ({
extra_class: a
}).replace('{{ extra_class }}', '')
},
Cargo.o.model.css = Backbone.Model.extend({
initialize: function () {
},
url: function () {
var a = Cargo.API.Config;
return a.api_path + '/' + a.Version + '/css/' + a.cargo_url
}
}),
Cargo.o.model.page = Backbone.Model.extend({
initialize: function () {
this.on('change:images', this.addImagesToGlobalCollection, this),
this.addImagesToGlobalCollection()
},
addImagesToGlobalCollection: function () {
if (Cargo.Collection.Images && this.get('images')) {
var a = Cargo.Collection.Images.add(this.get('images'));
this.attributes.images = a
}
},
fetch: function (a) {
if (!a.reset || !$('script[data-set=\'ProjectDetail\']').html()) return Backbone.Model.prototype.fetch.apply(this, arguments);
this.set($.parseJSON($('script[data-set=\'ProjectDetail\']').html()), a)
},
parse: function (a, b) {
var c = Cargo.Collection.Pages.findWhere({
project_url: this.GetProjectUrl()
});
return c && c.set(a),
a
},
url: function () {
return Cargo.API.GetSinglePagePath()
},
GetId: function () {
return this.get('id')
},
GetProjectUrl: function () {
return this.get('project_url')
},
GetType: function () {
return !(!this.get('type') || 0 == this.get('id')) && this.get('type')
},
GetBgColor: function () {
return !!this.get('bgcolor') && '#' + this.get('bgcolor')
}
}),
Cargo.o.model.display_options = Backbone.Model.extend({
fetch: function (a) {
$('script[data-set=\'DisplayOptions\']').html() ? this.set($.parseJSON($('script[data-set=\'DisplayOptions\']').html()), a) : Backbone.Model.prototype.fetch.apply(this, arguments)
},
url: function () {
return Cargo.API.GetDisplayOptionsPath()
},
GetPaginationCount: function () {
return this.get('pagination_count')
},
GetTotalProjects: function () {
return Cargo.API.Config.filter_total ? Math.floor(Cargo.API.Config.filter_total) : Math.floor(this.get('total_projects'))
},
GetDisableProjectScroll: function () {
return this.get('disable_project_scroll')
},
GetImageWidth: function () {
return this.get('image_width')
},
GetIndexRouteUrl: function () {
return this.get('index_route_url')
},
GetIndexRouteName: function () {
return this.get('index_route_name')
}
}),
Cargo.o.model.site = Backbone.Model.extend({
fetch: function (a) {
$('script[data-set=\'Site\']').html() ? this.set($.parseJSON($('script[data-set=\'Site\']').html()), a) : Backbone.Model.prototype.fetch.apply(this, arguments)
},
parse: function (a) {
return Cargo.Helper.IsAdminEdit() || (a.is_editor = Cargo.Helper.GetIsEditor()),
a
},
url: function () {
var a = Cargo.API.GetSitePath();
return '' != Cargo.API.Config.filter && (a += '?filter=' + encodeURIComponent(Cargo.API.Config.filter)),
a
},
GetId: function () {
return this.get('id')
},
GetAssetPath: function (a, b) {
return a && b ? this.get('asset_path') + '/' + a + '?' + b : this.get('asset_path')
},
GetPresetPreviewLink: function (a) {
return '//' + this.get('site_url') + '.' + Cargo.Helper.GetBaseCargoDomain() + '/presetpreview/' + a
},
GetWebsiteTitle: function () {
return this.get('website_title')
},
GetStartProjectId: function () {
return this.get('start_project_id')
},
GetIsEditor: function () {
return this.get('is_editor')
},
GetUseHiRes: function () {
var a = this.get('use_hi_res');
return void 0 == a && (a = window.devicePixelRatio > 1),
a
}
}),
Cargo.o.model.asset = Backbone.Model.extend({
}),
Cargo.o.model.image = Backbone.Model.extend({
initialize: function () {
_.bindAll(this, 'getImageByWidth')
},
urlRoot: function () {
return '/_api/v0/image'
},
getImageByWidth: function (a) {
var b = {
};
return a > this.get('width') && (a = this.get('width')),
b.w = a,
this.getImageWithOptions(b).url
},
getImageByWidth2x: function (a) {
return this.getImageByWidth(2 * a)
},
getImageWithOptions: function (a) {
var b = {
retina: !!window.devicePixelRatio && window.devicePixelRatio >= 1.2,
square: !1,
url: '',
webgl: a.hasOwnProperty('t') && 'webgl' == a.t
};
if (_.extend(b, a), 'original' === b.t && (b.retina = !1), !0 !== b.retina || b.webgl || (void 0 == b.q && (b.q = 67), b.hasOwnProperty('w') && (b.w = Math.min(2 * b.w, this.get('width'))), b.hasOwnProperty('h') && (b.h = Math.min(2 * b.h, this.get('height')))), b.w && b.w > this.get('width') && (b.webgl ? b.w = this.getValidWebGLSize(b.w) : b.w = this.get('width')), b.h && b.h > this.get('height') && (b.h = this.get('height')), !0 === b.square) {
var c = this.getSquareCrop();
b.c = {
x: c.x,
y: c.y,
w: c.w,
h: c.h
}
}
var d = [
't',
'w',
'h',
'q',
'c'
],
e = [
],
f = !1,
g = !1;
_.each(b, function (a, b) {
- 1 !== d.indexOf(b) && '' !== a && ('c' === b ? e.push('c/' + a.x + '/' + a.y + '/' + a.w + '/' + a.h) : e.push(b + '/' + a), f = 'w' == b ? a : 'c' == b && a.w ? a.w : f, g = 'h' == b ? a : 'c' == b && a.h ? a.h : g)
}, this);
var h = this.getScaleSize(f, g);
return b.w = h.w,
b.h = h.h,
b.url = '//cortex.persona.co/' + e.join('/') + '/i/' + this.get('hash') + '/' + this.get('name'),
b
},
getSquareCrop: function () {
var a = y = w = h = diff = 0;
return this.get('height') > this.get('width') ? (w = h = this.get('width'), diff = this.get('height') - this.get('width'), y = Math.floor(diff / 2), a = 0) : this.get('width') > this.get('height') ? (w = h = this.get('height'), diff = this.get('width') - this.get('height'), a = Math.floor(diff / 2), y = 0) : (w = this.get('width'), h = this.get('height'), a = y = 0),
{
w: w,
h: h,
x: a,
y: y
}
},
getOriginalImage: function () {
return this.getImageWithOptions({
t: 'original',
retina: !1
})
},
urlBelongsToImage: function (a) {
return 'string' == typeof a && - 1 !== a.indexOf(this.get('hash') + '/' + this.get('name'))
},
getValidWebGLSize: function (a) {
var b = [
128,
256,
512,
1024,
2048,
4096
];
return a > this.get('width') && _.each(b, function (b) {
b < 1000 && (a = b)
}),
a
},
getScaleSize: function (a, b) {
var c = a,
d = b;
if (og_w = parseInt(this.get('width')), og_h = parseInt(this.get('height')), a && b);
else if (og_w == og_h) c = a || (b || og_w),
d = c;
else if (a) var e = og_w / a,
d = Math.floor(og_h / e),
c = a;
else if (b) var e = og_h / b,
c = Math.floor(og_w / e),
d = b;
return {
w: c,
h: d
}
},
getFitSize: function (a, b, c, d) {
if (a = parseInt(a), (b = parseInt(b)) > a) var e = a / c,
f = Math.floor(b / e),
g = c;
else if (a > b) var e = b / d,
g = Math.floor(a / e),
f = d;
else var g = a,
f = b;
return [g,
f]
}
}),
Cargo.o.model.undefined_default = Backbone.Model.extend({
}),
Cargo.o.collection.pages = Backbone.Collection.extend({
model: Cargo.o.model.page,
initialize: function () {
},
url: function () {
return Cargo.API.GetPagesPath()
}
}),
Cargo.o.collection.assets = Backbone.Collection.extend({
initialize: function () {
},
fetch: function (a) {
$('script[data-set=\'Assets\']').html() && this.set($.parseJSON($('script[data-set=\'Assets\']').html()), a)
}
}),
Cargo.o.collection.undefined_default = Backbone.Collection.extend({
initialize: function () {
},
url: function () {
}
}),
Cargo.o.collection.images = Backbone.Collection.extend({
model: Cargo.o.model.image,
initialize: function () {
}
}),
Cargo.o.view.Main = Backbone.View.extend({
el: 'body',
initialize: function () {
this.collection.bind('change', this.render, this),
'html' == Cargo.API.Config.preview ? this.WriteCustomHtmlPreview() : 'css' == Cargo.API.Config.preview && this.WriteCustomCSSPreview(),
'object' != typeof Mobile && (Cargo.View.Following = new Cargo.o.view.Following({
el: '.container'
})),
Cargo.Helper.IsAdminEdit() && this.$el.attr('data-adminview', 'true')
},
events: {
'click [rel=\'history\']': 'HistoryPush',
'click [rel=\'show_index\']': 'ShowIndex',
'click [rel=\'close_project\']': 'ShowIndex',
'click [rel=\'show_home\']': 'ShowHome',
'click [rel=\'next_page\']': 'NextPage',
'click [rel=\'prev_page\']': 'PrevPage',
'click a': 'preventExtLinks'
},
render: function () {
this.collection
},
isClickInEditor: function (a) {
if ('undefined' == typeof CargoEditor || void 0 === CargoEditor.events) return !1;
if (void 0 === a) return !1;
for (var b = a.target; null !== (b = b.parentNode); ) {
if ('true' === b.contentEditable) return !0;
if (b.hasAttribute('data-ce-model-id') && b.getAttribute('data-ce-model-id') != Backbone.history.fragment) return !0
}
return !1
},
preventExtLinks: function (a) {
this.isClickInEditor(a) && a.preventDefault()
},
HistoryPush: function (a, b) {
if (!this.isClickInEditor(a)) {
a && (a.preventDefault(), b = a.currentTarget);
var c = $(b).attr('href') ? $(b).attr('href') : $(b).data('href'),
d = $(b).attr('data-id') ? $(b).attr('data-id') : $(b).data('id'),
e = !(!$(b).attr('target') || '_blank' != $(b).attr('target'));
a.metaKey || e ? window.open(c) : Cargo.Event.trigger('add_history', c, d)
}
},
ShowIndex: function (a) {
return !this.isClickInEditor(a) && (a && a.preventDefault(), Cargo.Model.DisplayOptions.GetIndexRouteName() ? void Cargo.Helper.GoToUrl(Cargo.Model.DisplayOptions.GetIndexRouteUrl()) : void Cargo.Event.trigger('add_history', ''))
},
ShowHome: function (a) {
if (this.isClickInEditor(a)) return !1;
if (a && a.preventDefault(), Cargo.Model.DisplayOptions.GetIndexRouteName()) return void Cargo.Helper.GoToUrl(Cargo.Model.DisplayOptions.GetIndexRouteUrl());
if (Cargo.Helper.GetStartProjectId()) {
Cargo.Event.trigger('add_history_passive', '');
var b = Cargo.Collection.Pages.findWhere({
id: Cargo.Helper.GetStartProjectId()
}),
c = void 0 !== Persona && 'object' == typeof Backdrop.Model.HomePage && Backdrop.Model.HomePage,
d = c || b;
d ? Cargo.Model.Page.set(d.toJSON()) : Cargo.Model.Page.fetch({
data: {
pid: Cargo.Helper.GetStartProjectId()
}
}),
this.SetHomepageClass()
} else {
Cargo.Model.Page.clear();
Cargo.Event.trigger('add_history', '')
}
},
WriteCustomHtmlPreview: function () {
if (void 0 !== parent.editframe) {
var a = parent.editframe.document.getElementById('syntax_highlight').value;
a = Cargo.Core.Handlebars.RenderOnlyAssets(a),
$('customhtml').html(a)
} else if (void 0 !== parent.Cargo && parent.Cargo.hasOwnProperty('Editor') && void 0 !== parent.Cargo.Editor.previewCustomHTML) {
var a = parent.Cargo.Editor.previewCustomHTML;
a = Cargo.Core.Handlebars.RenderOnlyAssets(a),
$('customhtml').html(a)
}
},
WriteCustomCSSPreview: function () {
var a = parent.editframe.document.getElementById('syntax_highlight').value;
a = Cargo.Core.Handlebars.RenderOnlyAssets(a),
$('body').append('<style>' + a + '</style>'),
$('head link[rel=\'stylesheet\']').remove()
},
SetWindowTitle: function (a) {
if (a || Cargo.Helper.IsOnHomepage()) document.title = Cargo.Model.Site.GetWebsiteTitle();
else {
var b = Cargo.Model.Page.get('title_no_html');
b ? document.title = b + ' - ' + Cargo.Model.Site.GetWebsiteTitle() : '' === b && (document.title = Cargo.Model.Site.GetWebsiteTitle())
}
},
SetHomepageClass: function () {
(Cargo.Model.Site.get('start_project_id') || 0 == Cargo.Model.Site.get('start_project_id')) && this.$el.addClass('homepage')
},
RemoveHomepageClass: function () {
this.$el.removeClass('homepage')
},
SetPageId: function (a) {
this.$el.attr('data-page-id', a)
}
}),
Cargo.o.view.Backstage = Backbone.View.extend({
className: 'persona-backstage-root',
fauxFixedElements: [
],
animationDuration: 600,
animationInProgress: !1,
backstageWidth: '400px',
enabled: !1,
iframeLoadInitialized: !1,
section: !1,
slideData: {
delta: 1,
offset: 0,
lastOffset: 0,
closing: !0
},
initialize: function () {
if (!(Cargo.Helper.IsPersonaAdmin() || Cargo.Helper.IsAdminEdit() || Cargo.Helper.IsPresetPreview())) {
this.contentFrame = document.createElement('iframe'),
this.contentFrame.id = 'backstage-frame',
this.contentFrame.style.display = 'none',
this.contentFrame.style.border = 'none',
this.contentFrame.name = 'backstage-frame',
this.backstageOverlay = document.createElement('div'),
this.backstageOverlay.id = 'backstage-overlay',
this.backstageOverlay.style.display = 'none',
this.backstageOverlay.style.cursor = 'pointer',
this.backstageOverlay.style.position = 'fixed',
this.backstageOverlay.style.top = 0,
this.backstageOverlay.style.left = 0,
this.backstageOverlay.style.right = 0,
this.backstageOverlay.style.bottom = 0,
this.backstageOverlay.style.zIndex = 999999,
this.backstageOverlay.addEventListener('click', _.bind(this.close, this)),
document.body.appendChild(this.backstageOverlay),
$('html').append(this.render().el);
var a = document.createElement('div');
a.id = 'backstage-container',
this.el.parentNode.insertBefore(a, this.el),
a.appendChild(this.el),
this.container = $(a),
this.contentFrame = $(this.contentFrame),
/^\/?backstage/.test(document.location.pathname) || $(window).load(_.bind(this.loadFrameSection, this))
}
},
render: function () {
return this.setElement(this.contentFrame),
this
},
Toggle: function () {
if (!0 !== this.animationInProgress) if (this.enabled) Cargo.Router.navigate(Cargo.Router.previousSiteRoute, {
trigger: !0
});
else {
Cargo.Event.trigger('add_history', 'backstage');
var a = parent.document.getElementById('login_frame');
null !== a && a.parentNode.removeChild(a)
}
},
loadSection: function (a) {
this.enabled || this.enable(),
this.loadFrameSection(a)
},
loadFrameSection: function (a) {
!0 !== this.iframeLoadInitialized ? (this.contentFrame.attr('src', '/backstageframe/' + Cargo.Helper.GetUrl() + ('string' == typeof a ? '/' + a : '')), this.iframeLoadInitialized = !0) : this.el.contentWindow && void 0 !== this.el.contentWindow.Backstage && void 0 !== this.el.contentWindow.Backstage.View.Main ? (this.el.contentWindow.Backstage.Router.navigate(a, {
trigger: !0,
replace: !0
}), this.el.contentWindow.Backstage.View.Main.showFirstLoadImages()) : this.contentFrame.attr('src', '/backstageframe/' + Cargo.Helper.GetUrl() + ('string' == typeof a ? '/' + a : ''))
},
updateCookieData: function () {
this.el.contentWindow && void 0 !== this.el.contentWindow.Backstage && this.el.contentWindow.Backstage.Model.Default.fetch()
},
resizeListener: function (a) {
var b = document.getElementsByTagName('html') [0],
c = window.innerWidth + 'px',
d = window.innerHeight + 'px';
!0 === a && (c = '', d = ''),
b.style.width = c,
b.style.height = d,
document.body.style.width = c,
document.body.style.height = d,
$(window).width() > 500 ? this.backstageWidth = '400px' : this.backstageWidth = $(window).width() - 40 + 'px',
this.enabled && (document.body.style.setProperty('transform', 'translateX(-' + this.backstageWidth + ')'), document.body.style.setProperty('-webkit-transform', 'translateX(-' + this.backstageWidth + ')')),
$('#backstage-container').css({
width: this.backstageWidth,
height: d
})
},
enable: function () {
if (!0 !== this.animationInProgress) {
document.body,
document.getElementsByTagName('html') [0];
if (this.fixedElements = this.getFixedElements(), $('<div id="backstage-container-overlap" />').insertAfter(this.$el.parent()), this.animationInProgress = !0, this.scrollAnchor = document.createElement('div'), this.scrollPos = window.scrollY, this.inlineStyles = document.createElement('style'), this.tempInlineStyles = document.createElement('style'), this.scrollAnchor.style.position = 'absolute', this.scrollAnchor.style.width = '0px', this.scrollAnchor.style.height = '0px', this.scrollAnchor.style.top = this.scrollPos + 'px', document.body.appendChild(this.scrollAnchor), document.body.appendChild(this.tempInlineStyles), document.body.appendChild(this.inlineStyles), Cargo.Router.is_first_route) return this.direct_route = !0,
this.prepareElementsForAnimation(),
void this.realEnable();
window.requestAnimationFrame(_.bind(function () {
this.prepareElementsForAnimation(),
window.setTimeout(_.bind(function () {
window.requestAnimationFrame(_.bind(this.realEnable, this))
}, this), 150)
}, this))
}
},
prepareElementsForAnimation: function () {
var a = document.body,
b = document.getElementsByTagName('html') [0];
this.tempInlineStyles.sheet.insertRule('#backdrop > div > * { \t-webkit-transform: translateZ(0);\t\t\ttransform: translateZ(0);}', 0),
a.style.setProperty('transform', 'translateZ(0)'),
a.style.setProperty('-webkit-transform', 'rotateZ(0)'),
a.style.setProperty('min-height', window.innerHeight + 'px'),
b.style.setProperty('transform', 'translateZ(0)'),
b.style.setProperty('-webkit-transform', 'rotateZ(0)'),
b.style.setProperty('min-height', window.innerHeight + 'px'),
this.container.css({
transform: 'translateX(' + this.backstageWidth + ')',
'-webkit-transform': 'translateX(' + this.backstageWidth + ')'
}),
this.contentFrame.css({
transform: 'translateX(-' + this.backstageWidth + ')',
'-webkit-transform': 'translateX(-' + this.backstageWidth + ')'
}),
this.resizeListener(),
this.fixFixedElements(this.fixedElements),
this.fixedElements = void 0,
a.style.setProperty('position', 'fixed'),
a.style.setProperty('overflow', 'hidden'),
b.style.setProperty('position', 'fixed'),
b.style.setProperty('overflow', 'hidden'),
setTimeout(_.bind(function () {
this.resizeListener()
}, this), 150),
this.scrollAnchor.scrollIntoView()
},
realEnable: function () {
var a = this;
this.inlineStyles.sheet.insertRule('#backstage-container { \twidth: ' + this.backstageWidth + ';\theight: 100%;\tposition: absolute;\ttop: 0;\tbottom: 0;\tright: 0;}', 0),
this.scrollAnchor.scrollIntoView(),
this.resizeListener = _.bind(this.resizeListener, this),
window.addEventListener('resize', this.resizeListener, !1),
this.scrollAnchor.parentNode.removeChild(this.scrollAnchor),
this.scrollAnchor = void 0;
var b = this.direct_route ? 0 : a.animationDuration;
try {
null !== this.contentFrame[0].contentWindow.document.body && (this.contentFrame[0].contentWindow.document.body.style.display = 'none', setTimeout(function () {
a.contentFrame[0].contentWindow.document.body.style.display = 'block'
}))
} catch (c) {
console.info(c)
}
$('body, #backstage-container-overlap').velocity({
translateX: '-' + a.backstageWidth,
translateZ: 0
}, {
duration: b,
easing: [
29,
9
],
complete: function () {
a.enabled = !0,
a.animationInProgress = !1,
a.enableClickToClose(),
a.tempInlineStyles.sheet.disabled = !0,
a.direct_route = !1,
$('#backstage-container-overlap').remove()
}
}),
this.container.velocity({
translateX: [
0,
parseInt(this.backstageWidth)
],
tween: [
0,
1
]
}, {
duration: b,
easing: [
29,
9
],
progress: function (b, c, d, e, f) {
f < 0 && a.container.css({
transform: 'translateX(0px)',
'-webkit-transform': 'translateX(0px)'
})
}
}),
this.contentFrame.velocity({
translateX: [
0,
- parseInt(this.backstageWidth)
],
tween: [
0,
1
]
}, {
duration: b,
easing: [
29,
9
],
progress: function (b, c, d, e, f) {
f < 0 && a.contentFrame.css({
transform: 'translateX(0px)',
'-webkit-transform': 'translateX(0px)'
})
}
}),
this.el.style.display = ''
},
enableClickToClose: function () {
this.backstageOverlay.style.display = 'block'
},
disableClickToClose: function () {
this.backstageOverlay.style.display = 'none'
},
slideStart: function (a) {
$(window).on('mousemove touchmove', {
slideData: this.slideData,
slideEnd: _.bind(this.slideEnd, this),
offset: a.clientX,
width: this.backstageWidth
}, this.slideMove)
},
slideMove: function (a) {
a.preventDefault();
var b = a.data.slideData,
c = 0,
d = parseInt(a.data.width);
c = event.touches ? event.touches[0].clientX - a.data.offset : a.clientX - a.data.offset;
var e = d - c;
b.delta = 1 - Math.abs(c - b.offsetLast) / 30 * 1,
b.delta < 0.3 ? b.delta = 0.3 : b.delta > 1 && (b.delta = 1),
c < 0 ? e = d : e < 0 && (e = 0, a.data.slideEnd()),
$('body, #backstage-container-overlap').velocity('stop').velocity({
translateX: - 1 * e
}, 1),
b.closing = c >= b.offsetLast,
b.offsetLast = c
},
slideEnd: function (a) {
this.slideData.closing ? this.close() : $('body, #backstage-container-overlap').velocity('stop').velocity({
translateX: '-' + this.backstageWidth,
translateZ: 0
}, {
duration: this.animationDuration * this.slideData.delta,
easing: [
29,
9
]
}),
$(window).off('mousemove touchstart', this.slideMove),
this.slideData.closing = !0,
this.slideData.offsetLast = 0,
this.slideData.delta = 1
},
close: function () {
this.Toggle()
},
disable: function () {
window.requestAnimationFrame(_.bind(this.realDisable, this))
},
realDisable: function () {
if (!0 !== this.animationInProgress) {
this.animationInProgress = !0,
window.focus(),
void 0 !== this.el.contentWindow.Backstage && this.el.contentWindow.Backstage.Events.trigger('disable');
var a = this;
this.tempInlineStyles.sheet.disabled = !1,
$('body, #backstage-container-overlap').velocity({
translateX: 0,
translateZ: 0
}, {
begin: function () {
$(this).css('cursor', 'auto')
},
duration: this.animationDuration * this.slideData.delta,
easing: [
25,
8.5
],
complete: function () {
a.enabled = !1,
a.animationInProgress = !1,
$(this).css({
transform: '',
'-webkit-transform': ''
}),
a.unfixFixedElements(),
void 0 !== a.inlineStyles && (a.inlineStyles.sheet.disabled = !0, a.inlineStyles.parentNode.removeChild(a.inlineStyles)),
void 0 !== a.tempInlineStyles && (a.tempInlineStyles.sheet.disabled = !0, a.tempInlineStyles.parentNode.removeChild(a.tempInlineStyles));
var b = document.body,
c = document.getElementsByTagName('html') [0];
b.style.setProperty('transform', ''),
b.style.setProperty('-webkit-transform', ''),
b.style.setProperty('min-height', ''),
c.style.setProperty('transform', ''),
c.style.setProperty('-webkit-transform', ''),
c.style.setProperty('min-height', ''),
b.style.setProperty('position', ''),
b.style.setProperty('overflow', ''),
c.style.setProperty('position', ''),
c.style.setProperty('overflow', ''),
a.resizeListener(!0),
window.scrollTo(0, a.scrollPos),
window.removeEventListener('resize', a.resizeListener, !1),
a.disableClickToClose(),
a.el.style.display = 'none'
}
}),
this.container.velocity({
translateX: [
parseInt(this.backstageWidth),
0
]
}, {
duration: this.animationDuration * this.slideData.delta,
easing: [
25,
8.5
]
}),
this.contentFrame.velocity({
translateX: [
- parseInt(this.backstageWidth),
0
]
}, {
duration: this.animationDuration * this.slideData.delta,
easing: [
25,
8.5
]
})
}
},
isActive: function () {
return this.enabled
},
getFixedElements: function (a) {
void 0 === a && (a = window.document);
var b,
c,
d,
e,
f,
g,
h,
i = [
'[style*="position:fixed"],[style*="position: fixed"]'
],
j = /\bposition:\s*fixed;/,
k = 'position',
l = 'fixed',
m = a.styleSheets,
n = [
];
for (c = 0; c < m.length; c++) {
try {
f = m[c].cssRules
} catch (o) {
continue
}
if (null !== f) for (e = f.length, d = 0; d < e; d++) g = f[d],
j.test(g.cssText) && void 0 != g.selectorText && i.push(g.selectorText)
}
for (i = i.join(','), i = a.querySelectorAll(i), e = i.length, c = 0; c < e; c++) h = i[c],
b = window.getComputedStyle(h, null),
b.getPropertyValue(k) === l && n.push({
el: h,
offset: {
left: isNaN(parseInt(b.getPropertyValue('left'))) ? 0 : parseInt(b.getPropertyValue('left')),
top: isNaN(parseInt(b.getPropertyValue('top'))) ? 0 : parseInt(b.getPropertyValue('top'))
},
webkitTransformMatrix: 'none' === b.getPropertyValue('-webkit-transform') ? '' : b.getPropertyValue('-webkit-transform'),
transformMatrix: 'none' === b.getPropertyValue('transform') ? '' : b.getPropertyValue('transform'),
styleAttribute: h.getAttribute('style')
});
return n
},
fixFixedElements: function (a) {
var b = this;
this.unfixFixedElements();
var c = {
top: $(window).scrollTop(),
left: $(window).scrollLeft()
};
lastScrollPos = c.top,
void 0 === a && (a = this.getFixedElements()),
Cargo.Helper.isEdge() && (c.top = 0),
a.forEach(function (a) {
a.el.style.setProperty('transform', 'translateY(' + c.top + 'px) ' + a.transformMatrix, 'important'),
a.el.style.setProperty('-webkit-transform', 'translateY(' + c.top + 'px) ' + a.webkitTransformMatrix, 'important'),
a.el.style.setProperty('transition', 'none', 'important'),
a.el.style.setProperty('-webkit-transition', 'none', 'important'),
b.fauxFixedElements.push(a)
})
},
unfixFixedElements: function () {
this.fauxFixedElements.forEach(function (a) {
a.el.style.removeProperty('transform'),
a.el.style.removeProperty('-webkit-transform'),
setTimeout(function () {
null === a.styleAttribute || '' === a.styleAttribute ? a.el.removeAttribute('style') : a.el.setAttribute('style', a.styleAttribute)
}, 1)
}),
this.fauxFixedElements = [
]
}
}),
Cargo.o.view.Backdrop = Backbone.View.extend({
has_webgl: null,
initialize: function (a) {
if (void 0 === Backdrop.Model.Settings) return Backdrop.Model.Settings = new Backdrop.o.model.Settings,
void Backdrop.Model.Settings.fetch({
success: $.proxy(function (a) {
this.initPlugin()
}, this)
});
this.initPlugin()
},
initPlugin: function () {
if (Backdrop.Model.Settings.get('requires_webgl') && !this.testWebGl()) return void this.makeFallback();
this.loadActivePlugin()
},
testWebGl: function () {
if (null != this.has_webgl) return this.has_webgl;
var a,
b,
c;
if (this.has_webgl = !1, window.WebGLRenderingContext) {
a = document.createElement('canvas'),
b = [
'webgl',
'experimental-webgl',
'moz-webgl',
'webkit-3d'
],
c = !1;
for (var d = 0; d < 4; d++) try {
if ((c = a.getContext(b[d])) && 'function' == typeof c.getParameter) return a = void 0,
this.has_webgl = !0,
this.has_webgl
} catch (e) {
}
return a = void 0,
this.has_webgl = !1,
this.has_webgl
}
return this.has_webgl = !1,
this.has_webgl
},
unloadMainPlugin: function () {
Backdrop.Data.prev_active_plugin && this.toggleCSS(Backdrop.Data.prev_active_plugin, !0),
'function' == typeof Backdrop.View.Plugin.destroy && Backdrop.View.Plugin.destroy(),
Backdrop.View.Plugin.undelegateEvents(),
Backdrop.View.Plugin.$el.removeData().unbind(),
Backdrop.View.Plugin.remove(),
Backdrop.View.Plugin = void 0,
Backdrop.Model.Settings.attributes = {
}
},
makeFallback: function () {
var a = $('[data-container="content"]main').css('color'),
b = a.split(','),
c = [
],
d = 0;
/rgb\(/.test(a) ? (b[0] = b[0].replace('rgb(', ''), c[0] = parseInt(b[0]), c[1] = parseInt(b[1]), c[2] = parseInt(b[2]), d = (299 * c[0] + 587 * c[1] + 114 * c[2]) / 1000) : /rgba\(/.test(a) ? (b[0] = b[0].replace('rgba(', ''), c[0] = parseInt(b[0]), c[1] = parseInt(b[1]), c[2] = parseInt(b[2]), d = (299 * c[0] + 587 * c[1] + 114 * c[2]) / 1000) : /#/.test(a) ? (c[0] = parseInt(b[0], 16), c[1] = parseInt(b[1], 16), c[2] = parseInt(b[2], 16), d = (299 * c[0] + 587 * c[1] + 114 * c[2]) / 1000) : d = 255,
d > 125 ? this.$el.css('background-color', '#333') : this.$el.css('background-color', '#fff')
},
loadActivePlugin: function () {
var a = this;
Backdrop.Data.require_loaded && '' != Backdrop.Data.active_plugin ? (Backdrop.Data.prev_active_plugin != Backdrop.Data.active_plugin && (Cargo.Event.trigger('show_loading_anim'), require.config({
baseUrl: '/_jsapps/backdrop'
}), require([Backdrop.Data.active_plugin + '/main'], function (b) {
0 == _.keys(Backdrop.Model.Settings.attributes).length ? (Backdrop.Model.Settings.fetch({
reset: !0
}), Backdrop.Model.Settings.once('sync', function () {
a.initAndRenderPlugin(b)
})) : a.initAndRenderPlugin(b)
})), Backdrop.Data.prev_active_plugin = Backdrop.Data.active_plugin) : setTimeout(function () {
Backdrop.View.Backdrop.loadActivePlugin()
}, 150)
},
render: function () {
this.$el.html(Backdrop.View.Plugin.render().$el),
Cargo.Event.trigger('plugin_render', Backdrop.View.Plugin),
'function' == typeof Backdrop.View.Plugin.Init && Backdrop.View.Plugin.Init()
},
initAndRenderPlugin: function (a) {
Cargo.Event.trigger('hide_loading_anim'),
void 0 === Backdrop.View.Plugin && (Backdrop.View.Plugin = new a({
model: Backdrop.Model.Settings
}), this.toggleCSS(Backdrop.Data.active_plugin, !1), this.render(), Cargo.Event.trigger('plugin_load_complete'))
},
toggleCSS: function (a, b) {
for (i = 0; i < document.styleSheets.length; i++) {
var c = document.styleSheets.item(i);
if (/backdrop\//.test(c.href)) {
a == c.href.split('backdrop/') [1].split('/style') [0] && (c.disabled = b)
}
}
}
}),
Cargo.o.view.ProjectDetail = Backbone.View.extend({
el: '#maincontainer',
isAdminEdit: !1,
use_lightbox: !1,
initialize: function () {
this.Data = {
total_tries: 0,
max_tries: 5,
first_load: !0
},
this.collection.bind('change', this.render, this);
var a = this.collection,
b = !(!a || !a.GetId()) && a.GetId();
this.markNodesAsOriginal(b),
Cargo.View.Main && b == Cargo.Model.Site.get('start_project_id') && Cargo.View.Main.SetHomepageClass();
try {
parent.hasOwnProperty('Cargo') && (this.isAdminEdit = parent.Cargo.Helper.IsAdminEdit())
} catch (c) {
}
!0 === Cargo.Model.DisplayOptions.get('lightbox_view') && (this.use_lightbox = !0, this.setupLightbox()),
Cargo.Core.Embeds.findEmbedsIn(this.el)
},
render: function (a) {
if (!0 !== this.preventRender) {
var b = this.collection;
if (b && !b.GetId()) return this.CloseProject(),
void Cargo.Helper.HideLoadingAnimation();
if (b) {
var c = !(!b || !b.GetId()) && b.GetId(),
d = Cargo.Template.Get('ProjectDetail');
if (this.Data.pid = c, !d) return Cargo.View.ProjectDetail.Data.total_tries >= Cargo.View.ProjectDetail.Data.max_tries ? document.location.href = b.get('direct_link') : setTimeout(function () {
Cargo.View.ProjectDetail.Data.total_tries++,
Cargo.View.ProjectDetail.render()
}, 100),
!1;
var e,
f = Cargo.API.GetDataPackage('project', b.toJSON()),
g = Cargo.Core.Handlebars.Render(d, f),
h = document.createRange(),
i = [
];
for (h.selectNode(document.body), e = h.createContextualFragment(g), _.each(e.querySelectorAll('script'), function (a) {
i.push({
node: a,
parentNode: a.parentNode,
nextSibling: a.nextSibling
}),
a.parentNode.removeChild(a)
}), this.el.innerHTML = ''; e.childNodes.length > 0; ) this.el.appendChild(e.childNodes[0]);
var j = !1,
k = function (a) {
j = !0
};
window.addEventListener('error', k, !1),
_.each(i, function (a) {
j = !1;
var b = $;
$(a.node).on('load', function () {
if ($ !== b) {
Cargo.Modal.Alert({
message: '<em>External versions of jQuery are not supported. Please use the built-in version of jQuery</em>'
});
var a = this.ownerDocument.createComment(this.outerHTML);
a.setSaveable(!0),
this.parentNode.insertBefore(a, this),
this.parentNode.removeChild(this),
jQuery.noConflict(!0)
}
}),
a.nextSibling && a.nextSibling.parentNode === a.parentNode ? a.parentNode.insertBefore(a.node, a.nextSibling) : a.parentNode.appendChild(a.node),
j && (j = !1, a.node.parentNode.insertBefore(document.createComment(a.node.outerHTML), a.node), a.node.parentNode.removeChild(a.node), this.isAdminEdit && Cargo.Modal.Alert({
message: '<em>One or more scripts on this page are broken and were disabled.</em>'
}))
}),
window.removeEventListener('error', k),
this.$el.show(),
this.markNodesAsOriginal(c),
Cargo.Core.Embeds.findEmbedsIn(this.el),
Cargo.Event.trigger('page_load_complete', c),
Cargo.View.ProjectDetail.Data.total_tries = 0,
this.Data.first_load = !1
}
this.use_lightbox && this.setupLightbox()
}
},
setupLightbox: function (a) {
var b = !1;
try {
parent.hasOwnProperty('Cargo') && (b = parent.Cargo.Helper.IsAdminEdit())
} catch (a) {
}
if (!b) {
var c = [
];
$('img', this.el).each(function () {
if ($(this).is('[src_o]') && 0 === $(this).closest('a').length) {
c.push(this);
var a = {
x: 0,
y: 0
};
$(this).css({
cursor: '-webkit-zoom-in',
cursor: '-moz-zoom-in',
cursor: 'zoom-in'
}).on('mousedown.lightbox', function (b) {
a.x = b.clientX,
a.y = b.clientY
}).on('click.lightbox', function (b) {
Math.sqrt((a.x -= b.clientX) * a.x + (a.y -= b.clientY) * a.y) > 100 || lightbox.openImageArray(c, this)
})
}
})
}
},
unloadLightbox: function () {
$('img', this.el).off('mousedown.lightbox click.lightbox').css({
cursor: 'initial',
cursor: 'initial',
cursor: 'initial'
})
},
CloseProject: function () {
var a = this,
b = this.collection;
!0 === this.Data.first_load ? this.DoCloseActions(this.Data.pid) : $.when(Cargo.Event.ShowIndexTransition(this.Data.pid, b)).then(function () {
a.DoCloseActions(a.Data.pid),
Cargo.View.Main.SetPageId('')
})
},
DoCloseActions: function (a) {
Cargo.Event.trigger('show_index_start', a),
this.$el.empty().hide(0),
Cargo.Event.trigger('show_index_complete', a),
this.Data.first_load = !1
},
Permalink: function (a) {
Cargo.Helper.isOldIE() ? this.IePermalink(a) : (this.el.style.display = 'block', Cargo.Event.trigger('direct_link_loaded', Cargo.Model.Page.GetId(), location.pathname), Cargo.Event.trigger('page_load_complete', Cargo.Model.Page.GetId())),
this.Data.first_load = !1
},
IePermalink: function (a) {
setTimeout(function () {
Cargo.API.GetSinglePage(a)
}, 500)
},
ChangeBgColorFromModel: function () {
var a = this.collection;
if ((!a || a.GetId()) && a.GetBgColor()) {
var b = '<style id="site_bg_color"> body { background-color: ' + a.GetBgColor() + ' } </style>';
this.$el.append(b)
}
},
SaveContent: function (a) {
var b = this.collection;
b.set('content', a, {
silent: !0
});
var c = Cargo.Collection.Pages.where({
id: b.get('id')
}) [0];
c ? c.set('content', a, {
silent: !0
}) : console.log('Unable to update content model')
},
markNodesAsOriginal: function (a) {
var b = this.$el.find('projectcontent') [0];
if (void 0 !== b) {
Node.prototype.hasOwnProperty('setSaveable') && this.getAllDescendants(b, function (a) {
a.setSaveable(!0)
});
var c = b.parentNode;
for (c.setAttribute('data-ce-host', 'true'), c.setAttribute('data-ce-model-id', a); b.childNodes.length > 0; ) c.insertBefore(b.childNodes[0], b);
c.removeChild(b),
_.each(c.querySelectorAll('video[autoplay]'), function (a) {
a.play()
})
}
},
getAllDescendants: function (a, b) {
for (var c = 0; c < a.childNodes.length; c++) {
var d = a.childNodes[c],
e = b(d);
if (!1 === e) return !1;
'continue' !== e && this.getAllDescendants(d, b)
}
}
}),
Cargo.o.view.Default = Backbone.View.extend({
initialize: function (a) {
this.options = a,
'object' == typeof this.collection && (this.listenTo(this.collection, 'reset', this.render), this.listenTo(this.collection, 'add', this.add))
},
render: function () {
var a = Cargo.Template.Get(this.options.template);
if (a) {
var b = Cargo.API.GetDataPackage(this.options.datasetname.toLowerCase(), this.collection.toJSON()),
c = Cargo.Core.Handlebars.Render(a, b);
this.$el.empty(),
this.$el.append(c)
}
},
add: function (a) {
var b = Cargo.Template.Get(this.options.template),
c = this,
d = $('[href=\'' + a.get('url') + '\']', c.$el).length > 0,
e = $('[data-id=\'' + a.get('id') + '\']', c.$el).length > 0;
if (b && !d && !e) {
var f = Cargo.API.GetDataPackage(this.options.datasetname.toLowerCase(), a.toJSON()),
g = Cargo.Core.Handlebars.Render(b, f);
this.$el.append(g)
}
}
}),
Cargo.o.view.Following = Backbone.View.extend({
initialize: function () {
var a = this;
if (Cargo.API.Config.preview && !Cargo.Helper.IsAdminEdit()) return !1;
$.getJSON('//' + Cargo.Helper.GetBaseCargoDomain() + '/dispatch/auth/backstageAuth/' + Cargo.Helper.GetUrl() + '?callback=?', function (b) {
!0 !== Cargo.InspectorLoading && ($.post('/dispatch/auth/backstageAuthLocal', {
token: b.jdata.token,
url: b.jdata.url,
muid: b.jdata.muid
}, function (b) {
a.InitBackstageIcon(),
a.Init(b.jdata)
}, 'json'), b.html && (a.$el.prepend(b.html), a.InitBackstageIcon(), a.Init(b.jdata)))
})
},
InitBackstageIcon: function () {
return Cargo.Helper.IsAdminBackdrop() ? void $('#backstage_icon a', this.el).attr('href', Cargo.Model.Site.get('home_url')).attr('target', '_top') : parent !== window ? void $('#backstage_icon', this.el).addClass('noclick') : void $('#backstage_icon a').off().on('click', function (a) {
if (a.preventDefault(), $(this).closest('#backstage_icon').hasClass('noclick')) return !1;
Cargo.View.Backstage.Toggle()
})
},
Init: function (a) {
Cargo.API.Config.cookie_url = a.cookie_url,
Cargo.API.Config.cookie_link = a.cookie_link,
Cargo.API.Config.cookie_site_count = a.cookie_site_count,
'object' == typeof Cargo.View.Backstage && 'object' == typeof Cargo.View.Backstage.el && Cargo.View.Backstage.updateCookieData()
}
}),
$(function () {
Cargo.Data = {
},
Cargo.API = new Cargo.o.api,
Cargo.Template = new Cargo.o.templates,
Cargo.Router = new Cargo.o.router,
Cargo.Analytics = new Cargo.o.analytics,
Cargo.Model.BasePage = Cargo.o.model.page,
Cargo.Model.Page = new Cargo.Model.BasePage,
Cargo.Model.DisplayOptions = new Cargo.o.model.display_options,
Cargo.Model.Site = new Cargo.o.model.site,
Cargo.Model.Asset = new Cargo.o.model.asset,
Cargo.Model.Image = new Cargo.o.model.image,
Cargo.Model.Css = new Cargo.o.model.css,
Cargo.Model.Default = new Cargo.o.model.undefined_default,
Cargo.Model.Project = Cargo.Model.Page,
Cargo.Collection.Images = new Cargo.o.collection.images,
Cargo.Collection.Pages = new Cargo.o.collection.pages,
Cargo.Collection.Assets = new Cargo.o.collection.assets({
model: Cargo.Model.Asset
}),
Cargo.Collection.Default = new Cargo.o.collection.undefined_default({
model: Cargo.Model.Default
}),
Cargo.Collection.Pages.on('reset', function (a) {
Cargo.Event.trigger('page_collection_reset')
}),
Cargo.Model.DisplayOptions.once('change', function () {
Cargo.Event.trigger('display_options_available', Cargo.Model.DisplayOptions)
}),
Cargo.Model.DisplayOptions.fetch({
reset: !0
}),
Cargo.Model.Page.fetch({
reset: !0
}),
Cargo.Collection.Assets.fetch(),
Cargo.Model.Site.fetch(),
Cargo.Helper.TestUrlCaseAndRedirect(),
Cargo.View.Backstage = new Cargo.o.view.Backstage,
Cargo.Core.Embeds.initialize(),
void 0 === Cargo.View.Main && (Cargo.View.Main = new Cargo.o.view.Main({
el: 'body',
collection: Cargo.Model.Site
})),
Cargo.Template.FindAndAddViewStubs(),
Cargo.Template.LoadFoundViews(),
Cargo.Collection.Pages.fetch({
complete: function () {
Cargo.Event.trigger('page_collection_reset'),
Cargo.Event.trigger('first_page_collection_reset')
}
}),
Cargo.Helper.isOldIE() || Cargo.Helper.IsPersonaAdmin() || (Cargo.Router.is_first_route = !0, Backbone.history.start({
pushState: !0,
hashChange: !1,
root: Cargo.Helper.GetHomeUrl(!0)
})),
Cargo.Core.KeyboardShortcut.InitDefaults(),
Cargo.Template.LoadAll(),
Cargo.Template.LoadFoundViews(),
Cargo.Core.Slideshow.InitSlideshow(),
Cargo.Core.InitKeycodeListener(),
Persona.Helper = Cargo.Helper,
Persona.Event = Cargo.Event
});
var Cargo = Cargo || {
};
Cargo.Plugins = Cargo.Plugins || {
},
Cargo.Plugins.backgroundSize = function (a) {
return function (b, c) {
var d,
e;
if (d = a.extend(!0, {
size: 'cover',
parent: document.getElementById('backdrop'),
limit: !1,
center: !0,
windowEvents: 'resize'
}, c), e = {
active: !1
}, void 0 === b) return void console.error('Please pass an element');
if (b.nodeType) {
var f = b;
b = [
],
b.push(f)
}
'object' == typeof b && Object.keys(b).map(function (a) {
return b[a][0]
});
var g = function () {
for (var a = 0; a < b.length; a++) i(b[a])
},
h = {
elementRatio: function (a) {
var b = {
x: 0,
y: 0
};
if (a.hasAttribute('height') && a.hasAttribute('width')) return b.y = a.getAttribute('width') / a.getAttribute('height'),
b.x = a.getAttribute('height') / a.getAttribute('width'),
b;
if (a.hasAttribute('data-aspect-ratio')) {
var c = a.getAttribute('data-aspect-ratio').split(':');
return b.y = parseInt(c[0]) / parseInt(c[1]),
b.x = parseInt(c[1]) / parseInt(c[0]),
b
}
return b = !1
},
isElement: function (a) {
return void 0 !== a && 'undefined' != typeof HTMLElement && a instanceof HTMLElement && 1 === a.nodeType
},
parentDimensions: function (a, b) {
var c = {
w: 0,
h: 0
};
return b && b !== window && 'window' !== b ? ('object' != typeof b || h.isElement(b) || (b = b[0]), h.isElement(b) ? (c.w = b.clientWidth, c.h = b.clientHeight, c) : (b = closest(a, b) || document.querySelector(b)) ? (c.w = b.clientWidth, c.h = b.clientHeight, c) : c = !1) : (c.w = window.innerWidth, c.h = window.innerHeight, c)
}
},
i = function (a) {
var b = d.size,
c = null,
e = null,
f = 0,
g = 0,
i = 0,
j = 0,
k = 0,
l = 0,
m = null;
if (!(e = h.elementRatio(a))) return void console.error('Element needs height and width defined');
if (f = parseInt(a.getAttribute('height')), g = parseInt(a.getAttribute('width')), a.hasAttribute('data-size')) {
var n = a.getAttribute('data-size');
'cover' !== n && 'contain' !== n || (b = n)
}
if (!(c = h.parentDimensions(a, d.parent))) return void console.error('Invalid parent option');
'contain' === b ? m = c.w / c.h > e.y : 'cover' === b ? m = c.w / c.h < e.y : console.warn('Please select a size mode'),
m ? (i = Math.ceil(c.h), j = Math.ceil(c.h * e.y)) : (i = Math.ceil(c.w * e.x), j = Math.ceil(c.w)),
'contain' === b && d.limit && (i > f && (i = f), j > g && (j = g)),
d.center || 'contain' !== d.size ? (k = Math.ceil((c.h - i) / 2), l = Math.ceil((c.w - j) / 2)) : (k = 0, l = 0),
a.style.height = i + 'px',
a.style.width = j + 'px',
a.style.marginTop = k + 'px',
a.style.marginLeft = l + 'px'
},
j = function () {
e.active || (e.active = !0, window.addEventListener('resize', g, !1), g())
},
k = function () {
g()
};
return {
start: j,
refresh: k,
stop: function () {
e.active && (e.active = !1, window.removeEventListener('resize', g, !1))
},
setSize: function (a) {
'cover' !== a && 'contain' !== a ? console.warn('Please pass a valid size') : (d.size = a, g())
},
setOptions: function (b) {
d = a.extend(!0, d, b),
k()
}
}
}
}(jQuery),
function (a) {
'use strict';
a(jQuery)
}(function (a) {
'use strict';
var b = window.Slick || {
};
b = function () {
function b(b, d) {
var e,
f = this;
f.defaults = {
accessibility: !0,
adaptiveHeight: !1,
appendArrows: a(b),
appendDots: a(b),
arrows: !0,
asNavFor: null,
prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>',
nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>',
autoplay: !1,
autoplaySpeed: 3000,
centerMode: !1,
centerPadding: '50px',
cssEase: 'ease',
customPaging: function (b, c) {
return a('<button type="button" data-role="none" role="button" aria-required="false" tabindex="0" />').text(c + 1)
},
dots: !1,
dotsClass: 'slick-dots',
draggable: !0,
easing: 'linear',
edgeFriction: 0.35,
fade: !1,
focusOnSelect: !1,
infinite: !0,
initialSlide: 0,
lazyLoad: 'ondemand',
mobileFirst: !1,
pauseOnHover: !0,
pauseOnFocus: !0,
pauseOnDotsHover: !1,
respondTo: 'window',
responsive: null,
rows: 1,
rtl: !1,
slide: '',
slidesPerRow: 1,
slidesToShow: 1,
slidesToScroll: 1,
speed: 500,
swipe: !0,
swipeToSlide: !1,
touchMove: !0,
touchThreshold: 5,
useCSS: !0,
useTransform: !0,
variableWidth: !1,
vertical: !1,
verticalSwiping: !1,
waitForAnimate: !0,
zIndex: 1000
},
f.initials = {
animating: !1,
dragging: !1,
autoPlayTimer: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
$dots: null,
listWidth: null,
listHeight: null,
loadIndex: 0,
$nextArrow: null,
$prevArrow: null,
slideCount: null,
slideWidth: null,
$slideTrack: null,
$slides: null,
sliding: !1,
slideOffset: 0,
swipeLeft: null,
$list: null,
touchObject: {
},
transformsEnabled: !1,
unslicked: !1
},
a.extend(f, f.initials),
f.activeBreakpoint = null,
f.animType = null,
f.animProp = null,
f.breakpoints = [
],
f.breakpointSettings = [
],
f.cssTransitions = !1,
f.focussed = !1,
f.interrupted = !1,
f.hidden = 'hidden',
f.paused = !0,
f.positionProp = null,
f.respondTo = null,
f.rowCount = 1,
f.shouldClick = !0,
f.$slider = a(b),
f.$slidesCache = null,
f.transformType = null,
f.transitionType = null,
f.visibilityChange = 'visibilitychange',
f.windowWidth = 0,
f.windowTimer = null,
e = a(b).data('slick') || {
},
f.options = a.extend({
}, f.defaults, d, e),
f.currentSlide = f.options.initialSlide,
f.originalSettings = f.options,
void 0 !== document.mozHidden ? (f.hidden = 'mozHidden', f.visibilityChange = 'mozvisibilitychange') : void 0 !== document.webkitHidden && (f.hidden = 'webkitHidden', f.visibilityChange = 'webkitvisibilitychange'),
f.autoPlay = a.proxy(f.autoPlay, f),
f.autoPlayClear = a.proxy(f.autoPlayClear, f),
f.autoPlayIterator = a.proxy(f.autoPlayIterator, f),
f.changeSlide = a.proxy(f.changeSlide, f),
f.clickHandler = a.proxy(f.clickHandler, f),
f.selectHandler = a.proxy(f.selectHandler, f),
f.setPosition = a.proxy(f.setPosition, f),
f.swipeHandler = a.proxy(f.swipeHandler, f),
f.dragHandler = a.proxy(f.dragHandler, f),
f.keyHandler = a.proxy(f.keyHandler, f),
f.instanceUid = c++,
f.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/,
f.registerBreakpoints(),
f.init(!0)
}
var c = 0;
return b
}(),
b.prototype.activateADA = function () {
this.$slideTrack.find('.slick-active').attr({
'aria-hidden': 'false'
}).find('a, input, button, select').attr({
tabindex: '0'
})
},
b.prototype.addSlide = b.prototype.slickAdd = function (b, c, d) {
var e = this;
if ('boolean' == typeof c) d = c,
c = null;
else if (c < 0 || c >= e.slideCount) return !1;
e.unload(),
'number' == typeof c ? 0 === c && 0 === e.$slides.length ? a(b).appendTo(e.$slideTrack) : d ? a(b).insertBefore(e.$slides.eq(c)) : a(b).insertAfter(e.$slides.eq(c)) : !0 === d ? a(b).prependTo(e.$slideTrack) : a(b).appendTo(e.$slideTrack),
e.$slides = e.$slideTrack.children(this.options.slide),
e.$slideTrack.children(this.options.slide).detach(),
e.$slideTrack.append(e.$slides),
e.$slides.each(function (b, c) {
a(c).attr('data-slick-index', b)
}),
e.$slidesCache = e.$slides,
e.reinit()
},
b.prototype.animateHeight = function () {
var a = this;
if (1 === a.options.slidesToShow && !0 === a.options.adaptiveHeight && !1 === a.options.vertical) {
var b = a.$slides.eq(a.currentSlide).outerHeight(!0);
a.$list.css('height', b)
}
},
b.prototype.animateSlide = function (b, c) {
var d = {
},
e = this;
e.animateHeight(),
!0 === e.options.rtl && !1 === e.options.vertical && (b = - b),
!1 === e.transformsEnabled ? !1 === e.options.vertical ? e.$slideTrack.animate({
left: b
}, e.options.speed, e.options.easing, c) : e.$slideTrack.animate({
top: b
}, e.options.speed, e.options.easing, c) : !1 === e.cssTransitions ? (!0 === e.options.rtl && (e.currentLeft = - e.currentLeft), a({
animStart: e.currentLeft
}).animate({
animStart: b
}, {
duration: e.options.speed,
easing: e.options.easing,
step: function (a) {
a = Math.ceil(a),
!1 === e.options.vertical ? (d[e.animType] = 'translate(' + a + 'px, 0px)', e.$slideTrack.css(d)) : (d[e.animType] = 'translate(0px,' + a + 'px)', e.$slideTrack.css(d))
},
complete: function () {
c && c.call()
}
})) : (e.applyTransition(), b = Math.ceil(b), !1 === e.options.vertical ? d[e.animType] = 'translate3d(' + b + 'px, 0px, 0px)' : d[e.animType] = 'translate3d(0px,' + b + 'px, 0px)', e.$slideTrack.css(d), c && setTimeout(function () {
e.disableTransition(),
c.call()
}, e.options.speed))
},
b.prototype.getNavTarget = function () {
var b = this,
c = b.options.asNavFor;
return c && null !== c && (c = a(c).not(b.$slider)),
c
},
b.prototype.asNavFor = function (b) {
var c = this,
d = c.getNavTarget();
null !== d && 'object' == typeof d && d.each(function () {
var c = a(this).slick('getSlick');
c.unslicked || c.slideHandler(b, !0)
})
},
b.prototype.applyTransition = function (a) {
var b = this,
c = {
};
!1 === b.options.fade ? c[b.transitionType] = b.transformType + ' ' + b.options.speed + 'ms ' + b.options.cssEase : c[b.transitionType] = 'opacity ' + b.options.speed + 'ms ' + b.options.cssEase,
!1 === b.options.fade ? b.$slideTrack.css(c) : b.$slides.eq(a).css(c)
},
b.prototype.autoPlay = function () {
var a = this;
a.autoPlayClear(),
a.slideCount > a.options.slidesToShow && (a.autoPlayTimer = setInterval(a.autoPlayIterator, a.options.autoplaySpeed))
},
b.prototype.autoPlayClear = function () {
var a = this;
a.autoPlayTimer && clearInterval(a.autoPlayTimer)
},
b.prototype.autoPlayIterator = function () {
var a = this,
b = a.currentSlide + a.options.slidesToScroll;
a.paused || a.interrupted || a.focussed || (!1 === a.options.infinite && (1 === a.direction && a.currentSlide + 1 === a.slideCount - 1 ? a.direction = 0 : 0 === a.direction && (b = a.currentSlide - a.options.slidesToScroll, a.currentSlide - 1 == 0 && (a.direction = 1))), a.slideHandler(b))
},
b.prototype.buildArrows = function () {
var b = this;
!0 === b.options.arrows && (b.$prevArrow = a(b.options.prevArrow).addClass('slick-arrow'), b.$nextArrow = a(b.options.nextArrow).addClass('slick-arrow'), b.slideCount > b.options.slidesToShow ? (b.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'), b.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'), b.htmlExpr.test(b.options.prevArrow) && b.$prevArrow.prependTo(b.options.appendArrows), b.htmlExpr.test(b.options.nextArrow) && b.$nextArrow.appendTo(b.options.appendArrows), !0 !== b.options.infinite && b.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true')) : b.$prevArrow.add(b.$nextArrow).addClass('slick-hidden').attr({
'aria-disabled': 'true',
tabindex: '-1'
}))
},
b.prototype.buildDots = function () {
var b,
c,
d = this;
if (!0 === d.options.dots && d.slideCount > d.options.slidesToShow) {
for (c = a('<ul />').addClass(d.options.dotsClass), b = 0; b <= d.getDotCount(); b += 1) c.append(a('<li />').append(d.options.customPaging.call(this, d, b)));
d.$dots = c.appendTo(d.options.appendDots),
d.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false')
}
},
b.prototype.buildOut = function () {
var b = this;
b.$slides = b.$slider.children(b.options.slide + ':not(.slick-cloned)').addClass('slick-slide'),
b.slideCount = b.$slides.length,
b.$slides.each(function (b, c) {
a(c).attr('data-slick-index', b).data('originalStyling', a(c).attr('style') || '')
}),
b.$slider.addClass('slick-slider'),
b.$slideTrack = 0 === b.slideCount ? a('<div class="slick-track"/>').appendTo(b.$slider) : b.$slides.wrapAll('<div class="slick-track"/>').parent(),
b.$list = b.$slideTrack.wrap('<div aria-live="polite" class="slick-list"/>').parent(),
b.$slideTrack.css('opacity', 0),
!0 !== b.options.centerMode && !0 !== b.options.swipeToSlide || (b.options.slidesToScroll = 1),
a('img[data-lazy]', b.$slider).not('[src]').addClass('slick-loading'),
b.setupInfinite(),
b.buildArrows(),
b.buildDots(),
b.updateDots(),
b.setSlideClasses('number' == typeof b.currentSlide ? b.currentSlide : 0),
!0 === b.options.draggable && b.$list.addClass('draggable')
},
b.prototype.buildRows = function () {
var a,
b,
c,
d,
e,
f,
g,
h = this;
if (d = document.createDocumentFragment(), f = h.$slider.children(), h.options.rows > 1) {
for (g = h.options.slidesPerRow * h.options.rows, e = Math.ceil(f.length / g), a = 0; a < e; a++) {
var i = document.createElement('div');
for (b = 0; b < h.options.rows; b++) {
var j = document.createElement('div');
for (c = 0; c < h.options.slidesPerRow; c++) {
var k = a * g + (b * h.options.slidesPerRow + c);
f.get(k) && j.appendChild(f.get(k))
}
i.appendChild(j)
}
d.appendChild(i)
}
h.$slider.empty().append(d),
h.$slider.children().children().children().css({
width: 100 / h.options.slidesPerRow + '%',
display: 'inline-block'
})
}
},
b.prototype.checkResponsive = function (b, c) {
var d,
e,
f,
g = this,
h = !1,
i = g.$slider.width(),
j = window.innerWidth || a(window).width();
if ('window' === g.respondTo ? f = j : 'slider' === g.respondTo ? f = i : 'min' === g.respondTo && (f = Math.min(j, i)), g.options.responsive && g.options.responsive.length && null !== g.options.responsive) {
e = null;
for (d in g.breakpoints) g.breakpoints.hasOwnProperty(d) && (!1 === g.originalSettings.mobileFirst ? f < g.breakpoints[d] && (e = g.breakpoints[d]) : f > g.breakpoints[d] && (e = g.breakpoints[d]));
null !== e ? null !== g.activeBreakpoint ? (e !== g.activeBreakpoint || c) && (g.activeBreakpoint = e, 'unslick' === g.breakpointSettings[e] ? g.unslick(e) : (g.options = a.extend({
}, g.originalSettings, g.breakpointSettings[e]), !0 === b && (g.currentSlide = g.options.initialSlide), g.refresh(b)), h = e) : (g.activeBreakpoint = e, 'unslick' === g.breakpointSettings[e] ? g.unslick(e) : (g.options = a.extend({
}, g.originalSettings, g.breakpointSettings[e]), !0 === b && (g.currentSlide = g.options.initialSlide), g.refresh(b)), h = e) : null !== g.activeBreakpoint && (g.activeBreakpoint = null, g.options = g.originalSettings, !0 === b && (g.currentSlide = g.options.initialSlide), g.refresh(b), h = e),
b || !1 === h || g.$slider.trigger('breakpoint', [
g,
h
])
}
},
b.prototype.changeSlide = function (b, c) {
var d,
e,
f,
g = this,
h = a(b.target);
switch (h.is('a') && b.preventDefault(), h.is('li') || (h = h.closest('li')), f = g.slideCount % g.options.slidesToScroll != 0, d = f ? 0 : (g.slideCount - g.currentSlide) % g.options.slidesToScroll, b.data.message) {
case 'previous':
e = 0 === d ? g.options.slidesToScroll : g.options.slidesToShow - d,
g.slideCount > g.options.slidesToShow && g.slideHandler(g.currentSlide - e, !1, c);
break;
case 'next':
e = 0 === d ? g.options.slidesToScroll : d,
g.slideCount > g.options.slidesToShow && g.slideHandler(g.currentSlide + e, !1, c);
break;
case 'index':
var i = 0 === b.data.index ? 0 : b.data.index || h.index() * g.options.slidesToScroll;
g.slideHandler(g.checkNavigable(i), !1, c),
h.children().trigger('focus');
break;
default:
return
}
},
b.prototype.checkNavigable = function (a) {
var b,
c,
d = this;
if (b = d.getNavigableIndexes(), c = 0, a > b[b.length - 1]) a = b[b.length - 1];
else for (var e in b) {
if (a < b[e]) {
a = c;
break
}
c = b[e]
}
return a
},
b.prototype.cleanUpEvents = function () {
var b = this;
b.options.dots && null !== b.$dots && a('li', b.$dots).off('click.slick', b.changeSlide).off('mouseenter.slick', a.proxy(b.interrupt, b, !0)).off('mouseleave.slick', a.proxy(b.interrupt, b, !1)),
b.$slider.off('focus.slick blur.slick'),
!0 === b.options.arrows && b.slideCount > b.options.slidesToShow && (b.$prevArrow && b.$prevArrow.off('click.slick', b.changeSlide), b.$nextArrow && b.$nextArrow.off('click.slick', b.changeSlide)),
b.$list.off('touchstart.slick mousedown.slick', b.swipeHandler),
b.$list.off('touchmove.slick mousemove.slick', b.swipeHandler),
b.$list.off('touchend.slick mouseup.slick', b.swipeHandler),
b.$list.off('touchcancel.slick mouseleave.slick', b.swipeHandler),
b.$list.off('click.slick', b.clickHandler),
a(document).off(b.visibilityChange, b.visibility),
b.cleanUpSlideEvents(),
!0 === b.options.accessibility && b.$list.off('keydown.slick', b.keyHandler),
!0 === b.options.focusOnSelect && a(b.$slideTrack).children().off('click.slick', b.selectHandler),
a(window).off('orientationchange.slick.slick-' + b.instanceUid, b.orientationChange),
a(window).off('resize.slick.slick-' + b.instanceUid, b.resize),
a('[draggable!=true]', b.$slideTrack).off('dragstart', b.preventDefault),
a(window).off('load.slick.slick-' + b.instanceUid, b.setPosition),
a(document).off('ready.slick.slick-' + b.instanceUid, b.setPosition)
},
b.prototype.cleanUpSlideEvents = function () {
var b = this;
b.$list.off('mouseenter.slick', a.proxy(b.interrupt, b, !0)),
b.$list.off('mouseleave.slick', a.proxy(b.interrupt, b, !1))
},
b.prototype.cleanUpRows = function () {
var a,
b = this;
b.options.rows > 1 && (a = b.$slides.children().children(), a.removeAttr('style'), b.$slider.empty().append(a))
},
b.prototype.clickHandler = function (a) {
!1 === this.shouldClick && (a.stopImmediatePropagation(), a.stopPropagation(), a.preventDefault())
},
b.prototype.destroy = function (b) {
var c = this;
c.autoPlayClear(),
c.touchObject = {
},
c.cleanUpEvents(),
a('.slick-cloned', c.$slider).detach(),
c.$dots && c.$dots.remove(),
c.$prevArrow && c.$prevArrow.length && (c.$prevArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display', ''), c.htmlExpr.test(c.options.prevArrow) && c.$prevArrow.remove()),
c.$nextArrow && c.$nextArrow.length && (c.$nextArrow.removeClass('slick-disabled slick-arrow slick-hidden').removeAttr('aria-hidden aria-disabled tabindex').css('display', ''), c.htmlExpr.test(c.options.nextArrow) && c.$nextArrow.remove()),
c.$slides && (c.$slides.removeClass('slick-slide slick-active slick-center slick-visible slick-current').removeAttr('aria-hidden').removeAttr('data-slick-index').each(function () {
a(this).attr('style', a(this).data('originalStyling'))
}), c.$slideTrack.children(this.options.slide).detach(), c.$slideTrack.detach(), c.$list.detach(), c.$slider.append(c.$slides)),
c.cleanUpRows(),
c.$slider.removeClass('slick-slider'),
c.$slider.removeClass('slick-initialized'),
c.unslicked = !0,
b || c.$slider.trigger('destroy', [
c
])
},
b.prototype.disableTransition = function (a) {
var b = this,
c = {
};
c[b.transitionType] = '',
!1 === b.options.fade ? b.$slideTrack.css(c) : b.$slides.eq(a).css(c)
},
b.prototype.fadeSlide = function (a, b) {
var c = this;
!1 === c.cssTransitions ? (c.$slides.eq(a).css({
zIndex: c.options.zIndex
}), c.$slides.eq(a).animate({
opacity: 1
}, c.options.speed, c.options.easing, b)) : (c.applyTransition(a), c.$slides.eq(a).css({
opacity: 1,
zIndex: c.options.zIndex
}), b && setTimeout(function () {
c.disableTransition(a),
b.call()
}, c.options.speed))
},
b.prototype.fadeSlideOut = function (a) {
var b = this;
!1 === b.cssTransitions ? b.$slides.eq(a).animate({
opacity: 0,
zIndex: b.options.zIndex - 2
}, b.options.speed, b.options.easing) : (b.applyTransition(a), b.$slides.eq(a).css({
opacity: 0,
zIndex: b.options.zIndex - 2
}))
},
b.prototype.filterSlides = b.prototype.slickFilter = function (a) {
var b = this;
null !== a && (b.$slidesCache = b.$slides, b.unload(), b.$slideTrack.children(this.options.slide).detach(), b.$slidesCache.filter(a).appendTo(b.$slideTrack), b.reinit())
},
b.prototype.focusHandler = function () {
var b = this;
b.$slider.off('focus.slick blur.slick').on('focus.slick blur.slick', '*:not(.slick-arrow)', function (c) {
c.stopImmediatePropagation();
var d = a(this);
setTimeout(function () {
b.options.pauseOnFocus && (b.focussed = d.is(':focus'), b.autoPlay())
}, 0)
})
},
b.prototype.getCurrent = b.prototype.slickCurrentSlide = function () {
return this.currentSlide
},
b.prototype.getDotCount = function () {
var a = this,
b = 0,
c = 0,
d = 0;
if (!0 === a.options.infinite) for (; b < a.slideCount; ) ++d,
b = c + a.options.slidesToScroll,
c += a.options.slidesToScroll <= a.options.slidesToShow ? a.options.slidesToScroll : a.options.slidesToShow;
else if (!0 === a.options.centerMode) d = a.slideCount;
else for (c = a.slideCount % a.options.slidesToShow == 0 ? c : c + 1; b < a.slideCount; ) ++d,
b = c + a.options.slidesToScroll,
c += a.options.slidesToScroll <= a.options.slidesToShow ? a.options.slidesToScroll : a.options.slidesToShow;
return d - 1
},
b.prototype.getLeft = function (a) {
var b,
c,
d,
e = this,
f = 0;
return e.slideOffset = 0,
c = e.$slides.first().outerHeight(!0),
!0 === e.options.infinite ? (e.slideCount > e.options.slidesToShow && (e.slideOffset = e.slideWidth * e.options.slidesToShow * - 1, f = c * e.options.slidesToShow * - 1), e.slideCount % e.options.slidesToScroll != 0 && a + e.options.slidesToScroll > e.slideCount && e.slideCount > e.options.slidesToShow && (a > e.slideCount ? (e.slideOffset = (e.options.slidesToShow - (a - e.slideCount)) * e.slideWidth * - 1, f = (e.options.slidesToShow - (a - e.slideCount)) * c * - 1) : (e.slideOffset = e.slideCount % e.options.slidesToScroll * e.slideWidth * - 1, f = e.slideCount % e.options.slidesToScroll * c * - 1))) : a + e.options.slidesToShow > e.slideCount && (e.slideOffset = (a + e.options.slidesToShow - e.slideCount) * e.slideWidth, f = (a + e.options.slidesToShow - e.slideCount) * c),
e.slideCount <= e.options.slidesToShow && (e.slideOffset = 0, f = 0),
!0 === e.options.centerMode && !0 === e.options.infinite ? e.slideOffset += e.slideWidth * Math.floor(e.options.slidesToShow / 2) - e.slideWidth : !0 === e.options.centerMode && (e.slideOffset = 0, e.slideOffset += e.slideWidth * Math.floor(e.options.slidesToShow / 2)),
b = !1 === e.options.vertical ? a * e.slideWidth * - 1 + e.slideOffset : a * c * - 1 + f,
!0 === e.options.variableWidth && (d = e.slideCount <= e.options.slidesToShow || !1 === e.options.infinite ? e.$slideTrack.children('.slick-slide').eq(a) : e.$slideTrack.children('.slick-slide').eq(a + e.options.slidesToShow), b = !0 === e.options.rtl ? d[0] ? - 1 * (e.$slideTrack.width() - d[0].offsetLeft - d.width()) : 0 : d[0] ? - 1 * d[0].offsetLeft : 0, !0 === e.options.centerMode && (d = e.slideCount <= e.options.slidesToShow || !1 === e.options.infinite ? e.$slideTrack.children('.slick-slide').eq(a) : e.$slideTrack.children('.slick-slide').eq(a + e.options.slidesToShow + 1), b = !0 === e.options.rtl ? d[0] ? - 1 * (e.$slideTrack.width() - d[0].offsetLeft - d.width()) : 0 : d[0] ? - 1 * d[0].offsetLeft : 0, b += (e.$list.width() - d.outerWidth()) / 2)),
b
},
b.prototype.getOption = b.prototype.slickGetOption = function (a) {
return this.options[a]
},
b.prototype.getNavigableIndexes = function () {
var a,
b = this,
c = 0,
d = 0,
e = [
];
for (!1 === b.options.infinite ? a = b.slideCount : (c = - 1 * b.options.slidesToScroll, d = - 1 * b.options.slidesToScroll, a = 2 * b.slideCount); c < a; ) e.push(c),
c = d + b.options.slidesToScroll,
d += b.options.slidesToScroll <= b.options.slidesToShow ? b.options.slidesToScroll : b.options.slidesToShow;
return e
},
b.prototype.getSlick = function () {
return this
},
b.prototype.getSlideCount = function () {
var b,
c,
d = this;
return c = !0 === d.options.centerMode ? d.slideWidth * Math.floor(d.options.slidesToShow / 2) : 0,
!0 === d.options.swipeToSlide ? (d.$slideTrack.find('.slick-slide').each(function (e, f) {
if (f.offsetLeft - c + a(f).outerWidth() / 2 > - 1 * d.swipeLeft) return b = f,
!1
}), Math.abs(a(b).attr('data-slick-index') - d.currentSlide) || 1) : d.options.slidesToScroll
},
b.prototype.goTo = b.prototype.slickGoTo = function (a, b) {
this.changeSlide({
data: {
message: 'index',
index: parseInt(a)
}
}, b)
},
b.prototype.init = function (b) {
var c = this;
a(c.$slider).hasClass('slick-initialized') || (a(c.$slider).addClass('slick-initialized'), c.buildRows(), c.buildOut(), c.setProps(), c.startLoad(), c.loadSlider(), c.initializeEvents(), c.updateArrows(), c.updateDots(), c.checkResponsive(!0), c.focusHandler()),
b && c.$slider.trigger('init', [
c
]),
!0 === c.options.accessibility && c.initADA(),
c.options.autoplay && (c.paused = !1, c.autoPlay())
},
b.prototype.initADA = function () {
var b = this;
b.$slides.add(b.$slideTrack.find('.slick-cloned')).attr({
'aria-hidden': 'true',
tabindex: '-1'
}).find('a, input, button, select').attr({
tabindex: '-1'
}),
b.$slideTrack.attr('role', 'listbox'),
b.$slides.not(b.$slideTrack.find('.slick-cloned')).each(function (c) {
a(this).attr({
role: 'option',
'aria-describedby': 'slick-slide' + b.instanceUid + c
})
}),
null !== b.$dots && b.$dots.attr('role', 'tablist').find('li').each(function (c) {
a(this).attr({
role: 'presentation',
'aria-selected': 'false',
'aria-controls': 'navigation' + b.instanceUid + c,
id: 'slick-slide' + b.instanceUid + c
})
}).first().attr('aria-selected', 'true').end().find('button').attr('role', 'button').end().closest('div').attr('role', 'toolbar'),
b.activateADA()
},
b.prototype.initArrowEvents = function () {
var a = this;
!0 === a.options.arrows && a.slideCount > a.options.slidesToShow && (a.$prevArrow.on('click.slick', {
message: 'previous'
}, a.changeSlide), a.$nextArrow.on('click.slick', {
message: 'next'
}, a.changeSlide))
},
b.prototype.initDotEvents = function () {
var b = this;
!0 === b.options.dots && b.slideCount > b.options.slidesToShow && a('li', b.$dots).on('click.slick', {
message: 'index'
}, b.changeSlide),
!0 === b.options.dots && !0 === b.options.pauseOnDotsHover && a('li', b.$dots).on('mouseenter.slick', a.proxy(b.interrupt, b, !0)).on('mouseleave.slick', a.proxy(b.interrupt, b, !1))
},
b.prototype.initSlideEvents = function () {
var b = this;
b.options.pauseOnHover && (b.$list.on('mouseenter.slick', a.proxy(b.interrupt, b, !0)), b.$list.on('mouseleave.slick', a.proxy(b.interrupt, b, !1)))
},
b.prototype.initializeEvents = function () {
var b = this;
b.initArrowEvents(),
b.initDotEvents(),
b.initSlideEvents(),
b.$list.on('touchstart.slick mousedown.slick', {
action: 'start'
}, b.swipeHandler),
b.$list.on('touchmove.slick mousemove.slick', {
action: 'move'
}, b.swipeHandler),
b.$list.on('touchend.slick mouseup.slick', {
action: 'end'
}, b.swipeHandler),
b.$list.on('touchcancel.slick mouseleave.slick', {
action: 'end'
}, b.swipeHandler),
b.$list.on('click.slick', b.clickHandler),
a(document).on(b.visibilityChange, a.proxy(b.visibility, b)),
!0 === b.options.accessibility && b.$list.on('keydown.slick', b.keyHandler),
!0 === b.options.focusOnSelect && a(b.$slideTrack).children().on('click.slick', b.selectHandler),
a(window).on('orientationchange.slick.slick-' + b.instanceUid, a.proxy(b.orientationChange, b)),
a(window).on('resize.slick.slick-' + b.instanceUid, a.proxy(b.resize, b)),
a('[draggable!=true]', b.$slideTrack).on('dragstart', b.preventDefault),
a(window).on('load.slick.slick-' + b.instanceUid, b.setPosition),
a(document).on('ready.slick.slick-' + b.instanceUid, b.setPosition)
},
b.prototype.initUI = function () {
var a = this;
!0 === a.options.arrows && a.slideCount > a.options.slidesToShow && (a.$prevArrow.show(), a.$nextArrow.show()),
!0 === a.options.dots && a.slideCount > a.options.slidesToShow && a.$dots.show()
},
b.prototype.keyHandler = function (a) {
var b = this;
a.target.tagName.match('TEXTAREA|INPUT|SELECT') || (37 === a.keyCode && !0 === b.options.accessibility ? b.changeSlide({
data: {
message: 'previous'
}
}) : 39 === a.keyCode && !0 === b.options.accessibility && b.changeSlide({
data: {
message: 'next'
}
}))
},
b.prototype.lazyLoad = function () {
function b(b) {
a('img[data-lazy]', b).each(function () {
var b = a(this),
c = a(this).attr('data-lazy'),
d = document.createElement('img');
d.onload = function () {
b.animate({
opacity: 0
}, 100, function () {
b.attr('src', c).animate({
opacity: 1
}, 200, function () {
b.removeAttr('data-lazy').removeClass('slick-loading')
})
})
},
d.src = c
})
}
var c,
d,
e,
f,
g = this;
!0 === g.options.centerMode ? !0 === g.options.infinite ? (e = g.currentSlide + (g.options.slidesToShow / 2 + 1), f = e + g.options.slidesToShow + 2) : (e = Math.max(0, g.currentSlide - (g.options.slidesToShow / 2 + 1)), f = g.options.slidesToShow / 2 + 1 + 2 + g.currentSlide) : (e = g.options.infinite ? g.options.slidesToShow + g.currentSlide : g.currentSlide, f = e + g.options.slidesToShow, !0 === g.options.fade && (e > 0 && e--, f <= g.slideCount && f++)),
c = g.$slider.find('.slick-slide').slice(e, f),
b(c),
g.slideCount <= g.options.slidesToShow ? (d = g.$slider.find('.slick-slide'), b(d)) : g.currentSlide >= g.slideCount - g.options.slidesToShow ? (d = g.$slider.find('.slick-cloned').slice(0, g.options.slidesToShow), b(d)) : 0 === g.currentSlide && (d = g.$slider.find('.slick-cloned').slice( - 1 * g.options.slidesToShow), b(d))
},
b.prototype.loadSlider = function () {
var a = this;
a.setPosition(),
a.$slideTrack.css({
opacity: 1
}),
a.$slider.removeClass('slick-loading'),
a.initUI(),
'progressive' === a.options.lazyLoad && a.progressiveLazyLoad()
},
b.prototype.next = b.prototype.slickNext = function () {
this.changeSlide({
data: {
message: 'next'
}
})
},
b.prototype.orientationChange = function () {
var a = this;
a.checkResponsive(),
a.setPosition()
},
b.prototype.pause = b.prototype.slickPause = function () {
var a = this;
a.autoPlayClear(),
a.paused = !0
},
b.prototype.play = b.prototype.slickPlay = function () {
var a = this;
a.autoPlay(),
a.options.autoplay = !0,
a.paused = !1,
a.focussed = !1,
a.interrupted = !1
},
b.prototype.postSlide = function (a) {
var b = this;
b.unslicked || (b.$slider.trigger('afterChange', [
b,
a
]), b.animating = !1, b.setPosition(), b.swipeLeft = null, b.options.autoplay && b.autoPlay(), !0 === b.options.accessibility && b.initADA())
},
b.prototype.prev = b.prototype.slickPrev = function () {
this.changeSlide({
data: {
message: 'previous'
}
})
},
b.prototype.preventDefault = function (a) {
a.preventDefault()
},
b.prototype.progressiveLazyLoad = function () {
var b,
c,
d = this;
(b = a('img[data-lazy]', d.$slider).length) > 0 && (c = a('img[data-lazy]', d.$slider).first(), c.attr('src', null), c.attr('src', c.attr('data-lazy')).removeClass('slick-loading').load(function () {
c.removeAttr('data-lazy'),
d.progressiveLazyLoad(),
!0 === d.options.adaptiveHeight && d.setPosition()
}).error(function () {
c.removeAttr('data-lazy'),
d.progressiveLazyLoad()
}))
},
b.prototype.refresh = function (b) {
var c,
d,
e = this;
d = e.slideCount - e.options.slidesToShow,
!e.options.infinite && e.currentSlide > d && (e.currentSlide = d),
e.slideCount <= e.options.slidesToShow && (e.currentSlide = 0),
c = e.currentSlide,
e.destroy(!0),
a.extend(e, e.initials, {
currentSlide: c
}),
e.init(),
b || e.changeSlide({
data: {
message: 'index',
index: c
}
}, !1)
},
b.prototype.registerBreakpoints = function () {
var b,
c,
d,
e = this,
f = e.options.responsive || null;
if ('array' === a.type(f) && f.length) {
e.respondTo = e.options.respondTo || 'window';
for (b in f) if (d = e.breakpoints.length - 1, c = f[b].breakpoint, f.hasOwnProperty(b)) {
for (; d >= 0; ) e.breakpoints[d] && e.breakpoints[d] === c && e.breakpoints.splice(d, 1),
d--;
e.breakpoints.push(c),
e.breakpointSettings[c] = f[b].settings
}
e.breakpoints.sort(function (a, b) {
return e.options.mobileFirst ? a - b : b - a
})
}
},
b.prototype.reinit = function () {
var b = this;
b.$slides = b.$slideTrack.children(b.options.slide).addClass('slick-slide'),
b.slideCount = b.$slides.length,
b.currentSlide >= b.slideCount && 0 !== b.currentSlide && (b.currentSlide = b.currentSlide - b.options.slidesToScroll),
b.slideCount <= b.options.slidesToShow && (b.currentSlide = 0),
b.registerBreakpoints(),
b.setProps(),
b.setupInfinite(),
b.buildArrows(),
b.updateArrows(),
b.initArrowEvents(),
b.buildDots(),
b.updateDots(),
b.initDotEvents(),
b.cleanUpSlideEvents(),
b.initSlideEvents(),
b.checkResponsive(!1, !0),
!0 === b.options.focusOnSelect && a(b.$slideTrack).children().on('click.slick', b.selectHandler),
b.setSlideClasses('number' == typeof b.currentSlide ? b.currentSlide : 0),
b.setPosition(),
b.focusHandler(),
b.options.autoplay && b.autoPlay(),
b.$slider.trigger('reInit', [
b
])
},
b.prototype.resize = function () {
var b = this;
a(window).width() !== b.windowWidth && (clearTimeout(b.windowDelay), b.windowDelay = window.setTimeout(function () {
b.windowWidth = a(window).width(),
b.checkResponsive(),
b.unslicked || b.setPosition()
}, 50))
},
b.prototype.removeSlide = b.prototype.slickRemove = function (a, b, c) {
var d = this;
if ('boolean' == typeof a ? (b = a, a = !0 === b ? 0 : d.slideCount - 1) : a = !0 === b ? --a : a, d.slideCount < 1 || a < 0 || a > d.slideCount - 1) return !1;
d.unload(),
!0 === c ? d.$slideTrack.children().remove() : d.$slideTrack.children(this.options.slide).eq(a).remove(),
d.$slides = d.$slideTrack.children(this.options.slide),
d.$slideTrack.children(this.options.slide).detach(),
d.$slideTrack.append(d.$slides),
d.$slidesCache = d.$slides,
d.reinit()
},
b.prototype.setCSS = function (a) {
var b,
c,
d = this,
e = {
};
!0 === d.options.rtl && (a = - a),
b = 'left' == d.positionProp ? Math.ceil(a) + 'px' : '0px',
c = 'top' == d.positionProp ? Math.ceil(a) + 'px' : '0px',
e[d.positionProp] = a,
!1 === d.transformsEnabled ? d.$slideTrack.css(e) : (e = {
}, !1 === d.cssTransitions ? (e[d.animType] = 'translate(' + b + ', ' + c + ')', d.$slideTrack.css(e)) : (e[d.animType] = 'translate3d(' + b + ', ' + c + ', 0px)', d.$slideTrack.css(e)))
},
b.prototype.setDimensions = function () {
var a = this;
!1 === a.options.vertical ? !0 === a.options.centerMode && a.$list.css({
padding: '0px ' + a.options.centerPadding
}) : (a.$list.height(a.$slides.first().outerHeight(!0) * a.options.slidesToShow), !0 === a.options.centerMode && a.$list.css({
padding: a.options.centerPadding + ' 0px'
})),
a.listWidth = a.$list.width(),
a.listHeight = a.$list.height(),
!1 === a.options.vertical && !1 === a.options.variableWidth ? (a.slideWidth = Math.ceil(a.listWidth / a.options.slidesToShow), a.$slideTrack.width(Math.ceil(a.slideWidth * a.$slideTrack.children('.slick-slide').length))) : !0 === a.options.variableWidth ? a.$slideTrack.width(5000 * a.slideCount) : (a.slideWidth = Math.ceil(a.listWidth), a.$slideTrack.height(Math.ceil(a.$slides.first().outerHeight(!0) * a.$slideTrack.children('.slick-slide').length)));
var b = a.$slides.first().outerWidth(!0) - a.$slides.first().width();
!1 === a.options.variableWidth && a.$slideTrack.children('.slick-slide').width(a.slideWidth - b)
},
b.prototype.setFade = function () {
var b,
c = this;
c.$slides.each(function (d, e) {
b = c.slideWidth * d * - 1,
!0 === c.options.rtl ? a(e).css({
position: 'relative',
right: b,
top: 0,
zIndex: c.options.zIndex - 2,
opacity: 0
}) : a(e).css({
position: 'relative',
left: b,
top: 0,
zIndex: c.options.zIndex - 2,
opacity: 0
})
}),
c.$slides.eq(c.currentSlide).css({
zIndex: c.options.zIndex - 1,
opacity: 1
})
},
b.prototype.setHeight = function () {
var a = this;
if (1 === a.options.slidesToShow && !0 === a.options.adaptiveHeight && !1 === a.options.vertical) {
var b = a.$slides.eq(a.currentSlide).outerHeight(!0);
a.$list.css('height', b)
}
},
b.prototype.setOption = b.prototype.slickSetOption = function (b, c, d) {
var e,
f,
g = this;
if ('responsive' === b && 'array' === a.type(c)) for (f in c) if ('array' !== a.type(g.options.responsive)) g.options.responsive = [
c[f]
];
else {
for (e = g.options.responsive.length - 1; e >= 0; ) g.options.responsive[e].breakpoint === c[f].breakpoint && g.options.responsive.splice(e, 1),
e--;
g.options.responsive.push(c[f])
} else g.options[b] = c;
!0 === d && (g.unload(), g.reinit())
},
b.prototype.setPosition = function () {
var a = this;
a.setDimensions(),
a.setHeight(),
!1 === a.options.fade ? a.setCSS(a.getLeft(a.currentSlide)) : a.setFade(),
a.$slider.trigger('setPosition', [
a
])
},
b.prototype.setProps = function () {
var a = this,
b = document.body.style;
a.positionProp = !0 === a.options.vertical ? 'top' : 'left',
'top' === a.positionProp ? a.$slider.addClass('slick-vertical') : a.$slider.removeClass('slick-vertical'),
void 0 === b.WebkitTransition && void 0 === b.MozTransition && void 0 === b.msTransition || !0 === a.options.useCSS && (a.cssTransitions = !0),
a.options.fade && ('number' == typeof a.options.zIndex ? a.options.zIndex < 3 && (a.options.zIndex = 3) : a.options.zIndex = a.defaults.zIndex),
void 0 !== b.OTransform && (a.animType = 'OTransform', a.transformType = '-o-transform', a.transitionType = 'OTransition', void 0 === b.perspectiveProperty && void 0 === b.webkitPerspective && (a.animType = !1)),
void 0 !== b.MozTransform && (a.animType = 'MozTransform', a.transformType = '-moz-transform', a.transitionType = 'MozTransition', void 0 === b.perspectiveProperty && void 0 === b.MozPerspective && (a.animType = !1)),
void 0 !== b.webkitTransform && (a.animType = 'webkitTransform', a.transformType = '-webkit-transform', a.transitionType = 'webkitTransition', void 0 === b.perspectiveProperty && void 0 === b.webkitPerspective && (a.animType = !1)),
void 0 !== b.msTransform && (a.animType = 'msTransform', a.transformType = '-ms-transform', a.transitionType = 'msTransition', void 0 === b.msTransform && (a.animType = !1)),
void 0 !== b.transform && !1 !== a.animType && (a.animType = 'transform', a.transformType = 'transform', a.transitionType = 'transition'),
a.transformsEnabled = a.options.useTransform && null !== a.animType && !1 !== a.animType
},
b.prototype.setSlideClasses = function (a) {
var b,
c,
d,
e,
f = this;
c = f.$slider.find('.slick-slide').removeClass('slick-active slick-center slick-current').attr('aria-hidden', 'true'),
f.$slides.eq(a).addClass('slick-current'),
!0 === f.options.centerMode ? (b = Math.floor(f.options.slidesToShow / 2), !0 === f.options.infinite && (a >= b && a <= f.slideCount - 1 - b ? f.$slides.slice(a - b, a + b + 1).addClass('slick-active').attr('aria-hidden', 'false') : (d = f.options.slidesToShow + a, c.slice(d - b + 1, d + b + 2).addClass('slick-active').attr('aria-hidden', 'false')), 0 === a ? c.eq(c.length - 1 - f.options.slidesToShow).addClass('slick-center') : a === f.slideCount - 1 && c.eq(f.options.slidesToShow).addClass('slick-center')), f.$slides.eq(a).addClass('slick-center')) : a >= 0 && a <= f.slideCount - f.options.slidesToShow ? f.$slides.slice(a, a + f.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false') : c.length <= f.options.slidesToShow ? c.addClass('slick-active').attr('aria-hidden', 'false') : (e = f.slideCount % f.options.slidesToShow, d = !0 === f.options.infinite ? f.options.slidesToShow + a : a, f.options.slidesToShow == f.options.slidesToScroll && f.slideCount - a < f.options.slidesToShow ? c.slice(d - (f.options.slidesToShow - e), d + e).addClass('slick-active').attr('aria-hidden', 'false') : c.slice(d, d + f.options.slidesToShow).addClass('slick-active').attr('aria-hidden', 'false')),
'ondemand' === f.options.lazyLoad && f.lazyLoad()
},
b.prototype.setupInfinite = function () {
var b,
c,
d,
e = this;
if (!0 === e.options.fade && (e.options.centerMode = !1), !0 === e.options.infinite && !1 === e.options.fade && (c = null, e.slideCount > e.options.slidesToShow)) {
for (d = !0 === e.options.centerMode ? e.options.slidesToShow + 1 : e.options.slidesToShow, b = e.slideCount; b > e.slideCount - d; b -= 1) c = b - 1,
a(e.$slides[c]).clone(!0).attr('id', '').attr('data-slick-index', c - e.slideCount).prependTo(e.$slideTrack).addClass('slick-cloned');
for (b = 0; b < d; b += 1) c = b,
a(e.$slides[c]).clone(!0).attr('id', '').attr('data-slick-index', c + e.slideCount).appendTo(e.$slideTrack).addClass('slick-cloned');
e.$slideTrack.find('.slick-cloned').find('[id]').each(function () {
a(this).attr('id', '')
})
}
},
b.prototype.interrupt = function (a) {
var b = this;
a || b.autoPlay(),
b.interrupted = a
},
b.prototype.selectHandler = function (b) {
var c = this,
d = a(b.target).is('.slick-slide') ? a(b.target) : a(b.target).parents('.slick-slide'),
e = parseInt(d.attr('data-slick-index'));
if (e || (e = 0), c.slideCount <= c.options.slidesToShow) return c.setSlideClasses(e),
void c.asNavFor(e);
c.slideHandler(e)
},
b.prototype.slideHandler = function (a, b, c) {
var d,
e,
f,
g,
h,
i = null,
j = this;
if (b = b || !1, (!0 !== j.animating || !0 !== j.options.waitForAnimate) && !(!0 === j.options.fade && j.currentSlide === a || j.slideCount <= j.options.slidesToShow)) {
if (!1 === b && j.asNavFor(a), d = a, i = j.getLeft(d), g = j.getLeft(j.currentSlide), j.currentLeft = null === j.swipeLeft ? g : j.swipeLeft, !1 === j.options.infinite && !1 === j.options.centerMode && (a < 0 || a > j.getDotCount() * j.options.slidesToScroll)) return void (!1 === j.options.fade && (d = j.currentSlide, !0 !== c ? j.animateSlide(g, function () {
j.postSlide(d)
}) : j.postSlide(d)));
if (!1 === j.options.infinite && !0 === j.options.centerMode && (a < 0 || a > j.slideCount - j.options.slidesToScroll)) return void (!1 === j.options.fade && (d = j.currentSlide, !0 !== c ? j.animateSlide(g, function () {
j.postSlide(d)
}) : j.postSlide(d)));
if (j.options.autoplay && clearInterval(j.autoPlayTimer), e = d < 0 ? j.slideCount % j.options.slidesToScroll != 0 ? j.slideCount - j.slideCount % j.options.slidesToScroll : j.slideCount + d : d >= j.slideCount ? j.slideCount % j.options.slidesToScroll != 0 ? 0 : d - j.slideCount : d, j.animating = !0, j.$slider.trigger('beforeChange', [
j,
j.currentSlide,
e
]), f = j.currentSlide, j.currentSlide = e, j.setSlideClasses(j.currentSlide), j.options.asNavFor && (h = j.getNavTarget(), h = h.slick('getSlick'), h.slideCount <= h.options.slidesToShow && h.setSlideClasses(j.currentSlide)), j.updateDots(), j.updateArrows(), !0 === j.options.fade) return !0 !== c ? (j.fadeSlideOut(f), j.fadeSlide(e, function () {
j.postSlide(e)
})) : j.postSlide(e),
void j.animateHeight();
!0 !== c ? j.animateSlide(i, function () {
j.postSlide(e)
}) : j.postSlide(e)
}
},
b.prototype.startLoad = function () {
var a = this;
!0 === a.options.arrows && a.slideCount > a.options.slidesToShow && (a.$prevArrow.hide(), a.$nextArrow.hide()),
!0 === a.options.dots && a.slideCount > a.options.slidesToShow && a.$dots.hide(),
a.$slider.addClass('slick-loading')
},
b.prototype.swipeDirection = function () {
var a,
b,
c,
d,
e = this;
return a = e.touchObject.startX - e.touchObject.curX,
b = e.touchObject.startY - e.touchObject.curY,
c = Math.atan2(b, a),
d = Math.round(180 * c / Math.PI),
d < 0 && (d = 360 - Math.abs(d)),
d <= 45 && d >= 0 ? !1 === e.options.rtl ? 'left' : 'right' : d <= 360 && d >= 315 ? !1 === e.options.rtl ? 'left' : 'right' : d >= 135 && d <= 225 ? !1 === e.options.rtl ? 'right' : 'left' : !0 === e.options.verticalSwiping ? d >= 35 && d <= 135 ? 'left' : 'right' : 'vertical'
},
b.prototype.swipeEnd = function (a) {
var b,
c = this;
if (c.dragging = !1, c.interrupted = !1, c.shouldClick = !(c.touchObject.swipeLength > 10), void 0 === c.touchObject.curX) return !1;
if (!0 === c.touchObject.edgeHit && c.$slider.trigger('edge', [
c,
c.swipeDirection()
]), c.touchObject.swipeLength >= c.touchObject.minSwipe) switch (c.swipeDirection()) {
case 'left':
b = c.options.swipeToSlide ? c.checkNavigable(c.currentSlide + c.getSlideCount()) : c.currentSlide + c.getSlideCount(),
c.slideHandler(b),
c.currentDirection = 0,
c.touchObject = {
},
c.$slider.trigger('swipe', [
c,
'left'
]);
break;
case 'right':
b = c.options.swipeToSlide ? c.checkNavigable(c.currentSlide - c.getSlideCount()) : c.currentSlide - c.getSlideCount(),
c.slideHandler(b),
c.currentDirection = 1,
c.touchObject = {
},
c.$slider.trigger('swipe', [
c,
'right'
])
} else c.touchObject.startX !== c.touchObject.curX && (c.slideHandler(c.currentSlide), c.touchObject = {
})
},
b.prototype.swipeHandler = function (a) {
var b = this
;
if (!(!1 === b.options.swipe || 'ontouchend' in document && !1 === b.options.swipe || !1 === b.options.draggable && - 1 !== a.type.indexOf('mouse'))) switch (b.touchObject.fingerCount = a.originalEvent && void 0 !== a.originalEvent.touches ? a.originalEvent.touches.length : 1, b.touchObject.minSwipe = b.listWidth / b.options.touchThreshold, !0 === b.options.verticalSwiping && (b.touchObject.minSwipe = b.listHeight / b.options.touchThreshold), a.data.action) {
case 'start':
b.swipeStart(a);
break;
case 'move':
b.swipeMove(a);
break;
case 'end':
b.swipeEnd(a)
}
},
b.prototype.swipeMove = function (a) {
var b,
c,
d,
e,
f,
g = this;
return f = void 0 !== a.originalEvent ? a.originalEvent.touches : null,
!(!g.dragging || f && 1 !== f.length) && (b = g.getLeft(g.currentSlide), g.touchObject.curX = void 0 !== f ? f[0].pageX : a.clientX, g.touchObject.curY = void 0 !== f ? f[0].pageY : a.clientY, g.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(g.touchObject.curX - g.touchObject.startX, 2))), !0 === g.options.verticalSwiping && (g.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(g.touchObject.curY - g.touchObject.startY, 2)))), 'vertical' !== (c = g.swipeDirection()) ? (void 0 !== a.originalEvent && g.touchObject.swipeLength > 4 && a.preventDefault(), e = (!1 === g.options.rtl ? 1 : - 1) * (g.touchObject.curX > g.touchObject.startX ? 1 : - 1), !0 === g.options.verticalSwiping && (e = g.touchObject.curY > g.touchObject.startY ? 1 : - 1), d = g.touchObject.swipeLength, g.touchObject.edgeHit = !1, !1 === g.options.infinite && (0 === g.currentSlide && 'right' === c || g.currentSlide >= g.getDotCount() && 'left' === c) && (d = g.touchObject.swipeLength * g.options.edgeFriction, g.touchObject.edgeHit = !0), !1 === g.options.vertical ? g.swipeLeft = b + d * e : g.swipeLeft = b + d * (g.$list.height() / g.listWidth) * e, !0 === g.options.verticalSwiping && (g.swipeLeft = b + d * e), !0 !== g.options.fade && !1 !== g.options.touchMove && (!0 === g.animating ? (g.swipeLeft = null, !1) : void g.setCSS(g.swipeLeft))) : void 0)
},
b.prototype.swipeStart = function (a) {
var b,
c = this;
if (c.interrupted = !0, 1 !== c.touchObject.fingerCount || c.slideCount <= c.options.slidesToShow) return c.touchObject = {
},
!1;
void 0 !== a.originalEvent && void 0 !== a.originalEvent.touches && (b = a.originalEvent.touches[0]),
c.touchObject.startX = c.touchObject.curX = void 0 !== b ? b.pageX : a.clientX,
c.touchObject.startY = c.touchObject.curY = void 0 !== b ? b.pageY : a.clientY,
c.dragging = !0
},
b.prototype.unfilterSlides = b.prototype.slickUnfilter = function () {
var a = this;
null !== a.$slidesCache && (a.unload(), a.$slideTrack.children(this.options.slide).detach(), a.$slidesCache.appendTo(a.$slideTrack), a.reinit())
},
b.prototype.unload = function () {
var b = this;
a('.slick-cloned', b.$slider).remove(),
b.$dots && b.$dots.remove(),
b.$prevArrow && b.htmlExpr.test(b.options.prevArrow) && b.$prevArrow.remove(),
b.$nextArrow && b.htmlExpr.test(b.options.nextArrow) && b.$nextArrow.remove(),
b.$slides.removeClass('slick-slide slick-active slick-visible slick-current').attr('aria-hidden', 'true').css('width', '')
},
b.prototype.unslick = function (a) {
var b = this;
b.$slider.trigger('unslick', [
b,
a
]),
b.destroy()
},
b.prototype.updateArrows = function () {
var a = this;
Math.floor(a.options.slidesToShow / 2),
!0 === a.options.arrows && a.slideCount > a.options.slidesToShow && !a.options.infinite && (a.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'), a.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'), 0 === a.currentSlide ? (a.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'), a.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false')) : a.currentSlide >= a.slideCount - a.options.slidesToShow && !1 === a.options.centerMode ? (a.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'), a.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false')) : a.currentSlide >= a.slideCount - 1 && !0 === a.options.centerMode && (a.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'), a.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false')))
},
b.prototype.updateDots = function () {
var a = this;
null !== a.$dots && (a.$dots.find('li').removeClass('slick-active').attr('aria-hidden', 'true'), a.$dots.find('li').eq(Math.floor(a.currentSlide / a.options.slidesToScroll)).addClass('slick-active').attr('aria-hidden', 'false'))
},
b.prototype.visibility = function () {
var a = this;
a.options.autoplay && (document[a.hidden] ? a.interrupted = !0 : a.interrupted = !1)
},
a.fn.slick = function () {
var a,
c,
d = this,
e = arguments[0],
f = Array.prototype.slice.call(arguments, 1),
g = d.length;
for (a = 0; a < g; a++) if ('object' == typeof e || void 0 === e ? d[a].slick = new b(d[a], e) : c = d[a].slick[e].apply(d[a].slick, f), void 0 !== c) return c;
return d
}
}),
function (a) {
void 0 !== define && define.amd ? define([], a) : 'undefined' != typeof module && module.exports ? module.exports = a() : window.scrollMonitor = a()
}(function () {
function a() {
if (h.viewportTop = g(), h.viewportBottom = h.viewportTop + h.viewportHeight, h.documentHeight = t(), h.documentHeight !== u) {
for (w = i.length; w--; ) i[w].recalculateLocation();
u = h.documentHeight
}
}
function b() {
h.viewportHeight = s(),
a(),
d()
}
function c() {
clearTimeout(x),
x = setTimeout(b, 100)
}
function d() {
for (y = i.length; y--; ) i[y].update();
for (y = i.length; y--; ) i[y].triggerCallbacks()
}
function e(a, b) {
function c(a) {
if (0 !== a.length) for (u = a.length; u--; ) w = a[u],
w.callback.call(d, v),
w.isOne && a.splice(u, 1)
}
var d = this;
this.watchItem = a,
this.offsets = b ? b === + b ? {
top: b,
bottom: b
}
: {
top: b.top || r.top,
bottom: b.bottom || r.bottom
}
: r,
this.callbacks = {
};
for (var e = 0, f = q.length; e < f; e++) d.callbacks[q[e]] = [
];
this.locked = !1;
var g,
i,
s,
t,
u,
w;
this.triggerCallbacks = function () {
switch (this.isInViewport && !g && c(this.callbacks[k]), this.isFullyInViewport && !i && c(this.callbacks[l]), this.isAboveViewport !== s && this.isBelowViewport !== t && (c(this.callbacks[j]), i || this.isFullyInViewport || (c(this.callbacks[l]), c(this.callbacks[n])), g || this.isInViewport || (c(this.callbacks[k]), c(this.callbacks[m]))), !this.isFullyInViewport && i && c(this.callbacks[n]), !this.isInViewport && g && c(this.callbacks[m]), this.isInViewport !== g && c(this.callbacks[j]), !0) {
case g !== this.isInViewport:
case i !== this.isFullyInViewport:
case s !== this.isAboveViewport:
case t !== this.isBelowViewport:
c(this.callbacks[p])
}
g = this.isInViewport,
i = this.isFullyInViewport,
s = this.isAboveViewport,
t = this.isBelowViewport
},
this.recalculateLocation = function () {
if (!this.locked) {
var a = this.top,
b = this.bottom;
if (this.watchItem.nodeName) {
var d = this.watchItem.style.display;
'none' === d && (this.watchItem.style.display = '');
var e = this.watchItem.getBoundingClientRect();
this.top = e.top + h.viewportTop,
this.bottom = e.bottom + h.viewportTop,
'none' === d && (this.watchItem.style.display = d)
} else this.watchItem === + this.watchItem ? this.watchItem > 0 ? this.top = this.bottom = this.watchItem : this.top = this.bottom = h.documentHeight - this.watchItem : (this.top = this.watchItem.top, this.bottom = this.watchItem.bottom);
this.top -= this.offsets.top,
this.bottom += this.offsets.bottom,
this.height = this.bottom - this.top,
void 0 === a && void 0 === b || this.top === a && this.bottom === b || c(this.callbacks[o])
}
},
this.recalculateLocation(),
this.update(),
g = this.isInViewport,
i = this.isFullyInViewport,
s = this.isAboveViewport,
t = this.isBelowViewport
}
function f(b) {
v = b,
a(),
d()
}
var g = function () {
return window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop
},
h = {
},
i = [
],
j = 'visibilityChange',
k = 'enterViewport',
l = 'fullyEnterViewport',
m = 'exitViewport',
n = 'partiallyExitViewport',
o = 'locationChange',
p = 'stateChange',
q = [
j,
k,
l,
m,
n,
o,
p
],
r = {
top: 0,
bottom: 0
},
s = function () {
return window.innerHeight || document.documentElement.clientHeight
},
t = function () {
return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.documentElement.clientHeight)
};
h.viewportTop = null,
h.viewportBottom = null,
h.documentHeight = null,
h.viewportHeight = s();
var u,
v,
w,
x,
y;
e.prototype = {
on: function (a, b, c) {
switch (!0) {
case a === j && !this.isInViewport && this.isAboveViewport:
case a === k && this.isInViewport:
case a === l && this.isFullyInViewport:
case a === m && this.isAboveViewport && !this.isInViewport:
case a === n && this.isAboveViewport:
if (b.call(this, v), c) return
}
if (!this.callbacks[a]) throw new Error('Tried to add a scroll monitor listener of type ' + a + '. Your options are: ' + q.join(', '));
this.callbacks[a].push({
callback: b,
isOne: c || !1
})
},
off: function (a, b) {
if (!this.callbacks[a]) throw new Error('Tried to remove a scroll monitor listener of type ' + a + '. Your options are: ' + q.join(', '));
for (var c, d = 0; c = this.callbacks[a][d]; d++) if (c.callback === b) {
this.callbacks[a].splice(d, 1);
break
}
},
one: function (a, b) {
this.on(a, b, !0)
},
recalculateSize: function () {
this.height = this.watchItem.offsetHeight + this.offsets.top + this.offsets.bottom,
this.bottom = this.top + this.height
},
update: function () {
this.isAboveViewport = this.top < h.viewportTop,
this.isBelowViewport = this.bottom > h.viewportBottom,
this.isInViewport = this.top <= h.viewportBottom && this.bottom >= h.viewportTop,
this.isFullyInViewport = this.top >= h.viewportTop && this.bottom <= h.viewportBottom || this.isAboveViewport && this.isBelowViewport
},
destroy: function () {
var a = i.indexOf(this),
b = this;
i.splice(a, 1);
for (var c = 0, d = q.length; c < d; c++) b.callbacks[q[c]].length = 0
},
lock: function () {
this.locked = !0
},
unlock: function () {
this.locked = !1
}
};
for (var z = function (a) {
return function (b, c) {
this.on.call(this, a, b, c)
}
}, A = 0, B = q.length; A < B; A++) {
var C = q[A];
e.prototype[C] = z(C)
}
try {
a()
} catch (D) {
try {
window.$(a)
} catch (D) {
throw new Error('If you must put scrollMonitor in the <head>, you must use jQuery.')
}
}
return window.addEventListener ? (window.addEventListener('scroll', f), window.addEventListener('resize', c)) : (window.attachEvent('onscroll', f), window.attachEvent('onresize', c)),
h.beget = h.create = function (a, b) {
'string' == typeof a ? a = document.querySelector(a) : a && a.length > 0 && (a = a[0]);
var c = new e(a, b);
return i.push(c),
c.update(),
c
},
h.update = function () {
v = null,
a(),
d()
},
h.recalculateLocations = function () {
h.documentHeight = 0,
h.update()
},
h
}),
function (a, b) {
var c = function (a, b, c) {
if (!1 !== a.prototype.hasOwnProperty(name)) return !1;
a.prototype[b] = c
};
c(Node, 'saveable', !1),
c(Node, 'setSaveable', function (a) {
return this.saveable = a,
this
}),
c(Node, 'isSaveable', function () {
return this.saveable
}),
Node.prototype.persistCloneNode = function () {
var a = function (b, c, d) {
for (var e = 0; e < b.childNodes.length; e++) d(b.childNodes[e], c.childNodes[e]),
0 < b.childNodes[e].childNodes.length && a(b.childNodes[e], c.childNodes[e], d)
},
b = Node.prototype.cloneNode.apply(this, arguments);
return !0 === this.isSaveable() && b.setSaveable(!0),
0 < this.childNodes.length && a(this, b, function (a, b) {
!0 === a.isSaveable() && b.setSaveable(!0)
}),
b
},
this.core = {
markAsEditable: function (a) {
}
}
}(window.CargoEditor = window.CargoEditor || {
}),
Cargo = window.Cargo || {
},
Cargo.Modal;
var modal = Backbone.View.extend({
id: 'confirm_modal',
defaults: {
message: 'Save changes?',
modal_type: 'save',
selector: 'body'
},
template: null,
existingLinkElement: void 0,
events: {
'click .modal-overlay': 'ModalClose',
'click [data-confirm]': 'ModalConfirm',
'click [data-deny]': 'ModalDeny'
},
is_active: !1,
initialize: function (a) {
if (null == this.template) {
var b = this;
$.get('/_jsapps/modal/modal.html', function (a) {
b.template = _.template(a)
})
}
},
render: function () {
var a = this.template({
modal: this.model.toJSON()
});
return this.$el.html(a),
setTimeout(function () {
$(this.el).attr('tabindex', '-1'),
$(this.el).focus(),
setTimeout(function () {
$(this.el).focus()
}.bind(this), 100)
}.bind(this), 100),
Cargo.Event.once('enter_keycode_triggered', this.ModalConfirm, this),
Cargo.Event.once('esc_keycode_triggered', this.ModalClose, this),
'save' == this.model.get('modal_type') && Cargo.Event.once('save_shortcut_triggered', this.ModalConfirm, this),
this
},
Confirm: function (a) {
a = a || {
},
a.modal_type = 'confirm',
this.show(a)
},
Alert: function (a) {
a = a || {
},
a.modal_type = 'alert',
this.show(a)
},
Save: function (a) {
a = a || {
},
a.modal_type = 'save',
this.show(a)
},
show: function (a) {
this.model = null,
this.model = new Backbone.Model(this.defaults),
_.extend(this.model.attributes, a),
$(this.model.get('selector')).append(this.render().el),
this.is_active = !0
},
isActive: function () {
return this.is_active
},
ModalConfirm: function () {
'function' == typeof this.model.get('confirm') && this.model.get('confirm') (),
this.model.set('modal_type', null),
this.ModalClose()
},
ModalDeny: function () {
'function' == typeof this.model.get('deny') && this.model.get('deny') (),
this.ModalClose()
},
ModalClose: function () {
if ('alert' == this.model.get('modal_type')) return this.model.set('modal_type', null),
void this.ModalConfirm();
this.is_active = !1,
Cargo.Event.off('enter_keycode_triggered', this.ModalConfirm),
Cargo.Event.off('enter_keycode_triggered', this.ModalClose),
Cargo.Event.off('esc_keycode_triggered', this.ModalClose),
Cargo.Event.off('save_shortcut_triggered', this.ModalConfirm),
$(document).off('keydown.confirm_modal'),
this.el.remove()
}
});
Cargo.Modal = new modal;
var Backdrop = {
Data: {
active_plugin: '',
active_plugin_id: '',
prev_active_plugin: '',
require_loaded: !1
},
Init: function () {
this.SetModels(),
Backdrop.View.Backdrop = Cargo.View.Backdrop
},
SetModels: function () {
void 0 === Backdrop.Model.Settings && (Backdrop.Model.Settings = new Backdrop.o.model.Settings, Backdrop.Model.Settings.fetch()),
void 0 === Backdrop.Model.Global && (Backdrop.Model.Global = new Backdrop.o.model.Global, Backdrop.Model.Global.fetch()),
void 0 === Backdrop.Collection.Images && (Backdrop.Collection.Images = new Backdrop.o.collection.images({
dataset: 'Images'
}), Backdrop.Collection.Images.fetch()),
void 0 === Backdrop.Collection.PresetImages && (Backdrop.Collection.PresetImages = new Backdrop.o.collection.images({
dataset: 'PresetImages'
}), Backdrop.Collection.PresetImages.fetch()),
'undefined' == Backdrop.Model.HomePage && Cargo.Helper.GetStartProjectId() > 0 && (Backdrop.Model.HomePage = new Cargo.Model.BasePage, Backdrop.Model.HomePage.fetch({
data: {
pid: Cargo.Helper.GetStartProjectId()
}
})),
Backdrop.Data.active_plugin_id = Backdrop.Model.Global.get('active_plugin_id'),
Backdrop.Data.active_plugin = Backdrop.Model.Global.get('active_plugin_path')
},
OpenSettings: function () {
Cargo.API.Config.is_editor ? parent.location == window.location && Cargo.Event.trigger('add_history', 'admin/plugins') : Cargo.Helper.GoToUrl('admin/plugins')
},
UnloadSettings: function () {
$('#persona_settings').remove()
}
};
Backdrop.o = {
},
Backdrop.o.model = {
},
Backdrop.o.collection = {
},
Backdrop.Model = {
},
Backdrop.Collection = {
},
Backdrop.View = {
},
$(function () {
Backdrop.Init()
}),
Backdrop.o.model.Settings = Backbone.Model.extend({
initialize: function () {
},
idAttribute: 'plugin_id',
isNew: function () {
return !0
},
fetch: function (a) {
if ($('[data-set=\'BackdropSettings\']').length > 0) {
if (this.set($.parseJSON($('[data-set=\'BackdropSettings\']').html()), a), Cargo.Helper.IsPresetPreview() || $('[data-set=\'BackdropSettings\']').remove(), a) var b = a.success;
b && b.call(a.context, this, null, a)
} else Backbone.Model.prototype.fetch.apply(this, arguments)
},
parse: function (a) {
if (a && a.image) {
Backdrop.Collection.Images.GetImageExistsByName(a.image) || (a = _.omit(a, 'image', 'image_2x'))
}
return a
},
url: function () {
var a = Cargo.API.Config;
return a.api_path + '/' + a.Version + '/backdrop/' + Cargo.Model.Site.get('site_url') + '/' + Backdrop.Data.active_plugin_id
}
}),
Backdrop.o.model.Global = Backbone.Model.extend({
isNew: function () {
return !0
},
fetch: function (a) {
$('[data-set=\'GlobalSettings\']').length > 0 ? this.set($.parseJSON($('[data-set=\'GlobalSettings\']').html()), a) : Backbone.Model.prototype.fetch.apply(this, arguments)
},
url: function () {
var a = Cargo.API.Config;
return a.api_path + '/' + a.Version + '/backdrop/global/' + a.cargo_url
}
}),
Backdrop.o.collection.images = Backbone.Collection.extend({
model: Cargo.o.model.image,
initialize: function (a) {
this.dataset = a.dataset ? a.dataset : 'Images'
},
comparator: 'sort',
fetch: function (a) {
$('[data-set=\'' + this.dataset + '\']').length > 0 ? (this.set($.parseJSON($('[data-set=\'' + this.dataset + '\']').html()), a), $('[data-set=\'' + this.dataset + '\']').remove()) : Backbone.Model.prototype.fetch.apply(this, arguments)
},
parse: function (a) {
if (!Backdrop.Model.Settings.get('media_uid')) return 'object' == typeof a.images ? a.images : a
},
url: function () {
return '/_api/v0/images/' + Cargo.Helper.GetUrl() + '/plugin/' + Backdrop.Model.Global.get('upload_id')
},
GetImageSizeByName: function (a, b) {
if (void 0 == a) return a;
var c = this.find(function (b) {
return b.urlBelongsToImage(a)
});
return c ? {
w: c.get('width'),
h: c.get('height'),
name: a
}
: void 0
},
GetImageModelBySizeName: function (a) {
return this.filter(function (b) {
return b.urlBelongsToImage(a)
}) [0]
},
GetImagePresetByName: function (a) {
return this.findWhere({
image: a
})
},
GetImageExistsByName: function (a) {
var b = this.filter(function (b) {
return b.urlBelongsToImage(a)
}) [0];
return void 0 === b && (b = Backdrop.Collection.PresetImages.GetImagePresetByName(a)),
void 0 !== b
},
GetImageUrlOrDefaultFromName: function (a, b) {
return this.GetImageExistsByName(a) ? a : b
},
getCleanImageUrl: function (a) {
return a
}
});
var Cargo = Cargo || {
};
Cargo.Plugins = Cargo.Plugins || {
},
Cargo.Plugins.baseUnit = function (a) {
return function (b) {
var c,
d = a.extend(!0, {
height: a(window).height(),
width: a(window).width(),
min: 11,
max: !1,
weight: 5,
round: !0,
offset: 1
}, b);
return c = d.height * d.offset > d.width * d.offset ? d.width * d.offset : d.height,
c /= 100 / d.weight,
d.min && c < d.min && (c = d.min),
d.max && c > d.max && (c = d.max),
d.round && (c = Math.floor(c)),
c
}
}(jQuery);
var Cargo = Cargo || {
};
Cargo.Plugins = Cargo.Plugins || {
},
Cargo.Plugins.elementResizer = function (a) {
var b = {
vars: {
ticking: !1,
initialized: !1
},
options: {
cargo_refreshEvents: [
'show_index_complete',
'pagination_complete',
'page_load_complete',
'inspector_preview',
'page_collection_reset',
'direct_link_loaded'
],
generic_refreshEvents: [
],
updateEvents: [
'resize',
'orientationchange'
],
selectors: [
'img',
'object',
'iframe',
'video',
'.elementresizer',
'[data-elementresizer-child]',
'.slideshow',
'.audio_component'
],
targets: {
},
minimumHeight: 1,
minimumWidth: 1,
centerElements: !0,
adjustElementsToWindowHeight: !0,
forceMargin: !1,
forceVerticalMargin: 40,
forceHorizontalMargin: 0,
allowInit: !0
},
init: function () {
function d(a, b, c) {
a.addEventListener ? a.addEventListener(b, c, !1) : a.attachEvent && a.attachEvent('on' + b, c)
}
if (Cargo.Event.trigger('element_resizer_init', c), !b.options.allowInit) return !1;
var e;
a.each(b.options.updateEvents, function (a, c) {
d(window, c, function () {
b.requestTick(),
'resize' === c && (clearTimeout(e), e = setTimeout(function () {
b.requestTick()
}, 100))
})
}),
a.each(b.options.generic_refreshEvents, function (a, c) {
d(window, c, function () {
b.refresh(),
b.update()
})
}),
a.each(b.options.cargo_refreshEvents, function (a, c) {
Cargo.hasOwnProperty('Event') && Cargo.Event.on(c, function () {
b.refresh(),
b.update()
})
}),
Cargo.hasOwnProperty('Event') && Cargo.Event.on('inspector_open', function () {
CargoInspector.eventManager.subscribe('style_changed', function (a) {
b.update()
})
});
try {
var f = window.matchMedia('(-webkit-min-device-pixel-ratio: 1.5)');
'function' == typeof f.addListener && f.addListener(function () {
b.setResponsiveImageSrcs()
})
} catch (g) {
}
b.vars.initialized = !0,
b.refresh(),
b.update()
},
refresh: function () {
if (!b.vars.initialized) return !1;
var c = a('[data-elementresizer]');
b.options.targets = {
},
c.each(function (c, d) {
var e = a(d).find(b.options.selectors.join(',')),
f = a(d).closest('[data-resize-parent]');
0 == f.length && (f = a('body'));
var g = [
],
h = [
];
e.each(function (c, d) {
var e = a(d).closest('[data-columnize]'),
d = (d.nodeName, a(d));
if ((0 == e.length || !1 !== e.is('[data-allow-elementresizer]')) && !(d.closest('[data-no-elementresizer]').length > 0 || d[0].hasAttribute('data-no-elementresizer'))) {
var f = d.width(),
i = d.height(),
j = parseInt(d.attr('width')),
k = parseInt(d.attr('height')),
l = 'string' == typeof d.attr('height') && - 1 !== d.attr('height').indexOf('%'),
m = 'string' == typeof d.attr('width') && - 1 !== d.attr('width').indexOf('%'),
n = isNaN(j) ? f : j,
o = isNaN(k) ? i : k,
p = b.constrain(b.options.minimumHeight, 0, o),
q = b.constrain(b.options.minimumWidth, 0, n),
r = !1,
s = {
element: d,
hasBeenHandled: !1,
originalWidth: n,
originalHeight: o,
widthIsPercentage: m,
heightIsPercentage: l,
actualWidth: j,
actualHeight: k,
minimumHeight: p > o ? o : p,
minimumWidth: q > n ? n : q,
ratio: o / n,
nodeName: d[0].nodeName.toLowerCase(),
isSlideshow: r,
isAudioPlayer: d.hasClass('audio_component'),
noResize: d.parent('[data-elementresizer-no-resize]').length > 0 || d[0].hasAttribute('data-elementresizer-no-resize'),
noCentering: d.parent('[data-elementresizer-no-centering]').length > 0 || d[0].hasAttribute('data-elementresizer-no-centering'),
noVerticalResize: d.parent('[data-elementresizer-no-vertical-resize]').length > 0 || d[0].hasAttribute('data-elementresizer-no-vertical-resize'),
prevLeftMargin: 0,
lastSize: d[0].__cachedLastSize ? d[0].__cachedLastSize : 0,
lastQ: d[0]._cachedLastQ ? d[0]._cachedLastQ : 0,
isSoundCloudFrame: - 1 !== (d.attr('src') + '').indexOf('soundcloud') && 'IFRAME' === d[0].nodeName
},
t = parseInt(d.attr('data-mid'));
isNaN(t) || (s.imageModel = Cargo.Collection.Images.findWhere({
id: t
})),
r ? h.push(s) : g.push(s)
}
}),
g = g.concat(h);
var i = parseInt(a(f).css('paddingLeft')) + parseInt(a(f).css('paddingRight'));
isNaN(i) && (i = 0),
b.options.targets[c] = {
container: a(d),
resize_parent: f,
children: g,
padding: i
}
}),
b.update()
},
requestTick: function () {
b.vars.ticking || (requestAnimationFrame(function () {
b.update()
}), b.vars.ticking = !0)
},
constrain: function (a, b, c) {
return a > c ? c : a < b ? b : a
},
update: function () {
var d,
e,
f,
g;
for (d in b.options.targets) {
g = b.options.targets[d];
var h = g.container.width(),
i = (g.padding, g.resize_parent.width() - b.options.forceHorizontalMargin),
j = b.options.adjustElementsToWindowHeight ? document.documentElement.clientHeight - b.options.forceVerticalMargin : 9000000000,
k = j,
l = 1;
b.options.adjustElementsToWindowHeight && void 0 !== window.orientation && 0 != window.orientation && (k = document.documentElement.clientWidth - (!1 === b.options.forceMargin ? 40 : b.options.forceMargin));
for (e in g.children) {
var m = i;
if (f = g.children[e], !f.noResize) {
var n = a(f.element).closest('[grid-col]');
n.length > 0 && (m = n.width() - b.options.forceHorizontalMargin),
k = f.noVerticalResize ? 9000000000 : j;
var o = f.actualWidth,
p = f.actualHeight;
m *= parseInt(f.element.attr('data-scale')) / 100 || 1,
horizontalDelta = b.constrain(m - o, 1, 9000000000),
verticalDelta = b.constrain(k - p, 1, 9000000000),
l = [
m / f.actualWidth,
k / f.actualHeight
],
l = Math.min(l[0], l[1]),
p = b.constrain(p * l, - 9000000000, f.originalHeight),
o = b.constrain(o * l, - 9000000000, f.originalWidth),
f.widthIsPercentage && (o = h / 100 * f.originalWidth),
f.heightIsPercentage && (p = o / 100 * f.originalHeight),
(p <= f.minimumHeight || o <= f.minimumWidth) && (l = [
f.minimumWidth / o,
f.minimumHeight / p
], l = Math.max(l[0], l[1]), p *= l, o *= l),
!1 !== f.hasBeenHandled && f.actualWidth == o && f.actualHeight == p || isNaN(o) || isNaN(p) || (f.actualWidth = o, f.actualHeight = p, f.element.add('object' === f.nodeName ? f.element.find('embed') : '').css({
width: f.actualWidth + 'px',
height: f.actualHeight + 'px'
}), f.hasBeenHandled)
}
b.options.centerElements && !f.noCentering && b.setLeftMargin(f, h),
f.isSlideshow && void 0 !== f.isSlideshow && (f.actualWidth = f.isSlideshow.resizeContainer())
}
}
b.setResponsiveImageSrcs(),
b.vars.ticking = !1,
Cargo.Event.trigger('elementresizer_update_complete', c)
},
setResponsiveImageSrcs: function () {
_.each(this.options.targets, function (a) {
var b,
c,
d = a.container.width();
for (c = 0; c < a.children.length; c++) if (b = a.children[c], void 0 !== b.imageModel || void 0 === b.element.attr('src_o') || void 0 !== b.element.attr('src')) {
if (!isNaN(b.actualWidth) && void 0 !== b.imageModel && 'function' == typeof b.imageModel.get) {
var e = 250,
f = Math.floor(Math.min(Math.ceil(Math.max(b.actualWidth, d) / e) * e, b.imageModel.get('width'))),
g = b.imageModel.getImageWithOptions({
w: f
});
g.retina && b.actualWidth / g.w > 0.51 && (g = b.imageModel.getImageWithOptions({
w: f,
q: 94
})),
g.w >= 0 && (g.w > b.lastSize || g.q > b.lastQ) && b.element.attr('src') !== g.url && (b.element.attr('src', g.url), b.lastSize = g.w, b.lastQ = g.q, b.element[0].__cachedLastSize = g.w, b.element[0]._cachedLastQ = g.q)
}
} else b.element.attr('src', b.element.attr('src_o')),
console.info('used src_o fallback')
}, this)
},
setLeftMargin: function (a, b, c) {
var d;
d = a.isSoundCloudFrame ? (b - a.element.width()) / 2 : (b - a.actualWidth) / 2,
isNaN(d) || (a.prevLeftMargin !== d && a.element.css('marginLeft', d), a.prevLeftMargin = d)
}
},
c = {
options: b.options,
init: b.init,
refresh: b.refresh,
update: b.update,
setOptions: function (c) {
a.extend(b.options, c),
!1 !== b.options.forceMargin && (b.options.forceHorizontalMargin = b.options.forceMargin, b.options.forceVerticalMargin = b.options.forceMargin),
b.options.allowInit && b.vars.initialized && b.update()
},
targets: function () {
return b.options.targets
}
};
return a(function () {
b.init()
}),
c
}(jQuery),
function (a, b) {
'use strict';
!function (a, b) {
a.PhotoSwipe = b()
}(this, function () {
return function (c, e, f, g) {
var h = {
features: null,
bind: function (a, b, c, d) {
var e = (d ? 'remove' : 'add') + 'EventListener';
b = b.split(' ');
for (var f = 0; f < b.length; f++) b[f] && a[e](b[f], c, !1)
},
isArray: function (a) {
return a instanceof Array
},
createEl: function (a, b) {
var c = document.createElement(b || 'div');
return a && (c.className = a),
c
},
getScrollY: function () {
var c = a.clientYOffset;
return c !== b ? c : document.documentElement.scrollTop
},
unbind: function (a, b, c) {
h.bind(a, b, c, !0)
},
removeClass: function (a, b) {
var c = new RegExp('(\\s|^)' + b + '(\\s|$)');
a.className = a.className.replace(c, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '')
},
addClass: function (a, b) {
h.hasClass(a, b) || (a.className += (a.className ? ' ' : '') + b)
},
hasClass: function (a, b) {
return a.className && new RegExp('(^|\\s)' + b + '(\\s|$)').test(a.className)
},
getChildByClass: function (a, b) {
for (var c = a.firstChild; c; ) {
if (h.hasClass(c, b)) return c;
c = c.nextSibling
}
},
arraySearch: function (a, b, c) {
for (var d = a.length; d--; ) if (a[d][c] === b) return d;
return - 1
},
extend: function (a, b, c) {
for (var d in b) if (b.hasOwnProperty(d)) {
if (c && a.hasOwnProperty(d)) continue;
a[d] = b[d]
}
},
easing: {
sine: {
out: function (a) {
return Math.sin(a * (Math.PI / 2))
},
inOut: function (a) {
return - (Math.cos(Math.PI * a) - 1) / 2
}
},
cubic: {
out: function (a) {
return --a * a * a + 1
}
}
},
detectFeatures: function () {
if (h.features) return h.features;
var b = h.createEl(),
c = b.style,
d = '',
e = {
};
if (e.oldIE = document.all && !document.addEventListener, e.touch = 'ontouchstart' in a, a.requestAnimationFrame && (e.raf = a.requestAnimationFrame, e.caf = a.cancelAnimationFrame), e.pointerEvent = navigator.pointerEnabled || navigator.msPointerEnabled, !e.pointerEvent) {
var f = navigator.userAgent;
if (/iP(hone|od)/.test(navigator.platform)) {
var g = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
g && g.length > 0 && (g = parseInt(g[1], 10)) >= 1 && 8 > g && (e.isOldIOSPhone = !0)
}
var i = f.match(/Android\s([0-9\.]*)/),
j = i ? i[1] : 0;
j = parseFloat(j),
j >= 1 && (4.4 > j && (e.isOldAndroid = !0), e.androidVersion = j),
e.isMobileOpera = /opera mini|opera mobi/i.test(f)
}
for (var k, l, m = [
'transform',
'perspective',
'animationName'
], n = [
'',
'webkit',
'Moz',
'ms',
'O'
], o = 0; 4 > o; o++) {
d = n[o];
for (var p = 0; 3 > p; p++) k = m[p],
l = d + (d ? k.charAt(0).toUpperCase() + k.slice(1) : k),
!e[k] && l in c && (e[k] = l);
d && !e.raf && (d = d.toLowerCase(), e.raf = a[d + 'RequestAnimationFrame'], e.raf && (e.caf = a[d + 'CancelAnimationFrame'] || a[d + 'CancelRequestAnimationFrame']))
}
if (!e.raf) {
var q = 0;
e.raf = function (b) {
var c = (new Date).getTime(),
d = Math.max(0, 16 - (c - q)),
e = a.setTimeout(function () {
b(c + d)
}, d);
return q = c + d,
e
},
e.caf = function (a) {
clearTimeout(a)
}
}
return e.svg = !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect,
h.features = e,
e
}
};
h.detectFeatures(),
h.features.oldIE && (h.bind = function (a, b, c, d) {
b = b.split(' ');
for (var e, f = (d ? 'detach' : 'attach') + 'Event', g = function () {
c.handleEvent.call(c)
}, h = 0; h < b.length; h++) if (e = b[h]) if ('object' == typeof c && c.handleEvent) {
if (d) {
if (!c['oldIE' + e]) return !1
} else c['oldIE' + e] = g;
a[f]('on' + e, c['oldIE' + e])
} else a[f]('on' + e, c)
});
var i = this,
j = 25,
k = 3,
l = {
allowPanToNext: !0,
spacing: 0.12,
bgOpacity: 1,
mouseUsed: !1,
loop: !0,
pinchToClose: !0,
closeOnScroll: !0,
closeOnVerticalDrag: !0,
verticalDragRange: 0.75,
hideAnimationDuration: 333,
showAnimationDuration: 333,
showHideOpacity: !1,
focus: !0,
escKey: !0,
arrowKeys: !0,
mainScrollEndFriction: 0.35,
panEndFriction: 0.35,
isClickableElement: function (a) {
return 'A' === a.tagName
},
getDoubleTapZoom: function (a, b) {
return a ? 1 : b.initialZoomLevel < 0.7 ? 1 : 1.33
},
maxSpreadZoom: 1.33,
modal: !0,
scaleMode: 'fit'
};
h.extend(l, g);
var m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z,
A,
B,
C,
D,
E,
F,
G,
H,
I,
J,
K,
L,
M,
N,
O,
P,
Q,
R,
S,
T,
U,
V,
W,
X,
Y,
Z,
$,
_,
aa,
ba,
ca,
da,
ea,
fa,
ga,
ha,
ia,
ja,
ka,
la,
ma,
na,
oa = function () {
return {
x: 0,
y: 0
}
},
pa = oa(),
qa = oa(),
ra = oa(),
sa = {
},
ta = 0,
ua = {
},
va = oa(),
wa = 0,
xa = !0,
ya = [
],
za = {
},
Aa = !1,
Ba = function (a, b) {
h.extend(i, b.publicMethods),
ya.push(a)
},
Ca = function (a) {
var b = cc();
return a > b - 1 ? a - b : 0 > a ? b + a : a
},
Da = {
},
Ea = function (a, b) {
return Da[a] || (Da[a] = [
]),
Da[a].push(b)
},
Fa = function (a) {
var b = Da[a];
if (b) {
var c = Array.prototype.slice.call(arguments);
c.shift();
for (var d = 0; d < b.length; d++) b[d].apply(i, c)
}
},
Ga = function () {
return (new Date).getTime()
},
Ha = function (a) {
la = a,
i.bg.style.opacity = a * l.bgOpacity
},
Ia = function (a, b, c, d, e) {
(!Aa || e && e !== i.currItem) && (d /= e ? e.fitRatio : i.currItem.fitRatio),
a[H] = x + b + 'px, ' + c + 'px' + y + ' scale(' + d + ')'
},
Ja = function (a) {
ga && (a && (v > i.currItem.fitRatio ? Aa || (oc(i.currItem, !1, !0), Aa = !0) : Aa && (oc(i.currItem), Aa = !1)), Ia(ga, ra.x, ra.y, v))
},
Ka = function (a) {
a.container && Ia(a.container.style, a.initialPosition.x, a.initialPosition.y, a.initialZoomLevel, a)
},
La = function (a, b) {
b[H] = x + a + 'px, 0px' + y
},
Ma = function (a, b) {
if (!l.loop && b) {
var c = p + (va.x * ta - a) / va.x,
d = Math.round(a - vb.x);
(0 > c && d > 0 || c >= cc() - 1 && 0 > d) && (a = vb.x + d * l.mainScrollEndFriction)
}
vb.x = a,
La(a, q)
},
Na = function (a, b) {
var c = wb[a] - ua[a];
return qa[a] + pa[a] + c - c * (b / w)
},
Oa = function (a, b) {
a.x = b.x,
a.y = b.y,
b.id && (a.id = b.id)
},
Pa = function (a) {
a.x = Math.round(a.x),
a.y = Math.round(a.y)
},
Qa = null,
Ra = function () {
Qa && (h.unbind(document, 'mousemove', Ra), h.addClass(c, 'pswp--has_mouse'), l.mouseUsed = !0, Fa('mouseUsed')),
Qa = setTimeout(function () {
Qa = null
}, 100)
},
Sa = function () {
h.bind(document, 'keydown', i),
Q.transform && h.bind(i.scrollWrap, 'click', i),
l.mouseUsed || h.bind(document, 'mousemove', Ra),
h.bind(a, 'resize scroll', i),
Fa('bindEvents')
},
Ta = function () {
h.unbind(a, 'resize', i),
h.unbind(a, 'scroll', u.scroll),
h.unbind(document, 'keydown', i),
h.unbind(document, 'mousemove', Ra),
Q.transform && h.unbind(i.scrollWrap, 'click', i),
X && h.unbind(a, s, i),
Fa('unbindEvents')
},
Ua = function (a, b) {
var c = kc(i.currItem, sa, a);
return b && (fa = c),
c
},
Va = function (a) {
return a || (a = i.currItem),
a.initialZoomLevel
},
Wa = function (a) {
return a || (a = i.currItem),
a.w > 0 ? l.maxSpreadZoom : 1
},
Xa = function (a, b, c, d) {
return d === i.currItem.initialZoomLevel ? (c[a] = i.currItem.initialPosition[a], !0) : (c[a] = Na(a, d), c[a] > b.min[a] ? (c[a] = b.min[a], !0) : c[a] < b.max[a] && (c[a] = b.max[a], !0))
},
Ya = function () {
if (H) {
var a = Q.perspective && !J;
return x = 'translate' + (a ? '3d(' : '('),
void (y = Q.perspective ? ', 0px)' : ')')
}
H = 'left',
h.addClass(c, 'pswp--ie'),
La = function (a, b) {
b.left = a + 'px'
},
Ka = function (a) {
var b = a.fitRatio > 1 ? 1 : a.fitRatio,
c = a.container.style,
d = b * a.w,
e = b * a.h;
c.width = d + 'px',
c.height = e + 'px',
c.left = a.initialPosition.x + 'px',
c.top = a.initialPosition.y + 'px'
},
Ja = function () {
if (ga) {
var a = ga,
b = i.currItem,
c = b.fitRatio > 1 ? 1 : b.fitRatio,
d = c * b.w,
e = c * b.h;
a.width = d + 'px',
a.height = e + 'px',
a.left = ra.x + 'px',
a.top = ra.y + 'px'
}
}
},
Za = function (a) {
var b = '';
l.escKey && 27 === a.keyCode ? b = 'close' : l.arrowKeys && (37 === a.keyCode ? b = 'prev' : 39 === a.keyCode && (b = 'next')),
b && (a.ctrlKey || a.altKey || a.shiftKey || a.metaKey || (a.preventDefault ? a.preventDefault() : a.returnValue = !1, i[b]()))
},
$a = function (a) {
a && ($ || Z || ha || V) && (a.preventDefault(), a.stopPropagation())
},
_a = function () {
i.setScrollOffset(0, h.getScrollY())
},
ab = {
},
bb = 0,
cb = function (a) {
ab[a] && (ab[a].raf && L(ab[a].raf), bb--, delete ab[a])
},
db = function (a) {
ab[a] && cb(a),
ab[a] || (bb++, ab[a] = {
})
},
eb = function () {
for (var a in ab) ab.hasOwnProperty(a) && cb(a)
},
fb = function (a, b, c, d, e, f, g) {
var h,
i = Ga();
db(a);
var j = function () {
if (ab[a]) {
if ((h = Ga() - i) >= d) return cb(a),
f(c),
void (g && g());
f((c - b) * e(h / d) + b),
ab[a].raf = K(j)
}
};
j()
},
gb = {
shout: Fa,
listen: Ea,
viewportSize: sa,
options: l,
isMainScrollAnimating: function () {
return ha
},
getZoomLevel: function () {
return v
},
getCurrentIndex: function () {
return p
},
isDragging: function () {
return X
},
isZooming: function () {
return ca
},
setScrollOffset: function (a, b) {
ua.x = a,
P = ua.y = b,
Fa('updateScrollOffset', ua)
},
applyZoomPan: function (a, b, c, d) {
ra.x = b,
ra.y = c,
v = a,
Ja(d)
},
init: function () {
if (!m && !n) {
d('init', i);
var a;
i.framework = h,
i.template = c,
i.bg = h.getChildByClass(c, 'pswp__bg'),
M = c.className,
m = !0,
Q = h.detectFeatures(),
K = Q.raf,
L = Q.caf,
H = Q.transform,
O = Q.oldIE,
i.scrollWrap = h.getChildByClass(c, 'pswp__scroll-wrap'),
i.container = h.getChildByClass(i.scrollWrap, 'pswp__container'),
q = i.container.style,
i.itemHolders = B = [
{
el: i.container.children[0],
wrap: 0,
index: - 1
},
{
el: i.container.children[1],
wrap: 0,
index: - 1
},
{
el: i.container.children[2],
wrap: 0,
index: - 1
}
],
B[0].el.style.display = B[2].el.style.display = 'none',
Ya(),
u = {
resize: i.updateSize,
scroll: _a,
keydown: Za,
click: $a
};
var f = Q.isOldIOSPhone || Q.isOldAndroid || Q.isMobileOpera;
for (Q.animationName && Q.transform && !f || (l.showAnimationDuration = l.hideAnimationDuration = 0), a = 0; a < ya.length; a++) i['init' + ya[a]]();
if (e) {
(i.ui = new e(i, h)).init()
}
Fa('firstUpdate'),
p = p || l.index || 0,
(isNaN(p) || 0 > p || p >= cc()) && (p = 0),
i.currItem = bc(p),
(Q.isOldIOSPhone || Q.isOldAndroid) && (xa = !1),
c.setAttribute('aria-hidden', 'false'),
l.modal && (xa ? c.style.position = 'fixed' : (c.style.position = 'absolute', c.style.top = h.getScrollY() + 'px')),
P === b && (Fa('initialLayout'), P = N = h.getScrollY());
var g = 'pswp--open ';
for (l.mainClass && (g += l.mainClass + ' '), l.showHideOpacity && (g += 'pswp--animate_opacity '), g += J ? 'pswp--touch' : 'pswp--notouch', g += Q.animationName ? ' pswp--css_animation' : '', g += Q.svg ? ' pswp--svg' : '', h.addClass(c, g), i.updateSize(), r = - 1, wa = null, a = 0; k > a; a++) La((a + r) * va.x, B[a].el.style);
O || h.bind(i.scrollWrap, t, i),
Ea('initialZoomInEnd', function () {
i.setContent(B[0], p - 1),
i.setContent(B[2], p + 1),
B[0].el.style.display = B[2].el.style.display = 'block',
l.focus && c.focus(),
Sa()
}),
i.setContent(B[1], p),
i.updateCurrItem(),
Fa('afterInit'),
d('after-init', i),
xa || (z = setInterval(function () {
bb || X || ca || v !== i.currItem.initialZoomLevel || i.updateSize()
}, 1000)),
h.addClass(c, 'pswp--visible')
}
},
close: function () {
m && (m = !1, n = !0, Fa('close'), d('closing', i), Ta(), ec(i.currItem, null, !0, i.destroy))
},
destroy: function () {
Fa('destroy'),
d('destroy', i),
Zb && clearTimeout(Zb),
c.setAttribute('aria-hidden', 'true'),
c.className = M,
z && clearInterval(z),
h.unbind(i.scrollWrap, t, i),
h.unbind(a, 'scroll', i),
Bb(),
eb(),
Da = null
},
panTo: function (a, b, c) {
c || (a > fa.min.x ? a = fa.min.x : a < fa.max.x && (a = fa.max.x), b > fa.min.y ? b = fa.min.y : b < fa.max.y && (b = fa.max.y)),
ra.x = a,
ra.y = b,
Ja()
},
handleEvent: function (b) {
b = b || a.event,
u[b.type] && u[b.type](b)
},
goTo: function (a) {
a = Ca(a);
var b = a - p;
wa = b,
p = a,
i.currItem = bc(p),
ta -= b,
Ma(va.x * ta),
eb(),
ha = !1,
i.updateCurrItem()
},
next: function () {
i.goTo(p + 1)
},
prev: function () {
i.goTo(p - 1)
},
updateCurrZoomItem: function (a) {
if (a && (Fa('beforeChange', 0), d('before-slide-change', i, 0)), B[1].el.children.length) {
var b = B[1].el.children[0];
ga = h.hasClass(b, 'pswp__zoom-wrap') ? b.style : null
} else ga = null;
fa = i.currItem.bounds,
w = v = i.currItem.initialZoomLevel,
ra.x = fa.center.x,
ra.y = fa.center.y,
a && (Fa('afterChange'), d('after-slide-change', i))
},
invalidateCurrItems: function () {
A = !0;
for (var a = 0; k > a; a++) B[a].item && (B[a].item.needsUpdate = !0)
},
updateCurrItem: function (a) {
if (0 !== wa) {
var b,
c = Math.abs(wa);
if (!(a && 2 > c)) {
i.currItem = bc(p),
Aa = !1,
Fa('beforeChange', wa);
var e = wa;
null === e && (e = 0),
d('slide-change', i, e),
c >= k && (r += wa + (wa > 0 ? - k : k), c = k);
for (var f = 0; c > f; f++) wa > 0 ? (b = B.shift(), B[k - 1] = b, r++, La((r + 2) * va.x, b.el.style), i.setContent(b, p - c + f + 1 + 1)) : (b = B.pop(), B.unshift(b), r--, La(r * va.x, b.el.style), i.setContent(b, p + c - f - 1 - 1));
if (ga && 1 === Math.abs(wa)) {
var g = bc(C);
g.initialZoomLevel !== v && (kc(g, sa), oc(g), Ka(g))
}
wa = 0,
i.updateCurrZoomItem(),
C = p,
Fa('afterChange')
}
}
},
updateSize: function (d) {
if (!xa && l.modal) {
var e = h.getScrollY();
if (P !== e && (c.style.top = e + 'px', P = e), !d && za.x === a.innerWidth && za.y === a.innerHeight) return;
za.x = a.innerWidth,
za.y = a.innerHeight,
c.style.height = za.y + 'px'
}
if (sa.x = i.scrollWrap.clientWidth, sa.y = i.scrollWrap.clientHeight, _a(), va.x = sa.x + Math.round(sa.x * l.spacing), va.y = sa.y, Ma(va.x * ta), Fa('beforeResize'), r !== b) {
for (var f, g, j, m = 0; k > m; m++) f = B[m],
La((m + r) * va.x, f.el.style),
j = p + m - 1,
l.loop && cc() > 2 && (j = Ca(j)),
g = bc(j),
g && (A || g.needsUpdate || !g.bounds) ? (i.cleanSlide(g), i.setContent(f, j), 1 === m && (i.currItem = g, i.updateCurrZoomItem(!0)), g.needsUpdate = !1) : - 1 === f.index && j >= 0 && i.setContent(f, j),
g && g.container && (kc(g, sa), oc(g), Ka(g));
A = !1
}
w = v = i.currItem.initialZoomLevel,
fa = i.currItem.bounds,
fa && (ra.x = fa.center.x, ra.y = fa.center.y, Ja(!0)),
Fa('resize')
},
zoomTo: function (a, b, c, d, e) {
b && (w = v, wb.x = Math.abs(b.x) - ra.x, wb.y = Math.abs(b.y) - ra.y, Oa(qa, ra));
var f = Ua(a, !1),
g = {
};
Xa('x', f, g, a),
Xa('y', f, g, a);
var i = v,
j = {
x: ra.x,
y: ra.y
};
Pa(g);
var k = function (b) {
1 === b ? (v = a, ra.x = g.x, ra.y = g.y) : (v = (a - i) * b + i, ra.x = (g.x - j.x) * b + j.x, ra.y = (g.y - j.y) * b + j.y),
e && e(b),
Ja(1 === b)
};
c ? fb('customZoomTo', 0, 1, c, d || h.easing.sine.inOut, k) : k(1)
}
},
hb = 30,
ib = 10,
jb = {
},
kb = {
},
lb = {
},
mb = {
},
nb = {
},
ob = [
],
pb = {
},
qb = [
],
rb = {
},
sb = 0,
tb = oa(),
ub = 0,
vb = oa(),
wb = oa(),
xb = oa(),
yb = function (a, b) {
return a.x === b.x && a.y === b.y
},
zb = function (a, b) {
return Math.abs(a.x - b.x) < j && Math.abs(a.y - b.y) < j
},
Ab = function (a, b) {
return rb.x = Math.abs(a.x - b.x),
rb.y = Math.abs(a.y - b.y),
Math.sqrt(rb.x * rb.x + rb.y * rb.y)
},
Bb = function () {
_ && (L(_), _ = null)
},
Cb = function () {
X && (_ = K(Cb), Sb())
},
Db = function () {
return !('fit' === l.scaleMode && v === i.currItem.initialZoomLevel)
},
Eb = function (a, b) {
return !(!a || a === document) && (!(a.getAttribute('class') && a.getAttribute('class').indexOf('pswp__scroll-wrap') > - 1) && (b(a) ? a : Eb(a.parentNode, b)))
},
Fb = {
},
Gb = function (a, b) {
return Fb.prevent = !Eb(a.target, l.isClickableElement),
Fa('preventDragEvent', a, b, Fb),
Fb.prevent
},
Hb = function (a, b) {
return b.x = a.clientX,
b.y = a.clientY,
b.id = a.identifier,
b
},
Ib = function (a, b, c) {
c.x = 0.5 * (a.x + b.x),
c.y = 0.5 * (a.y + b.y)
},
Jb = function (a, b, c) {
if (a - S > 50) {
var d = qb.length > 2 ? qb.shift() : {
};
d.x = b,
d.y = c,
qb.push(d),
S = a
}
},
Kb = function () {
var a = ra.y - i.currItem.initialPosition.y;
return Math.min(1.2 - Math.abs(a / (sa.y / 2)), 1)
},
Lb = {
},
Mb = {
},
Nb = [
],
Ob = function (a) {
for (; Nb.length > 0; ) Nb.pop();
return I ? (na = 0, ob.forEach(function (a) {
0 === na ? Nb[0] = a : 1 === na && (Nb[1] = a),
na++
})) : a.type.indexOf('touch') > - 1 ? a.touches && a.touches.length > 0 && (Nb[0] = Hb(a.touches[0], Lb), a.touches.length > 1 && (Nb[1] = Hb(a.touches[1], Mb))) : (Lb.x = a.clientX, Lb.y = a.clientY, Lb.id = '', Nb[0] = Lb),
Nb
},
Pb = function (a, c) {
var d,
e,
f,
g,
h = ra[a] + c[a],
j = c[a] > 0,
k = vb.x + c.x,
m = vb.x - pb.x;
return d = h > fa.min[a] || h < fa.max[a] ? l.panEndFriction : 1,
h = ra[a] + c[a] * d,
!l.allowPanToNext && v !== i.currItem.initialZoomLevel || (ga ? 'h' !== ia || 'x' !== a || Z || (j ? (h > fa.min[a] && (d = l.panEndFriction, fa.min[a] - h, e = fa.min[a] - qa[a]), (0 >= e || 0 > m) && cc() > 1 ? (g = k, 0 > m && k > pb.x && (g = pb.x)) : fa.min.x !== fa.max.x && (f = h)) : (h < fa.max[a] && (d = l.panEndFriction, h - fa.max[a], e = qa[a] - fa.max[a]), (0 >= e || m > 0) && cc() > 1 ? (g = k, m > 0 && k < pb.x && (g = pb.x)) : fa.min.x !== fa.max.x && (f = h))) : g = k, 'x' !== a) ? void (ha || aa || v > i.currItem.fitRatio && (ra[a] += c[a] * d)) : (g !== b && (Ma(g, !0), aa = g !== pb.x), fa.min.x !== fa.max.x && (f !== b ? ra.x = f : aa || (ra.x += c.x * d)), g !== b)
},
Qb = function (b) {
if (!('mousedown' === b.type && b.button > 0)) {
if (ac) return void b.preventDefault();
if (!W || 'mousedown' !== b.type) {
if (Gb(b, !0) && b.preventDefault(), Fa('pointerDown'), I) {
var c = h.arraySearch(ob, b.pointerId, 'id');
0 > c && (c = ob.length),
ob[c] = {
x: b.clientX,
y: b.clientY,
id: b.pointerId
}
}
var d = Ob(b),
e = d.length;
ba = null,
eb(),
X && 1 !== e || (X = ja = !0, h.bind(a, s, i), U = ma = ka = V = aa = $ = Y = Z = !1, ia = null, Fa('firstTouchStart', d), Oa(qa, ra), pa.x = pa.y = 0, Oa(mb, d[0]), Oa(nb, mb), pb.x = va.x * ta, qb = [
{
x: mb.x,
y: mb.y
}
], S = R = Ga(), Ua(v, !0), Bb(), Cb()),
!ca && e > 1 && !ha && !aa && (w = v, Z = !1, ca = Y = !0, pa.y = pa.x = 0, Oa(qa, ra), Oa(jb, d[0]), Oa(kb, d[1]), Ib(jb, kb, xb), wb.x = Math.abs(xb.x) - ra.x, wb.y = Math.abs(xb.y) - ra.y, da = ea = Ab(jb, kb))
}
}
},
Rb = function (a) {
if (a.preventDefault(), I) {
var b = h.arraySearch(ob, a.pointerId, 'id');
if (b > - 1) {
var c = ob[b];
c.x = a.clientX,
c.y = a.clientY
}
}
if (X) {
var d = Ob(a);
if (ia || $ || ca) ba = d;
else if (vb.x !== va.x * ta) ia = 'h';
else {
var e = Math.abs(d[0].x - mb.x) - Math.abs(d[0].y - mb.y);
Math.abs(e) >= ib && (ia = e > 0 ? 'h' : 'v', ba = d)
}
}
},
Sb = function () {
if (ba) {
var a = ba.length;
if (0 !== a) if (Oa(jb, ba[0]), lb.x = jb.x - mb.x, lb.y = jb.y - mb.y, ca && a > 1) {
if (mb.x = jb.x, mb.y = jb.y, !lb.x && !lb.y && yb(ba[1], kb)) return;
Oa(kb, ba[1]),
Z || (Z = !0, Fa('zoomGestureStarted'));
var b = Ab(jb, kb),
c = Xb(b);
c > i.currItem.initialZoomLevel + i.currItem.initialZoomLevel / 15 && (ma = !0);
var d = 1,
e = Va(),
f = Wa();
if (e > c) if (l.pinchToClose && !ma && w <= i.currItem.initialZoomLevel) {
var g = e - c,
h = 1 - g / (e / 1.2);
Ha(h),
Fa('onPinchClose', h),
ka = !0
} else d = (e - c) / e,
d > 1 && (d = 1),
c = e - d * (e / 3);
else c > f && (d = (c - f) / (6 * e), d > 1 && (d = 1), c = f + d * e);
0 > d && (d = 0),
da = b,
Ib(jb, kb, tb),
pa.x += tb.x - xb.x,
pa.y += tb.y - xb.y,
Oa(xb, tb),
ra.x = Na('x', c),
ra.y = Na('y', c),
U = c > v,
v = c,
Ja()
} else {
if (!ia) return;
if (ja && (ja = !1, Math.abs(lb.x) >= ib && (lb.x -= ba[0].x - nb.x), Math.abs(lb.y) >= ib && (lb.y -= ba[0].y - nb.y)), mb.x = jb.x, mb.y = jb.y, 0 === lb.x && 0 === lb.y) return;
if ('v' === ia && l.closeOnVerticalDrag && !Db()) {
pa.y += lb.y,
ra.y += lb.y;
var j = Kb();
return V = !0,
Fa('onVerticalDrag', j),
Ha(j),
void Ja()
}
Jb(Ga(), jb.x, jb.y),
$ = !0,
fa = i.currItem.bounds;
var k = Pb('x', lb);
k || (Pb('y', lb), Pa(ra), Ja())
}
}
},
Tb = function (b) {
if (Q.isOldAndroid) {
if (W && 'mouseup' === b.type) return;
b.type.indexOf('touch') > - 1 && (clearTimeout(W), W = setTimeout(function () {
W = 0
}, 600))
}
Fa('pointerUp'),
Gb(b, !1) && b.preventDefault();
var c;
if (I) {
var d = h.arraySearch(ob, b.pointerId, 'id');
if (d > - 1) if (c = ob.splice(d, 1) [0], navigator.pointerEnabled) c.type = b.pointerType || 'mouse';
else {
var e = {
4: 'mouse',
2: 'touch',
3: 'pen'
};
c.type = e[b.pointerType],
c.type || (c.type = b.pointerType || 'mouse')
}
}
var f,
g = Ob(b),
j = g.length;
if ('mouseup' === b.type && (j = 0), 2 === j) return ba = null,
!0;
1 === j && Oa(nb, g[0]),
0 !== j || ia || ha || (c || ('mouseup' === b.type ? c = {
x: b.clientX,
y: b.clientY,
type: 'mouse'
}
: b.changedTouches && b.changedTouches[0] && (c = {
x: b.changedTouches[0].clientX,
y: b.changedTouches[0].clientY,
type: 'touch'
})), Fa('touchRelease', b, c));
var k = - 1;
if (0 === j && (X = !1, h.unbind(a, s, i), Bb(), ca ? k = 0 : - 1 !== ub && (k = Ga() - ub)), ub = 1 === j ? Ga() : - 1, f = - 1 !== k && 150 > k ? 'zoom' : 'swipe', ca && 2 > j && (ca = !1, 1 === j && (f = 'zoomPointerUp'), Fa('zoomGestureEnded')), ba = null, $ || Z || ha || V) if (eb(), T || (T = Ub()), T.calculateSwipeSpeed('x'), V) {
var m = Kb();
if (m < l.verticalDragRange) i.close();
else {
var n = ra.y,
o = la;
fb('verticalDrag', 0, 1, 300, h.easing.cubic.out, function (a) {
ra.y = (i.currItem.initialPosition.y - n) * a + n,
Ha((1 - o) * a + o),
Ja()
}),
Fa('onVerticalDrag', 1)
}
} else {
if ((aa || ha) && 0 === j) {
var p = Wb(f, T);
if (p) return;
f = 'zoomPointerUp'
}
if (!ha) return 'swipe' !== f ? void Yb() : void (!aa && v > i.currItem.fitRatio && Vb(T))
}
},
Ub = function () {
var a,
c,
d = {
lastFlickOffset: {
},
lastFlickDist: {
},
lastFlickSpeed: {
},
slowDownRatio: {
},
slowDownRatioReverse: {
},
speedDecelerationRatio: {
},
speedDecelerationRatioAbs: {
},
distanceOffset: {
},
backAnimDestination: {
},
backAnimStarted: {
},
calculateSwipeSpeed: function (b) {
qb.length > 1 ? (a = Ga() - S + 50, c = qb[qb.length - 2][b]) : (a = Ga() - R, c = nb[b]),
d.lastFlickOffset[b] = mb[b] - c,
d.lastFlickDist[b] = Math.abs(d.lastFlickOffset[b]),
d.lastFlickDist[b] > 20 ? d.lastFlickSpeed[b] = d.lastFlickOffset[b] / a : d.lastFlickSpeed[b] = 0,
Math.abs(d.lastFlickSpeed[b]) < 0.1 && (d.lastFlickSpeed[b] = 0),
d.slowDownRatio[b] = 0.95,
d.slowDownRatioReverse[b] = 1 - d.slowDownRatio[b],
d.speedDecelerationRatio[b] = 1
},
calculateOverBoundsAnimOffset: function (a, c) {
d.backAnimStarted[a] || (ra[a] > fa.min[a] ? d.backAnimDestination[a] = fa.min[a] : ra[a] < fa.max[a] && (d.backAnimDestination[a] = fa.max[a]), d.backAnimDestination[a] !== b && (d.slowDownRatio[a] = 0.7, d.slowDownRatioReverse[a] = 1 - d.slowDownRatio[a], d.speedDecelerationRatioAbs[a] < 0.05 && (d.lastFlickSpeed[a] = 0, d.backAnimStarted[a] = !0, fb('bounceZoomPan' + a, ra[a], d.backAnimDestination[a], c || 300, h.easing.sine.out, function (b) {
ra[a] = b,
Ja()
}))))
},
calculateAnimOffset: function (a) {
d.backAnimStarted[a] || (d.speedDecelerationRatio[a] = d.speedDecelerationRatio[a] * (d.slowDownRatio[a] + d.slowDownRatioReverse[a] - d.slowDownRatioReverse[a] * d.timeDiff / 10), d.speedDecelerationRatioAbs[a] = Math.abs(d.lastFlickSpeed[a] * d.speedDecelerationRatio[a]), d.distanceOffset[a] = d.lastFlickSpeed[a] * d.speedDecelerationRatio[a] * d.timeDiff, ra[a] += d.distanceOffset[a])
},
panAnimLoop: function () {
return ab.zoomPan && (ab.zoomPan.raf = K(d.panAnimLoop), d.now = Ga(), d.timeDiff = d.now - d.lastNow, d.lastNow = d.now, d.calculateAnimOffset('x'), d.calculateAnimOffset('y'), Ja(), d.calculateOverBoundsAnimOffset('x'), d.calculateOverBoundsAnimOffset('y'), d.speedDecelerationRatioAbs.x < 0.05 && d.speedDecelerationRatioAbs.y < 0.05) ? (ra.x = Math.round(ra.x), ra.y = Math.round(ra.y), Ja(), void cb('zoomPan')) : void 0
}
};
return d
},
Vb = function (a) {
return a.calculateSwipeSpeed('y'),
fa = i.currItem.bounds,
a.backAnimDestination = {
},
a.backAnimStarted = {
},
Math.abs(a.lastFlickSpeed.x) <= 0.05 && Math.abs(a.lastFlickSpeed.y) <= 0.05 ? (a.speedDecelerationRatioAbs.x = a.speedDecelerationRatioAbs.y = 0, a.calculateOverBoundsAnimOffset('x'), a.calculateOverBoundsAnimOffset('y'), !0) : (db('zoomPan'), a.lastNow = Ga(), void a.panAnimLoop())
},
Wb = function (a, b) {
var c;
ha || (sb = p);
var d;
if ('swipe' === a) {
var e = mb.x - nb.x,
f = b.lastFlickDist.x < 10;
e > hb && (f || b.lastFlickOffset.x > 20) ? d = - 1 : - hb > e && (f || b.lastFlickOffset.x < - 20) && (d = 1)
}
var g;
d && (p += d, 0 > p ? (p = l.loop ? cc() - 1 : 0, g = !0) : p >= cc() && (p = l.loop ? 0 : cc() - 1, g = !0), g && !l.loop || (wa += d, ta -= d, c = !0));
var j,
k = va.x * ta,
m = Math.abs(k - vb.x);
return c || k > vb.x == b.lastFlickSpeed.x > 0 ? (j = Math.abs(b.lastFlickSpeed.x) > 0 ? m / Math.abs(b.lastFlickSpeed.x) : 333, j = Math.min(j, 400), j = Math.max(j, 250)) : j = 333,
sb === p && (c = !1),
ha = !0,
Fa('mainScrollAnimStart'),
fb('mainScroll', vb.x, k, j, h.easing.cubic.out, Ma, function () {
eb(),
ha = !1,
sb = - 1,
(c || sb !== p) && i.updateCurrItem(),
Fa('mainScrollAnimComplete')
}),
c && i.updateCurrItem(!0),
c
},
Xb = function (a) {
return 1 / ea * a * w
},
Yb = function () {
var a = v,
b = Va(),
c = Wa();
b > v ? a = b : v > c && (a = c);
var d,
e = la;
return ka && !U && !ma && b > v ? (i.close(), !0) : (ka && (d = function (a) {
Ha((1 - e) * a + e)
}), i.zoomTo(a, 0, 200, h.easing.cubic.out, d), !0)
};
Ba('Gestures', {
publicMethods: {
initGestures: function () {
var a = function (a, b, c, d, e) {
D = a + b,
E = a + c,
F = a + d,
G = e ? a + e : ''
};
I = Q.pointerEvent,
I && Q.touch && (Q.touch = !1),
I ? navigator.pointerEnabled ? a('pointer', 'down', 'move', 'up', 'cancel') : a('MSPointer', 'Down', 'Move', 'Up', 'Cancel') : Q.touch ? (a('touch', 'start', 'move', 'end', 'cancel'), J = !0) : a('mouse', 'down', 'move', 'up'),
s = E + ' ' + F + ' ' + G,
t = D,
I && !J && (J = navigator.maxTouchPoints > 1 || navigator.msMaxTouchPoints > 1),
i.likelyTouchDevice = J,
u[D] = Qb,
u[E] = Rb,
u[F] = Tb,
G && (u[G] = u[F]),
Q.touch && (t += ' mousedown', s += ' mousemove mouseup', u.mousedown = u[D], u.mousemove = u[E], u.mouseup = u[F]),
J || (l.allowPanToNext = !1)
}
}
});
var Zb,
$b,
_b,
ac,
bc,
cc,
dc,
ec = function (a, d, e, f) {
Zb && clearTimeout(Zb),
ac = !0,
_b = !0;
var g;
a.initialLayout ? (g = a.initialLayout, a.initialLayout = null) : g = l.getThumbBoundsFn && l.getThumbBoundsFn(p);
var j = e ? l.hideAnimationDuration : l.showAnimationDuration,
k = function () {
cb('initialZoom'),
e ? (i.template.removeAttribute('style'), i.bg.removeAttribute('style')) : (Ha(1), d && (d.style.display = 'block'), h.addClass(c, 'pswp--animated-in'), Fa('initialZoom' + (e ? 'OutEnd' : 'InEnd'))),
f && f(),
ac = !1
};
if (!j || !g || g.x === b) return Fa('initialZoom' + (e ? 'Out' : 'In')),
v = a.initialZoomLevel,
Oa(ra, a.initialPosition),
Ja(),
c.style.opacity = e ? 0 : 1,
Ha(1),
void (j ? setTimeout(function () {
k()
}, j) : k());
!function () {
var b = o,
d = !i.currItem.src || i.currItem.loadError || l.showHideOpacity;
a.miniImg && (a.miniImg.style.webkitBackfaceVisibility = 'hidden'),
e || (v = g.w / a.w, ra.x = g.x, ra.y = g.y - N, i[d ? 'template' : 'bg'].style.opacity = 0.001, Ja()),
db('initialZoom'),
e && !b && h.removeClass(c, 'pswp--animated-in'),
d && (e ? h[(b ? 'remove' : 'add') + 'Class'](c, 'pswp--animate_opacity') : setTimeout(function () {
h.addClass(c, 'pswp--animate_opacity')
}, 30)),
Zb = setTimeout(function () {
if (Fa('initialZoom' + (e ? 'Out' : 'In')), e) {
var f = g.w / a.w,
i = {
x: ra.x,
y: ra.y
},
l = v,
m = la,
n = function (a) {
1 === a ? (v = f, ra.x = g.x, ra.y = g.y - P) : (v = (f - l) * a + l, ra.x = (g.x - i.x) * a + i.x, ra.y = (g.y - P - i.y) * a + i.y),
Ja(),
d ? c.style.opacity = 1 - a : Ha(m - a * m)
};
b ? fb('initialZoom', 0, 1, j, h.easing.cubic.out, n, k) : (n(1), Zb = setTimeout(k, j + 20))
} else v = a.initialZoomLevel,
Oa(ra, a.initialPosition),
Ja(),
Ha(1),
d ? c.style.opacity = 1 : Ha(1),
Zb = setTimeout(k, j + 20)
}, e ? 25 : 90)
}()
},
fc = {
},
gc = [
],
hc = {
index: 0,
errorMsg: '<div class="pswp__error-msg"><a href="%url%" target="_blank">The image</a> could not be loaded.</div>',
forceProgressiveLoading: !1,
preload: [
1,
1
],
getNumItemsFn: function () {
return $b.length
}
},
ic = function () {
return {
center: {
x: 0,
y: 0
},
max: {
x: 0,
y: 0
},
min: {
x: 0,
y: 0
}
}
},
jc = function (a, b, c) {
var d = a.bounds;
d.center.x = Math.round((fc.x - b) / 2) + a.hGap.left,
d.center.y = Math.round((fc.y - c) / 2) + a.vGap.top,
d.max.x = b > fc.x ? Math.round(fc.x - b) + a.hGap.left : d.center.x,
d.max.y = c > fc.y ? Math.round(fc.y - c) + a.vGap.top : d.center.y,
d.min.x = b > fc.x ? a.hGap.left : d.center.x,
d.min.y = c > fc.y ? a.vGap.top : d.center.y
},
kc = function (a, b, c) {
if (a.src && !a.loadError) {
var d = !c;
if (d && (a.vGap || (a.vGap = {
top: 0,
bottom: 0
}), a.hGap || (a.hGap = {
left: 0,
right: 0
}), Fa('parseVerticalMargin', a)), fc.x = b.x - a.hGap.left - a.hGap.right, fc.y = b.y - a.vGap.top - a.vGap.bottom, d) {
var e = fc.x / a.w,
f = fc.y / a.h;
a.fitRatio = f > e ? e : f;
var g = l.scaleMode;
'orig' === g ? c = 1 : 'fit' === g && (c = a.fitRatio),
c > 1 && (c = 1),
a.initialZoomLevel = c,
a.bounds || (a.bounds = ic())
}
if (!c) return;
return jc(a, a.w * c, a.h * c),
d && c === a.initialZoomLevel && (a.initialPosition = a.bounds.center),
a.bounds
}
return a.w = a.h = 0,
a.initialZoomLevel = a.fitRatio = 1,
a.bounds = ic(),
a.initialPosition = a.bounds.center,
a.bounds
},
lc = function (a, b, c, d, e, f) {
b.loadError || d && (b.imageAppended = !0, oc(b, d, b === i.currItem && Aa), c.appendChild(d), f && setTimeout(function () {
b && b.loaded && b.placeholder && (b.placeholder.style.display = 'none', b.placeholder = null)
}, 500))
},
mc = function (a) {
a.loading = !0,
a.loaded = !1;
var b = a.img = h.createEl('pswp__img', 'img'),
c = function () {
a.loading = !1,
a.loaded = !0,
a.loadComplete ? a.loadComplete(a) : a.img = null,
b.onload = b.onerror = null,
b = null
};
return b.onload = c,
b.onerror = function () {
a.loadError = !0,
c()
},
b.src = a.src,
b
},
nc = function (a, b) {
return a.src && a.loadError && a.container ? (b && (a.container.innerHTML = ''), a.container.innerHTML = l.errorMsg.replace('%url%', a.src), !0) : void 0
},
oc = function (a, b, c) {
if (a.src) {
b || (b = a.container.lastChild);
var d = c ? a.w : Math.round(a.w * a.fitRatio),
e = c ? a.h : Math.round(a.h * a.fitRatio);
a.placeholder && !a.loaded && (a.placeholder.style.width = d + 'px', a.placeholder.style.height = e + 'px'),
b.style.width = d + 'px',
b.style.height = e + 'px'
}
},
pc = function () {
if (gc.length) {
for (var a, b = 0; b < gc.length; b++) a = gc[b],
a.holder.index === a.index && lc(a.index, a.item, a.baseDiv, a.img, !1, a.clearPlaceholder);
gc = [
]
}
};
Ba('Controller', {
publicMethods: {
lazyLoadItem: function (a) {
a = Ca(a);
var b = bc(a);
b && (!b.loaded && !b.loading || A) && (Fa('gettingData', a, b), b.src && mc(b))
},
initController: function () {
h.extend(l, hc, !0),
i.items = $b = f,
bc = i.getItemAt,
cc = l.getNumItemsFn,
dc = l.loop,
cc() < 3 && (l.loop = !1),
Ea('beforeChange', function (a) {
var b,
c = l.preload,
d = null === a || a >= 0,
e = Math.min(c[0], cc()),
f = Math.min(c[1], cc());
for (b = 1; (d ? f : e) >= b; b++) i.lazyLoadItem(p + b);
for (b = 1; (d ? e : f) >= b; b++) i.lazyLoadItem(p - b)
}),
Ea('initialLayout', function () {
i.currItem.initialLayout = l.getThumbBoundsFn && l.getThumbBoundsFn(p)
}),
Ea('mainScrollAnimComplete', pc),
Ea('initialZoomInEnd', pc),
Ea('destroy', function () {
for (var a, b = 0; b < $b.length; b++) a = $b[b],
a.container && (a.container = null),
a.placeholder && (a.placeholder = null),
a.img && (a.img = null),
a.preloader && (a.preloader = null),
a.loadError && (a.loaded = a.loadError = !1);
gc = null
})
},
getItemAt: function (a) {
return a >= 0 && $b[a] !== b && $b[a]
},
allowProgressiveImg: function () {
return l.forceProgressiveLoading || !J || l.mouseUsed || screen.width > 1200
},
setContent: function (a, b) {
l.loop && (b = Ca(b));
var c = i.getItemAt(a.index);
c && (c.container = null);
var d,
e = i.getItemAt(b);
if (!e) return void (a.el.innerHTML = '');
Fa('gettingData', b, e),
a.index = b,
a.item = e;
var f = e.container = h.createEl('pswp__zoom-wrap');
if (!e.src && e.html && (e.html.tagName ? f.appendChild(e.html) : f.innerHTML = e.html), nc(e), kc(e, sa), !e.src || e.loadError || e.loaded) e.src && !e.loadError && (d = h.createEl('pswp__img', 'img'), d.style.opacity = 1, d.src = e.src, oc(e, d), lc(b, e, f, d, !0));
else {
if (e.loadComplete = function (c) {
if (m) {
if (a && a.index === b) {
if (nc(c, !0)) return c.loadComplete = c.img = null,
kc(c, sa),
Ka(c),
void (a.index === p && i.updateCurrZoomItem());
c.imageAppended ? !ac && c.placeholder && (c.placeholder.style.display = 'none', c.placeholder = null) : Q.transform && (ha || ac) ? gc.push({
item: c,
baseDiv: f,
img: c.img,
index: b,
holder: a,
clearPlaceholder: !0
}) : lc(b, c, f, c.img, ha || ac, !0)
}
c.loadComplete = null,
c.img = null,
Fa('imageLoadComplete', b, c)
}
}, h.features.transform) {
var g = 'pswp__img pswp__img--placeholder';
g += e.msrc ? '' : ' pswp__img--placeholder--blank';
var j = h.createEl(g, e.msrc ? 'img' : '');
e.msrc && (j.src = e.msrc),
oc(e, j),
f.appendChild(j),
e.placeholder = j
}
e.loading || mc(e),
i.allowProgressiveImg() && (!_b && Q.transform ? gc.push({
item: e,
baseDiv: f,
img: e.img,
index: b,
holder: a
}) : lc(b, e, f, e.img, !0, !0))
}
_b || b !== p ? Ka(e) : (ga = f.style, ec(e, d || e.img)),
a.el.innerHTML = '',
a.el.appendChild(f)
},
cleanSlide: function (a) {
a.img && (a.img.onload = a.img.onerror = null),
a.loaded = a.loading = a.img = a.imageAppended = !1
}
}
});
var qc,
rc = {
},
sc = function (a, b, c) {
var d = document.createEvent('CustomEvent'),
e = {
origEvent: a,
target: a.target,
releasePoint: b,
pointerType: c || 'touch'
};
d.initCustomEvent('pswpTap', !0, !0, e),
a.target.dispatchEvent(d)
};
Ba('Tap', {
publicMethods: {
initTap: function () {
Ea('firstTouchStart', i.onTapStart),
Ea('touchRelease', i.onTapRelease),
Ea('destroy', function () {
rc = {
},
qc = null
})
},
onTapStart: function (a) {
a.length > 1 && (clearTimeout(qc), qc = null)
},
onTapRelease: function (a, b) {
if (b && !$ && !Y && !bb) {
var c = b;
if (qc && (clearTimeout(qc), qc = null, zb(c, rc))) return void Fa('doubleTap', c);
if ('mouse' === b.type) return void sc(a, b, 'mouse');
if ('BUTTON' === a.target.tagName.toUpperCase() || h.hasClass(a.target, 'pswp__single-tap')) return void sc(a, b);
Oa(rc, c),
qc = setTimeout(function () {
sc(a, b),
qc = null
}, 300)
}
}
}
});
var tc;
Ba('DesktopZoom', {
publicMethods: {
initDesktopZoom: function () {
O || (J ? Ea('mouseUsed', function () {
i.setupDesktopZoom()
}) : i.setupDesktopZoom(!0))
},
setupDesktopZoom: function (a) {
tc = {
};
var b = 'wheel mousewheel DOMMouseScroll';
Ea('bindEvents', function () {
h.bind(c, b, i.handleMouseWheel)
}),
Ea('unbindEvents', function () {
tc && h.unbind(c, b, i.handleMouseWheel)
}),
i.mouseZoomedIn = !1;
var d,
e = function () {
i.mouseZoomedIn && (h.removeClass(c, 'pswp--zoomed-in'), i.mouseZoomedIn = !1),
1 > v ? h.addClass(c, 'pswp--zoom-allowed') : h.removeClass(c, 'pswp--zoom-allowed'),
f()
},
f = function () {
d && (h.removeClass(c, 'pswp--dragging'), d = !1)
};
Ea('resize', e),
Ea('afterChange', e),
Ea('pointerDown', function () {
i.mouseZoomedIn && (d = !0, h.addClass(c, 'pswp--dragging'))
}),
Ea('pointerUp', f),
a || e()
},
handleMouseWheel: function (a) {
if (v <= i.currItem.fitRatio) return l.modal && (!l.closeOnScroll || bb || X ? a.preventDefault() : H && Math.abs(a.deltaY) > 2 && (o = !0, i.close())),
!0;
if (a.stopPropagation(), tc.x = 0, 'deltaX' in a) 1 === a.deltaMode ? (tc.x = 18 * a.deltaX, tc.y = 18 * a.deltaY) : (tc.x = a.deltaX, tc.y = a.deltaY);
else if ('wheelDelta' in a) a.wheelDeltaX && (tc.x = - 0.16 * a.wheelDeltaX),
a.wheelDeltaY ? tc.y = - 0.16 * a.wheelDeltaY : tc.y = - 0.16 * a.wheelDelta;
else {
if (!('detail' in a)) return;
tc.y = a.detail
}
Ua(v, !0);
var b = ra.x - tc.x,
c = ra.y - tc.y;
(l.modal || b <= fa.min.x && b >= fa.max.x && c <= fa.min.y && c >= fa.max.y) && a.preventDefault(),
i.panTo(b, c)
},
toggleDesktopZoom: function (a) {
a = a || {
x: sa.x / 2 + ua.x,
y: sa.y / 2 + ua.y
};
var b = l.getDoubleTapZoom(!0, i.currItem),
d = v === b;
i.mouseZoomedIn = !d,
i.zoomTo(d ? i.currItem.initialZoomLevel : b, a, 333),
h[(d ? 'remove' : 'add') + 'Class'](c, 'pswp--zoomed-in')
}
}
}),
h.extend(i, gb)
}
}),
this.template = '<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"> <!-- Background of PhotoSwipe. It\'s a separate element as animating opacity is faster than rgba(). --> <div class="pswp__bg"></div> <!-- Slides wrapper with overflow:hidden. --> <div class="pswp__scroll-wrap"> <!-- Container that holds slides. PhotoSwipe keeps only 3 of them in the DOM to save memory. Don\'t modify these 3 pswp__item elements, data is added later on. --> <div class="pswp__container"> <div class="pswp__item"></div> <div class="pswp__item"></div> <div class="pswp__item"></div> </div> <div class="pswp__ui pswp__ui--hidden pswp__custom_nav"> <div class="pswp__group"> <div class="pswp__button pswp__button-prev"> <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><path d="M10 15l10 5V10z"/></svg> </div> <div class="pswp__button pswp__button-close"> <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15"><path d="M15 1.667L13.333 0 7.5 5.834 1.667 0 0 1.667 5.833 7.5 0 13.334 1.667 15 7.5 9.167 13.333 15 15 13.334 9.167 7.5z"/></svg> </div> <div class="pswp__button pswp__button-next"> <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><path d="M20 15l-10 5V10z"/></svg> </div> </div> </div> </div><div id="freshbox" style="display: none; width: 0; height: 0;"><!-- legacy support --></div> </div>';
var c = function () {
var a = document.createElement('div');
for (a.innerHTML = this.template; a.childNodes.length > 0; ) document.body.appendChild(a.childNodes[0]);
a = null
}.bind(this),
d = function () {
};
this.setEventProxy = function (a) {
'function' == typeof a && (d = a)
},
this.isActive = !1,
this.activeGallery = b,
this.openImageArray = function (a, d, e) {
if (a !== b && this.activeGallery === b) {
var f = document.querySelectorAll('.pswp') [0];
f === b && (c(), f = document.querySelectorAll('.pswp') [0]);
var g = [
],
h = 0;
if (Array.prototype.forEach.call(a, function (a) {
a.hasAttribute('src') && a.hasAttribute('src_o') && a.hasAttribute('width_o') && a.hasAttribute('height_o') && (a === d && (h = g.length), g.push({
src: a.getAttribute('src_o'),
msrc: a.getAttribute('src'),
w: a.getAttribute('width_o'),
h: a.getAttribute('height_o'),
el: a
}))
}), 0 == g.length) return !1;
var i = this,
j = {
index: h,
maxSpreadZoom: 1,
getThumbBoundsFn: function (a) {
return !1
},
closeEl: !0,
arrowEl: g.length > 1,
tapToClose: !0,
closeOnScroll: !1
};
if (e !== b && 'object' == typeof e) for (var k in e) e.hasOwnProperty(k) && (j[k] = e[k]);
return this.activeGallery = new this.PhotoSwipe(f, this.PhotoSwipeUI_Default, g, j),
this.activeGallery.init(),
this.isActive = !0,
this.activeGallery.listen('destroy', function () {
null !== f.parentNode && f.parentNode.removeChild(f),
i.isActive = !1,
i.activeGallery = b
}),
this.activeGallery
}
},
function (a, b) {
a.PhotoSwipeUI_Default = b()
}(this, function () {
return function (b, c) {
var d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n = this,
o = !1,
p = !0,
q = {
closeElClasses: [
'item',
'caption',
'zoom-wrap',
'ui',
'top-bar'
],
timeToIdle: 2000,
timeToIdleOutside: 1000,
closeEl: !0,
fullscreenEl: !0,
zoomEl: !0,
counterEl: !0,
arrowEl: !0,
tapToClose: !1,
tapToToggleControls: !0,
clickToCloseNonZoomable: !0,
fitControlsWidth: 1200
},
r = function (b) {
if (j) return !0;
b = b || a.event,
i.timeToIdle && i.mouseUsed && !g && v();
for (var d = b.target || b.srcElement; 'svg' === d.nodeName || 'path' === d.nodeName; ) d = d.parentNode;
for (var e, f, h = d.getAttribute('class') || '', l = 0; l < A.length; l++) e = A[l],
e.onTap && h.indexOf('pswp__' + e.name) > - 1 && (e.onTap(), f = !0);
if (f) {
b.stopPropagation && b.stopPropagation(),
j = !0;
var m = c.features.isOldAndroid ? 600 : 30;
k = setTimeout(function () {
j = !1
}, m)
}
},
s = function (a, b, d) {
c[(d ? 'add' : 'remove') + 'Class'](a, 'pswp__' + b)
},
t = function (a) {
for (var b = 0; b < i.closeElClasses.length; b++) if (c.hasClass(a, 'pswp__' + i.closeElClasses[b])) return !0
},
u = 0,
v = function () {
clearTimeout(m),
u = 0,
g && n.setIdle(!1)
},
w = function (b) {
b = b || a.event;
var c = b.relatedTarget || b.toElement;
c && 'HTML' !== c.nodeName || (clearTimeout(m), m = setTimeout(function () {
n.setIdle(!0)
}, i.timeToIdleOutside))
},
x = function () {
i.fullscreenEl && !c.features.isOldAndroid && (d || (d = n.getFullscreenAPI()), d ? (c.bind(document, d.eventK, n.updateFullscreen), n.updateFullscreen(), c.addClass(b.template, 'pswp--supports-fs')) : c.removeClass(b.template, 'pswp--supports-fs'))
},
y = function () {
i.timeToIdle && h('mouseUsed', function () {
c.bind(document, 'mousemove', v),
c.bind(document, 'mouseout', w),
l = setInterval(function () {
2 === ++u && n.setIdle(!0)
}, i.timeToIdle / 2)
})
},
z = function () {
h('onVerticalDrag', function (a) {
p && 0.95 > a ? n.hideControls() : !p && a >= 0.95 && n.showControls()
});
var a;
h('onPinchClose', function (b) {
p && 0.9 > b ? (n.hideControls(), a = !0) : a && !p && b > 0.9 && n.showControls()
}),
h('zoomGestureEnded', function () {
(a = !1) && !p && n.showControls()
})
},
A = [
{
name: 'button--zoom',
option: 'zoomEl',
onTap: b.toggleDesktopZoom
},
{
name: 'button-close',
option: 'closeEl',
onTap: b.close
},
{
name: 'button-prev',
option: 'arrowEl',
onTap: b.prev
},
{
name: 'button-next',
option: 'arrowEl',
onTap: b.next
},
{
name: 'button--fs',
option: 'fullscreenEl',
onTap: function () {
d.isFullscreen() ? d.exit() : d.enter()
}
}
],
B = function () {
var a,
b,
d,
f = function (e) {
if (e) {
for (var f = e.length, g = [
], h = 0; f > h; h++) {
a = e[h],
b = a.className;
for (var j = 0; j < A.length; j++) d = A[j],
b.indexOf('pswp__' + d.name) > - 1 && (i[d.option] ? (c.removeClass(a, 'pswp__element--disabled'), g.push(a), d.onInit && d.onInit(a)) : c.addClass(a, 'pswp__element--disabled'))
}
g.length > 0 && (c.addClass(g[0], 'pswp__first-group-element'), c.addClass(g[g.length - 1], 'pswp__last-group-element'))
}
};
f(e.children);
for (var g = e.querySelectorAll('.pswp__group'), h = 0; h < g.length; h++) f(g[h].children)
};
n.init = function () {
c.extend(b.options, q, !0),
i = b.options,
e = c.getChildByClass(b.scrollWrap, 'pswp__ui'),
h = b.listen,
z(),
h('beforeChange', n.update),
h('doubleTap', function (a) {
var c = b.currItem.initialZoomLevel;
b.getZoomLevel() !== c ? b.zoomTo(c, a, 333) : b.zoomTo(i.getDoubleTapZoom(!1, b.currItem), a, 333)
}),
h('preventDragEvent', function (a, b, c) {
var d = a.target || a.srcElement;
d && d.getAttribute('class') && a.type.indexOf('mouse') > - 1 && (d.getAttribute('class').indexOf('__caption') > 0 || /(SMALL|STRONG|EM)/i.test(d.tagName)) && (c.prevent = !1)
}),
h('bindEvents', function () {
c.bind(e, 'pswpTap click', r),
c.bind(b.scrollWrap, 'pswpTap', n.onGlobalTap),
b.likelyTouchDevice || c.bind(b.scrollWrap, 'mouseover', n.onMouseOver)
}),
h('unbindEvents', function () {
l && clearInterval(l),
c.unbind(document, 'mouseout', w),
c.unbind(document, 'mousemove', v),
c.unbind(e, 'pswpTap click', r),
c.unbind(b.scrollWrap, 'pswpTap', n.onGlobalTap),
c.unbind(b.scrollWrap, 'mouseover', n.onMouseOver),
d && (c.unbind(document, d.eventK, n.updateFullscreen), d.isFullscreen() && (i.hideAnimationDuration = 0, d.exit()), d = null)
}),
h('destroy', function () {
i.captionEl && (_fakeCaptionContainer && e.removeChild(_fakeCaptionContainer), c.removeClass(_captionContainer, 'pswp__caption--empty')),
c.removeClass(e, 'pswp__ui--over-close'),
c.addClass(e, 'pswp__ui--hidden'),
n.setIdle(!1)
}),
i.showAnimationDuration || c.removeClass(e, 'pswp__ui--hidden'),
h('initialZoomIn', function () {
i.showAnimationDuration && c.removeClass(e, 'pswp__ui--hidden')
}),
h('initialZoomOut', function () {
c.addClass(e, 'pswp__ui--hidden')
}),
B(),
y(),
n.setIdle(!0),
x()
},
n.setIdle = function (a) {
g = a,
s(e, 'ui--idle', a)
},
n.update = function () {
o = !(!p || !b.currItem)
},
n.updateFullscreen = function (a) {
a && setTimeout(function () {
b.setScrollOffset(0, c.getScrollY())
}, 50),
c[(d.isFullscreen() ? 'add' : 'remove') + 'Class'](b.template, 'pswp--fs')
},
n.onGlobalTap = function (d) {
d = d || a.event;
var e = d.target || d.srcElement;
if (!j) if (d.detail && 'mouse' === d.detail.pointerType) {
if (t(e)) return void b.close();
c.hasClass(e, 'pswp__img') && (1 === b.getZoomLevel() && b.getZoomLevel() <= b.currItem.fitRatio ? i.clickToCloseNonZoomable && b.close() : b.toggleDesktopZoom(d.detail.releasePoint))
} else if (i.tapToToggleControls && (p ? n.hideControls() : n.showControls()), i.tapToClose && (c.hasClass(e, 'pswp__img') || t(e))) return void b.close()
},
n.onMouseOver = function (b) {
b = b || a.event;
var c = b.target || b.srcElement;
s(e, 'ui--over-close', t(c))
},
n.hideControls = function () {
c.addClass(e, 'pswp__ui--hidden'),
p = !1
},
n.showControls = function () {
p = !0,
o || n.update(),
c.removeClass(e, 'pswp__ui--hidden')
},
n.toggleFullscreen = function () {
d.isFullscreen() ? d.exit() : d.enter()
},
n.supportsFullscreen = function () {
var a = document;
return !!(a.exitFullscreen || a.mozCancelFullScreen || a.webkitExitFullscreen || a.msExitFullscreen)
},
n.getFullscreenAPI = function () {
var a,
c = document.documentElement,
d = 'fullscreenchange';
return c.requestFullscreen ? a = {
enterK: 'requestFullscreen',
exitK: 'exitFullscreen',
elementK: 'fullscreenElement',
eventK: d
}
: c.mozRequestFullScreen ? a = {
enterK: 'mozRequestFullScreen',
exitK: 'mozCancelFullScreen',
elementK: 'mozFullScreenElement',
eventK: 'moz' + d
}
: c.webkitRequestFullscreen ? a = {
enterK: 'webkitRequestFullscreen',
exitK: 'webkitExitFullscreen',
elementK: 'webkitFullscreenElement',
eventK: 'webkit' + d
}
: c.msRequestFullscreen && (a = {
enterK: 'msRequestFullscreen',
exitK: 'msExitFullscreen',
elementK: 'msFullscreenElement',
eventK: 'MSFullscreenChange'
}),
a && (a.enter = function () {
return f = i.closeOnScroll,
i.closeOnScroll = !1,
'webkitRequestFullscreen' !== this.enterK ? b.template[this.enterK]() : void b.template[this.enterK](Element.ALLOW_KEYBOARD_INPUT)
}, a.exit = function () {
return i.closeOnScroll = f,
document[this.exitK]()
}, a.isFullscreen = function () {
return document[this.elementK]
}),
a
}
}
})
}.call(window.lightbox = {
}, window);
var requirejs,
require,
define;
!function (global) {
function isFunction(a) {
return '[object Function]' === ostring.call(a)
}
function isArray(a) {
return '[object Array]' === ostring.call(a)
}
function each(a, b) {
if (a) {
var c;
for (c = 0; c < a.length && (!a[c] || !b(a[c], c, a)); c += 1);
}
}
function eachReverse(a, b) {
if (a) {
var c;
for (c = a.length - 1; c > - 1 && (!a[c] || !b(a[c], c, a)); c -= 1);
}
}
function hasProp(a, b) {
return hasOwn.call(a, b)
}
function getOwn(a, b) {
return hasProp(a, b) && a[b]
}
function eachProp(a, b) {
var c;
for (c in a) if (hasProp(a, c) && b(a[c], c)) break
}
function mixin(a, b, c, d) {
return b && eachProp(b, function (b, e) {
!c && hasProp(a, e) || (!d || 'object' != typeof b || !b || isArray(b) || isFunction(b) || b instanceof RegExp ? a[e] = b : (a[e] || (a[e] = {
}), mixin(a[e], b, c, d)))
}),
a
}
function bind(a, b) {
return function () {
return b.apply(a, arguments)
}
}
function scripts() {
return document.getElementsByTagName('script')
}
function defaultOnError(a) {
throw a
}
function getGlobal(a) {
if (!a) return a;
var b = global;
return each(a.split('.'), function (a) {
b = b[a]
}),
b
}
function makeError(a, b, c, d) {
var e = new Error(b + '\nhttp://requirejs.org/docs/errors.html#' + a);
return e.requireType = a,
e.requireModules = d,
c && (e.originalError = c),
e
}
function newContext(a) {
function b(a) {
var b,
c;
for (b = 0; b < a.length; b++) if ('.' === (c = a[b])) a.splice(b, 1),
b -= 1;
else if ('..' === c) {
if (0 === b || 1 === b && '..' === a[2] || '..' === a[b - 1]) continue;
b > 0 && (a.splice(b - 1, 2), b -= 2)
}
}
function c(a, c, d) {
var e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p = c && c.split('/'),
q = x.map,
r = q && q['*'];
if (a && (a = a.split('/'), j = a.length - 1, x.nodeIdCompat && jsSuffixRegExp.test(a[j]) && (a[j] = a[j].replace(jsSuffixRegExp, '')), '.' === a[0].charAt(0) && p && (o = p.slice(0, p.length - 1), a = o.concat(a)), b(a), a = a.join('/')), d && q && (p || r)) {
f = a.split('/');
a: for (g = f.length; g > 0; g -= 1) {
if (i = f.slice(0, g).join('/'), p) for (h = p.length; h > 0; h -= 1) if ((e = getOwn(q, p.slice(0, h).join('/'))) && (e = getOwn(e, i))) {
k = e,
l = g;
break a
}
!m && r && getOwn(r, i) && (m = getOwn(r, i), n = g)
}
!k && m && (k = m, l = n),
k && (f.splice(0, l, k), a = f.join('/'))
}
return getOwn(x.pkgs, a) || a
}
function d(a) {
isBrowser && each(scripts(), function (b) {
if (b.getAttribute('data-requiremodule') === a && b.getAttribute('data-requirecontext') === u.contextName) return b.parentNode.removeChild(b),
!0
})
}
function e(a) {
var b = getOwn(x.paths, a);
if (b && isArray(b) && b.length > 1) return b.shift(),
u.require.undef(a),
u.makeRequire(null, {
skipMap: !0
}) ([a]),
!0
}
function f(a) {
var b,
c = a ? a.indexOf('!') : - 1;
return c > - 1 && (b = a.substring(0, c), a = a.substring(c + 1, a.length)),
[
b,
a
]
}
function g(a, b, d, e) {
var g,
h,
i,
j,
k = null,
l = b ? b.name : null,
m = a,
n = !0,
o = '';
return a || (n = !1, a = '_@r' + (F += 1)),
j = f(a),
k = j[0],
a = j[1],
k && (k = c(k, l, e), h = getOwn(C, k)),
a && (k ? o = h && h.normalize ? h.normalize(a, function (a) {
return c(a, l, e)
}) : - 1 === a.indexOf('!') ? c(a, l, e) : a : (o = c(a, l, e), j = f(o), k = j[0], o = j[1], d = !0, g = u.nameToUrl(o))),
i = !k || h || d ? '' : '_unnormalized' + (G += 1),
{
prefix: k,
name: o,
parentMap: b,
unnormalized: !!i,
url: g,
originalName: m,
isDefine: n,
id: (k ? k + '!' + o : o) + i
}
}
function h(a) {
var b = a.id,
c = getOwn(y, b);
return c || (c = y[b] = new u.Module(a)),
c
}
function i(a, b, c) {
var d = a.id,
e = getOwn(y, d);
!hasProp(C, d) || e && !e.defineEmitComplete ? (e = h(a), e.error && 'error' === b ? c(e.error) : e.on(b, c)) : 'defined' === b && c(C[d])
}
function j(a, b) {
var c = a.requireModules,
d = !1;
b ? b(a) : (each(c, function (b) {
var c = getOwn(y, b);
c && (c.error = a, c.events.error && (d = !0, c.emit('error', a)))
}), d || req.onError(a))
}
function k() {
globalDefQueue.length && (apsp.apply(B, [
B.length,
0
].concat(globalDefQueue)), globalDefQueue = [
])
}
function l(a) {
delete y[a],
delete z[a]
}
function m(a, b, c) {
var d = a.map.id;
a.error ? a.emit('error', a.error) : (b[d] = !0, each(a.depMaps, function (d, e) {
var f = d.id,
g = getOwn(y, f);
!g || a.depMatched[e] || c[f] || (getOwn(b, f) ? (a.defineDep(e, C[f]), a.check()) : m(g, b, c))
}), c[d] = !0)
}
function n() {
var a,
b,
c = 1000 * x.waitSeconds,
f = c && u.startTime + c < (new Date).getTime(),
g = [
],
h = [
],
i = !1,
k = !0;
if (!s) {
if (s = !0, eachProp(z, function (a) {
var c = a.map,
j = c.id;
if (a.enabled && (c.isDefine || h.push(a), !a.error)) if (!a.inited && f) e(j) ? (b = !0, i = !0) : (g.push(j), d(j));
else if (!a.inited && a.fetched && c.isDefine && (i = !0, !c.prefix)) return k = !1
}), f && g.length) return a = makeError('timeout', 'Load timeout for modules: ' + g, null, g),
a.contextName = u.contextName,
j(a);
k && each(h, function (a) {
m(a, {
}, {
})
}),
f && !b || !i || !isBrowser && !isWebWorker || w || (w = setTimeout(function () {
w = 0,
n()
}, 50)),
s = !1
}
}
function o(a) {
hasProp(C, a[0]) || h(g(a[0], null, !0)).init(a[1], a[2])
}
function p(a, b, c, d) {
a.detachEvent && !isOpera ? d && a.detachEvent(d, b) : a.removeEventListener(c, b, !1)
}
function q(a) {
var b = a.currentTarget || a.srcElement;
return p(b, u.onScriptLoad, 'load', 'onreadystatechange'),
p(b, u.onScriptError, 'error'),
{
node: b,
id: b && b.getAttribute('data-requiremodule')
}
}
function r() {
var a;
for (k(); B.length; ) {
if (a = B.shift(), null === a[0]) return j(makeError('mismatch', 'Mismatched anonymous define() module: ' + a[a.length - 1]));
o(a)
}
}
var s,
t,
u,
v,
w,
x = {
waitSeconds: 7,
baseUrl: './',
paths: {
},
bundles: {
},
pkgs: {
},
shim: {
},
config: {
}
},
y = {
},
z = {
},
A = {
},
B = [
],
C = {
},
D = {
},
E = {
},
F = 1,
G = 1;
return v = {
require: function (a) {
return a.require ? a.require : a.require = u.makeRequire(a.map)
},
exports: function (a) {
if (a.usingExports = !0, a.map.isDefine) return a.exports ? C[a.map.id] = a.exports : a.exports = C[a.map.id] = {
}
},
module: function (a) {
return a.module ? a.module : a.module = {
id: a.map.id,
uri: a.map.url,
config: function () {
return getOwn(x.config, a.map.id) || {
}
},
exports: a.exports || (a.exports = {
})
}
}
},
t = function (a) {
this.events = getOwn(A, a.id) || {
},
this.map = a,
this.shim = getOwn(x.shim, a.id),
this.depExports = [
],
this.depMaps = [
],
this.depMatched = [
],
this.pluginMaps = {
},
this.depCount = 0
},
t.prototype = {
init: function (a, b, c, d) {
d = d || {
},
this.inited || (this.factory = b, c ? this.on('error', c) : this.events.error && (c = bind(this, function (a) {
this.emit('error', a)
})), this.depMaps = a && a.slice(0), this.errback = c, this.inited = !0, this.ignore = d.ignore, d.enabled || this.enabled ? this.enable() : this.check())
},
defineDep: function (a, b) {
this.depMatched[a] || (this.depMatched[a] = !0, this.depCount -= 1, this.depExports[a] = b)
},
fetch: function () {
if (!this.fetched) {
this.fetched = !0,
u.startTime = (new Date).getTime();
var a = this.map;
if (!this.shim) return a.prefix ? this.callPlugin() : this.load();
u.makeRequire(this.map, {
enableBuildCallback: !0
}) (this.shim.deps || [
], bind(this, function () {
return a.prefix ? this.callPlugin() : this.load()
}))
}
},
load: function () {
var a = this.map.url;
D[a] || (D[a] = !0, u.load(this.map.id, a))
},
check: function () {
if (this.enabled && !this.enabling) {
var a,
b,
c = this.map.id,
d = this.depExports,
e = this.exports,
f = this.factory;
if (this.inited) {
if (this.error) this.emit('error', this.error);
else if (!this.defining) {
if (this.defining = !0, this.depCount < 1 && !this.defined) {
if (isFunction(f)) {
if (this.events.error && this.map.isDefine || req.onError !== defaultOnError) try {
e = u.execCb(c, f, d, e)
} catch (g) {
a = g
} else e = u.execCb(c, f, d, e);
if (this.map.isDefine && void 0 === e && (b = this.module, b ? e = b.exports : this.usingExports && (e = this.exports)), a) return a.requireMap = this.map,
a.requireModules = this.map.isDefine ? [
this.map.id
] : null,
a.requireType = this.map.isDefine ? 'define' : 'require',
j(this.error = a)
} else e = f;
this.exports = e,
this.map.isDefine && !this.ignore && (C[c] = e, req.onResourceLoad && req.onResourceLoad(u, this.map, this.depMaps)),
l(c),
this.defined = !0
}
this.defining = !1,
this.defined && !this.defineEmitted && (this.defineEmitted = !0, this.emit('defined', this.exports), this.defineEmitComplete = !0)
}
} else this.fetch()
}
},
callPlugin: function () {
var a = this.map,
b = a.id,
d = g(a.prefix);
this.depMaps.push(d),
i(d, 'defined', bind(this, function (d) {
var e,
f,
k,
m = getOwn(E, this.map.id),
n = this.map.name,
o = this.map.parentMap ? this.map.parentMap.name : null,
p = u.makeRequire(a.parentMap, {
enableBuildCallback: !0
});
return this.map.unnormalized ? (d.normalize && (n = d.normalize(n, function (a) {
return c(a, o, !0)
}) || ''), f = g(a.prefix + '!' + n, this.map.parentMap), i(f, 'defined', bind(this, function (a) {
this.init([], function () {
return a
}, null, {
enabled: !0,
ignore: !0
})
})), void ((k = getOwn(y, f.id)) && (this.depMaps.push(f), this.events.error && k.on('error', bind(this, function (a) {
this.emit('error', a)
})), k.enable()))) : m ? (this.map.url = u.nameToUrl(m), void this.load()) : (e = bind(this, function (a) {
this.init([], function () {
return a
}, null, {
enabled: !0
})
}), e.error = bind(this, function (a) {
this.inited = !0,
this.error = a,
a.requireModules = [
b
],
eachProp(y, function (a) {
0 === a.map.id.indexOf(b + '_unnormalized') && l(a.map.id)
}),
j(a)
}), e.fromText = bind(this, function (c, d) {
var f = a.name,
i = g(f),
k = useInteractive;
d && (c = d),
k && (useInteractive = !1),
h(i),
hasProp(x.config, b) && (x.config[f] = x.config[b]);
try {
req.exec(c)
} catch (l) {
return j(makeError('fromtexteval', 'fromText eval for ' + b + ' failed: ' + l, l, [
b
]))
}
k && (useInteractive = !0),
this.depMaps.push(i),
u.completeLoad(f),
p([f], e)
}), void d.load(a.name, p, e, x))
})),
u.enable(d, this),
this.pluginMaps[d.id] = d
},
enable: function () {
z[this.map.id] = this,
this.enabled = !0,
this.enabling = !0,
each(this.depMaps, bind(this, function (a, b) {
var c,
d,
e;
if ('string' == typeof a) {
if (a = g(a, this.map.isDefine ? this.map : this.map.parentMap, !1, !this.skipMap), this.depMaps[b] = a, e = getOwn(v, a.id)) return void (this.depExports[b] = e(this));
this.depCount += 1,
i(a, 'defined', bind(this, function (a) {
this.defineDep(b, a),
this.check()
})),
this.errback ? i(a, 'error', bind(this, this.errback)) : this.events.error && i(a, 'error', bind(this, function (a) {
this.emit('error', a)
}))
}
c = a.id,
d = y[c],
hasProp(v, c) || !d || d.enabled || u.enable(a, this)
})),
eachProp(this.pluginMaps, bind(this, function (a) {
var b = getOwn(y, a.id);
b && !b.enabled && u.enable(a, this)
})),
this.enabling = !1,
this.check()
},
on: function (a, b) {
var c = this.events[a];
c || (c = this.events[a] = [
]),
c.push(b)
},
emit: function (a, b) {
each(this.events[a], function (a) {
a(b)
}),
'error' === a && delete this.events[a]
}
},
u = {
config: x,
contextName: a,
registry: y,
defined: C,
urlFetched: D,
defQueue: B,
Module: t,
makeModuleMap: g,
nextTick: req.nextTick,
onError: j,
configure: function (a) {
a.baseUrl && '/' !== a.baseUrl.charAt(a.baseUrl.length - 1) && (a.baseUrl += '/');
var b = x.shim,
c = {
paths: !0,
bundles: !0,
config: !0,
map: !0
};
eachProp(a, function (a, b) {
c[b] ? (x[b] || (x[b] = {
}), mixin(x[b], a, !0, !0)) : x[b] = a
}),
a.bundles && eachProp(a.bundles, function (a, b) {
each(a, function (a) {
a !== b && (E[a] = b)
})
}),
a.shim && (eachProp(a.shim, function (a, c) {
isArray(a) && (a = {
deps: a
}),
!a.exports && !a.init || a.exportsFn || (a.exportsFn = u.makeShimExports(a)),
b[c] = a
}), x.shim = b),
a.packages && each(a.packages, function (a) {
var b,
c;
a = 'string' == typeof a ? {
name: a
}
: a,
c = a.name,
b = a.location,
b && (x.paths[c] = a.location),
x.pkgs[c] = a.name + '/' + (a.main || 'main').replace(currDirRegExp, '').replace(jsSuffixRegExp, '')
}),
eachProp(y, function (a, b) {
a.inited || a.map.unnormalized || (a.map = g(b))
}),
(a.deps || a.callback) && u.require(a.deps || [
], a.callback)
},
makeShimExports: function (a) {
function b() {
var b;
return a.init && (b = a.init.apply(global, arguments)),
b || a.exports && getGlobal(a.exports)
}
return b
},
makeRequire: function (b, e) {
function f(c, d, i) {
var k,
l,
m;
return e.enableBuildCallback && d && isFunction(d) && (d.__requireJsBuild = !0),
'string' == typeof c ? isFunction(d) ? j(makeError('requireargs', 'Invalid require call'), i) : b && hasProp(v, c) ? v[c](y[b.id]) : req.get ? req.get(u, c, b, f) : (l = g(c, b, !1, !0), k = l.id, hasProp(C, k) ? C[k] : j(makeError('notloaded', 'Module name "' + k + '" has not been loaded yet for context: ' + a + (b ? '' : '. Use require([])')))) : (r(), u.nextTick(function () {
r(),
m = h(g(null, b)),
m.skipMap = e.skipMap,
m.init(c, d, i, {
enabled: !0
}),
n()
}), f)
}
return e = e || {
},
mixin(f, {
isBrowser: isBrowser,
toUrl: function (a) {
var d,
e = a.lastIndexOf('.'),
f = a.split('/') [0],
g = '.' === f || '..' === f;
return - 1 !== e && (!g || e > 1) && (d = a.substring(e, a.length), a = a.substring(0, e)),
u.nameToUrl(c(a, b && b.id, !0), d, !0)
},
defined: function (a) {
return hasProp(C, g(a, b, !1, !0).id)
},
specified: function (a) {
return a = g(a, b, !1, !0).id,
hasProp(C, a) || hasProp(y, a)
}
}),
b || (f.undef = function (a) {
k();
var c = g(a, b, !0),
e = getOwn(y, a);
d(a),
delete C[a],
delete D[c.url],
delete A[a],
eachReverse(B, function (b, c) {
b[0] === a && B.splice(c, 1)
}),
e && (e.events.defined && (A[a] = e.events), l(a))
}),
f
},
enable: function (a) {
getOwn(y, a.id) && h(a).enable()
},
completeLoad: function (a) {
var b,
c,
d,
f = getOwn(x.shim, a) || {
},
g = f.exports;
for (k(); B.length; ) {
if (c = B.shift(), null === c[0]) {
if (c[0] = a, b) break;
b = !0
} else c[0] === a && (b = !0);
o(c)
}
if (d = getOwn(y, a), !b && !hasProp(C, a) && d && !d.inited) {
if (!(!x.enforceDefine || g && getGlobal(g))) return e(a) ? void 0 : j(makeError('nodefine', 'No define call for ' + a, null, [
a
]));
o([a,
f.deps || [
],
f.exportsFn])
}
n()
},
nameToUrl: function (a, b, c) {
var d,
e,
f,
g,
h,
i,
j,
k = getOwn(x.pkgs, a);
if (k && (a = k), j = getOwn(E, a)) return u.nameToUrl(j, b, c);
if (req.jsExtRegExp.test(a)) h = a + (b || '');
else {
for (d = x.paths, e = a.split('/'), f = e.length; f > 0; f -= 1) if (g = e.slice(0, f).join('/'), i = getOwn(d, g)) {
isArray(i) && (i = i[0]),
e.splice(0, f, i);
break
}
h = e.join('/'),
h += b || (/^data\:|\?/.test(h) || c ? '' : '.js'),
h = ('/' === h.charAt(0) || h.match(/^[\w\+\.\-]+:/) ? '' : x.baseUrl) + h
}
return x.urlArgs ? h + ( - 1 === h.indexOf('?') ? '?' : '&') + x.urlArgs : h
},
load: function (a, b) {
req.load(u, a, b)
},
execCb: function (a, b, c, d) {
return b.apply(d, c)
},
onScriptLoad: function (a) {
if ('load' === a.type || readyRegExp.test((a.currentTarget || a.srcElement).readyState)) {
interactiveScript = null;
var b = q(a);
u.completeLoad(b.id)
}
},
onScriptError: function (a) {
var b = q(a);
if (!e(b.id)) return j(makeError('scripterror', 'Script error for: ' + b.id, a, [
b.id
]))
}
},
u.require = u.makeRequire(),
u
}
function getInteractiveScript() {
return interactiveScript && 'interactive' === interactiveScript.readyState ? interactiveScript : (eachReverse(scripts(), function (a) {
if ('interactive' === a.readyState) return interactiveScript = a
}), interactiveScript)
}
var req,
s,
head,
baseElement,
dataMain,
src,
interactiveScript,
currentlyAddingScript,
mainScript,
subPath,
version = '2.1.17',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
currDirRegExp = /^\.\//,
op = Object.prototype,
ostring = op.toString,
hasOwn = op.hasOwnProperty,
ap = Array.prototype,
apsp = ap.splice,
isBrowser = !('undefined' == typeof window || 'undefined' == typeof navigator || !window.document),
isWebWorker = !isBrowser && 'undefined' != typeof importScripts,
readyRegExp = isBrowser && 'PLAYSTATION 3' === navigator.platform ? /^complete$/ : /^(complete|loaded)$/,
defContextName = '_',
isOpera = 'undefined' != typeof opera && '[object Opera]' === opera.toString(),
contexts = {
},
cfg = {
},
globalDefQueue = [
],
useInteractive = !1;
if (void 0 === define) {
if (void 0 !== requirejs) {
if (isFunction(requirejs)) return;
cfg = requirejs,
requirejs = void 0
}
void 0 === require || isFunction(require) || (cfg = require, require = void 0),
req = requirejs = function (a, b, c, d) {
var e,
f,
g = defContextName;
return isArray(a) || 'string' == typeof a || (f = a, isArray(b) ? (a = b, b = c, c = d) : a = [
]),
f && f.context && (g = f.context),
e = getOwn(contexts, g),
e || (e = contexts[g] = req.s.newContext(g)),
f && e.configure(f),
e.require(a, b, c)
},
req.config = function (a) {
return req(a)
},
req.nextTick = 'undefined' != typeof setTimeout ? function (a) {
setTimeout(a, 4)
}
: function (a) {
a()
},
require || (require = req),
req.version = version,
req.jsExtRegExp = /^\/|:|\?|\.js$/,
req.isBrowser = isBrowser,
s = req.s = {
contexts: contexts,
newContext: newContext
},
req({
}),
each(['toUrl',
'undef',
'defined',
'specified'], function (a) {
req[a] = function () {
var b = contexts[defContextName];
return b.require[a].apply(b, arguments)
}
}),
isBrowser && (head = s.head = document.getElementsByTagName('head') [0], (baseElement = document.getElementsByTagName('base') [0]) && (head = s.head = baseElement.parentNode)),
req.onError = defaultOnError,
req.createNode = function (a, b, c) {
var d = a.xhtml ? document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : document.createElement('script');
return d.type = a.scriptType || 'text/javascript',
d.charset = 'utf-8',
d.async = !0,
d
},
req.load = function (a, b, c) {
var d,
e = a && a.config || {
};
if (isBrowser) return d = req.createNode(e, b, c),
d.setAttribute('data-requirecontext', a.contextName),
d.setAttribute('data-requiremodule', b),
!d.attachEvent || d.attachEvent.toString && d.attachEvent.toString().indexOf('[native code') < 0 || isOpera ? (d.addEventListener('load', a.onScriptLoad, !1), d.addEventListener('error', a.onScriptError, !1)) : (useInteractive = !0, d.attachEvent('onreadystatechange', a.onScriptLoad)),
d.src = c,
currentlyAddingScript = d,
baseElement ? head.insertBefore(d, baseElement) : head.appendChild(d),
currentlyAddingScript = null,
d;
if (isWebWorker) try {
importScripts(c),
a.completeLoad(b)
} catch (f) {
a.onError(makeError('importscripts', 'importScripts failed for ' + b + ' at ' + c, f, [
b
]))
}
},
isBrowser && !cfg.skipDataMain && eachReverse(scripts(), function (a) {
if (head || (head = a.parentNode), dataMain = a.getAttribute('data-main')) return mainScript = dataMain,
cfg.baseUrl || (src = mainScript.split('/'), mainScript = src.pop(), subPath = src.length ? src.join('/') + '/' : './', cfg.baseUrl = subPath),
mainScript = mainScript.replace(jsSuffixRegExp, ''),
req.jsExtRegExp.test(mainScript) && (mainScript = dataMain),
cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [
mainScript
],
!0
}),
define = function (a, b, c) {
var d,
e;
'string' != typeof a && (c = b, b = a, a = null),
isArray(b) || (c = b, b = null),
!b && isFunction(c) && (b = [
], c.length && (c.toString().replace(commentRegExp, '').replace(cjsRequireRegExp, function (a, c) {
b.push(c)
}), b = (1 === c.length ? [
'require'
] : [
'require',
'exports',
'module'
]).concat(b))),
useInteractive && (d = currentlyAddingScript || getInteractiveScript()) && (a || (a = d.getAttribute('data-requiremodule')), e = contexts[d.getAttribute('data-requirecontext')]),
(e ? e.defQueue : globalDefQueue).push([a,
b,
c])
},
define.amd = {
jQuery: !0
},
req.exec = function (text) {
return eval(text)
},
req(cfg)
}
}(this);
;
define('text', [
'module'
], function (e) {
'use strict';
var t,
r,
i = [
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP',
'Msxml2.XMLHTTP.4.0'
],
n = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
o = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
a = 'undefined' != typeof location && location.href,
s = a && location.protocol && location.protocol.replace(/\:/, ''),
h = a && location.hostname,
c = a && (location.port || void 0),
u = [
],
l = e.config && e.config() || {
};
return t = {
version: '2.0.1',
strip: function (e) {
if (e) {
e = e.replace(n, '');
var t = e.match(o);
t && (e = t[1])
} else e = '';
return e
},
jsEscape: function (e) {
return e.replace(/(['\\])/g, '\\$1').replace(/[\f]/g, '\\f').replace(/[\b]/g, '\\b').replace(/[\n]/g, '\\n').replace(/[\t]/g, '\\t').replace(/[\r]/g, '\\r').replace(/[\u2028]/g, '\\u2028').replace(/[\u2029]/g, '\\u2029')
},
createXhr: l.createXhr || function () {
var e,
t,
r;
if ('undefined' != typeof XMLHttpRequest) return new XMLHttpRequest;
if ('undefined' != typeof ActiveXObject) for (t = 0; 3 > t; t += 1) {
r = i[t];
try {
e = new ActiveXObject(r)
} catch (n) {
}
if (e) {
i = [
r
];
break
}
}
return e
},
parseName: function (e) {
var t = !1,
r = e.indexOf('.'),
i = e.substring(0, r),
n = e.substring(r + 1, e.length);
return r = n.indexOf('!'),
- 1 !== r && (t = n.substring(r + 1, n.length), t = 'strip' === t, n = n.substring(0, r)),
{
moduleName: i,
ext: n,
strip: t
}
},
xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
useXhr: function (e, r, i, n) {
var o,
a,
s,
h = t.xdRegExp.exec(e);
return h ? (o = h[2], a = h[3], a = a.split(':'), s = a[1], a = a[0], !(o && o !== r || a && a.toLowerCase() !== i.toLowerCase() || (s || a) && s !== n)) : !0
},
finishLoad: function (e, r, i, n) {
i = r ? t.strip(i) : i,
l.isBuild && (u[e] = i),
n(i)
},
load: function (e, r, i, n) {
if (n.isBuild && !n.inlineText) return void i();
l.isBuild = n.isBuild;
var o = t.parseName(e),
u = o.moduleName + '.' + o.ext,
E = r.toUrl(u),
p = l.useXhr || t.useXhr;
!a || p(E, s, h, c) ? t.get(E, function (r) {
t.finishLoad(e, o.strip, r, i)
}, function (e) {
i.error && i.error(e)
}) : r([u], function (e) {
t.finishLoad(o.moduleName + '.' + o.ext, o.strip, e, i)
})
},
write: function (e, r, i, n) {
if (u.hasOwnProperty(r)) {
var o = t.jsEscape(u[r]);
i.asModule(e + '!' + r, 'define(function () { return \'' + o + '\';});\n')
}
},
writeFile: function (e, r, i, n, o) {
var a = t.parseName(r),
s = a.moduleName + '.' + a.ext,
h = i.toUrl(a.moduleName + '.' + a.ext) + '.js';
t.load(s, i, function (r) {
var i = function (e) {
return n(h, e)
};
i.asModule = function (e, t) {
return n.asModule(e, h, t)
},
t.write(e, s, i, o)
}, o)
}
},
'undefined' != typeof process && process.versions && process.versions.node ? (r = require.nodeRequire('fs'), t.get = function (e, t) {
var i = r.readFileSync(e, 'utf8');
0 === i.indexOf('') && (i = i.substring(1)),
t(i)
}) : t.createXhr() ? t.get = function (e, r, i) {
var n = t.createXhr();
n.open('GET', e, !0),
l.onXhr && l.onXhr(n, e),
n.onreadystatechange = function (t) {
var o,
a;
4 === n.readyState && (o = n.status, o > 399 && 600 > o ? (a = new Error(e + ' HTTP status: ' + o), a.xhr = n, i(a)) : r(n.responseText))
},
n.send(null)
}
: 'undefined' != typeof Packages && (t.get = function (e, t) {
var r,
i,
n = 'utf-8',
o = new java.io.File(e),
a = java.lang.System.getProperty('line.separator'),
s = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(o), n)),
h = '';
try {
for (r = new java.lang.StringBuffer, i = s.readLine(), i && i.length() && 65279 === i.charAt(0) && (i = i.substring(1)), r.append(i); null !== (i = s.readLine()); ) r.append(a),
r.append(i);
h = String(r.toString())
} finally {
s.close()
}
t(h)
}),
t
}),
define('text!refraction/template.html', [
], function () {
return ''
});
var THREE = {
REVISION: '73'
};
'function' == typeof define && define.amd ? define('three', THREE) : 'undefined' != typeof exports && 'undefined' != typeof module && (module.exports = THREE),
void 0 !== self.requestAnimationFrame && void 0 !== self.cancelAnimationFrame || function () {
for (var e = 0, t = [
'ms',
'moz',
'webkit',
'o'
], r = 0; r < t.length && !self.requestAnimationFrame; ++r) self.requestAnimationFrame = self[t[r] + 'RequestAnimationFrame'],
self.cancelAnimationFrame = self[t[r] + 'CancelAnimationFrame'] || self[t[r] + 'CancelRequestAnimationFrame'];
void 0 === self.requestAnimationFrame && void 0 !== self.setTimeout && (self.requestAnimationFrame = function (t) {
var r = Date.now(),
i = Math.max(0, 16 - (r - e)),
n = self.setTimeout(function () {
t(r + i)
}, i);
return e = r + i,
n
}),
void 0 === self.cancelAnimationFrame && void 0 !== self.clearTimeout && (self.cancelAnimationFrame = function (e) {
self.clearTimeout(e)
})
}(),
void 0 === self.performance && (self.performance = {
}),
void 0 === self.performance.now && function () {
var e = Date.now();
self.performance.now = function () {
return Date.now() - e
}
}(),
void 0 === Number.EPSILON && (Number.EPSILON = Math.pow(2, - 52)),
void 0 === Math.sign && (Math.sign = function (e) {
return 0 > e ? - 1 : e > 0 ? 1 : + e
}),
void 0 === Function.prototype.name && void 0 !== Object.defineProperty && Object.defineProperty(Function.prototype, 'name', {
get: function () {
return this.toString().match(/^\s*function\s*(\S*)\s*\(/) [1]
}
}),
THREE.MOUSE = {
LEFT: 0,
MIDDLE: 1,
RIGHT: 2
},
THREE.CullFaceNone = 0,
THREE.CullFaceBack = 1,
THREE.CullFaceFront = 2,
THREE.CullFaceFrontBack = 3,
THREE.FrontFaceDirectionCW = 0,
THREE.FrontFaceDirectionCCW = 1,
THREE.BasicShadowMap = 0,
THREE.PCFShadowMap = 1,
THREE.PCFSoftShadowMap = 2,
THREE.FrontSide = 0,
THREE.BackSide = 1,
THREE.DoubleSide = 2,
THREE.FlatShading = 1,
THREE.SmoothShading = 2,
THREE.NoColors = 0,
THREE.FaceColors = 1,
THREE.VertexColors = 2,
THREE.NoBlending = 0,
THREE.NormalBlending = 1,
THREE.AdditiveBlending = 2,
THREE.SubtractiveBlending = 3,
THREE.MultiplyBlending = 4,
THREE.CustomBlending = 5,
THREE.AddEquation = 100,
THREE.SubtractEquation = 101,
THREE.ReverseSubtractEquation = 102,
THREE.MinEquation = 103,
THREE.MaxEquation = 104,
THREE.ZeroFactor = 200,
THREE.OneFactor = 201,
THREE.SrcColorFactor = 202,
THREE.OneMinusSrcColorFactor = 203,
THREE.SrcAlphaFactor = 204,
THREE.OneMinusSrcAlphaFactor = 205,
THREE.DstAlphaFactor = 206,
THREE.OneMinusDstAlphaFactor = 207,
THREE.DstColorFactor = 208,
THREE.OneMinusDstColorFactor = 209,
THREE.SrcAlphaSaturateFactor = 210,
THREE.NeverDepth = 0,
THREE.AlwaysDepth = 1,
THREE.LessDepth = 2,
THREE.LessEqualDepth = 3,
THREE.EqualDepth = 4,
THREE.GreaterEqualDepth = 5,
THREE.GreaterDepth = 6,
THREE.NotEqualDepth = 7,
THREE.MultiplyOperation = 0,
THREE.MixOperation = 1,
THREE.AddOperation = 2,
THREE.UVMapping = 300,
THREE.CubeReflectionMapping = 301,
THREE.CubeRefractionMapping = 302,
THREE.EquirectangularReflectionMapping = 303,
THREE.EquirectangularRefractionMapping = 304,
THREE.SphericalReflectionMapping = 305,
THREE.RepeatWrapping = 1000,
THREE.ClampToEdgeWrapping = 1001,
THREE.MirroredRepeatWrapping = 1002,
THREE.NearestFilter = 1003,
THREE.NearestMipMapNearestFilter = 1004,
THREE.NearestMipMapLinearFilter = 1005,
THREE.LinearFilter = 1006,
THREE.LinearMipMapNearestFilter = 1007,
THREE.LinearMipMapLinearFilter = 1008,
THREE.UnsignedByteType = 1009,
THREE.ByteType = 1010,
THREE.ShortType = 1011,
THREE.UnsignedShortType = 1012,
THREE.IntType = 1013,
THREE.UnsignedIntType = 1014,
THREE.FloatType = 1015,
THREE.HalfFloatType = 1025,
THREE.UnsignedShort4444Type = 1016,
THREE.UnsignedShort5551Type = 1017,
THREE.UnsignedShort565Type = 1018,
THREE.AlphaFormat = 1019,
THREE.RGBFormat = 1020,
THREE.RGBAFormat = 1021,
THREE.LuminanceFormat = 1022,
THREE.LuminanceAlphaFormat = 1023,
THREE.RGBEFormat = THREE.RGBAFormat,
THREE.RGB_S3TC_DXT1_Format = 2001,
THREE.RGBA_S3TC_DXT1_Format = 2002,
THREE.RGBA_S3TC_DXT3_Format = 2003,
THREE.RGBA_S3TC_DXT5_Format = 2004,
THREE.RGB_PVRTC_4BPPV1_Format = 2100,
THREE.RGB_PVRTC_2BPPV1_Format = 2101,
THREE.RGBA_PVRTC_4BPPV1_Format = 2102,
THREE.RGBA_PVRTC_2BPPV1_Format = 2103,
THREE.LoopOnce = 2200,
THREE.LoopRepeat = 2201,
THREE.LoopPingPong = 2202,
THREE.Projector = function () {
console.error('THREE.Projector has been moved to /examples/js/renderers/Projector.js.'),
this.projectVector = function (e, t) {
console.warn('THREE.Projector: .projectVector() is now vector.project().'),
e.project(t)
},
this.unprojectVector = function (e, t) {
console.warn('THREE.Projector: .unprojectVector() is now vector.unproject().'),
e.unproject(t)
},
this.pickingRay = function (e, t) {
console.error('THREE.Projector: .pickingRay() is now raycaster.setFromCamera().')
}
},
THREE.CanvasRenderer = function () {
console.error('THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js'),
this.domElement = document.createElement('canvas'),
this.clear = function () {
},
this.render = function () {
},
this.setClearColor = function () {
},
this.setSize = function () {
}
},
THREE.Color = function (e) {
return 3 === arguments.length ? this.fromArray(arguments) : this.set(e)
},
THREE.Color.prototype = {
constructor: THREE.Color,
r: 1,
g: 1,
b: 1,
set: function (e) {
return e instanceof THREE.Color ? this.copy(e) : 'number' == typeof e ? this.setHex(e) : 'string' == typeof e && this.setStyle(e),
this
},
setHex: function (e) {
return e = Math.floor(e),
this.r = (e >> 16 & 255) / 255,
this.g = (e >> 8 & 255) / 255,
this.b = (255 & e) / 255,
this
},
setRGB: function (e, t, r) {
return this.r = e,
this.g = t,
this.b = r,
this
},
setHSL: function () {
function e(e, t, r) {
return 0 > r && (r += 1),
r > 1 && (r -= 1),
1 / 6 > r ? e + 6 * (t - e) * r : 0.5 > r ? t : 2 / 3 > r ? e + 6 * (t - e) * (2 / 3 - r) : e
}
return function (t, r, i) {
return t = THREE.Math.euclideanModulo(t, 1),
r = THREE.Math.clamp(r, 0, 1),
i = THREE.Math.clamp(i, 0, 1),
0 === r ? this.r = this.g = this.b = i : (r = 0.5 >= i ? i * (1 + r) : i + r - i * r, i = 2 * i - r, this.r = e(i, r, t + 1 / 3), this.g = e(i, r, t), this.b = e(i, r, t - 1 / 3)),
this
}
}(),
setStyle: function (e) {
function t(t) {
void 0 !== t && 1 > parseFloat(t) && console.warn('THREE.Color: Alpha component of ' + e + ' will be ignored.')
}
var r;
if (r = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)) {
var i = r[2];
switch (r[1]) {
case 'rgb':
case 'rgba':
if (r = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)) return this.r = Math.min(255, parseInt(r[1], 10)) / 255,
this.g = Math.min(255, parseInt(r[2], 10)) / 255,
this.b = Math.min(255, parseInt(r[3], 10)) / 255,
t(r[5]),
this;
if (r = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)) return this.r = Math.min(100, parseInt(r[1], 10)) / 100,
this.g = Math.min(100, parseInt(r[2], 10)) / 100,
this.b = Math.min(100, parseInt(r[3], 10)) / 100,
t(r[5]),
this;
break;
case 'hsl':
case 'hsla':
if (r = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)) {
var i = parseFloat(r[1]) / 360,
n = parseInt(r[2], 10) / 100,
o = parseInt(r[3], 10) / 100;
return t(r[5]),
this.setHSL(i, n, o)
}
}
} else if (r = /^\#([A-Fa-f0-9]+)$/.exec(e)) {
if (r = r[1], i = r.length, 3 === i) return this.r = parseInt(r.charAt(0) + r.charAt(0), 16) / 255,
this.g = parseInt(r.charAt(1) + r.charAt(1), 16) / 255,
this.b = parseInt(r.charAt(2) + r.charAt(2), 16) / 255,
this;
if (6 === i) return this.r = parseInt(r.charAt(0) + r.charAt(1), 16) / 255,
this.g = parseInt(r.charAt(2) + r.charAt(3), 16) / 255,
this.b = parseInt(r.charAt(4) + r.charAt(5), 16) / 255,
this
}
return e && 0 < e.length && (r = THREE.ColorKeywords[e], void 0 !== r ? this.setHex(r) : console.warn('THREE.Color: Unknown color ' + e)),
this
},
clone: function () {
return new this.constructor(this.r, this.g, this.b)
},
copy: function (e) {
return this.r = e.r,
this.g = e.g,
this.b = e.b,
this
},
copyGammaToLinear: function (e, t) {
return void 0 === t && (t = 2),
this.r = Math.pow(e.r, t),
this.g = Math.pow(e.g, t),
this.b = Math.pow(e.b, t),
this
},
copyLinearToGamma: function (e, t) {
void 0 === t && (t = 2);
var r = t > 0 ? 1 / t : 1;
return this.r = Math.pow(e.r, r),
this.g = Math.pow(e.g, r),
this.b = Math.pow(e.b, r),
this
},
convertGammaToLinear: function () {
var e = this.r,
t = this.g,
r = this.b;
return this.r = e * e,
this.g = t * t,
this.b = r * r,
this
},
convertLinearToGamma: function () {
return this.r = Math.sqrt(this.r),
this.g = Math.sqrt(this.g),
this.b = Math.sqrt(this.b),
this
},
getHex: function () {
return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0
},
getHexString: function () {
return ('000000' + this.getHex().toString(16)).slice( - 6)
},
getHSL: function (e) {
e = e || {
h: 0,
s: 0,
l: 0
};
var t,
r = this.r,
i = this.g,
n = this.b,
o = Math.max(r, i, n),
a = Math.min(r, i, n),
s = (a + o) / 2;
if (a === o) a = t = 0;
else {
var h = o - a,
a = 0.5 >= s ? h / (o + a) : h / (2 - o - a);
switch (o) {
case r:
t = (i - n) / h + (n > i ? 6 : 0);
break;
case i:
t = (n - r) / h + 2;
break;
case n:
t = (r - i) / h + 4
}
t /= 6
}
return e.h = t,
e.s = a,
e.l = s,
e
},
getStyle: function () {
return 'rgb(' + (255 * this.r | 0) + ',' + (255 * this.g | 0) + ',' + (255 * this.b | 0) + ')'
},
offsetHSL: function (e, t, r) {
var i = this.getHSL();
return i.h += e,
i.s += t,
i.l += r,
this.setHSL(i.h, i.s, i.l),
this
},
add: function (e) {
return this.r += e.r,
this.g += e.g,
this.b += e.b,
this
},
addColors: function (e, t) {
return this.r = e.r + t.r,
this.g = e.g + t.g,
this.b = e.b + t.b,
this
},
addScalar: function (e) {
return this.r += e,
this.g += e,
this.b += e,
this
},
multiply: function (e) {
return this.r *= e.r,
this.g *= e.g,
this.b *= e.b,
this
},
multiplyScalar: function (e) {
return this.r *= e,
this.g *= e,
this.b *= e,
this
},
lerp: function (e, t) {
return this.r += (e.r - this.r) * t,
this.g += (e.g - this.g) * t,
this.b += (e.b - this.b) * t,
this
},
equals: function (e) {
return e.r === this.r && e.g === this.g && e.b === this.b
},
fromArray: function (e, t) {
return void 0 === t && (t = 0),
this.r = e[t],
this.g = e[t + 1],
this.b = e[t + 2],
this
},
toArray: function (e, t) {
return void 0 === e && (e = [
]),
void 0 === t && (t = 0),
e[t] = this.r,
e[t + 1] = this.g,
e[t + 2] = this.b,
e
}
},
THREE.ColorKeywords = {
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
aquamarine: 8388564,
azure: 15794175,
beige: 16119260,
bisque: 16770244,
black: 0,
blanchedalmond: 16772045,
blue: 255,
blueviolet: 9055202,
brown: 10824234,
burlywood: 14596231,
cadetblue: 6266528,
chartreuse: 8388352,
chocolate: 13789470,
coral: 16744272,
cornflowerblue: 6591981,
cornsilk: 16775388,
crimson: 14423100,
cyan: 65535,
darkblue: 139,
darkcyan: 35723,
darkgoldenrod: 12092939,
darkgray: 11119017,
darkgreen: 25600,
darkgrey: 11119017,
darkkhaki: 12433259,
darkmagenta: 9109643,
darkolivegreen: 5597999,
darkorange: 16747520,
darkorchid: 10040012,
darkred: 9109504,
darksalmon: 15308410,
darkseagreen: 9419919,
darkslateblue: 4734347,
darkslategray: 3100495,
darkslategrey: 3100495,
darkturquoise: 52945,
darkviolet: 9699539,
deeppink: 16716947,
deepskyblue: 49151,
dimgray: 6908265,
dimgrey: 6908265,
dodgerblue: 2003199,
firebrick: 11674146,
floralwhite: 16775920,
forestgreen: 2263842,
fuchsia: 16711935,
gainsboro: 14474460,
ghostwhite: 16316671,
gold: 16766720,
goldenrod: 14329120,
gray: 8421504,
green: 32768,
greenyellow: 11403055,
grey: 8421504,
honeydew: 15794160,
hotpink: 16738740,
indianred: 13458524,
indigo: 4915330,
ivory: 16777200,
khaki: 15787660,
lavender: 15132410,
lavenderblush: 16773365,
lawngreen: 8190976,
lemonchiffon: 16775885,
lightblue: 11393254,
lightcoral: 15761536,
lightcyan: 14745599,
lightgoldenrodyellow: 16448210,
lightgray: 13882323,
lightgreen: 9498256,
lightgrey: 13882323,
lightpink: 16758465,
lightsalmon: 16752762,
lightseagreen: 2142890,
lightskyblue: 8900346,
lightslategray: 7833753,
lightslategrey: 7833753,
lightsteelblue: 11584734,
lightyellow: 16777184,
lime: 65280,
limegreen: 3329330,
linen: 16445670,
magenta: 16711935,
maroon: 8388608,
mediumaquamarine: 6737322,
mediumblue: 205,
mediumorchid: 12211667,
mediumpurple: 9662683,
mediumseagreen: 3978097,
mediumslateblue: 8087790,
mediumspringgreen: 64154,
mediumturquoise: 4772300,
mediumvioletred: 13047173,
midnightblue: 1644912,
mintcream: 16121850,
mistyrose: 16770273,
moccasin: 16770229,
navajowhite: 16768685,
navy: 128,
oldlace: 16643558,
olive: 8421376,
olivedrab: 7048739,
orange: 16753920,
orangered: 16729344,
orchid: 14315734,
palegoldenrod: 15657130,
palegreen: 10025880,
paleturquoise: 11529966,
palevioletred: 14381203,
papayawhip: 16773077,
peachpuff: 16767673,
peru: 13468991,
pink: 16761035,
plum: 14524637,
powderblue: 11591910,
purple: 8388736,
red: 16711680,
rosybrown: 12357519,
royalblue: 4286945,
saddlebrown: 9127187,
salmon: 16416882,
sandybrown: 16032864,
seagreen: 3050327,
seashell: 16774638,
sienna: 10506797,
silver: 12632256,
skyblue: 8900331,
slateblue: 6970061,
slategray: 7372944,
slategrey: 7372944,
snow: 16775930,
springgreen: 65407,
steelblue: 4620980,
tan: 13808780,
teal: 32896,
thistle: 14204888,
tomato: 16737095,
turquoise: 4251856,
violet: 15631086,
wheat: 16113331,
white: 16777215,
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
},
THREE.Quaternion = function (e, t, r, i) {
this._x = e || 0,
this._y = t || 0,
this._z = r || 0,
this._w = void 0 !== i ? i : 1
},
THREE.Quaternion.prototype = {
constructor: THREE.Quaternion,
get x() {
return this._x
},
set x(e) {
this._x = e,
this.onChangeCallback()
},
get y() {
return this._y
},
set y(e) {
this._y = e,
this.onChangeCallback()
},
get z() {
return this._z
},
set z(e) {
this._z = e,
this.onChangeCallback()
},
get w() {
return this._w
},
set w(e) {
this._w = e,
this.onChangeCallback()
},
set: function (e, t, r, i) {
return this._x = e,
this._y = t,
this._z = r,
this._w = i,
this.onChangeCallback(),
this
},
clone: function () {
return new this.constructor(this._x, this._y, this._z, this._w)
},
copy: function (e) {
return this._x = e.x,
this._y = e.y,
this._z = e.z,
this._w = e.w,
this.onChangeCallback(),
this
},
setFromEuler: function (e, t) {
if (!1 == e instanceof THREE.Euler) throw Error('THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.');
var r = Math.cos(e._x / 2),
i = Math.cos(e._y / 2),
n = Math.cos(e._z / 2),
o = Math.sin(e._x / 2),
a = Math.sin(e._y / 2),
s = Math.sin(e._z / 2),
h = e.order;
return 'XYZ' === h ? (this._x = o * i * n + r * a * s, this._y = r * a * n - o * i * s, this._z = r * i * s + o * a * n, this._w = r * i * n - o * a * s) : 'YXZ' === h ? (this._x = o * i * n + r * a * s, this._y = r * a * n - o * i * s, this._z = r * i * s - o * a * n, this._w = r * i * n + o * a * s) : 'ZXY' === h ? (this._x = o * i * n - r * a * s, this._y = r * a * n + o * i * s, this._z = r * i * s + o * a * n, this._w = r * i * n - o * a * s) : 'ZYX' === h ? (this._x = o * i * n - r * a * s, this._y = r * a * n + o * i * s, this._z = r * i * s - o * a * n, this._w = r * i * n + o * a * s) : 'YZX' === h ? (this._x = o * i * n + r * a * s, this._y = r * a * n + o * i * s, this._z = r * i * s - o * a * n, this._w = r * i * n - o * a * s) : 'XZY' === h && (this._x = o * i * n - r * a * s, this._y = r * a * n - o * i * s, this._z = r * i * s + o * a * n, this._w = r * i * n + o * a * s),
!1 !== t && this.onChangeCallback(),
this
},
setFromAxisAngle: function (e, t) {
var r = t / 2,
i = Math.sin(r);
return this._x = e.x * i,
this._y = e.y * i,
this._z = e.z * i,
this._w = Math.cos(r),
this.onChangeCallback(),
this
},
setFromRotationMatrix: function (e) {
var t = e.elements,
r = t[0];
e = t[4];
var i = t[8],
n = t[1],
o = t[5],
a = t[9],
s = t[2],
h = t[6],
t = t[10],
c = r + o + t;
return c > 0 ? (r = 0.5 / Math.sqrt(c + 1), this._w = 0.25 / r, this._x = (h - a) * r, this._y = (i - s) * r, this._z = (n - e) * r) : r > o && r > t ? (r = 2 * Math.sqrt(1 + r - o - t), this._w = (h - a) / r, this._x = 0.25 * r, this._y = (e + n) / r, this._z = (i + s) / r) : o > t ? (r = 2 * Math.sqrt(1 + o - r - t), this._w = (i - s) / r, this._x = (e + n) / r, this._y = 0.25 * r, this._z = (a + h) / r) : (r = 2 * Math.sqrt(1 + t - r - o), this._w = (n - e) / r, this._x = (i + s) / r, this._y = (a + h) / r, this._z = 0.25 * r),
this.onChangeCallback(),
this
},
setFromUnitVectors: function () {
var e,
t;
return function (r, i) {
return void 0 === e && (e = new THREE.Vector3),
t = r.dot(i) + 1,
0.000001 > t ? (t = 0, Math.abs(r.x) > Math.abs(r.z) ? e.set( - r.y, r.x, 0) : e.set(0, - r.z, r.y)) : e.crossVectors(r, i),
this._x = e.x,
this._y = e.y,
this._z = e.z,
this._w = t,
this.normalize(),
this
}
}(),
inverse: function () {
return this.conjugate().normalize(),
this
},
conjugate: function () {
return this._x *= - 1,
this._y *= - 1,
this._z *= - 1,
this.onChangeCallback(),
this
},
dot: function (e) {
return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w
},
lengthSq: function () {
return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w
},
length: function () {
return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
},
normalize: function () {
var e = this.length();
return 0 === e ? (this._z = this._y = this._x = 0, this._w = 1) : (e = 1 / e, this._x *= e, this._y *= e, this._z *= e, this._w *= e),
this.onChangeCallback(),
this
},
multiply: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'), this.multiplyQuaternions(e, t)) : this.multiplyQuaternions(this, e)
},
multiplyQuaternions: function (e, t) {
var r = e._x,
i = e._y,
n = e._z,
o = e._w,
a = t._x,
s = t._y,
h = t._z,
c = t._w;
return this._x = r * c + o * a + i * h - n * s,
this._y = i * c + o * s + n * a - r * h,
this._z = n * c + o * h + r * s - i * a,
this._w = o * c - r * a - i * s - n * h,
this.onChangeCallback(),
this
},
multiplyVector3: function (e) {
return console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.'),
e.applyQuaternion(this)
},
slerp: function (e, t) {
if (0 === t) return this;
if (1 === t) return this.copy(e);
var r = this._x,
i = this._y,
n = this._z,
o = this._w,
a = o * e._w + r * e._x + i * e._y + n * e._z;
if (0 > a ? (this._w = - e._w, this._x = - e._x, this._y = - e._y, this._z = - e._z, a = - a) : this.copy(e), a >= 1) return this._w = o,
this._x = r,
this._y = i,
this._z = n,
this;
var s = Math.acos(a),
h = Math.sqrt(1 - a * a);
return 0.001 > Math.abs(h) ? (this._w = 0.5 * (o + this._w), this._x = 0.5 * (r + this._x), this._y = 0.5 * (i + this._y), this._z = 0.5 * (n + this._z), this) : (a = Math.sin((1 - t) * s) / h, s = Math.sin(t * s) / h, this._w = o * a + this._w * s, this._x = r * a + this._x * s, this._y = i * a + this._y * s, this._z = n * a + this._z * s, this.onChangeCallback(), this)
},
equals: function (e) {
return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w
},
fromArray: function (e, t) {
return void 0 === t && (t = 0),
this._x = e[t],
this._y = e[t + 1],
this._z = e[t + 2],
this._w = e[t + 3],
this.onChangeCallback(),
this
},
toArray: function (e, t) {
return void 0 === e && (e = [
]),
void 0 === t && (t = 0),
e[t] = this._x,
e[t + 1] = this._y,
e[t + 2] = this._z,
e[t + 3] = this._w,
e
},
onChange: function (e) {
return this.onChangeCallback = e,
this
},
onChangeCallback: function () {
}
},
THREE.Quaternion.slerp = function (e, t, r, i) {
return r.copy(e).slerp(t, i)
},
THREE.Vector2 = function (e, t) {
this.x = e || 0,
this.y = t || 0
},
THREE.Vector2.prototype = {
constructor: THREE.Vector2,
get width() {
return this.x
},
set width(e) {
this.x = e
},
get height() {
return this.y
},
set height(e) {
this.y = e
},
set: function (e, t) {
return this.x = e,
this.y = t,
this
},
setX: function (e) {
return this.x = e,
this
},
setY: function (e) {
return this.y = e,
this
},
setComponent: function (e, t) {
switch (e) {
case 0:
this.x = t;
break;
case 1:
this.y = t;
break;
default:
throw Error('index is out of range: ' + e)
}
},
getComponent: function (e) {
switch (e) {
case 0:
return this.x;
case 1:
return this.y;
default:
throw Error('index is out of range: ' + e)
}
},
clone: function () {
return new this.constructor(this.x, this.y)
},
copy: function (e) {
return this.x = e.x,
this.y = e.y,
this
},
add: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this)
},
addScalar: function (e) {
return this.x += e,
this.y += e,
this
},
addVectors: function (e, t) {
return this.x = e.x + t.x,
this.y = e.y + t.y,
this
},
addScaledVector: function (e, t) {
return this.x += e.x * t,
this.y += e.y * t,
this
},
sub: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this)
},
subScalar: function (e) {
return this.x -= e,
this.y -= e,
this
},
subVectors: function (e, t) {
return this.x = e.x - t.x,
this.y = e.y - t.y,
this
},
multiply: function (e) {
return this.x *= e.x,
this.y *= e.y,
this
},
multiplyScalar: function (e) {
return isFinite(e) ? (this.x *= e, this.y *= e) : this.y = this.x = 0,
this
},
divide: function (e) {
return this.x /= e.x,
this.y /= e.y,
this
},
divideScalar: function (e) {
return this.multiplyScalar(1 / e)
},
min: function (e) {
return this.x = Math.min(this.x, e.x),
this.y = Math.min(this.y, e.y),
this
},
max: function (e) {
return this.x = Math.max(this.x, e.x),
this.y = Math.max(this.y, e.y),
this
},
clamp: function (e, t) {
return this.x = Math.max(e.x, Math.min(t.x, this.x)),
this.y = Math.max(e.y, Math.min(t.y, this.y)),
this
},
clampScalar: function () {
var e,
t;
return function (r, i) {
return void 0 === e && (e = new THREE.Vector2, t = new THREE.Vector2),
e.set(r, r),
t.set(i, i),
this.clamp(e, t)
}
}(),
clampLength: function (e, t) {
var r = this.length();
return this.multiplyScalar(Math.max(e, Math.min(t, r)) / r),
this
},
floor: function () {
return this.x = Math.floor(this.x),
this.y = Math.floor(this.y),
this
},
ceil: function () {
return this.x = Math.ceil(this.x),
this.y = Math.ceil(this.y),
this
},
round: function () {
return this.x = Math.round(this.x),
this.y = Math.round(this.y),
this
},
roundToZero: function () {
return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
this
},
negate: function () {
return this.x = - this.x,
this.y = - this.y,
this
},
dot: function (e) {
return this.x * e.x + this.y * e.y
},
lengthSq: function () {
return this.x * this.x + this.y * this.y
},
length: function () {
return Math.sqrt(this.x * this.x + this.y * this.y)
},
lengthManhattan: function () {
return Math.abs(this.x) + Math.abs(this.y)
},
normalize: function () {
return this.divideScalar(this.length())
},
distanceTo: function (e) {
return Math.sqrt(this.distanceToSquared(e))
},
distanceToSquared: function (e) {
var t = this.x - e.x;
return e = this.y - e.y,
t * t + e * e
},
setLength: function (e) {
return this.multiplyScalar(e / this.length())
},
lerp: function (e, t) {
return this.x += (e.x - this.x) * t,
this.y += (e.y - this.y) * t,
this
},
lerpVectors: function (e, t, r) {
return this.subVectors(t, e).multiplyScalar(r).add(e),
this
},
equals: function (e) {
return e.x === this.x && e.y === this.y
},
fromArray: function (e, t) {
return void 0 === t && (t = 0),
this.x = e[t],
this.y = e[t + 1],
this
},
toArray: function (e, t) {
return void 0 === e && (e = [
]),
void 0 === t && (t = 0),
e[t] = this.x,
e[t + 1] = this.y,
e
},
fromAttribute: function (e, t, r) {
return void 0 === r && (r = 0),
t = t * e.itemSize + r,
this.x = e.array[t],
this.y = e.array[t + 1],
this
},
rotateAround: function (e, t) {
var r = Math.cos(t),
i = Math.sin(t),
n = this.x - e.x,
o = this.y - e.y;
return this.x = n * r - o * i + e.x,
this.y = n * i + o * r + e.y,
this
}
},
THREE.Vector3 = function (e, t, r) {
this.x = e || 0,
this.y = t || 0,
this.z = r || 0
},
THREE.Vector3.prototype = {
constructor: THREE.Vector3,
set: function (e, t, r) {
return this.x = e,
this.y = t,
this.z = r,
this
},
setX: function (e) {
return this.x = e,
this
},
setY: function (e) {
return this.y = e,
this
},
setZ: function (e) {
return this.z = e,
this
},
setComponent: function (e, t) {
switch (e) {
case 0:
this.x = t;
break;
case 1:
this.y = t;
break;
case 2:
this.z = t;
break;
default:
throw Error('index is out of range: ' + e)
}
},
getComponent: function (e) {
switch (e) {
case 0:
return this.x;
case 1:
return this.y;
case 2:
return this.z;
default:
throw Error('index is out of range: ' + e)
}
},
clone: function () {
return new this.constructor(this.x, this.y, this.z)
},
copy: function (e) {
return this.x = e.x,
this.y = e.y,
this.z = e.z,
this
},
add: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this)
},
addScalar: function (e) {
return this.x += e,
this.y += e,
this.z += e,
this
},
addVectors: function (e, t) {
return this.x = e.x + t.x,
this.y = e.y + t.y,
this.z = e.z + t.z,
this
},
addScaledVector: function (e, t) {
return this.x += e.x * t,
this.y += e.y * t,
this.z += e.z * t,
this
},
sub: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this)
},
subScalar: function (e) {
return this.x -= e,
this.y -= e,
this.z -= e,
this
},
subVectors: function (e, t) {
return this.x = e.x - t.x,
this.y = e.y - t.y,
this.z = e.z - t.z,
this
},
multiply: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'), this.multiplyVectors(e, t)) : (this.x *= e.x, this.y *= e.y, this.z *= e.z, this)
},
multiplyScalar: function (e) {
return isFinite(e) ? (this.x *= e, this.y *= e, this.z *= e) : this.z = this.y = this.x = 0,
this
},
multiplyVectors: function (e, t) {
return this.x = e.x * t.x,
this.y = e.y * t.y,
this.z = e.z * t.z,
this
},
applyEuler: function () {
var e;
return function (t) {
return !1 == t instanceof THREE.Euler && console.error('THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.'),
void 0 === e && (e = new THREE.Quaternion),
this.applyQuaternion(e.setFromEuler(t)),
this
}
}(),
applyAxisAngle: function () {
var e;
return function (t, r) {
return void 0 === e && (e = new THREE.Quaternion),
this.applyQuaternion(e.setFromAxisAngle(t, r)),
this
}
}(),
applyMatrix3: function (e) {
var t = this.x,
r = this.y,
i = this.z;
return e = e.elements,
this.x = e[0] * t + e[3] * r + e[6] * i,
this.y = e[1] * t + e[4] * r + e[7] * i,
this.z = e[2] * t + e[5] * r + e[8] * i,
this
},
applyMatrix4: function (e) {
var t = this.x,
r = this.y,
i = this.z;
return e = e.elements,
this.x = e[0] * t + e[4] * r + e[8] * i + e[12],
this.y = e[1] * t + e[5] * r + e[9] * i + e[13],
this.z = e[2] * t + e[6] * r + e[10] * i + e[14],
this
},
applyProjection: function (e) {
var t = this.x,
r = this.y,
i = this.z;
e = e.elements;
var n = 1 / (e[3] * t + e[7] * r + e[11] * i + e[15]);
return this.x = (e[0] * t + e[4] * r + e[8] * i + e[12]) * n,
this.y = (e[1] * t + e[5] * r + e[9] * i + e[13]) * n,
this.z = (e[2] * t + e[6] * r + e[10] * i + e[14]) * n,
this
},
applyQuaternion: function (e) {
var t = this.x,
r = this.y,
i = this.z,
n = e.x,
o = e.y,
a = e.z;
e = e.w;
var s = e * t + o * i - a * r,
h = e * r + a * t - n * i,
c = e * i + n * r - o * t,
t = - n * t - o * r - a * i;
return this.x = s * e + t * - n + h * - a - c * - o,
this.y = h * e + t * - o + c * - n - s * - a,
this.z = c * e + t * - a + s * - o - h * - n,
this
},
project: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.multiplyMatrices(t.projectionMatrix, e.getInverse(t.matrixWorld)),
this.applyProjection(e)
}
}(),
unproject: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.multiplyMatrices(t.matrixWorld, e.getInverse(t.projectionMatrix)),
this.applyProjection(e)
}
}(),
transformDirection: function (e) {
var t = this.x,
r = this.y,
i = this.z;
return e = e.elements,
this.x = e[0] * t + e[4] * r + e[8] * i,
this.y = e[1] * t + e[5] * r + e[9] * i,
this.z = e[2] * t + e[6] * r + e[10] * i,
this.normalize(),
this
},
divide: function (e) {
return this.x /= e.x,
this.y /= e.y,
this.z /= e.z,
this
},
divideScalar: function (e) {
return this.multiplyScalar(1 / e)
},
min: function (e) {
return this.x = Math.min(this.x, e.x),
this.y = Math.min(this.y, e.y),
this.z = Math.min(this.z, e.z),
this
},
max: function (e) {
return this.x = Math.max(this.x, e.x),
this.y = Math.max(this.y, e.y),
this.z = Math.max(this.z, e.z),
this
},
clamp: function (e, t) {
return this.x = Math.max(e.x, Math.min(t.x, this.x)),
this.y = Math.max(e.y, Math.min(t.y, this.y)),
this.z = Math.max(e.z, Math.min(t.z, this.z)),
this
},
clampScalar: function () {
var e,
t;
return function (r, i) {
return void 0 === e && (e = new THREE.Vector3, t = new THREE.Vector3),
e.set(r, r, r),
t.set(i, i, i),
this.clamp(e, t)
}
}(),
clampLength: function (e, t) {
var r = this.length();
return this.multiplyScalar(Math.max(e, Math.min(t, r)) / r),
this
},
floor: function () {
return this.x = Math.floor(this.x),
this.y = Math.floor(this.y),
this.z = Math.floor(this.z),
this
},
ceil: function () {
return this.x = Math.ceil(this.x),
this.y = Math.ceil(this.y),
this.z = Math.ceil(this.z),
this
},
round: function () {
return this.x = Math.round(this.x),
this.y = Math.round(this.y),
this.z = Math.round(this.z),
this
},
roundToZero: function () {
return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
this.z = 0 > this.z ? Math.ceil(this.z) : Math.floor(this.z),
this
},
negate: function () {
return this.x = - this.x,
this.y = - this.y,
this.z = - this.z,
this
},
dot: function (e) {
return this.x * e.x + this.y * e.y + this.z * e.z
},
lengthSq: function () {
return this.x * this.x + this.y * this.y + this.z * this.z
},
length: function () {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
},
lengthManhattan: function () {
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
},
normalize: function () {
return this.divideScalar(this.length())
},
setLength: function (e) {
return this.multiplyScalar(e / this.length())
},
lerp: function (e, t) {
return this.x += (e.x - this.x) * t,
this.y += (e.y - this.y) * t,
this.z += (e.z - this.z) * t,
this
},
lerpVectors: function (e, t, r) {
return this.subVectors(t, e).multiplyScalar(r).add(e),
this
},
cross: function (e, t) {
if (void 0 !== t) return console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'),
this.crossVectors(e, t);
var r = this.x,
i = this.y,
n = this.z;
return this.x = i * e.z - n * e.y,
this.y = n * e.x - r * e.z,
this.z = r * e.y - i * e.x,
this
},
crossVectors: function (e, t) {
var r = e.x,
i = e.y,
n = e.z,
o = t.x,
a = t.y,
s = t.z;
return this.x = i * s - n * a,
this.y = n * o - r * s,
this.z = r * a - i * o,
this
},
projectOnVector: function () {
var e,
t;
return function (r) {
return void 0 === e && (e = new THREE.Vector3),
e.copy(r).normalize(),
t = this.dot(e),
this.copy(e).multiplyScalar(t)
}
}(),
projectOnPlane: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Vector3),
e.copy(this).projectOnVector(t),
this.sub(e)
}
}(),
reflect: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Vector3),
this.sub(e.copy(t).multiplyScalar(2 * this.dot(t)))
}
}(),
angleTo: function (e) {
return e = this.dot(e) / (this.length() * e.length()),
Math.acos(THREE.Math.clamp(e, - 1, 1))
},
distanceTo: function (e) {
return Math.sqrt(this.distanceToSquared(e))
},
distanceToSquared: function (e) {
var t = this.x - e.x,
r = this.y - e.y;
return e = this.z - e.z,
t * t + r * r + e * e
},
setEulerFromRotationMatrix: function (e, t) {
console.error('THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.')
},
setEulerFromQuaternion: function (e, t) {
console.error('THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.')
},
getPositionFromMatrix: function (e) {
return console.warn('THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().'),
this.setFromMatrixPosition(e)
},
getScaleFromMatrix: function (e) {
return console.warn('THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().'),
this.setFromMatrixScale(e)
},
getColumnFromMatrix: function (e, t) {
return console.warn('THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().'),
this.setFromMatrixColumn(e, t)
},
setFromMatrixPosition: function (e) {
return this.x = e.elements[12],
this.y = e.elements[13],
this.z = e.elements[14],
this
},
setFromMatrixScale: function (e) {
var t = this.set(e.elements[0], e.elements[1], e.elements[2]).length(),
r = this.set(e.elements[4], e.elements[5], e.elements[6]).length();
return e = this.set(e.elements[8], e.elements[9], e.elements[10]).length(),
this.x = t,
this.y = r,
this.z = e,
this
},
setFromMatrixColumn: function (e, t) {
var r = 4 * e,
i = t.elements;
return this.x = i[r],
this.y = i[r + 1],
this.z = i[r + 2],
this
},
equals: function (e) {
return e.x === this.x && e.y === this.y && e.z === this.z
},
fromArray: function (e, t) {
return void 0 === t && (t = 0),
this.x = e[t],
this.y = e[t + 1],
this.z = e[t + 2],
this
},
toArray: function (e, t) {
return void 0 === e && (e = [
]),
void 0 === t && (t = 0),
e[t] = this.x,
e[t + 1] = this.y,
e[t + 2] = this.z,
e
},
fromAttribute: function (e, t, r) {
return void 0 === r && (r = 0),
t = t * e.itemSize + r,
this.x = e.array[t],
this.y = e.array[t + 1],
this.z = e.array[t + 2],
this
}
},
THREE.Vector4 = function (e, t, r, i) {
this.x = e || 0,
this.y = t || 0,
this.z = r || 0,
this.w = void 0 !== i ? i : 1
},
THREE.Vector4.prototype = {
constructor: THREE.Vector4,
set: function (e, t, r, i) {
return this.x = e,
this.y = t,
this.z = r,
this.w = i,
this
},
setX: function (e) {
return this.x = e,
this
},
setY: function (e) {
return this.y = e,
this
},
setZ: function (e) {
return this.z = e,
this
},
setW: function (e) {
return this.w = e,
this
},
setComponent: function (e, t) {
switch (e) {
case 0:
this.x = t;
break;
case 1:
this.y = t;
break;
case 2:
this.z = t;
break;
case 3:
this.w = t;
break;
default:
throw Error('index is out of range: ' + e)
}
},
getComponent: function (e) {
switch (e) {
case 0:
return this.x;
case 1:
return this.y;
case 2:
return this.z;
case 3:
return this.w;
default:
throw Error('index is out of range: ' + e)
}
},
clone: function () {
return new this.constructor(this.x, this.y, this.z, this.w)
},
copy: function (e) {
return this.x = e.x,
this.y = e.y,
this.z = e.z,
this.w = void 0 !== e.w ? e.w : 1,
this
},
add: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this)
},
addScalar: function (e) {
return this.x += e,
this.y += e,
this.z += e,
this.w += e,
this
},
addVectors: function (e, t) {
return this.x = e.x + t.x,
this.y = e.y + t.y,
this.z = e.z + t.z,
this.w = e.w + t.w,
this
},
addScaledVector: function (e, t) {
return this.x += e.x * t,
this.y += e.y * t,
this.z += e.z * t,
this.w += e.w * t,
this
},
sub: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this)
},
subScalar: function (e) {
return this.x -= e,
this.y -= e,
this.z -= e,
this.w -= e,
this
},
subVectors: function (e, t) {
return this.x = e.x - t.x,
this.y = e.y - t.y,
this.z = e.z - t.z,
this.w = e.w - t.w,
this
},
multiplyScalar: function (e) {
return isFinite(e) ? (this.x *= e, this.y *= e, this.z *= e, this.w *= e) : this.w = this.z = this.y = this.x = 0,
this
},
applyMatrix4: function (e) {
var t = this.x,
r = this.y,
i = this.z,
n = this.w;
return e = e.elements,
this.x = e[0] * t + e[4] * r + e[8] * i + e[12] * n,
this.y = e[1] * t + e[5] * r + e[9] * i + e[13] * n,
this.z = e[2] * t + e[6] * r + e[10] * i + e[14] * n,
this.w = e[3] * t + e[7] * r + e[11] * i + e[15] * n,
this
},
divideScalar: function (e) {
return this.multiplyScalar(1 / e)
},
setAxisAngleFromQuaternion: function (e) {
this.w = 2 * Math.acos(e.w);
var t = Math.sqrt(1 - e.w * e.w);
return 0.0001 > t ? (this.x = 1, this.z = this.y = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t),
this
},
setAxisAngleFromRotationMatrix: function (e) {
var t,
r,
i;
e = e.elements;
var n = e[0];
i = e[4];
var o = e[8],
a = e[1],
s = e[5],
h = e[9];
r = e[2],
t = e[6];
var c = e[10];
return 0.01 > Math.abs(i - a) && 0.01 > Math.abs(o - r) && 0.01 > Math.abs(h - t) ? 0.1 > Math.abs(i + a) && 0.1 > Math.abs(o + r) && 0.1 > Math.abs(h + t) && 0.1 > Math.abs(n + s + c - 3) ? (this.set(1, 0, 0, 0), this) : (e = Math.PI, n = (n + 1) / 2, s = (s + 1) / 2, c = (c + 1) / 2, i = (i + a) / 4, o = (o + r) / 4, h = (h + t) / 4, n > s && n > c ? 0.01 > n ? (t = 0, i = r = 0.707106781) : (t = Math.sqrt(n), r = i / t, i = o / t) : s > c ? 0.01 > s ? (t = 0.707106781, r = 0, i = 0.707106781) : (r = Math.sqrt(s), t = i / r, i = h / r) : 0.01 > c ? (r = t = 0.707106781, i = 0) : (i = Math.sqrt(c), t = o / i, r = h / i), this.set(t, r, i, e), this) : (e = Math.sqrt((t - h) * (t - h) + (o - r) * (o - r) + (a - i) * (a - i)), 0.001 > Math.abs(e) && (e = 1), this.x = (t - h) / e, this.y = (o - r) / e, this.z = (a - i) / e, this.w = Math.acos((n + s + c - 1) / 2), this)
},
min: function (e) {
return this.x = Math.min(this.x, e.x),
this.y = Math.min(this.y, e.y),
this.z = Math.min(this.z, e.z),
this.w = Math.min(this.w, e.w),
this
},
max: function (e) {
return this.x = Math.max(this.x, e.x),
this.y = Math.max(this.y, e.y),
this.z = Math.max(this.z, e.z),
this.w = Math.max(this.w, e.w),
this
},
clamp: function (e, t) {
return this.x = Math.max(e.x, Math.min(t.x, this.x)),
this.y = Math.max(e.y, Math.min(t.y, this.y)),
this.z = Math.max(e.z, Math.min(t.z, this.z)),
this.w = Math.max(e.w, Math.min(t.w, this.w)),
this
},
clampScalar: function () {
var e,
t;
return function (r, i) {
return void 0 === e && (e = new THREE.Vector4, t = new THREE.Vector4),
e.set(r, r, r, r),
t.set(i, i, i, i),
this.clamp(e, t)
}
}(),
floor: function () {
return this.x = Math.floor(this.x),
this.y = Math.floor(this.y),
this.z = Math.floor(this.z),
this.w = Math.floor(this.w),
this
},
ceil: function () {
return this.x = Math.ceil(this.x),
this.y = Math.ceil(this.y),
this.z = Math.ceil(this.z),
this.w = Math.ceil(this.w),
this
},
round: function () {
return this.x = Math.round(this.x),
this.y = Math.round(this.y),
this.z = Math.round(this.z),
this.w = Math.round(this.w),
this
},
roundToZero: function () {
return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
this.z = 0 > this.z ? Math.ceil(this.z) : Math.floor(this.z),
this.w = 0 > this.w ? Math.ceil(this.w) : Math.floor(this.w),
this
},
negate: function () {
return this.x = - this.x,
this.y = - this.y,
this.z = - this.z,
this.w = - this.w,
this
},
dot: function (e) {
return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w
},
lengthSq: function () {
return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w
},
length: function () {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)
},
lengthManhattan: function () {
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w)
},
normalize: function () {
return this.divideScalar(this.length())
},
setLength: function (e) {
return this.multiplyScalar(e / this.length())
},
lerp: function (e, t) {
return this.x += (e.x - this.x) * t,
this.y += (e.y - this.y) * t,
this.z += (e.z - this.z) * t,
this.w += (e.w - this.w) * t,
this
},
lerpVectors: function (e, t, r) {
return this.subVectors(t, e).multiplyScalar(r).add(e),
this
},
equals: function (e) {
return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w
},
fromArray: function (e, t) {
return void 0 === t && (t = 0),
this.x = e[t],
this.y = e[t + 1],
this.z = e[t + 2],
this.w = e[t + 3],
this
},
toArray: function (e, t) {
return void 0 === e && (e = [
]),
void 0 === t && (t = 0),
e[t] = this.x,
e[t + 1] = this.y,
e[t + 2] = this.z,
e[t + 3] = this.w,
e
},
fromAttribute: function (e, t, r) {
return void 0 === r && (r = 0),
t = t * e.itemSize + r,
this.x = e.array[t],
this.y = e.array[t + 1],
this.z = e.array[t + 2],
this.w = e.array[t + 3],
this
}
},
THREE.Euler = function (e, t, r, i) {
this._x = e || 0,
this._y = t || 0,
this._z = r || 0,
this._order = i || THREE.Euler.DefaultOrder
},
THREE.Euler.RotationOrders = 'XYZ YZX ZXY XZY YXZ ZYX'.split(' '),
THREE.Euler.DefaultOrder = 'XYZ',
THREE.Euler.prototype = {
constructor: THREE.Euler,
get x() {
return this._x
},
set x(e) {
this._x = e,
this.onChangeCallback()
},
get y() {
return this._y
},
set y(e) {
this._y = e,
this.onChangeCallback()
},
get z() {
return this._z
},
set z(e) {
this._z = e,
this.onChangeCallback()
},
get order() {
return this._order
},
set order(e) {
this._order = e,
this.onChangeCallback()
},
set: function (e, t, r, i) {
return this._x = e,
this._y = t,
this._z = r,
this._order = i || this._order,
this.onChangeCallback(),
this
},
clone: function () {
return new this.constructor(this._x, this._y, this._z, this._order)
},
copy: function (e) {
return this._x = e._x,
this._y = e._y,
this._z = e._z,
this._order = e._order,
this.onChangeCallback(),
this
},
setFromRotationMatrix: function (e, t, r) {
var i = THREE.Math.clamp,
n = e.elements;
e = n[0];
var o = n[4],
a = n[8],
s = n[1],
h = n[5],
c = n[9],
u = n[2],
l = n[6],
n = n[10];
return t = t || this._order,
'XYZ' === t ? (this._y = Math.asin(i(a, - 1, 1)), 0.99999 > Math.abs(a) ? (this._x = Math.atan2( - c, n), this._z = Math.atan2( - o, e)) : (this._x = Math.atan2(l, h), this._z = 0)) : 'YXZ' === t ? (this._x = Math.asin( - i(c, - 1, 1)), 0.99999 > Math.abs(c) ? (this._y = Math.atan2(a, n), this._z = Math.atan2(s, h)) : (this._y = Math.atan2( - u, e), this._z = 0)) : 'ZXY' === t ? (this._x = Math.asin(i(l, - 1, 1)), 0.99999 > Math.abs(l) ? (this._y = Math.atan2( - u, n), this._z = Math.atan2( - o, h)) : (this._y = 0, this._z = Math.atan2(s, e))) : 'ZYX' === t ? (this._y = Math.asin( - i(u, - 1, 1)), 0.99999 > Math.abs(u) ? (this._x = Math.atan2(l, n), this._z = Math.atan2(s, e)) : (this._x = 0, this._z = Math.atan2( - o, h))) : 'YZX' === t ? (this._z = Math.asin(i(s, - 1, 1)), 0.99999 > Math.abs(s) ? (this._x = Math.atan2( - c, h), this._y = Math.atan2( - u, e)) : (this._x = 0, this._y = Math.atan2(a, n))) : 'XZY' === t ? (this._z = Math.asin( - i(o, - 1, 1)), 0.99999 > Math.abs(o) ? (this._x = Math.atan2(l, h), this._y = Math.atan2(a, e)) : (this._x = Math.atan2( - c, n), this._y = 0)) : console.warn('THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + t),
this._order = t,
!1 !== r && this.onChangeCallback(),
this
},
setFromQuaternion: function () {
var e;
return function (t, r, i) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeRotationFromQuaternion(t),
this.setFromRotationMatrix(e, r, i),
this
}
}(),
setFromVector3: function (e, t) {
return this.set(e.x, e.y, e.z, t || this._order)
},
reorder: function () {
var e = new THREE.Quaternion;
return function (t) {
e.setFromEuler(this),
this.setFromQuaternion(e, t)
}
}(),
equals: function (e) {
return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order
},
fromArray: function (e) {
return this._x = e[0],
this._y = e[1],
this._z = e[2],
void 0 !== e[3] && (this._order = e[3]),
this.onChangeCallback(),
this
},
toArray: function (e, t) {
return void 0 === e && (e = [
]),
void 0 === t && (t = 0),
e[t] = this._x,
e[t + 1] = this._y,
e[t + 2] = this._z,
e[t + 3] = this._order,
e
},
toVector3: function (e) {
return e ? e.set(this._x, this._y, this._z) : new THREE.Vector3(this._x, this._y, this._z)
},
onChange: function (e) {
return this.onChangeCallback = e,
this
},
onChangeCallback: function () {
}
},
THREE.Line3 = function (e, t) {
this.start = void 0 !== e ? e : new THREE.Vector3,
this.end = void 0 !== t ? t : new THREE.Vector3
},
THREE.Line3.prototype = {
constructor: THREE.Line3,
set: function (e, t) {
return this.start.copy(e),
this.end.copy(t),
this
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.start.copy(e.start),
this.end.copy(e.end),
this
},
center: function (e) {
return (e || new THREE.Vector3).addVectors(this.start, this.end).multiplyScalar(0.5)
},
delta: function (e) {
return (e || new THREE.Vector3).subVectors(this.end, this.start)
},
distanceSq: function () {
return this.start.distanceToSquared(this.end)
},
distance: function () {
return this.start.distanceTo(this.end)
},
at: function (e, t) {
var r = t || new THREE.Vector3;
return this.delta(r).multiplyScalar(e).add(this.start)
},
closestPointToPointParameter: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3;
return function (r, i) {
e.subVectors(r, this.start),
t.subVectors(this.end, this.start);
var n = t.dot(t),
n = t.dot(e) / n;
return i && (n = THREE.Math.clamp(n, 0, 1)),
n
}
}(),
closestPointToPoint: function (e, t, r) {
return e = this.closestPointToPointParameter(e, t),
r = r || new THREE.Vector3,
this.delta(r).multiplyScalar(e).add(this.start)
},
applyMatrix4: function (e) {
return this.start.applyMatrix4(e),
this.end.applyMatrix4(e),
this
},
equals: function (e) {
return e.start.equals(this.start) && e.end.equals(this.end)
}
},
THREE.Box2 = function (e, t) {
this.min = void 0 !== e ? e : new THREE.Vector2(1 / 0, 1 / 0),
this.max = void 0 !== t ? t : new THREE.Vector2( - (1 / 0), - (1 / 0))
},
THREE.Box2.prototype = {
constructor: THREE.Box2,
set: function (e, t) {
return this.min.copy(e),
this.max.copy(t),
this
},
setFromPoints: function (e) {
this.makeEmpty();
for (var t = 0, r = e.length; r > t; t++) this.expandByPoint(e[t]);
return this
},
setFromCenterAndSize: function () {
var e = new THREE.Vector2;
return function (t, r) {
var i = e.copy(r).multiplyScalar(0.5);
return this.min.copy(t).sub(i),
this.max.copy(t).add(i),
this
}
}(),
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.min.copy(e.min),
this.max.copy(e.max),
this
},
makeEmpty: function () {
return this.min.x = this.min.y = 1 / 0,
this.max.x = this.max.y = - (1 / 0),
this
},
empty: function () {
return this.max.x < this.min.x || this.max.y < this.min.y
},
center: function (e) {
return (e || new THREE.Vector2).addVectors(this.min, this.max).multiplyScalar(0.5)
},
size: function (e) {
return (e || new THREE.Vector2).subVectors(this.max, this.min)
},
expandByPoint: function (e) {
return this.min.min(e),
this.max.max(e),
this
},
expandByVector: function (e) {
return this.min.sub(e),
this.max.add(e),
this
},
expandByScalar: function (e) {
return this.min.addScalar( - e),
this.max.addScalar(e),
this
},
containsPoint: function (e) {
return e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y ? !1 : !0
},
containsBox: function (e) {
return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y ? !0 : !1
},
getParameter: function (e, t) {
return (t || new THREE.Vector2).set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y))
},
isIntersectionBox: function (e) {
return e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y ? !1 : !0
},
clampPoint: function (e, t) {
return (t || new THREE.Vector2).copy(e).clamp(this.min, this.max)
},
distanceToPoint: function () {
var e = new THREE.Vector2;
return function (t) {
return e.copy(t).clamp(this.min, this.max).sub(t).length()
}
}(),
intersect: function (e) {
return this.min.max(e.min),
this.max.min(e.max),
this
},
union: function (e) {
return this.min.min(e.min),
this.max.max(e.max),
this
},
translate: function (e) {
return this.min.add(e),
this.max.add(e),
this
},
equals: function (e) {
return e.min.equals(this.min) && e.max.equals(this.max)
}
},
THREE.Box3 = function (e, t) {
this.min = void 0 !== e ? e : new THREE.Vector3(1 / 0, 1 / 0, 1 / 0),
this.max = void 0 !== t ? t : new THREE.Vector3( - (1 / 0), - (1 / 0), - (1 / 0))
},
THREE.Box3.prototype = {
constructor: THREE.Box3,
set: function (e, t) {
return this.min.copy(e),
this.max.copy(t),
this
},
setFromPoints: function (e) {
this.makeEmpty();
for (var t = 0, r = e.length; r > t; t++) this.expandByPoint(e[t]);
return this
},
setFromCenterAndSize: function () {
var e = new THREE.Vector3;
return function (t, r) {
var i = e.copy(r).multiplyScalar(0.5);
return this.min.copy(t).sub(i),
this.max.copy(t).add(i),
this
}
}(),
setFromObject: function () {
var e = new THREE.Vector3;
return function (t) {
var r = this;
return t.updateMatrixWorld(!0),
this.makeEmpty(),
t.traverse(function (t) {
var i = t.geometry;
if (void 0 !== i) if (i instanceof THREE.Geometry) for (var n = i.vertices, i = 0, o = n.length; o > i; i++) e.copy(n[i]),
e.applyMatrix4(t.matrixWorld),
r.expandByPoint(e);
else if (i instanceof THREE.BufferGeometry && void 0 !== i.attributes.position) for (n = i.attributes.position.array, i = 0, o = n.length; o > i; i += 3) e.set(n[i], n[i + 1], n[i + 2]),
e.applyMatrix4(t.matrixWorld),
r.expandByPoint(e)
}),
this
}
}(),
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.min.copy(e.min),
this.max.copy(e.max),
this
},
makeEmpty: function () {
return this.min.x = this.min.y = this.min.z = 1 / 0,
this.max.x = this.max.y = this.max.z = - (1 / 0),
this
},
empty: function () {
return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z
},
center: function (e) {
return (e || new THREE.Vector3).addVectors(this.min, this.max).multiplyScalar(0.5)
},
size: function (e) {
return (e || new THREE.Vector3).subVectors(this.max, this.min)
},
expandByPoint: function (e) {
return this.min.min(e),
this.max.max(e),
this
},
expandByVector: function (e) {
return this.min.sub(e),
this.max.add(e),
this
},
expandByScalar: function (e) {
return this.min.addScalar( - e),
this.max.addScalar(e),
this
},
containsPoint: function (e) {
return e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y || e.z < this.min.z || e.z > this.max.z ? !1 : !0
},
containsBox: function (e) {
return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z ? !0 : !1
},
getParameter: function (e, t) {
return (t || new THREE.Vector3).set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y), (e.z - this.min.z) / (this.max.z - this.min.z))
},
isIntersectionBox: function (e) {
return e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y || e.max.z < this.min.z || e.min.z > this.max.z ? !1 : !0
},
clampPoint: function (e, t) {
return (t || new THREE.Vector3).copy(e).clamp(this.min, this.max)
},
distanceToPoint: function () {
var e = new THREE.Vector3;
return function (t) {
return e.copy(t).clamp(this.min, this.max).sub(t).length()
}
}(),
getBoundingSphere: function () {
var e = new THREE.Vector3;
return function (t) {
return t = t || new THREE.Sphere,
t.center = this.center(),
t.radius = 0.5 * this.size(e).length(),
t
}
}(),
intersect: function (e) {
return this.min.max(e.min),
this.max.min(e.max),
this
},
union: function (e) {
return this.min.min(e.min),
this.max.max(e.max),
this
},
applyMatrix4: function () {
var e = [
new THREE.Vector3,
new THREE.Vector3,
new THREE.Vector3,
new THREE.Vector3,
new THREE.Vector3,
new THREE.Vector3,
new THREE.Vector3,
new THREE.Vector3
];
return function (t) {
return e[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(t),
e[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(t),
e[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(t),
e[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(t),
e[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(t),
e[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(t),
e[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(t),
e[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(t),
this.makeEmpty(),
this.setFromPoints(e),
this
}
}(),
translate: function (e) {
return this.min.add(e),
this.max.add(e),
this
},
equals: function (e) {
return e.min.equals(this.min) && e.max.equals(this.max)
}
},
THREE.Matrix3 = function () {
this.elements = new Float32Array([1,
0,
0,
0,
1,
0,
0,
0,
1]),
0 < arguments.length && console.error('THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.')
},
THREE.Matrix3.prototype = {
constructor: THREE.Matrix3,
set: function (e, t, r, i, n, o, a, s, h) {
var c = this.elements;
return c[0] = e,
c[3] = t,
c[6] = r,
c[1] = i,
c[4] = n,
c[7] = o,
c[2] = a,
c[5] = s,
c[8] = h,
this
},
identity: function () {
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1),
this
},
clone: function () {
return (new this.constructor).fromArray(this.elements)
},
copy: function (e) {
return e = e.elements,
this.set(e[0], e[3], e[6], e[1], e[4], e[7], e[2], e[5], e[8]),
this
},
multiplyVector3: function (e) {
return console.warn('THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.'),
e.applyMatrix3(this)
},
multiplyVector3Array: function (e) {
return console.warn('THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.'),
this.applyToVector3Array(e)
},
applyToVector3Array: function () {
var e;
return function (t, r, i) {
void 0 === e && (e = new THREE.Vector3),
void 0 === r && (r = 0),
void 0 === i && (i = t.length);
for (var n = 0; i > n; n += 3, r += 3) e.fromArray(t, r),
e.applyMatrix3(this),
e.toArray(t, r);
return t
}
}(),
applyToBuffer: function () {
var e;
return function (t, r, i) {
void 0 === e && (e = new THREE.Vector3),
void 0 === r && (r = 0),
void 0 === i && (i = t.length / t.itemSize);
for (var n = 0; i > n; n++, r++) e.x = t.getX(r),
e.y = t.getY(r),
e.z = t.getZ(r),
e.applyMatrix3(this),
t.setXYZ(e.x, e.y, e.z);
return t
}
}(),
multiplyScalar: function (e) {
var t = this.elements;
return t[0] *= e,
t[3] *= e,
t[6] *= e,
t[1] *= e,
t[4] *= e,
t[7] *= e,
t[2] *= e,
t[5] *= e,
t[8] *= e,
this
},
determinant: function () {
var e = this.elements,
t = e[0],
r = e[1],
i = e[2],
n = e[3],
o = e[4],
a = e[5],
s = e[6],
h = e[7],
e = e[8];
return t * o * e - t * a * h - r * n * e + r * a * s + i * n * h - i * o * s
},
getInverse: function (e, t) {
var r = e.elements,
i = this.elements;
if (i[0] = r[10] * r[5] - r[6] * r[9], i[1] = - r[10] * r[1] + r[2] * r[9], i[2] = r[6] * r[1] - r[2] * r[5], i[3] = - r[10] * r[4] + r[6] * r[8], i[4] = r[10] * r[0] - r[2] * r[8], i[5] = - r[6] * r[0] + r[2] * r[4], i[6] = r[9] * r[4] - r[5] * r[8], i[7] = - r[9] * r[0] + r[1] * r[8], i[8] = r[5] * r[0] - r[1] * r[4], r = r[0] * i[0] + r[1] * i[3] + r[2] * i[6], 0 === r) {
if (t) throw Error('Matrix3.getInverse(): can\'t invert matrix, determinant is 0');
return console.warn('Matrix3.getInverse(): can\'t invert matrix, determinant is 0'),
this.identity(),
this
}
return this.multiplyScalar(1 / r),
this
},
transpose: function () {
var e,
t = this.elements;
return e = t[1],
t[1] = t[3],
t[3] = e,
e = t[2],
t[2] = t[6],
t[6] = e,
e = t[5],
t[5] = t[7],
t[7] = e,
this
},
flattenToArrayOffset: function (e, t) {
var r = this.elements;
return e[t] = r[0],
e[t + 1] = r[1],
e[t + 2] = r[2],
e[t + 3] = r[3],
e[t + 4] = r[4],
e[t + 5] = r[5],
e[t + 6] = r[6],
e[t + 7] = r[7],
e[t + 8] = r[8],
e
},
getNormalMatrix: function (e) {
return this.getInverse(e).transpose(),
this
},
transposeIntoArray: function (e) {
var t = this.elements;
return e[0] = t[0],
e[1] = t[3],
e[2] = t[6],
e[3] = t[1],
e[4] = t[4],
e[5] = t[7],
e[6] = t[2],
e[7] = t[5],
e[8] = t[8],
this
},
fromArray: function (e) {
return this.elements.set(e),
this
},
toArray: function () {
var e = this.elements;
return [e[0],
e[1],
e[2],
e[3],
e[4],
e[5],
e[6],
e[7],
e[8]]
}
},
THREE.Matrix4 = function () {
this.elements = new Float32Array([1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1]),
0 < arguments.length && console.error('THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.')
},
THREE.Matrix4.prototype = {
constructor: THREE.Matrix4,
set: function (e, t, r, i, n, o, a, s, h, c, u, l, E, p, d, f) {
var m = this.elements;
return m[0] = e,
m[4] = t,
m[8] = r,
m[12] = i,
m[1] = n,
m[5] = o,
m[9] = a,
m[13] = s,
m[2] = h,
m[6] = c,
m[10] = u,
m[14] = l,
m[3] = E,
m[7] = p,
m[11] = d,
m[15] = f,
this
},
identity: function () {
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
this
},
clone: function () {
return (new THREE.Matrix4).fromArray(this.elements)
},
copy: function (e) {
return this.elements.set(e.elements),
this
},
extractPosition: function (e) {
return console.warn('THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().'),
this.copyPosition(e)
},
copyPosition: function (e) {
var t = this.elements;
return e = e.elements,
t[12] = e[12],
t[13] = e[13],
t[14] = e[14],
this
},
extractBasis: function (e, t, r) {
var i = this.elements;
return e.set(i[0], i[1], i[2]),
t.set(i[4], i[5], i[6]),
r.set(i[8], i[9], i[10]),
this
},
makeBasis: function (e, t, r) {
return this.set(e.x, t.x, r.x, 0, e.y, t.y, r.y, 0, e.z, t.z, r.z, 0, 0, 0, 0, 1),
this
},
extractRotation: function () {
var e;
return function (t) {
void 0 === e && (e = new THREE.Vector3);
var r = this.elements;
t = t.elements;
var i = 1 / e.set(t[0], t[1], t[2]).length(),
n = 1 / e.set(t[4], t[5], t[6]).length(),
o = 1 / e.set(t[8], t[9], t[10]).length();
return r[0] = t[0] * i,
r[1] = t[1] * i,
r[2] = t[2] * i,
r[4] = t[4] * n,
r[5] = t[5] * n,
r[6] = t[6] * n,
r[8] = t[8] * o,
r[9] = t[9] * o,
r[10] = t[10] * o,
this
}
}(),
makeRotationFromEuler: function (e) {
!1 == e instanceof THREE.Euler && console.error('THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');
var t = this.elements,
r = e.x,
i = e.y,
n = e.z,
o = Math.cos(r),
r = Math.sin(r),
a = Math.cos(i),
i = Math.sin(i),
s = Math.cos(n),
n = Math.sin(n);
if ('XYZ' === e.order) {
e = o * s;
var h = o * n,
c = r * s,
u = r * n;
t[0] = a * s,
t[4] = - a * n,
t[8] = i,
t[1] = h + c * i,
t[5] = e - u * i,
t[9] = - r * a,
t[2] = u - e * i,
t[6] = c + h * i,
t[10] = o * a
} else 'YXZ' === e.order ? (e = a * s, h = a * n, c = i * s, u = i * n, t[0] = e + u * r, t[4] = c * r - h, t[8] = o * i, t[1] = o * n, t[5] = o * s, t[9] = - r, t[2] = h * r - c, t[6] = u + e * r, t[10] = o * a) : 'ZXY' === e.order ? (e = a * s, h = a * n, c = i * s, u = i * n, t[0] = e - u * r, t[4] = - o * n, t[8] = c + h * r, t[1] = h + c * r, t[5] = o * s, t[9] = u - e * r, t[2] = - o * i, t[6] = r, t[10] = o * a) : 'ZYX' === e.order ? (e = o * s, h = o * n, c = r * s, u = r * n, t[0] = a * s, t[4] = c * i - h, t[8] = e * i + u, t[1] = a * n, t[5] = u * i + e, t[9] = h * i - c, t[2] = - i, t[6] = r * a, t[10] = o * a) : 'YZX' === e.order ? (e = o * a, h = o * i, c = r * a, u = r * i, t[0] = a * s, t[4] = u - e * n, t[8] = c * n + h, t[1] = n, t[5] = o * s, t[9] = - r * s, t[2] = - i * s, t[6] = h * n + c, t[10] = e - u * n) : 'XZY' === e.order && (e = o * a, h = o * i, c = r * a, u = r * i, t[0] = a * s, t[4] = - n, t[8] = i * s, t[1] = e * n + u, t[5] = o * s, t[9] = h * n - c, t[2] = c * n - h, t[6] = r * s, t[10] = u * n + e);
return t[3] = 0,
t[7] = 0,
t[11] = 0,
t[12] = 0,
t[13] = 0,
t[14] = 0,
t[15] = 1,
this
},
setRotationFromQuaternion: function (e) {
return console.warn('THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().'),
this.makeRotationFromQuaternion(e)
},
makeRotationFromQuaternion: function (e) {
var t = this.elements,
r = e.x,
i = e.y,
n = e.z,
o = e.w,
a = r + r,
s = i + i,
h = n + n;
e = r * a;
var c = r * s,
r = r * h,
u = i * s,
i = i * h,
n = n * h,
a = o * a,
s = o * s,
o = o * h;
return t[0] = 1 - (u + n),
t[4] = c - o,
t[8] = r + s,
t[1] = c + o,
t[5] = 1 - (e + n),
t[9] = i - a,
t[2] = r - s,
t[6] = i + a,
t[10] = 1 - (e + u),
t[3] = 0,
t[7] = 0,
t[11] = 0,
t[12] = 0,
t[13] = 0,
t[14] = 0,
t[15] = 1,
this
},
lookAt: function () {
var e,
t,
r;
return function (i, n, o) {
void 0 === e && (e = new THREE.Vector3),
void 0 === t && (t = new THREE.Vector3),
void 0 === r && (r = new THREE.Vector3);
var a = this.elements;
return r.subVectors(i, n).normalize(),
0 === r.lengthSq() && (r.z = 1),
e.crossVectors(o, r).normalize(),
0 === e.lengthSq() && (r.x += 0.0001, e.crossVectors(o, r).normalize()),
t.crossVectors(r, e),
a[0] = e.x,
a[4] = t.x,
a[8] = r.x,
a[1] = e.y,
a[5] = t.y,
a[9] = r.y,
a[2] = e.z,
a[6] = t.z,
a[10] = r.z,
this
}
}(),
multiply: function (e, t) {
return void 0 !== t ? (console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'), this.multiplyMatrices(e, t)) : this.multiplyMatrices(this, e)
},
multiplyMatrices: function (e, t) {
var r = e.elements,
i = t.elements,
n = this.elements,
o = r[0],
a = r[4],
s = r[8],
h = r[12],
c = r[1],
u = r[5],
l = r[9],
E = r[13],
p = r[2],
d = r[6],
f = r[10],
m = r[14],
T = r[3],
g = r[7],
v = r[11],
r = r[15],
y = i[0],
R = i[4],
H = i[8],
x = i[12],
b = i[1],
_ = i[5],
w = i[9],
M = i[13],
S = i[2],
A = i[6],
C = i[10],
L = i[14],
P = i[3],
k = i[7],
D = i[11],
i = i[15];
return n[0] = o * y + a * b + s * S + h * P,
n[4] = o * R + a * _ + s * A + h * k,
n[8] = o * H + a * w + s * C + h * D,
n[12] = o * x + a * M + s * L + h * i,
n[1] = c * y + u * b + l * S + E * P,
n[5] = c * R + u * _ + l * A + E * k,
n[9] = c * H + u * w + l * C + E * D,
n[13] = c * x + u * M + l * L + E * i,
n[2] = p * y + d * b + f * S + m * P,
n[6] = p * R + d * _ + f * A + m * k,
n[10] = p * H + d * w + f * C + m * D,
n[14] = p * x + d * M + f * L + m * i,
n[3] = T * y + g * b + v * S + r * P,
n[7] = T * R + g * _ + v * A + r * k,
n[11] = T * H + g * w + v * C + r * D,
n[15] = T * x + g * M + v * L + r * i,
this
},
multiplyToArray: function (e, t, r) {
var i = this.elements;
return this.multiplyMatrices(e, t),
r[0] = i[0],
r[1] = i[1],
r[2] = i[2],
r[3] = i[3],
r[4] = i[4],
r[5] = i[5],
r[6] = i[6],
r[7] = i[7],
r[8] = i[8],
r[9] = i[9],
r[10] = i[10],
r[11] = i[11],
r[12] = i[12],
r[13] = i[13],
r[14] = i[14],
r[15] = i[15],
this
},
multiplyScalar: function (e) {
var t = this.elements;
return t[0] *= e,
t[4] *= e,
t[8] *= e,
t[12] *= e,
t[1] *= e,
t[5] *= e,
t[9] *= e,
t[13] *= e,
t[2] *= e,
t[6] *= e,
t[10] *= e,
t[14] *= e,
t[3] *= e,
t[7] *= e,
t[11] *= e,
t[15] *= e,
this
},
multiplyVector3: function (e) {
return console.warn('THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.'),
e.applyProjection(this)
},
multiplyVector4: function (e) {
return console.warn('THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.'),
e.applyMatrix4(this)
},
multiplyVector3Array: function (e) {
return console.warn('THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.'),
this.applyToVector3Array(e)
},
applyToVector3Array: function () {
var e;
return function (t, r, i) {
void 0 === e && (e = new THREE.Vector3),
void 0 === r && (r = 0),
void 0 === i && (i = t.length);
for (var n = 0; i > n; n += 3, r += 3) e.fromArray(t, r),
e.applyMatrix4(this),
e.toArray(t, r);
return t
}
}(),
applyToBuffer: function () {
var e;
return function (t, r, i) {
void 0 === e && (e = new THREE.Vector3),
void 0 === r && (r = 0),
void 0 === i && (i = t.length / t.itemSize);
for (var n = 0; i > n; n++, r++) e.x = t.getX(r),
e.y = t.getY(r),
e.z = t.getZ(r),
e.applyMatrix4(this),
t.setXYZ(e.x, e.y, e.z);
return t
}
}(),
rotateAxis: function (e) {
console.warn('THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.'),
e.transformDirection(this)
},
crossVector: function (e) {
return console.warn('THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.'),
e.applyMatrix4(this)
},
determinant: function () {
var e = this.elements,
t = e[0],
r = e[4],
i = e[8],
n = e[12],
o = e[1],
a = e[5],
s = e[9],
h = e[13],
c = e[2],
u = e[6],
l = e[10],
E = e[14];
return e[3] * ( + n * s * u - i * h * u - n * a * l + r * h * l + i * a * E - r * s * E) + e[7] * ( + t * s * E - t * h * l + n * o * l - i * o * E + i * h * c - n * s * c) + e[11] * ( + t * h * u - t * a * E - n * o * u + r * o * E + n * a * c - r * h * c) + e[15] * ( - i * a * c - t * s * u + t * a * l + i * o * u - r * o * l + r * s * c)
},
transpose: function () {
var e,
t = this.elements;
return e = t[1],
t[1] = t[4],
t[4] = e,
e = t[2],
t[2] = t[8],
t[8] = e,
e = t[6],
t[6] = t[9],
t[9] = e,
e = t[3],
t[3] = t[12],
t[12] = e,
e = t[7],
t[7] = t[13],
t[13] = e,
e = t[11],
t[11] = t[14],
t[14] = e,
this
},
flattenToArrayOffset: function (e, t) {
var r = this.elements;
return e[t] = r[0],
e[t + 1] = r[1],
e[t + 2] = r[2],
e[t + 3] = r[3],
e[t + 4] = r[4],
e[t + 5] = r[5],
e[t + 6] = r[6],
e[t + 7] = r[7],
e[t + 8] = r[8],
e[t + 9] = r[9],
e[t + 10] = r[10],
e[t + 11] = r[11],
e[t + 12] = r[12],
e[t + 13] = r[13],
e[t + 14] = r[14],
e[t + 15] = r[15],
e
},
getPosition: function () {
var e;
return function () {
void 0 === e && (e = new THREE.Vector3),
console.warn('THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.');
var t = this.elements;
return e.set(t[12], t[13], t[14])
}
}(),
setPosition: function (e) {
var t = this.elements;
return t[12] = e.x,
t[13] = e.y,
t[14] = e.z,
this
},
getInverse: function (e, t) {
var r = this.elements,
i = e.elements,
n = i[0],
o = i[4],
a = i[8],
s = i[12],
h = i[1],
c = i[5],
u = i[9],
l = i[13],
E = i[2],
p = i[6],
d = i[10],
f = i[14],
m = i[3],
T = i[7],
g = i[11],
i = i[15];
if (r[0] = u * f * T - l * d * T + l * p * g - c * f * g - u * p * i + c * d * i, r[4] = s * d * T - a * f * T - s * p * g + o * f * g + a * p * i - o * d * i, r[8] = a * l * T - s * u * T + s * c * g - o * l * g - a * c * i + o * u * i, r[12] = s * u * p - a * l * p - s * c * d + o * l * d + a * c * f - o * u * f, r[1] = l * d * m - u * f * m - l * E * g + h * f * g + u * E * i - h * d * i, r[5] = a * f * m - s * d * m + s * E * g - n * f * g - a * E * i + n * d * i, r[9] = s * u * m - a * l * m - s * h * g + n * l * g + a * h * i - n * u * i, r[13] = a * l * E - s * u * E + s * h * d - n * l * d - a * h * f + n * u * f, r[2] = c * f * m - l * p * m + l * E * T - h * f * T - c * E * i + h * p * i, r[6] = s * p * m - o * f * m - s * E * T + n * f * T + o * E * i - n * p * i, r[10] = o * l * m - s * c * m + s * h * T - n * l * T - o * h * i + n * c * i, r[14] = s * c * E - o * l * E - s * h * p + n * l * p + o * h * f - n * c * f, r[3] = u * p * m - c * d * m - u * E * T + h * d * T + c * E * g - h * p * g, r[7] = o * d * m - a * p * m + a * E * T - n * d * T - o * E * g + n * p * g, r[11] = a * c * m - o * u * m - a * h * T + n * u * T + o * h * g - n * c * g, r[15] = o * u * E - a * c * E + a * h * p - n * u * p - o * h * d + n * c * d, r = n * r[0] + h * r[4] + E * r[8] + m * r[12], 0 === r) {
if (t) throw Error('THREE.Matrix4.getInverse(): can\'t invert matrix, determinant is 0');
return console.warn('THREE.Matrix4.getInverse(): can\'t invert matrix, determinant is 0'),
this.identity(),
this
}
return this.multiplyScalar(1 / r),
this
},
translate: function (e) {
console.error('THREE.Matrix4: .translate() has been removed.')
},
rotateX: function (e) {
console.error('THREE.Matrix4: .rotateX() has been removed.')
},
rotateY: function (e) {
console.error('THREE.Matrix4: .rotateY() has been removed.')
},
rotateZ: function (e) {
console.error('THREE.Matrix4: .rotateZ() has been removed.')
},
rotateByAxis: function (e, t) {
console.error('THREE.Matrix4: .rotateByAxis() has been removed.')
},
scale: function (e) {
var t = this.elements,
r = e.x,
i = e.y;
return e = e.z,
t[0] *= r,
t[4] *= i,
t[8] *= e,
t[1] *= r,
t[5] *= i,
t[9] *= e,
t[2] *= r,
t[6] *= i,
t[10] *= e,
t[3] *= r,
t[7] *= i,
t[11] *= e,
this
},
getMaxScaleOnAxis: function () {
var e = this.elements;
return Math.sqrt(Math.max(e[0] * e[0] + e[1] * e[1] + e[2] * e[2], e[4] * e[4] + e[5] * e[5] + e[6] * e[6], e[8] * e[8] + e[9] * e[9] + e[10] * e[10]))
},
makeTranslation: function (e, t, r) {
return this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, r, 0, 0, 0, 1),
this
},
makeRotationX: function (e) {
var t = Math.cos(e);
return e = Math.sin(e),
this.set(1, 0, 0, 0, 0, t, - e, 0, 0, e, t, 0, 0, 0, 0, 1),
this
},
makeRotationY: function (e) {
var t = Math.cos(e);
return e = Math.sin(e),
this.set(t, 0, e, 0, 0, 1, 0, 0, - e, 0, t, 0, 0, 0, 0, 1),
this
},
makeRotationZ: function (e) {
var t = Math.cos(e);
return e = Math.sin(e),
this.set(t, - e, 0, 0, e, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
this
},
makeRotationAxis: function (e, t) {
var r = Math.cos(t),
i = Math.sin(t),
n = 1 - r,
o = e.x,
a = e.y,
s = e.z,
h = n * o,
c = n * a;
return this.set(h * o + r, h * a - i * s, h * s + i * a, 0, h * a + i * s, c * a + r, c * s - i * o, 0, h * s - i * a, c * s + i * o, n * s * s + r, 0, 0, 0, 0, 1),
this
},
makeScale: function (e, t, r) {
return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, r, 0, 0, 0, 0, 1),
this
},
compose: function (e, t, r) {
return this.makeRotationFromQuaternion(t),
this.scale(r),
this.setPosition(e),
this
},
decompose: function () {
var e,
t;
return function (r, i, n) {
void 0 === e && (e = new THREE.Vector3),
void 0 === t && (t = new THREE.Matrix4);
var o = this.elements,
a = e.set(o[0], o[1], o[2]).length(),
s = e.set(o[4], o[5], o[6]).length(),
h = e.set(o[8], o[9], o[10]).length();
0 > this.determinant() && (a = - a),
r.x = o[12],
r.y = o[13],
r.z = o[14],
t.elements.set(this.elements),
r = 1 / a;
var o = 1 / s,
c = 1 / h;
return t.elements[0] *= r,
t.elements[1] *= r,
t.elements[2] *= r,
t.elements[4] *= o,
t.elements[5] *= o,
t.elements[6] *= o,
t.elements[8] *= c,
t.elements[9] *= c,
t.elements[10] *= c,
i.setFromRotationMatrix(t),
n.x = a,
n.y = s,
n.z = h,
this
}
}(),
makeFrustum: function (e, t, r, i, n, o) {
var a = this.elements;
return a[0] = 2 * n / (t - e),
a[4] = 0,
a[8] = (t + e) / (t - e),
a[12] = 0,
a[1] = 0,
a[5] = 2 * n / (i - r),
a[9] = (i + r) / (i - r),
a[13] = 0,
a[2] = 0,
a[6] = 0,
a[10] = - (o + n) / (o - n),
a[14] = - 2 * o * n / (o - n),
a[3] = 0,
a[7] = 0,
a[11] = - 1,
a[15] = 0,
this
},
makePerspective: function (e, t, r, i) {
e = r * Math.tan(THREE.Math.degToRad(0.5 * e));
var n = - e;
return this.makeFrustum(n * t, e * t, n, e, r, i)
},
makeOrthographic: function (e, t, r, i, n, o) {
var a = this.elements,
s = t - e,
h = r - i,
c = o - n;
return a[0] = 2 / s,
a[4] = 0,
a[8] = 0,
a[12] = - ((t + e) / s),
a[1] = 0,
a[5] = 2 / h,
a[9] = 0,
a[13] = - ((r + i) / h),
a[2] = 0,
a[6] = 0,
a[10] = - 2 / c,
a[14] = - ((o + n) / c),
a[3] = 0,
a[7] = 0,
a[11] = 0,
a[15] = 1,
this
},
equals: function (e) {
var t = this.elements;
e = e.elements;
for (var r = 0; 16 > r; r++) if (t[r] !== e[r]) return !1;
return !0
},
fromArray: function (e) {
return this.elements.set(e),
this
},
toArray: function () {
var e = this.elements;
return [e[0],
e[1],
e[2],
e[3],
e[4],
e[5],
e[6],
e[7],
e[8],
e[9],
e[10],
e[11],
e[12],
e[13],
e[14],
e[15]]
}
},
THREE.Ray = function (e, t) {
this.origin = void 0 !== e ? e : new THREE.Vector3,
this.direction = void 0 !== t ? t : new THREE.Vector3
},
THREE.Ray.prototype = {
constructor: THREE.Ray,
set: function (e, t) {
return this.origin.copy(e),
this.direction.copy(t),
this
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.origin.copy(e.origin),
this.direction.copy(e.direction),
this
},
at: function (e, t) {
return (t || new THREE.Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)
},
recast: function () {
var e = new THREE.Vector3;
return function (t) {
return this.origin.copy(this.at(t, e)),
this
}
}(),
closestPointToPoint: function (e, t) {
var r = t || new THREE.Vector3;
r.subVectors(e, this.origin);
var i = r.dot(this.direction);
return 0 > i ? r.copy(this.origin) : r.copy(this.direction).multiplyScalar(i).add(this.origin)
},
distanceToPoint: function (e) {
return Math.sqrt(this.distanceSqToPoint(e))
},
distanceSqToPoint: function () {
var e = new THREE.Vector3;
return function (t) {
var r = e.subVectors(t, this.origin).dot(this.direction);
return 0 > r ? this.origin.distanceToSquared(t) : (e.copy(this.direction).multiplyScalar(r).add(this.origin), e.distanceToSquared(t))
}
}(),
distanceSqToSegment: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3,
r = new THREE.Vector3;
return function (i, n, o, a) {
e.copy(i).add(n).multiplyScalar(0.5),
t.copy(n).sub(i).normalize(),
r.copy(this.origin).sub(e);
var s,
h = 0.5 * i.distanceTo(n),
c = - this.direction.dot(t),
u = r.dot(this.direction),
l = - r.dot(t),
E = r.lengthSq(),
p = Math.abs(1 - c * c);
return p > 0 ? (i = c * l - u, n = c * u - l, s = h * p, i >= 0 ? n >= - s ? s >= n ? (h = 1 / p, i *= h, n *= h, c = i * (i + c * n + 2 * u) + n * (c * i + n + 2 * l) + E) : (n = h, i = Math.max(0, - (c * n + u)), c = - i * i + n * (n + 2 * l) + E) : (n = - h, i = Math.max(0, - (c * n + u)), c = - i * i + n * (n + 2 * l) + E) : - s >= n ? (i = Math.max(0, - ( - c * h + u)), n = i > 0 ? - h : Math.min(Math.max( - h, - l), h), c = - i * i + n * (n + 2 * l) + E) : s >= n ? (i = 0, n = Math.min(Math.max( - h, - l), h), c = n * (n + 2 * l) + E) : (i = Math.max(0, - (c * h + u)), n = i > 0 ? h : Math.min(Math.max( - h, - l), h), c = - i * i + n * (n + 2 * l) + E)) : (n = c > 0 ? - h : h, i = Math.max(0, - (c * n + u)), c = - i * i + n * (n + 2 * l) + E),
o && o.copy(this.direction).multiplyScalar(i).add(this.origin),
a && a.copy(t).multiplyScalar(n).add(e),
c
}
}(),
isIntersectionSphere: function (e) {
return this.distanceToPoint(e.center) <= e.radius
},
intersectSphere: function () {
var e = new THREE.Vector3;
return function (t, r) {
e.subVectors(t.center, this.origin);
var i = e.dot(this.direction),
n = e.dot(e) - i * i,
o = t.radius * t.radius;
return n > o ? null : (o = Math.sqrt(o - n), n = i - o, i += o, 0 > n && 0 > i ? null : 0 > n ? this.at(i, r) : this.at(n, r))
}
}(),
isIntersectionPlane: function (e) {
var t = e.distanceToPoint(this.origin);
return 0 === t || 0 > e.normal.dot(this.direction) * t ? !0 : !1
},
distanceToPlane: function (e) {
var t = e.normal.dot(this.direction);
return 0 === t ? 0 === e.distanceToPoint(this.origin) ? 0 : null : (e = - (this.origin.dot(e.normal) + e.constant) / t, e >= 0 ? e : null)
},
intersectPlane: function (e, t) {
var r = this.distanceToPlane(e);
return null === r ? null : this.at(r, t)
},
isIntersectionBox: function () {
var e = new THREE.Vector3;
return function (t) {
return null !== this.intersectBox(t, e)
}
}(),
intersectBox: function (e, t) {
var r,
i,
n,
o,
a;
i = 1 / this.direction.x,
o = 1 / this.direction.y,
a = 1 / this.direction.z;
var s = this.origin;
return i >= 0 ? (r = (e.min.x - s.x) * i, i *= e.max.x - s.x) : (r = (e.max.x - s.x) * i, i *= e.min.x - s.x),
o >= 0 ? (n = (e.min.y - s.y) * o, o *= e.max.y - s.y) : (n = (e.max.y - s.y) * o, o *= e.min.y - s.y),
r > o || n > i ? null : ((n > r || r !== r) && (r = n), (i > o || i !== i) && (i = o), a >= 0 ? (n = (e.min.z - s.z) * a, a *= e.max.z - s.z) : (n = (e.max.z - s.z) * a, a *= e.min.z - s.z), r > a || n > i ? null : ((n > r || r !== r) && (r = n), (i > a || i !== i) && (i = a), 0 > i ? null : this.at(r >= 0 ? r : i, t)))
},
intersectTriangle: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3,
r = new THREE.Vector3,
i = new THREE.Vector3;
return function (n, o, a, s, h) {
if (t.subVectors(o, n), r.subVectors(a, n), i.crossVectors(t, r), o = this.direction.dot(i), o > 0) {
if (s) return null;
s = 1
} else {
if (!(0 > o)) return null;
s = - 1,
o = - o
}
return e.subVectors(this.origin, n),
n = s * this.direction.dot(r.crossVectors(e, r)),
0 > n ? null : (a = s * this.direction.dot(t.cross(e)), 0 > a || n + a > o ? null : (n = - s * e.dot(i), 0 > n ? null : this.at(n / o, h)))
}
}(),
applyMatrix4: function (e) {
return this.direction.add(this.origin).applyMatrix4(e),
this.origin.applyMatrix4(e),
this.direction.sub(this.origin),
this.direction.normalize(),
this
},
equals: function (e) {
return e.origin.equals(this.origin) && e.direction.equals(this.direction)
}
},
THREE.Sphere = function (e, t) {
this.center = void 0 !== e ? e : new THREE.Vector3,
this.radius = void 0 !== t ? t : 0
},
THREE.Sphere.prototype = {
constructor: THREE.Sphere,
set: function (e, t) {
return this.center.copy(e),
this.radius = t,
this
},
setFromPoints: function () {
var e = new THREE.Box3;
return function (t, r) {
var i = this.center;
void 0 !== r ? i.copy(r) : e.setFromPoints(t).center(i);
for (var n = 0, o = 0, a = t.length; a > o; o++) n = Math.max(n, i.distanceToSquared(t[o]));
return this.radius = Math.sqrt(n),
this
}
}(),
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.center.copy(e.center),
this.radius = e.radius,
this
},
empty: function () {
return 0 >= this.radius
},
containsPoint: function (e) {
return e.distanceToSquared(this.center) <= this.radius * this.radius
},
distanceToPoint: function (e) {
return e.distanceTo(this.center) - this.radius
},
intersectsSphere: function (e) {
var t = this.radius + e.radius;
return e.center.distanceToSquared(this.center) <= t * t
},
clampPoint: function (e, t) {
var r = this.center.distanceToSquared(e),
i = t || new THREE.Vector3;
return i.copy(e),
r > this.radius * this.radius && (i.sub(this.center).normalize(), i.multiplyScalar(this.radius).add(this.center)),
i
},
getBoundingBox: function (e) {
return e = e || new THREE.Box3,
e.set(this.center, this.center),
e.expandByScalar(this.radius),
e
},
applyMatrix4: function (e) {
return this.center.applyMatrix4(e),
this.radius *= e.getMaxScaleOnAxis(),
this
},
translate: function (e) {
return this.center.add(e),
this
},
equals: function (e) {
return e.center.equals(this.center) && e.radius === this.radius
}
},
THREE.Frustum = function (e, t, r, i, n, o) {
this.planes = [
void 0 !== e ? e : new THREE.Plane,
void 0 !== t ? t : new THREE.Plane,
void 0 !== r ? r : new THREE.Plane,
void 0 !== i ? i : new THREE.Plane,
void 0 !== n ? n : new THREE.Plane,
void 0 !== o ? o : new THREE.Plane
]
},
THREE.Frustum.prototype = {
constructor: THREE.Frustum,
set: function (e, t, r, i, n, o) {
var a = this.planes;
return a[0].copy(e),
a[1].copy(t),
a[2].copy(r),
a[3].copy(i),
a[4].copy(n),
a[5].copy(o),
this
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
for (var t = this.planes, r = 0; 6 > r; r++) t[r].copy(e.planes[r]);
return this
},
setFromMatrix: function (e) {
var t = this.planes,
r = e.elements;
e = r[0];
var i = r[1],
n = r[2],
o = r[3],
a = r[4],
s = r[5],
h = r[6],
c = r[7],
u = r[8],
l = r[9],
E = r[10],
p = r[11],
d = r[12],
f = r[13],
m = r[14],
r = r[15];
return t[0].setComponents(o - e, c - a, p - u, r - d).normalize(),
t[1].setComponents(o + e, c + a, p + u, r + d).normalize(),
t[2].setComponents(o + i, c + s, p + l, r + f).normalize(),
t[3].setComponents(o - i, c - s, p - l, r - f).normalize(),
t[4].setComponents(o - n, c - h, p - E, r - m).normalize(),
t[5].setComponents(o + n, c + h, p + E, r + m).normalize(),
this
},
intersectsObject: function () {
var e = new THREE.Sphere;
return function (t) {
var r = t.geometry;
return null === r.boundingSphere && r.computeBoundingSphere(),
e.copy(r.boundingSphere),
e.applyMatrix4(t.matrixWorld),
this.intersectsSphere(e)
}
}(),
intersectsSphere: function (e) {
var t = this.planes,
r = e.center;
e = - e.radius;
for (var i = 0; 6 > i; i++) if (t[i].distanceToPoint(r) < e) return !1;
return !0
},
intersectsBox: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3;
return function (r) {
for (var i = this.planes, n = 0; 6 > n; n++) {
var o = i[n];
e.x = 0 < o.normal.x ? r.min.x : r.max.x,
t.x = 0 < o.normal.x ? r.max.x : r.min.x,
e.y = 0 < o.normal.y ? r.min.y : r.max.y,
t.y = 0 < o.normal.y ? r.max.y : r.min.y,
e.z = 0 < o.normal.z ? r.min.z : r.max.z,
t.z = 0 < o.normal.z ? r.max.z : r.min.z;
var a = o.distanceToPoint(e),
o = o.distanceToPoint(t);
if (0 > a && 0 > o) return !1
}
return !0
}
}(),
containsPoint: function (e) {
for (var t = this.planes, r = 0; 6 > r; r++) if (0 > t[r].distanceToPoint(e)) return !1;
return !0
}
},
THREE.Plane = function (e, t) {
this.normal = void 0 !== e ? e : new THREE.Vector3(1, 0, 0),
this.constant = void 0 !== t ? t : 0
},
THREE.Plane.prototype = {
constructor: THREE.Plane,
set: function (e, t) {
return this.normal.copy(e),
this.constant = t,
this
},
setComponents: function (e, t, r, i) {
return this.normal.set(e, t, r),
this.constant = i,
this
},
setFromNormalAndCoplanarPoint: function (e, t) {
return this.normal.copy(e),
this.constant = - t.dot(this.normal),
this
},
setFromCoplanarPoints: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3;
return function (r, i, n) {
return i = e.subVectors(n, i).cross(t.subVectors(r, i)).normalize(),
this.setFromNormalAndCoplanarPoint(i, r),
this
}
}(),
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.normal.copy(e.normal),
this.constant = e.constant,
this
},
normalize: function () {
var e = 1 / this.normal.length();
return this.normal.multiplyScalar(e),
this.constant *= e,
this
},
negate: function () {
return this.constant *= - 1,
this.normal.negate(),
this
},
distanceToPoint: function (e) {
return this.normal.dot(e) + this.constant
},
distanceToSphere: function (e) {
return this.distanceToPoint(e.center) - e.radius
},
projectPoint: function (e, t) {
return this.orthoPoint(e, t).sub(e).negate()
},
orthoPoint: function (e, t) {
var r = this.distanceToPoint(e);
return (t || new THREE.Vector3).copy(this.normal).multiplyScalar(r)
},
isIntersectionLine: function (e) {
var t = this.distanceToPoint(e.start);
return e = this.distanceToPoint(e.end),
0 > t && e > 0 || 0 > e && t > 0
},
intersectLine: function () {
var e = new THREE.Vector3;
return function (t, r) {
var i = r || new THREE.Vector3,
n = t.delta(e),
o = this.normal.dot(n);
return 0 !== o ? (o = - (t.start.dot(this.normal) + this.constant) / o, 0 > o || o > 1 ? void 0 : i.copy(n).multiplyScalar(o).add(t.start)) : 0 === this.distanceToPoint(t.start) ? i.copy(t.start) : void 0
}
}(),
coplanarPoint: function (e) {
return (e || new THREE.Vector3).copy(this.normal).multiplyScalar( - this.constant)
},
applyMatrix4: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3,
r = new THREE.Matrix3;
return function (i, n) {
var o = n || r.getNormalMatrix(i),
o = e.copy(this.normal).applyMatrix3(o),
a = this.coplanarPoint(t);
return a.applyMatrix4(i),
this.setFromNormalAndCoplanarPoint(o, a),
this
}
}(),
translate: function (e) {
return this.constant -= e.dot(this.normal),
this
},
equals: function (e) {
return e.normal.equals(this.normal) && e.constant === this.constant
}
},
THREE.Math = {
generateUUID: function () {
var e,
t = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''),
r = Array(36),
i = 0;
return function () {
for (var n = 0; 36 > n; n++) 8 === n || 13 === n || 18 === n || 23 === n ? r[n] = '-' : 14 === n ? r[n] = '4' : (2 >= i && (i = 33554432 + 16777216 * Math.random() | 0), e = 15 & i, i >>= 4, r[n] = t[19 === n ? 3 & e | 8 : e]);
return r.join('')
}
}(),
clamp: function (e, t, r) {
return Math.max(t, Math.min(r, e))
},
euclideanModulo: function (e, t) {
return (e % t + t) % t
},
mapLinear: function (e, t, r, i, n) {
return i + (e - t) * (n - i) / (r - t)
},
smoothstep: function (e, t, r) {
return t >= e ? 0 : e >= r ? 1 : (e = (e - t) / (r - t), e * e * (3 - 2 * e))
},
smootherstep: function (e, t, r) {
return t >= e ? 0 : e >= r ? 1 : (e = (e - t) / (r - t), e * e * e * (e * (6 * e - 15) + 10))
},
random16: function () {
return (65280 * Math.random() + 255 * Math.random()) / 65535
},
randInt: function (e, t) {
return e + Math.floor(Math.random() * (t - e + 1))
},
randFloat: function (e, t) {
return e + Math.random() * (t - e)
},
randFloatSpread: function (e) {
return e * (0.5 - Math.random())
},
degToRad: function () {
var e = Math.PI / 180;
return function (t) {
return t * e
}
}(),
radToDeg: function () {
var e = 180 / Math.PI;
return function (t) {
return t * e
}
}(),
isPowerOfTwo: function (e) {
return 0 === (e & e - 1) && 0 !== e
},
nearestPowerOfTwo: function (e) {
return Math.pow(2, Math.round(Math.log(e) / Math.LN2))
},
nextPowerOfTwo: function (e) {
return e--,
e |= e >> 1,
e |= e >> 2,
e |= e >> 4,
e |= e >> 8,
e |= e >> 16,
e++,
e
}
},
THREE.Spline = function (e) {
function t(e, t, r, i, n, o, a) {
return e = 0.5 * (r - e),
i = 0.5 * (i - t),
(2 * (t - r) + e + i) * a + ( - 3 * (t - r) - 2 * e - i) * o + e * n + t
}
this.points = e;
var r,
i,
n,
o,
a,
s,
h,
c,
u,
l = [
],
E = {
x: 0,
y: 0,
z: 0
};
this.initFromArray = function (e) {
this.points = [
];
for (var t = 0; t < e.length; t++) this.points[t] = {
x: e[t][0],
y: e[t][1],
z: e[t][2]
}
},
this.getPoint = function (e) {
return r = (this.points.length - 1) * e,
i = Math.floor(r),
n = r - i,
l[0] = 0 === i ? i : i - 1,
l[1] = i,
l[2] = i > this.points.length - 2 ? this.points.length - 1 : i + 1,
l[3] = i > this.points.length - 3 ? this.points.length - 1 : i + 2,
s = this.points[l[0]],
h = this.points[l[1]],
c = this.points[l[2]],
u = this.points[l[3]],
o = n * n,
a = n * o,
E.x = t(s.x, h.x, c.x, u.x, n, o, a),
E.y = t(s.y, h.y, c.y, u.y, n, o, a),
E.z = t(s.z, h.z, c.z, u.z, n, o, a),
E
},
this.getControlPointsArray = function () {
var e,
t,
r = this.points.length,
i = [
];
for (e = 0; r > e; e++) t = this.points[e],
i[e] = [
t.x,
t.y,
t.z
];
return i
},
this.getLength = function (e) {
var t,
r,
i,
n = t = t = 0,
o = new THREE.Vector3,
a = new THREE.Vector3,
s = [
],
h = 0;
for (s[0] = 0, e || (e = 100), r = this.points.length * e, o.copy(this.points[0]), e = 1; r > e; e++) t = e / r,
i = this.getPoint(t),
a.copy(i),
h += a.distanceTo(o),
o.copy(i),
t *= this.points.length - 1,
t = Math.floor(t),
t !== n && (s[t] = h, n = t);
return s[s.length] = h,
{
chunks: s,
total: h
}
},
this.reparametrizeByArcLength = function (e) {
var t,
r,
i,
n,
o,
a,
s = [
],
h = new THREE.Vector3,
c = this.getLength();
for (s.push(h.copy(this.points[0]).clone()), t = 1; t < this.points.length; t++) {
for (r = c.chunks[t] - c.chunks[t - 1], a = Math.ceil(e * r / c.total), n = (t - 1) / (this.points.length - 1), o = t / (this.points.length - 1), r = 1; a - 1 > r; r++) i = n + 1 / a * r * (o - n),
i = this.getPoint(i),
s.push(h.copy(i).clone());
s.push(h.copy(this.points[t]).clone())
}
this.points = s
}
},
THREE.Triangle = function (e, t, r) {
this.a = void 0 !== e ? e : new THREE.Vector3,
this.b = void 0 !== t ? t : new THREE.Vector3,
this.c = void 0 !== r ? r : new THREE.Vector3
},
THREE.Triangle.normal = function () {
var e = new THREE.Vector3;
return function (t, r, i, n) {
return n = n || new THREE.Vector3,
n.subVectors(i, r),
e.subVectors(t, r),
n.cross(e),
t = n.lengthSq(),
t > 0 ? n.multiplyScalar(1 / Math.sqrt(t)) : n.set(0, 0, 0)
}
}(),
THREE.Triangle.barycoordFromPoint = function () {
var e = new THREE.Vector3,
t = new THREE.Vector3,
r = new THREE.Vector3;
return function (i, n, o, a, s) {
e.subVectors(a, n),
t.subVectors(o, n),
r.subVectors(i, n),
i = e.dot(e),
n = e.dot(t),
o = e.dot(r);
var h = t.dot(t);
a = t.dot(r);
var c = i * h - n * n;
return s = s || new THREE.Vector3,
0 === c ? s.set( - 2, - 1, - 1) : (c = 1 / c, h = (h * o - n * a) * c, i = (i * a - n * o) * c, s.set(1 - h - i, i, h))
}
}(),
THREE.Triangle.containsPoint = function () {
var e = new THREE.Vector3;
return function (t, r, i, n) {
return t = THREE.Triangle.barycoordFromPoint(t, r, i, n, e),
0 <= t.x && 0 <= t.y && 1 >= t.x + t.y
}
}(),
THREE.Triangle.prototype = {
constructor: THREE.Triangle,
set: function (e, t, r) {
return this.a.copy(e),
this.b.copy(t),
this.c.copy(r),
this
},
setFromPointsAndIndices: function (e, t, r, i) {
return this.a.copy(e[t]),
this.b.copy(e[r]),
this.c.copy(e[i]),
this
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.a.copy(e.a),
this.b.copy(e.b),
this.c.copy(e.c),
this
},
area: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3;
return function () {
return e.subVectors(this.c, this.b),
t.subVectors(this.a, this.b),
0.5 * e.cross(t).length()
}
}(),
midpoint: function (e) {
return (e || new THREE.Vector3).addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3)
},
normal: function (e) {
return THREE.Triangle.normal(this.a, this.b, this.c, e)
},
plane: function (e) {
return (e || new THREE.Plane).setFromCoplanarPoints(this.a, this.b, this.c)
},
barycoordFromPoint: function (e, t) {
return THREE.Triangle.barycoordFromPoint(e, this.a, this.b, this.c, t)
},
containsPoint: function (e) {
return THREE.Triangle.containsPoint(e, this.a, this.b, this.c)
},
equals: function (e) {
return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c)
}
},
THREE.Channels = function () {
this.mask = 1
},
THREE.Channels.prototype = {
constructor: THREE.Channels,
set: function (e) {
this.mask = 1 << e
},
enable: function (e) {
this.mask |= 1 << e
},
toggle: function (e) {
this.mask ^= 1 << e
},
disable: function (e) {
this.mask &= ~(1 << e)
}
},
THREE.Clock = function (e) {
this.autoStart = void 0 !== e ? e : !0,
this.elapsedTime = this.oldTime = this.startTime = 0,
this.running = !1
},
THREE.Clock.prototype = {
constructor: THREE.Clock,
start: function () {
this.oldTime = this.startTime = self.performance.now(),
this.running = !0
},
stop: function () {
this.getElapsedTime(),
this.running = !1
},
getElapsedTime: function () {
return this.getDelta(),
this.elapsedTime
},
getDelta: function () {
var e = 0;
if (this.autoStart && !this.running && this.start(), this.running) {
var t = self.performance.now(),
e = 0.001 * (t - this.oldTime);
this.oldTime = t,
this.elapsedTime += e
}
return e
}
},
THREE.EventDispatcher = function () {
},
THREE.EventDispatcher.prototype = {
constructor: THREE.EventDispatcher,
apply: function (e) {
e.addEventListener = THREE.EventDispatcher.prototype.addEventListener,
e.hasEventListener = THREE.EventDispatcher.prototype.hasEventListener,
e.removeEventListener = THREE.EventDispatcher.prototype.removeEventListener,
e.dispatchEvent = THREE.EventDispatcher.prototype.dispatchEvent
},
addEventListener: function (e, t) {
void 0 === this._listeners && (this._listeners = {
});
var r = this._listeners;
void 0 === r[e] && (r[e] = [
]),
- 1 === r[e].indexOf(t) && r[e].push(t)
},
hasEventListener: function (e, t) {
if (void 0 === this._listeners) return !1;
var r = this._listeners;
return void 0 !== r[e] && - 1 !== r[e].indexOf(t) ? !0 : !1
},
removeEventListener: function (e, t) {
if (void 0 !== this._listeners) {
var r = this._listeners[e];
if (void 0 !== r) {
var i = r.indexOf(t);
- 1 !== i && r.splice(i, 1)
}
}
},
dispatchEvent: function (e) {
if (void 0 !== this._listeners) {
var t = this._listeners[e.type];
if (void 0 !== t) {
e.target = this;
for (var r = [
], i = t.length, n = 0; i > n; n++) r[n] = t[n];
for (n = 0; i > n; n++) r[n].call(this, e)
}
}
}
},
function (e) {
function t(e, t) {
return e.distance - t.distance
}
function r(e, t, i, n) {
if (!1 !== e.visible && (e.raycast(t, i), !0 === n)) {
e = e.children,
n = 0;
for (var o = e.length; o > n; n++) r(e[n], t, i, !0)
}
}
e.Raycaster = function (t, r, i, n) {
this.ray = new e.Ray(t, r),
this.near = i || 0,
this.far = n || 1 / 0,
this.params = {
Mesh: {
},
Line: {
},
LOD: {
},
Points: {
threshold: 1
},
Sprite: {
}
},
Object.defineProperties(this.params, {
PointCloud: {
get: function () {
return console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'),
this.Points
}
}
})
},
e.Raycaster.prototype = {
constructor: e.Raycaster,
linePrecision: 1,
set: function (e, t) {
this.ray.set(e, t)
},
setFromCamera: function (t, r) {
r instanceof e.PerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(r.matrixWorld), this.ray.direction.set(t.x, t.y, 0.5).unproject(r).sub(this.ray.origin).normalize()) : r instanceof e.OrthographicCamera ? (this.ray.origin.set(t.x, t.y, - 1).unproject(r), this.ray.direction.set(0, 0, - 1).transformDirection(r.matrixWorld)) : console.error('THREE.Raycaster: Unsupported camera type.')
},
intersectObject: function (e, i) {
var n = [
];
return r(e, this, n, i),
n.sort(t),
n
},
intersectObjects: function (e, i) {
var n = [
];
if (!1 === Array.isArray(e)) return console.warn('THREE.Raycaster.intersectObjects: objects is not an Array.'),
n;
for (var o = 0, a = e.length; a > o; o++) r(e[o], this, n, i);
return n.sort(t),
n
}
}
}(THREE),
THREE.Object3D = function () {
Object.defineProperty(this, 'id', {
value: THREE.Object3DIdCount++
}),
this.uuid = THREE.Math.generateUUID(),
this.name = '',
this.type = 'Object3D',
this.parent = null,
this.channels = new THREE.Channels,
this.children = [
],
this.up = THREE.Object3D.DefaultUp.clone();
var e = new THREE.Vector3,
t = new THREE.Euler,
r = new THREE.Quaternion,
i = new THREE.Vector3(1, 1, 1);
t.onChange(function () {
r.setFromEuler(t, !1)
}),
r.onChange(function () {
t.setFromQuaternion(r, void 0, !1)
}),
Object.defineProperties(this, {
position: {
enumerable: !0,
value: e
},
rotation: {
enumerable: !0,
value: t
},
quaternion: {
enumerable: !0,
value: r
},
scale: {
enumerable: !0,
value: i
},
modelViewMatrix: {
value: new THREE.Matrix4
},
normalMatrix: {
value: new THREE.Matrix3
}
}),
this.rotationAutoUpdate = !0,
this.matrix = new THREE.Matrix4,
this.matrixWorld = new THREE.Matrix4,
this.matrixAutoUpdate = THREE.Object3D.DefaultMatrixAutoUpdate,
this.matrixWorldNeedsUpdate = !1,
this.visible = !0,
this.receiveShadow = this.castShadow = !1,
this.frustumCulled = !0,
this.renderOrder = 0,
this.userData = {
}
},
THREE.Object3D.DefaultUp = new THREE.Vector3(0, 1, 0),
THREE.Object3D.DefaultMatrixAutoUpdate = !0,
THREE.Object3D.prototype = {
constructor: THREE.Object3D,
get eulerOrder() {
return console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.'),
this.rotation.order
},
set eulerOrder(e) {
console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.'),
this.rotation.order = e
},
get useQuaternion() {
console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.')
},
set useQuaternion(e) {
console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.')
},
set renderDepth(e) {
console.warn('THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.')
},
applyMatrix: function (e) {
this.matrix.multiplyMatrices(e, this.matrix),
this.matrix.decompose(this.position, this.quaternion, this.scale)
},
setRotationFromAxisAngle: function (e, t) {
this.quaternion.setFromAxisAngle(e, t)
},
setRotationFromEuler: function (e) {
this.quaternion.setFromEuler(e, !0)
},
setRotationFromMatrix: function (e) {
this.quaternion.setFromRotationMatrix(e)
},
setRotationFromQuaternion: function (e) {
this.quaternion.copy(e)
},
rotateOnAxis: function () {
var e = new THREE.Quaternion;
return function (t, r) {
return e.setFromAxisAngle(t, r),
this.quaternion.multiply(e),
this
}
}(),
rotateX: function () {
var e = new THREE.Vector3(1, 0, 0);
return function (t) {
return this.rotateOnAxis(e, t)
}
}(),
rotateY: function () {
var e = new THREE.Vector3(0, 1, 0);
return function (t) {
return this.rotateOnAxis(e, t)
}
}(),
rotateZ: function () {
var e = new THREE.Vector3(0, 0, 1);
return function (t) {
return this.rotateOnAxis(e, t)
}
}(),
translateOnAxis: function () {
var e = new THREE.Vector3;
return function (t, r) {
return e.copy(t).applyQuaternion(this.quaternion),
this.position.add(e.multiplyScalar(r)),
this
}
}(),
translate: function (e, t) {
return console.warn('THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.'),
this.translateOnAxis(t, e)
},
translateX: function () {
var e = new THREE.Vector3(1, 0, 0);
return function (t) {
return this.translateOnAxis(e, t)
}
}(),
translateY: function () {
var e = new THREE.Vector3(0, 1, 0);
return function (t) {
return this.translateOnAxis(e, t)
}
}(),
translateZ: function () {
var e = new THREE.Vector3(0, 0, 1);
return function (t) {
return this.translateOnAxis(e, t)
}
}(),
localToWorld: function (e) {
return e.applyMatrix4(this.matrixWorld)
},
worldToLocal: function () {
var e = new THREE.Matrix4;
return function (t) {
return t.applyMatrix4(e.getInverse(this.matrixWorld))
}
}(),
lookAt: function () {
var e = new THREE.Matrix4;
return function (t) {
e.lookAt(t, this.position, this.up),
this.quaternion.setFromRotationMatrix(e)
}
}(),
add: function (e) {
if (1 < arguments.length) {
for (var t = 0; t < arguments.length; t++) this.add(arguments[t]);
return this
}
return e === this ? (console.error('THREE.Object3D.add: object can\'t be added as a child of itself.', e), this) : (e instanceof THREE.Object3D ? (null !== e.parent && e.parent.remove(e), e.parent = this, e.dispatchEvent({
type: 'added'
}), this.children.push(e)) : console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.', e), this)
},
remove: function (e) {
if (1 < arguments.length) for (var t = 0; t < arguments.length; t++) this.remove(arguments[t]);
t = this.children.indexOf(e),
- 1 !== t && (e.parent = null, e.dispatchEvent({
type: 'removed'
}), this.children.splice(t, 1))
},
getChildByName: function (e) {
return console.warn('THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().'),
this.getObjectByName(e)
},
getObjectById: function (e) {
return this.getObjectByProperty('id', e)
},
getObjectByName: function (e) {
return this.getObjectByProperty('name', e)
},
getObjectByProperty: function (e, t) {
if (this[e] === t) return this;
for (var r = 0, i = this.children.length; i > r; r++) {
var n = this.children[r].getObjectByProperty(e, t);
if (void 0 !== n) return n
}
},
getWorldPosition: function (e) {
return e = e || new THREE.Vector3,
this.updateMatrixWorld(!0),
e.setFromMatrixPosition(this.matrixWorld)
},
getWorldQuaternion: function () {
var e = new THREE.Vector3,
t = new THREE.Vector3;
return function (r) {
return r = r || new THREE.Quaternion,
this.updateMatrixWorld(!0),
this.matrixWorld.decompose(e, r, t),
r
}
}(),
getWorldRotation: function () {
var e = new THREE.Quaternion;
return function (t) {
return t = t || new THREE.Euler,
this.getWorldQuaternion(e),
t.setFromQuaternion(e, this.rotation.order, !1)
}
}(),
getWorldScale: function () {
var e = new THREE.Vector3,
t = new THREE.Quaternion;
return function (r) {
return r = r || new THREE.Vector3,
this.updateMatrixWorld(!0),
this.matrixWorld.decompose(e, t, r),
r
}
}(),
getWorldDirection: function () {
var e = new THREE.Quaternion;
return function (t) {
return t = t || new THREE.Vector3,
this.getWorldQuaternion(e),
t.set(0, 0, 1).applyQuaternion(e)
}
}(),
raycast: function () {
},
traverse: function (e) {
e(this);
for (var t = this.children, r = 0, i = t.length; i > r; r++) t[r].traverse(e)
},
traverseVisible: function (e) {
if (!1 !== this.visible) {
e(this);
for (var t = this.children, r = 0, i = t.length; i > r; r++) t[r].traverseVisible(e)
}
},
traverseAncestors: function (e) {
var t = this.parent;
null !== t && (e(t), t.traverseAncestors(e))
},
updateMatrix: function () {
this.matrix.compose(this.position, this.quaternion, this.scale),
this.matrixWorldNeedsUpdate = !0
},
updateMatrixWorld: function (e) {
!0 === this.matrixAutoUpdate && this.updateMatrix(),
(!0 === this.matrixWorldNeedsUpdate || !0 === e) && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate = !1, e = !0);
for (var t = 0, r = this.children.length; r > t; t++) this.children[t].updateMatrixWorld(e)
},
toJSON: function (e) {
function t(e) {
var t,
r = [
];
for (t in e) {
var i = e[t];
delete i.metadata,
r.push(i)
}
return r
}
var r = void 0 === e,
i = {
};
r && (e = {
geometries: {
},
materials: {
},
textures: {
},
images: {
}
}, i.metadata = {
version: 4.4,
type: 'Object',
generator: 'Object3D.toJSON'
});
var n = {
};
if (n.uuid = this.uuid, n.type = this.type, '' !== this.name && (n.name = this.name), '{}' !== JSON.stringify(this.userData) && (n.userData = this.userData), !0 === this.castShadow && (n.castShadow = !0), !0 === this.receiveShadow && (n.receiveShadow = !0), !1 === this.visible && (n.visible = !1), n.matrix = this.matrix.toArray(), void 0 !== this.geometry && (void 0 === e.geometries[this.geometry.uuid] && (e.geometries[this.geometry.uuid] = this.geometry.toJSON(e)), n.geometry = this.geometry.uuid), void 0 !== this.material && (void 0 === e.materials[this.material.uuid] && (e.materials[this.material.uuid] = this.material.toJSON(e)), n.material = this.material.uuid), 0 < this.children.length) {
n.children = [
];
for (var o = 0; o < this.children.length; o++) n.children.push(this.children[o].toJSON(e).object)
}
if (r) {
var r = t(e.geometries),
o = t(e.materials),
a = t(e.textures);
e = t(e.images),
0 < r.length && (i.geometries = r),
0 < o.length && (i.materials = o),
0 < a.length && (i.textures = a),
0 < e.length && (i.images = e)
}
return i.object = n,
i
},
clone: function (e) {
return (new this.constructor).copy(this, e)
},
copy: function (e, t) {
if (void 0 === t && (t = !0), this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.rotationAutoUpdate = e.rotationAutoUpdate, this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.userData = JSON.parse(JSON.stringify(e.userData)), !0 === t) for (var r = 0; r < e.children.length; r++) this.add(e.children[r].clone());
return this
}
},
THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype),
THREE.Object3DIdCount = 0,
THREE.Face3 = function (e, t, r, i, n, o) {
this.a = e,
this.b = t,
this.c = r,
this.normal = i instanceof THREE.Vector3 ? i : new THREE.Vector3,
this.vertexNormals = Array.isArray(i) ? i : [
],
this.color = n instanceof THREE.Color ? n : new THREE.Color,
this.vertexColors = Array.isArray(n) ? n : [
],
this.materialIndex = void 0 !== o ? o : 0
},
THREE.Face3.prototype = {
constructor: THREE.Face3,
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
this.a = e.a,
this.b = e.b,
this.c = e.c,
this.normal.copy(e.normal),
this.color.copy(e.color),
this.materialIndex = e.materialIndex;
for (var t = 0, r = e.vertexNormals.length; r > t; t++) this.vertexNormals[t] = e.vertexNormals[t].clone();
for (t = 0, r = e.vertexColors.length; r > t; t++) this.vertexColors[t] = e.vertexColors[t].clone();
return this
}
},
THREE.Face4 = function (e, t, r, i, n, o, a) {
return console.warn('THREE.Face4 has been removed. A THREE.Face3 will be created instead.'),
new THREE.Face3(e, t, r, n, o, a)
},
THREE.BufferAttribute = function (e, t) {
this.uuid = THREE.Math.generateUUID(),
this.array = e,
this.itemSize = t,
this.dynamic = !1,
this.updateRange = {
offset: 0,
count: - 1
},
this.version = 0
},
THREE.BufferAttribute.prototype = {
constructor: THREE.BufferAttribute,
get length() {
return console.warn('THREE.BufferAttribute: .length has been deprecated. Please use .count.'),
this.array.length
},
get count() {
return this.array.length / this.itemSize
},
set needsUpdate(e) {
!0 === e && this.version++
},
setDynamic: function (e) {
return this.dynamic = e,
this
},
copy: function (e) {
return this.array = new e.array.constructor(e.array),
this.itemSize = e.itemSize,
this.dynamic = e.dynamic,
this
},
copyAt: function (e, t, r) {
e *= this.itemSize,
r *= t.itemSize;
for (var i = 0, n = this.itemSize; n > i; i++) this.array[e + i] = t.array[r + i];
return this
},
copyArray: function (e) {
return this.array.set(e),
this
},
copyColorsArray: function (e) {
for (var t = this.array, r = 0, i = 0, n = e.length; n > i; i++) {
var o = e[i];
void 0 === o && (console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i), o = new THREE.Color),
t[r++] = o.r,
t[r++] = o.g,
t[r++] = o.b
}
return this
},
copyIndicesArray: function (e) {
for (var t = this.array, r = 0, i = 0, n = e.length; n > i; i++) {
var o = e[i];
t[r++] = o.a,
t[r++] = o.b,
t[r++] = o.c
}
return this
},
copyVector2sArray: function (e) {
for (var t = this.array, r = 0, i = 0, n = e.length; n > i; i++) {
var o = e[i];
void 0 === o && (console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i), o = new THREE.Vector2),
t[r++] = o.x,
t[r++] = o.y
}
return this
},
copyVector3sArray: function (e) {
for (var t = this.array, r = 0, i = 0, n = e.length; n > i; i++) {
var o = e[i];
void 0 === o && (console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i), o = new THREE.Vector3),
t[r++] = o.x,
t[r++] = o.y,
t[r++] = o.z
}
return this
},
copyVector4sArray: function (e) {
for (var t = this.array, r = 0, i = 0, n = e.length; n > i; i++) {
var o = e[i];
void 0 === o && (console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i), o = new THREE.Vector4),
t[r++] = o.x,
t[r++] = o.y,
t[r++] = o.z,
t[r++] = o.w
}
return this
},
set: function (e, t) {
return void 0 === t && (t = 0),
this.array.set(e, t),
this
},
getX: function (e) {
return this.array[e * this.itemSize]
},
setX: function (e, t) {
return this.array[e * this.itemSize] = t,
this
},
getY: function (e) {
return this.array[e * this.itemSize + 1]
},
setY: function (e, t) {
return this.array[e * this.itemSize + 1] = t,
this
},
getZ: function (e) {
return this.array[e * this.itemSize + 2]
},
setZ: function (e, t) {
return this.array[e * this.itemSize + 2] = t,
this
},
getW: function (e) {
return this.array[e * this.itemSize + 3]
},
setW: function (e, t) {
return this.array[e * this.itemSize + 3] = t,
this
},
setXY: function (e, t, r) {
return e *= this.itemSize,
this.array[e + 0] = t,
this.array[e + 1] = r,
this
},
setXYZ: function (e, t, r, i) {
return e *= this.itemSize,
this.array[e + 0] = t,
this.array[e + 1] = r,
this.array[e + 2] = i,
this
},
setXYZW: function (e, t, r, i, n) {
return e *= this.itemSize,
this.array[e + 0] = t,
this.array[e + 1] = r,
this.array[e + 2] = i,
this.array[e + 3] = n,
this
},
clone: function () {
return (new this.constructor).copy(this)
}
},
THREE.Int8Attribute = function (e, t) {
return new THREE.BufferAttribute(new Int8Array(e), t)
},
THREE.Uint8Attribute = function (e, t) {
return new THREE.BufferAttribute(new Uint8Array(e), t)
},
THREE.Uint8ClampedAttribute = function (e, t) {
return new THREE.BufferAttribute(new Uint8ClampedArray(e), t)
},
THREE.Int16Attribute = function (e, t) {
return new THREE.BufferAttribute(new Int16Array(e), t)
},
THREE.Uint16Attribute = function (e, t) {
return new THREE.BufferAttribute(new Uint16Array(e), t)
},
THREE.Int32Attribute = function (e, t) {
return new THREE.BufferAttribute(new Int32Array(e), t)
},
THREE.Uint32Attribute = function (e, t) {
return new THREE.BufferAttribute(new Uint32Array(e), t)
},
THREE.Float32Attribute = function (e, t) {
return new THREE.BufferAttribute(new Float32Array(e), t)
},
THREE.Float64Attribute = function (e, t) {
return new THREE.BufferAttribute(new Float64Array(e), t)
},
THREE.DynamicBufferAttribute = function (e, t) {
return console.warn('THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.'),
new THREE.BufferAttribute(e, t).setDynamic(!0)
},
THREE.InstancedBufferAttribute = function (e, t, r) {
THREE.BufferAttribute.call(this, e, t),
this.meshPerAttribute = r || 1
},
THREE.InstancedBufferAttribute.prototype = Object.create(THREE.BufferAttribute.prototype),
THREE.InstancedBufferAttribute.prototype.constructor = THREE.InstancedBufferAttribute,
THREE.InstancedBufferAttribute.prototype.copy = function (e) {
return THREE.BufferAttribute.prototype.copy.call(this, e),
this.meshPerAttribute = e.meshPerAttribute,
this
},
THREE.InterleavedBuffer = function (e, t) {
this.uuid = THREE.Math.generateUUID(),
this.array = e,
this.stride = t,
this.dynamic = !1,
this.updateRange = {
offset: 0,
count: - 1
},
this.version = 0
},
THREE.InterleavedBuffer.prototype = {
constructor: THREE.InterleavedBuffer,
get length() {
return this.array.length
},
get count() {
return this.array.length / this.stride
},
set needsUpdate(e) {
!0 === e && this.version++
},
setDynamic: function (e) {
return this.dynamic = e,
this
},
copy: function (e) {
this.array = new e.array.constructor(e.array),
this.stride = e.stride,
this.dynamic = e.dynamic
},
copyAt: function (e, t, r) {
e *= this.stride,
r *= t.stride;
for (var i = 0, n = this.stride; n > i; i++) this.array[e + i] = t.array[r + i];
return this
},
set: function (e, t) {
return void 0 === t && (t = 0),
this.array.set(e, t),
this
},
clone: function () {
return (new this.constructor).copy(this)
}
},
THREE.InstancedInterleavedBuffer = function (e, t, r) {
THREE.InterleavedBuffer.call(this, e, t),
this.meshPerAttribute = r || 1
},
THREE.InstancedInterleavedBuffer.prototype = Object.create(THREE.InterleavedBuffer.prototype),
THREE.InstancedInterleavedBuffer.prototype.constructor = THREE.InstancedInterleavedBuffer,
THREE.InstancedInterleavedBuffer.prototype.copy = function (e) {
return THREE.InterleavedBuffer.prototype.copy.call(this, e),
this.meshPerAttribute = e.meshPerAttribute,
this
},
THREE.InterleavedBufferAttribute = function (e, t, r) {
this.uuid = THREE.Math.generateUUID(),
this.data = e,
this.itemSize = t,
this.offset = r
},
THREE.InterleavedBufferAttribute.prototype = {
constructor: THREE.InterleavedBufferAttribute,
get length() {
return console.warn('THREE.BufferAttribute: .length has been deprecated. Please use .count.'),
this.array.length
},
get count() {
return this.data.array.length / this.data.stride
},
setX: function (e, t) {
return this.data.array[e * this.data.stride + this.offset] = t,
this
},
setY: function (e, t) {
return this.data.array[e * this.data.stride + this.offset + 1] = t,
this
},
setZ: function (e, t) {
return this.data.array[e * this.data.stride + this.offset + 2] = t,
this
},
setW: function (e, t) {
return this.data.array[e * this.data.stride + this.offset + 3] = t,
this
},
getX: function (e) {
return this.data.array[e * this.data.stride + this.offset]
},
getY: function (e) {
return this.data.array[e * this.data.stride + this.offset + 1]
},
getZ: function (e) {
return this.data.array[e * this.data.stride + this.offset + 2]
},
getW: function (e) {
return this.data.array[e * this.data.stride + this.offset + 3]
},
setXY: function (e, t, r) {
return e = e * this.data.stride + this.offset,
this.data.array[e + 0] = t,
this.data.array[e + 1] = r,
this
},
setXYZ: function (e, t, r, i) {
return e = e * this.data.stride + this.offset,
this.data.array[e + 0] = t,
this.data.array[e + 1] = r,
this.data.array[e + 2] = i,
this
},
setXYZW: function (e, t, r, i, n) {
return e = e * this.data.stride + this.offset,
this.data.array[e + 0] = t,
this.data.array[e + 1] = r,
this.data.array[e + 2] = i,
this.data.array[e + 3] = n,
this
}
},
THREE.Geometry = function () {
Object.defineProperty(this, 'id', {
value: THREE.GeometryIdCount++
}),
this.uuid = THREE.Math.generateUUID(),
this.name = '',
this.type = 'Geometry',
this.vertices = [
],
this.colors = [
],
this.faces = [
],
this.faceVertexUvs = [
[]
],
this.morphTargets = [
],
this.morphNormals = [
],
this.skinWeights = [
],
this.skinIndices = [
],
this.lineDistances = [
],
this.boundingSphere = this.boundingBox = null,
this.groupsNeedUpdate = this.lineDistancesNeedUpdate = this.colorsNeedUpdate = this.normalsNeedUpdate = this.uvsNeedUpdate = this.elementsNeedUpdate = this.verticesNeedUpdate = !1
},
THREE.Geometry.prototype = {
constructor: THREE.Geometry,
applyMatrix: function (e) {
for (var t = (new THREE.Matrix3).getNormalMatrix(e), r = 0, i = this.vertices.length; i > r; r++) this.vertices[r].applyMatrix4(e);
for (r = 0, i = this.faces.length; i > r; r++) {
e = this.faces[r],
e.normal.applyMatrix3(t).normalize();
for (var n = 0, o = e.vertexNormals.length; o > n; n++) e.vertexNormals[n].applyMatrix3(t).normalize()
}
null !== this.boundingBox && this.computeBoundingBox(),
null !== this.boundingSphere && this.computeBoundingSphere(),
this.normalsNeedUpdate = this.verticesNeedUpdate = !0
},
rotateX: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeRotationX(t),
this.applyMatrix(e),
this
}
}(),
rotateY: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeRotationY(t),
this.applyMatrix(e),
this
}
}(),
rotateZ: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeRotationZ(t),
this.applyMatrix(e),
this
}
}(),
translate: function () {
var e;
return function (t, r, i) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeTranslation(t, r, i),
this.applyMatrix(e),
this
}
}(),
scale: function () {
var e;
return function (t, r, i) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeScale(t, r, i),
this.applyMatrix(e),
this
}
}(),
lookAt: function () {
var e;
return function (t) {
void 0 === e && (e = new THREE.Object3D),
e.lookAt(t),
e.updateMatrix(),
this.applyMatrix(e.matrix)
}
}(),
fromBufferGeometry: function (e) {
function t(e, t, i) {
var n = void 0 !== a ? [
u[e].clone(),
u[t].clone(),
u[i].clone()
] : [
],
o = void 0 !== s ? [
r.colors[e].clone(),
r.colors[t].clone(),
r.colors[i].clone()
] : [
],
n = new THREE.Face3(e, t, i, n, o);
r.faces.push(n),
void 0 !== h && r.faceVertexUvs[0].push([l[e].clone(),
l[t].clone(),
l[i].clone()]),
void 0 !== c && r.faceVertexUvs[1].push([E[e].clone(),
E[t].clone(),
E[i].clone()])
}
var r = this,
i = null !== e.index ? e.index.array : void 0,
n = e.attributes,
o = n.position.array,
a = void 0 !== n.normal ? n.normal.array : void 0,
s = void 0 !== n.color ? n.color.array : void 0,
h = void 0 !== n.uv ? n.uv.array : void 0,
c = void 0 !== n.uv2 ? n.uv2.array : void 0;
void 0 !== c && (this.faceVertexUvs[1] = [
]);
for (var u = [
], l = [
], E = [
], p = n = 0; n < o.length; n += 3, p += 2) r.vertices.push(new THREE.Vector3(o[n], o[n + 1], o[n + 2])),
void 0 !== a && u.push(new THREE.Vector3(a[n], a[n + 1], a[n + 2])),
void 0 !== s && r.colors.push(new THREE.Color(s[n], s[n + 1], s[n + 2])),
void 0 !== h && l.push(new THREE.Vector2(h[p], h[p + 1])),
void 0 !== c && E.push(new THREE.Vector2(c[p], c[p + 1]));
if (void 0 !== i) if (o = e.groups, 0 < o.length) for (n = 0; n < o.length; n++) for (var p = o[n], d = p.start, f = p.count, p = d, d = d + f; d > p; p += 3) t(i[p], i[p + 1], i[p + 2]);
else for (n = 0; n < i.length; n += 3) t(i[n], i[n + 1], i[n + 2]);
else for (n = 0; n < o.length / 3; n += 3) t(n, n + 1, n + 2);
return this.computeFaceNormals(),
null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()),
null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()),
this
},
center: function () {
this.computeBoundingBox();
var e = this.boundingBox.center().negate();
return this.translate(e.x, e.y, e.z),
e
},
normalize: function () {
this.computeBoundingSphere();
var e = this.boundingSphere.center,
t = this.boundingSphere.radius,
t = 0 === t ? 1 : 1 / t,
r = new THREE.Matrix4;
return r.set(t, 0, 0, - t * e.x, 0, t, 0, - t * e.y, 0, 0, t, - t * e.z, 0, 0, 0, 1),
this.applyMatrix(r),
this
},
computeFaceNormals: function () {
for (var e = new THREE.Vector3, t = new THREE.Vector3, r = 0, i = this.faces.length; i > r; r++) {
var n = this.faces[r],
o = this.vertices[n.a],
a = this.vertices[n.b];
e.subVectors(this.vertices[n.c], a),
t.subVectors(o, a),
e.cross(t),
e.normalize(),
n.normal.copy(e)
}
},
computeVertexNormals: function (e) {
var t,
r,
i;
for (i = Array(this.vertices.length), t = 0, r = this.vertices.length; r > t; t++) i[t] = new THREE.Vector3;
if (e) {
var n,
o,
a,
s = new THREE.Vector3,
h = new THREE.Vector3;
for (e = 0, t = this.faces.length; t > e; e++) r = this.faces[e],
n = this.vertices[r.a],
o = this.vertices[r.b],
a = this.vertices[r.c],
s.subVectors(a, o),
h.subVectors(n, o),
s.cross(h),
i[r.a].add(s),
i[r.b].add(s),
i[r.c].add(s)
} else for (e = 0, t = this.faces.length; t > e; e++) r = this.faces[e],
i[r.a].add(r.normal),
i[r.b].add(r.normal),
i[r.c].add(r.normal);
for (t = 0, r = this.vertices.length; r > t; t++) i[t].normalize();
for (e = 0, t = this.faces.length; t > e; e++) r = this.faces[e],
n = r.vertexNormals,
3 === n.length ? (n[0].copy(i[r.a]), n[1].copy(i[r.b]), n[2].copy(i[r.c])) : (n[0] = i[r.a].clone(), n[1] = i[r.b].clone(), n[2] = i[r.c].clone())
},
computeMorphNormals: function () {
var e,
t,
r,
i,
n;
for (r = 0, i = this.faces.length; i > r; r++) for (n = this.faces[r], n.__originalFaceNormal ? n.__originalFaceNormal.copy(n.normal) : n.__originalFaceNormal = n.normal.clone(), n.__originalVertexNormals || (n.__originalVertexNormals = [
]), e = 0, t = n.vertexNormals.length; t > e; e++) n.__originalVertexNormals[e] ? n.__originalVertexNormals[e].copy(n.vertexNormals[e]) : n.__originalVertexNormals[e] = n.vertexNormals[e].clone();
var o = new THREE.Geometry;
for (o.faces = this.faces, e = 0, t = this.morphTargets.length; t > e; e++) {
if (!this.morphNormals[e]) {
this.morphNormals[e] = {
},
this.morphNormals[e].faceNormals = [
],
this.morphNormals[e].vertexNormals = [
],
n = this.morphNormals[e].faceNormals;
var a,
s,
h = this.morphNormals[e].vertexNormals;
for (r = 0, i = this.faces.length; i > r; r++) a = new THREE.Vector3,
s = {
a: new THREE.Vector3,
b: new THREE.Vector3,
c: new THREE.Vector3
},
n.push(a),
h.push(s)
}
for (h = this.morphNormals[e], o.vertices = this.morphTargets[e].vertices, o.computeFaceNormals(), o.computeVertexNormals(), r = 0, i = this.faces.length; i > r; r++) n = this.faces[r],
a = h.faceNormals[r],
s = h.vertexNormals[r],
a.copy(n.normal),
s.a.copy(n.vertexNormals[0]),
s.b.copy(n.vertexNormals[1]),
s.c.copy(n.vertexNormals[2])
}
for (r = 0, i = this.faces.length; i > r; r++) n = this.faces[r],
n.normal = n.__originalFaceNormal,
n.vertexNormals = n.__originalVertexNormals
},
computeTangents: function () {
console.warn('THREE.Geometry: .computeTangents() has been removed.')
},
computeLineDistances: function () {
for (var e = 0, t = this.vertices, r = 0, i = t.length; i > r; r++) r > 0 && (e += t[r].distanceTo(t[r - 1])),
this.lineDistances[r] = e
},
computeBoundingBox: function () {
null === this.boundingBox && (this.boundingBox = new THREE.Box3),
this.boundingBox.setFromPoints(this.vertices)
},
computeBoundingSphere: function () {
null === this.boundingSphere && (this.boundingSphere = new THREE.Sphere),
this.boundingSphere.setFromPoints(this.vertices)
},
merge: function (e, t, r) {
if (!1 == e instanceof THREE.Geometry) console.error('THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', e);
else {
var i,
n = this.vertices.length,
o = this.vertices,
a = e.vertices,
s = this.faces,
h = e.faces,
c = this.faceVertexUvs[0];
e = e.faceVertexUvs[0],
void 0 === r && (r = 0),
void 0 !== t && (i = (new THREE.Matrix3).getNormalMatrix(t));
for (var u = 0, l = a.length; l > u; u++) {
var E = a[u].clone();
void 0 !== t && E.applyMatrix4(t),
o.push(E)
}
for (u = 0, l = h.length; l > u; u++) {
var p,
a = h[u],
d = a.vertexNormals,
f = a.vertexColors,
E = new THREE.Face3(a.a + n, a.b + n, a.c + n);
for (E.normal.copy(a.normal), void 0 !== i && E.normal.applyMatrix3(i).normalize(), t = 0, o = d.length; o > t; t++) p = d[t].clone(),
void 0 !== i && p.applyMatrix3(i).normalize(),
E.vertexNormals.push(p);
for (E.color.copy(a.color), t = 0, o = f.length; o > t; t++) p = f[t],
E.vertexColors.push(p.clone());
E.materialIndex = a.materialIndex + r,
s.push(E)
}
for (u = 0, l = e.length; l > u; u++) if (r = e[u], i = [
], void 0 !== r) {
for (t = 0, o = r.length; o > t; t++) i.push(r[t].clone());
c.push(i)
}
}
},
mergeMesh: function (e) {
!1 == e instanceof THREE.Mesh ? console.error('THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', e) : (e.matrixAutoUpdate && e.updateMatrix(), this.merge(e.geometry, e.matrix))
},
mergeVertices: function () {
var e,
t,
r,
i = {
},
n = [
],
o = [
],
a = Math.pow(10, 4);
for (t = 0, r = this.vertices.length; r > t; t++) e = this.vertices[t],
e = Math.round(e.x * a) + '_' + Math.round(e.y * a) + '_' + Math.round(e.z * a),
void 0 === i[e] ? (i[e] = t, n.push(this.vertices[t]), o[t] = n.length - 1) : o[t] = o[i[e]];
for (i = [
], t = 0, r = this.faces.length; r > t; t++) for (a = this.faces[t], a.a = o[a.a], a.b = o[a.b], a.c = o[a.c], a = [
a.a,
a.b,
a.c
], e = 0; 3 > e; e++) if (a[e] === a[(e + 1) % 3]) {
i.push(t);
break
}
for (t = i.length - 1; t >= 0; t--) for (a = i[t], this.faces.splice(a, 1), o = 0, r = this.faceVertexUvs.length; r > o; o++) this.faceVertexUvs[o].splice(a, 1);
return t = this.vertices.length - n.length,
this.vertices = n,
t
},
sortFacesByMaterialIndex: function () {
for (var e = this.faces, t = e.length, r = 0; t > r; r++) e[r]._id = r;
e.sort(function (e, t) {
return e.materialIndex - t.materialIndex
});
var i,
n,
o = this.faceVertexUvs[0],
a = this.faceVertexUvs[1];
for (o && o.length === t && (i = [
]), a && a.length === t && (n = [
]), r = 0; t > r; r++) {
var s = e[r]._id;
i && i.push(o[s]),
n && n.push(a[s])
}
i && (this.faceVertexUvs[0] = i),
n && (this.faceVertexUvs[1] = n)
},
toJSON: function () {
function e(e, t, r) {
return r ? e | 1 << t : e & ~(1 << t)
}
function t(e) {
var t = e.x.toString() + e.y.toString() + e.z.toString();
return void 0 !== c[t] ? c[t] : (c[t] = h.length / 3, h.push(e.x, e.y, e.z), c[t])
}
function r(e) {
var t = e.r.toString() + e.g.toString() + e.b.toString();
return void 0 !== l[t] ? l[t] : (l[t] = u.length, u.push(e.getHex()), l[t])
}
function i(e) {
var t = e.x.toString() + e.y.toString();
return void 0 !== p[t] ? p[t] : (p[t] = E.length / 2, E.push(e.x, e.y), p[t])
}
var n = {
metadata: {
version: 4.4,
type: 'Geometry',
generator: 'Geometry.toJSON'
}
};
if (n.uuid = this.uuid, n.type = this.type, '' !== this.name && (n.name = this.name), void 0 !== this.parameters) {
var o,
a = this.parameters;
for (o in a) void 0 !== a[o] && (n[o] = a[o]);
return n
}
for (a = [
], o = 0; o < this.vertices.length; o++) {
var s = this.vertices[o];
a.push(s.x, s.y, s.z)
}
var s = [
],
h = [
],
c = {
},
u = [
],
l = {
},
E = [
],
p = {
};
for (o = 0; o < this.faces.length; o++) {
var d = this.faces[o],
f = void 0 !== this.faceVertexUvs[0][o],
m = 0 < d.normal.length(),
T = 0 < d.vertexNormals.length,
g = 1 !== d.color.r || 1 !== d.color.g || 1 !== d.color.b,
v = 0 < d.vertexColors.length,
y = 0,
y = e(y, 0, 0),
y = e(y, 1, !1),
y = e(y, 2, !1),
y = e(y, 3, f),
y = e(y, 4, m),
y = e(y, 5, T),
y = e(y, 6, g),
y = e(y, 7, v);
s.push(y),
s.push(d.a, d.b, d.c),
f && (f = this.faceVertexUvs[0][o], s.push(i(f[0]), i(f[1]), i(f[2]))),
m && s.push(t(d.normal)),
T && (m = d.vertexNormals, s.push(t(m[0]), t(m[1]), t(m[2]))),
g && s.push(r(d.color)),
v && (d = d.vertexColors, s.push(r(d[0]), r(d[1]), r(d[2])))
}
return n.data = {
},
n.data.vertices = a,
n.data.normals = h,
0 < u.length && (n.data.colors = u),
0 < E.length && (n.data.uvs = [
E
]),
n.data.faces = s,
n
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
this.vertices = [
],
this.faces = [
],
this.faceVertexUvs = [
[]
];
for (var t = e.vertices, r = 0, i = t.length; i > r; r++) this.vertices.push(t[r].clone());
for (t = e.faces, r = 0, i = t.length; i > r; r++) this.faces.push(t[r].clone());
for (r = 0, i = e.faceVertexUvs.length; i > r; r++) {
t = e.faceVertexUvs[r],
void 0 === this.faceVertexUvs[r] && (this.faceVertexUvs[r] = [
]);
for (var n = 0, o = t.length; o > n; n++) {
for (var a = t[n], s = [
], h = 0, c = a.length; c > h; h++) s.push(a[h].clone());
this.faceVertexUvs[r].push(s)
}
}
return this
},
dispose: function () {
this.dispatchEvent({
type: 'dispose'
})
}
},
THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),
THREE.GeometryIdCount = 0,
THREE.DirectGeometry = function () {
Object.defineProperty(this, 'id', {
value: THREE.GeometryIdCount++
}),
this.uuid = THREE.Math.generateUUID(),
this.name = '',
this.type = 'DirectGeometry',
this.indices = [
],
this.vertices = [
],
this.normals = [
],
this.colors = [
],
this.uvs = [
],
this.uvs2 = [
],
this.groups = [
],
this.morphTargets = {
},
this.skinWeights = [
],
this.skinIndices = [
],
this.boundingSphere = this.boundingBox = null,
this.groupsNeedUpdate = this.uvsNeedUpdate = this.colorsNeedUpdate = this.normalsNeedUpdate = this.verticesNeedUpdate = !1
},
THREE.DirectGeometry.prototype = {
constructor: THREE.DirectGeometry,
computeBoundingBox: THREE.Geometry.prototype.computeBoundingBox,
computeBoundingSphere: THREE.Geometry.prototype.computeBoundingSphere,
computeFaceNormals: function () {
console.warn('THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.')
},
computeVertexNormals: function () {
console.warn('THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.')
},
computeGroups: function (e) {
var t,
r,
i = [
];
e = e.faces;
for (var n = 0; n < e.length; n++) {
var o = e[n];
o.materialIndex !== r && (r = o.materialIndex, void 0 !== t && (t.count = 3 * n - t.start, i.push(t)), t = {
start: 3 * n,
materialIndex: r
})
}
void 0 !== t && (t.count = 3 * n - t.start, i.push(t)),
this.groups = i
},
fromGeometry: function (e) {
var t = e.faces,
r = e.vertices,
i = e.faceVertexUvs,
n = i[0] && 0 < i[0].length,
o = i[1] && 0 < i[1].length,
a = e.morphTargets,
s = a.length;
if (s > 0) {
for (var h = [
], c = 0; s > c; c++) h[c] = [
];
this.morphTargets.position = h
}
var u = e.morphNormals,
l = u.length;
if (l > 0) {
for (var E = [
], c = 0; l > c; c++) E[c] = [
];
this.morphTargets.normal = E
}
for (var p = e.skinIndices, d = e.skinWeights, f = p.length === r.length, m = d.length === r.length, c = 0; c < t.length; c++) {
var T = t[c];
this.vertices.push(r[T.a], r[T.b], r[T.c]);
var g = T.vertexNormals;
for (3 === g.length ? this.normals.push(g[0], g[1], g[2]) : (g = T.normal, this.normals.push(g, g, g)), g = T.vertexColors, 3 === g.length ? this.colors.push(g[0], g[1], g[2]) : (g = T.color, this.colors.push(g, g, g)), !0 === n && (g = i[0][c], void 0 !== g ? this.uvs.push(g[0], g[1], g[2]) : (console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', c), this.uvs.push(new THREE.Vector2, new THREE.Vector2, new THREE.Vector2))), !0 === o && (g = i[1][c], void 0 !== g ? this.uvs2.push(g[0], g[1], g[2]) : (console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', c), this.uvs2.push(new THREE.Vector2, new THREE.Vector2, new THREE.Vector2))), g = 0; s > g; g++) {
var v = a[g].vertices;
h[g].push(v[T.a], v[T.b], v[T.c])
}
for (g = 0; l > g; g++) v = u[g].vertexNormals[c],
E[g].push(v.a, v.b, v.c);
f && this.skinIndices.push(p[T.a], p[T.b], p[T.c]),
m && this.skinWeights.push(d[T.a], d[T.b], d[T.c])
}
return this.computeGroups(e),
this.verticesNeedUpdate = e.verticesNeedUpdate,
this.normalsNeedUpdate = e.normalsNeedUpdate,
this.colorsNeedUpdate = e.colorsNeedUpdate,
this.uvsNeedUpdate = e.uvsNeedUpdate,
this.groupsNeedUpdate = e.groupsNeedUpdate,
this
},
dispose: function () {
this.dispatchEvent({
type: 'dispose'
})
}
},
THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype),
THREE.BufferGeometry = function () {
Object.defineProperty(this, 'id', {
value: THREE.GeometryIdCount++
}),
this.uuid = THREE.Math.generateUUID(),
this.name = '',
this.type = 'BufferGeometry',
this.index = null,
this.attributes = {
},
this.morphAttributes = {
},
this.groups = [
],
this.boundingSphere = this.boundingBox = null,
this.drawRange = {
start: 0,
count: 1 / 0
}
},
THREE.BufferGeometry.prototype = {
constructor: THREE.BufferGeometry,
addIndex: function (e) {
console.warn('THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().'),
this.setIndex(e)
},
getIndex: function () {
return this.index
},
setIndex: function (e) {
this.index = e
},
addAttribute: function (e, t, r) {
!1 == t instanceof THREE.BufferAttribute && !1 == t instanceof THREE.InterleavedBufferAttribute ? (console.warn('THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).'), this.addAttribute(e, new THREE.BufferAttribute(t, r))) : 'index' === e ? (console.warn('THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.'), this.setIndex(t)) : this.attributes[e] = t
},
getAttribute: function (e) {
return this.attributes[e]
},
removeAttribute: function (e) {
delete this.attributes[e]
},
get drawcalls() {
return console.error('THREE.BufferGeometry: .drawcalls has been renamed to .groups.'),
this.groups
},
get offsets() {
return console.warn('THREE.BufferGeometry: .offsets has been renamed to .groups.'),
this.groups
},
addDrawCall: function (e, t, r) {
void 0 !== r && console.warn('THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.'),
console.warn('THREE.BufferGeometry: .addDrawCall() is now .addGroup().'),
this.addGroup(e, t)
},
clearDrawCalls: function () {
console.warn('THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().'),
this.clearGroups()
},
addGroup: function (e, t, r) {
this.groups.push({
start: e,
count: t,
materialIndex: void 0 !== r ? r : 0
})
},
clearGroups: function () {
this.groups = [
]
},
setDrawRange: function (e, t) {
this.drawRange.start = e,
this.drawRange.count = t
},
applyMatrix: function (e) {
var t = this.attributes.position;
void 0 !== t && (e.applyToVector3Array(t.array), t.needsUpdate = !0),
t = this.attributes.normal,
void 0 !== t && ((new THREE.Matrix3).getNormalMatrix(e).applyToVector3Array(t.array), t.needsUpdate = !0),
null !== this.boundingBox && this.computeBoundingBox(),
null !== this.boundingSphere && this.computeBoundingSphere()
},
rotateX: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeRotationX(t),
this.applyMatrix(e),
this
}
}(),
rotateY: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeRotationY(t),
this.applyMatrix(e),
this
}
}(),
rotateZ: function () {
var e;
return function (t) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeRotationZ(t),
this.applyMatrix(e),
this
}
}(),
translate: function () {
var e;
return function (t, r, i) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeTranslation(t, r, i),
this.applyMatrix(e),
this
}
}(),
scale: function () {
var e;
return function (t, r, i) {
return void 0 === e && (e = new THREE.Matrix4),
e.makeScale(t, r, i),
this.applyMatrix(e),
this
}
}(),
lookAt: function () {
var e;
return function (t) {
void 0 === e && (e = new THREE.Object3D),
e.lookAt(t),
e.updateMatrix(),
this.applyMatrix(e.matrix)
}
}(),
center: function () {
this.computeBoundingBox();
var e = this.boundingBox.center().negate();
return this.translate(e.x, e.y, e.z),
e
},
setFromObject: function (e) {
var t = e.geometry;
if (e instanceof THREE.Points || e instanceof THREE.Line) {
e = new THREE.Float32Attribute(3 * t.vertices.length, 3);
var r = new THREE.Float32Attribute(3 * t.colors.length, 3);
this.addAttribute('position', e.copyVector3sArray(t.vertices)),
this.addAttribute('color', r.copyColorsArray(t.colors)),
t.lineDistances && t.lineDistances.length === t.vertices.length && (e = new THREE.Float32Attribute(t.lineDistances.length, 1), this.addAttribute('lineDistance', e.copyArray(t.lineDistances))),
null !== t.boundingSphere && (this.boundingSphere = t.boundingSphere.clone()),
null !== t.boundingBox && (this.boundingBox = t.boundingBox.clone())
} else e instanceof THREE.Mesh && t instanceof THREE.Geometry && this.fromGeometry(t);
return this
},
updateFromObject: function (e) {
var t = e.geometry;
if (e instanceof THREE.Mesh) {
var r = t.__directGeometry;
if (void 0 === r) return this.fromGeometry(t);
r.verticesNeedUpdate = t.verticesNeedUpdate,
r.normalsNeedUpdate = t.normalsNeedUpdate,
r.colorsNeedUpdate = t.colorsNeedUpdate,
r.uvsNeedUpdate = t.uvsNeedUpdate,
r.groupsNeedUpdate = t.groupsNeedUpdate,
t.verticesNeedUpdate = !1,
t.normalsNeedUpdate = !1,
t.colorsNeedUpdate = !1,
t.uvsNeedUpdate = !1,
t.groupsNeedUpdate = !1,
t = r
}
return !0 === t.verticesNeedUpdate && (r = this.attributes.position, void 0 !== r && (r.copyVector3sArray(t.vertices), r.needsUpdate = !0), t.verticesNeedUpdate = !1),
!0 === t.normalsNeedUpdate && (r = this.attributes.normal, void 0 !== r && (r.copyVector3sArray(t.normals), r.needsUpdate = !0), t.normalsNeedUpdate = !1),
!0 === t.colorsNeedUpdate && (r = this.attributes.color, void 0 !== r && (r.copyColorsArray(t.colors), r.needsUpdate = !0), t.colorsNeedUpdate = !1),
t.uvsNeedUpdate && (r = this.attributes.uv, void 0 !== r && (r.copyVector2sArray(t.uvs), r.needsUpdate = !0), t.uvsNeedUpdate = !1),
t.lineDistancesNeedUpdate && (r = this.attributes.lineDistance, void 0 !== r && (r.copyArray(t.lineDistances), r.needsUpdate = !0), t.lineDistancesNeedUpdate = !1),
t.groupsNeedUpdate && (t.computeGroups(e.geometry), this.groups = t.groups, t.groupsNeedUpdate = !1),
this
},
fromGeometry: function (e) {
return e.__directGeometry = (new THREE.DirectGeometry).fromGeometry(e),
this.fromDirectGeometry(e.__directGeometry)
},
fromDirectGeometry: function (e) {
var t = new Float32Array(3 * e.vertices.length);
this.addAttribute('position', new THREE.BufferAttribute(t, 3).copyVector3sArray(e.vertices)),
0 < e.normals.length && (t = new Float32Array(3 * e.normals.length), this.addAttribute('normal', new THREE.BufferAttribute(t, 3).copyVector3sArray(e.normals))),
0 < e.colors.length && (t = new Float32Array(3 * e.colors.length), this.addAttribute('color', new THREE.BufferAttribute(t, 3).copyColorsArray(e.colors))),
0 < e.uvs.length && (t = new Float32Array(2 * e.uvs.length), this.addAttribute('uv', new THREE.BufferAttribute(t, 2).copyVector2sArray(e.uvs))),
0 < e.uvs2.length && (t = new Float32Array(2 * e.uvs2.length), this.addAttribute('uv2', new THREE.BufferAttribute(t, 2).copyVector2sArray(e.uvs2))),
0 < e.indices.length && (t = new (65535 < e.vertices.length ? Uint32Array : Uint16Array) (3 * e.indices.length), this.setIndex(new THREE.BufferAttribute(t, 1).copyIndicesArray(e.indices))),
this.groups = e.groups;
for (var r in e.morphTargets) {
for (var t = [
], i = e.morphTargets[r], n = 0, o = i.length; o > n; n++) {
var a = i[n],
s = new THREE.Float32Attribute(3 * a.length, 3);
t.push(s.copyVector3sArray(a))
}
this.morphAttributes[r] = t
}
return 0 < e.skinIndices.length && (r = new THREE.Float32Attribute(4 * e.skinIndices.length, 4), this.addAttribute('skinIndex', r.copyVector4sArray(e.skinIndices))),
0 < e.skinWeights.length && (r = new THREE.Float32Attribute(4 * e.skinWeights.length, 4), this.addAttribute('skinWeight', r.copyVector4sArray(e.skinWeights))),
null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()),
null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()),
this
},
computeBoundingBox: function () {
var e = new THREE.Vector3;
return function () {
null === this.boundingBox && (this.boundingBox = new THREE.Box3);
var t = this.attributes.position.array;
if (t) {
var r = this.boundingBox;
r.makeEmpty();
for (var i = 0, n = t.length; n > i; i += 3) e.fromArray(t, i),
r.expandByPoint(e)
}(void 0 === t || 0 === t.length) && (this.boundingBox.min.set(0, 0, 0), this.boundingBox.max.set(0, 0, 0)),
(isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this)
}
}(),
computeBoundingSphere: function () {
var e = new THREE.Box3,
t = new THREE.Vector3;
return function () {
null === this.boundingSphere && (this.boundingSphere = new THREE.Sphere);
var r = this.attributes.position.array;
if (r) {
e.makeEmpty();
for (var i = this.boundingSphere.center, n = 0, o = r.length; o > n; n += 3) t.fromArray(r, n),
e.expandByPoint(t);
e.center(i);
for (var a = 0, n = 0, o = r.length; o > n; n += 3) t.fromArray(r, n),
a = Math.max(a, i.distanceToSquared(t));
this.boundingSphere.radius = Math.sqrt(a),
isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this)
}
}
}(),
computeFaceNormals: function () {
},
computeVertexNormals: function () {
var e = this.index,
t = this.attributes,
r = this.groups;
if (t.position) {
var i = t.position.array;
if (void 0 === t.normal) this.addAttribute('normal', new THREE.BufferAttribute(new Float32Array(i.length), 3));
else for (var n = t.normal.array, o = 0, a = n.length; a > o; o++) n[o] = 0;
var s,
h,
c,
n = t.normal.array,
u = new THREE.Vector3,
l = new THREE.Vector3,
E = new THREE.Vector3,
p = new THREE.Vector3,
d = new THREE.Vector3;
if (e) {
e = e.array,
0 === r.length && this.addGroup(0, e.length);
for (var f = 0, m = r.length; m > f; ++f) for (o = r[f], a = o.start, s = o.count, o = a, a += s; a > o; o += 3) s = 3 * e[o + 0],
h = 3 * e[o + 1],
c = 3 * e[o + 2],
u.fromArray(i, s),
l.fromArray(i, h),
E.fromArray(i, c),
p.subVectors(E, l),
d.subVectors(u, l),
p.cross(d),
n[s] += p.x,
n[s + 1] += p.y,
n[s + 2] += p.z,
n[h] += p.x,
n[h + 1] += p.y,
n[h + 2] += p.z,
n[c] += p.x,
n[c + 1] += p.y,
n[c + 2] += p.z
} else for (o = 0, a = i.length; a > o; o += 9) u.fromArray(i, o),
l.fromArray(i, o + 3),
E.fromArray(i, o + 6),
p.subVectors(E, l),
d.subVectors(u, l),
p.cross(d),
n[o] = p.x,
n[o + 1] = p.y,
n[o + 2] = p.z,
n[o + 3] = p.x,
n[o + 4] = p.y,
n[o + 5] = p.z,
n[o + 6] = p.x,
n[o + 7] = p.y,
n[o + 8] = p.z;
this.normalizeNormals(),
t.normal.needsUpdate = !0
}
},
computeTangents: function () {
console.warn('THREE.BufferGeometry: .computeTangents() has been removed.')
},
computeOffsets: function (e) {
console.warn('THREE.BufferGeometry: .computeOffsets() has been removed.')
},
merge: function (e, t) {
if (!1 != e instanceof THREE.BufferGeometry) {
void 0 === t && (t = 0);
var r,
i = this.attributes;
for (r in i) if (void 0 !== e.attributes[r]) for (var n = i[r].array, o = e.attributes[r], a = o.array, s = 0, o = o.itemSize * t; s < a.length; s++, o++) n[o] = a[s];
return this
}
console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', e)
},
normalizeNormals: function () {
for (var e, t, r, i = this.attributes.normal.array, n = 0, o = i.length; o > n; n += 3) e = i[n],
t = i[n + 1],
r = i[n + 2],
e = 1 / Math.sqrt(e * e + t * t + r * r),
i[n] *= e,
i[n + 1] *= e,
i[n + 2] *= e
},
toJSON: function () {
var e = {
metadata: {
version: 4.4,
type: 'BufferGeometry',
generator: 'BufferGeometry.toJSON'
}
};
if (e.uuid = this.uuid, e.type = this.type, '' !== this.name && (e.name = this.name), void 0 !== this.parameters) {
var t,
r = this.parameters;
for (t in r) void 0 !== r[t] && (e[t] = r[t]);
return e
}
e.data = {
attributes: {
}
};
var i = this.index;
null !== i && (r = Array.prototype.slice.call(i.array), e.data.index = {
type: i.array.constructor.name,
array: r
}),
i = this.attributes;
for (t in i) {
var n = i[t],
r = Array.prototype.slice.call(n.array);
e.data.attributes[t] = {
itemSize: n.itemSize,
type: n.array.constructor.name,
array: r
}
}
return t = this.groups,
0 < t.length && (e.data.groups = JSON.parse(JSON.stringify(t))),
t = this.boundingSphere,
null !== t && (e.data.boundingSphere = {
center: t.center.toArray(),
radius: t.radius
}),
e
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
var t = e.index;
null !== t && this.setIndex(t.clone());
var r,
t = e.attributes;
for (r in t) this.addAttribute(r, t[r].clone());
for (e = e.groups, r = 0, t = e.length; t > r; r++) {
var i = e[r];
this.addGroup(i.start, i.count)
}
return this
},
dispose: function () {
this.dispatchEvent({
type: 'dispose'
})
}
},
THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),
THREE.BufferGeometry.MaxIndex = 65535,
THREE.InstancedBufferGeometry = function () {
THREE.BufferGeometry.call(this),
this.type = 'InstancedBufferGeometry',
this.maxInstancedCount = void 0
},
THREE.InstancedBufferGeometry.prototype = Object.create(THREE.BufferGeometry.prototype),
THREE.InstancedBufferGeometry.prototype.constructor = THREE.InstancedBufferGeometry,
THREE.InstancedBufferGeometry.prototype.addGroup = function (e, t, r) {
this.groups.push({
start: e,
count: t,
instances: r
})
},
THREE.InstancedBufferGeometry.prototype.copy = function (e) {
var t = e.index;
null !== t && this.setIndex(t.clone());
var r,
t = e.attributes;
for (r in t) this.addAttribute(r, t[r].clone());
for (e = e.groups, r = 0, t = e.length; t > r; r++) {
var i = e[r];
this.addGroup(i.start, i.count, i.instances)
}
return this
},
THREE.EventDispatcher.prototype.apply(THREE.InstancedBufferGeometry.prototype),
THREE.AnimationAction = function (e, t, r, i, n) {
if (void 0 === e) throw Error('clip is null');
this.clip = e,
this.localRoot = null,
this.startTime = t || 0,
this.timeScale = r || 1,
this.weight = i || 1,
this.loop = n || THREE.LoopRepeat,
this.loopCount = 0,
this.enabled = !0,
this.actionTime = - this.startTime,
this.clipTime = 0,
this.propertyBindings = [
]
},
THREE.AnimationAction.prototype = {
constructor: THREE.AnimationAction,
setLocalRoot: function (e) {
return this.localRoot = e,
this
},
updateTime: function (e) {
var t = this.clipTime,
r = this.loopCount,
i = this.clip.duration;
return this.actionTime += e,
this.loop === THREE.LoopOnce ? (this.loopCount = 0, this.clipTime = Math.min(Math.max(this.actionTime, 0), i), this.clipTime !== t && (this.clipTime === i ? this.mixer.dispatchEvent({
type: 'finished',
action: this,
direction: 1
}) : 0 === this.clipTime && this.mixer.dispatchEvent({
type: 'finished',
action: this,
direction: - 1
})), this.clipTime) : (this.loopCount = Math.floor(this.actionTime / i), e = this.actionTime - this.loopCount * i, e %= i, this.loop == THREE.LoopPingPong && 1 === Math.abs(this.loopCount % 2) && (e = i - e), this.clipTime = e, this.loopCount !== r && this.mixer.dispatchEvent({
type: 'loop',
action: this,
loopDelta: this.loopCount - this.loopCount
}), this.clipTime)
},
syncWith: function (e) {
return this.actionTime = e.actionTime,
this.timeScale = e.timeScale,
this
},
warpToDuration: function (e) {
return this.timeScale = this.clip.duration / e,
this
},
init: function (e) {
return this.clipTime = e - this.startTime,
this
},
update: function (e) {
return this.updateTime(e),
this.clip.getAt(this.clipTime)
},
getTimeScaleAt: function (e) {
return this.timeScale.getAt ? this.timeScale.getAt(e) : this.timeScale
},
getWeightAt: function (e) {
return this.weight.getAt ? this.weight.getAt(e) : this.weight
}
},
THREE.AnimationClip = function (e, t, r) {
if (this.name = e, this.tracks = r, this.duration = void 0 !== t ? t : - 1, 0 > this.duration) for (e = 0; e < this.tracks.length; e++) t = this.tracks[e],
this.duration = Math.max(t.keys[t.keys.length - 1].time);
this.trim(),
this.optimize(),
this.results = [
]
},
THREE.AnimationClip.prototype = {
constructor: THREE.AnimationClip,
getAt: function (e) {
e = Math.max(0, Math.min(e, this.duration));
for (var t = 0; t < this.tracks.length; t++) this.results[t] = this.tracks[t].getAt(e);
return this.results
},
trim: function () {
for (var e = 0; e < this.tracks.length; e++) this.tracks[e].trim(0, this.duration);
return this
},
optimize: function () {
for (var e = 0; e < this.tracks.length; e++) this.tracks[e].optimize();
return this
}
},
THREE.AnimationClip.CreateFromMorphTargetSequence = function (e, t, r) {
for (var i = t.length, n = [
], o = 0; i > o; o++) {
var a = [
];
a.push({
time: (o + i - 1) % i,
value: 0
}),
a.push({
time: o,
value: 1
}),
a.push({
time: (o + 1) % i,
value: 0
}),
a.sort(THREE.KeyframeTrack.keyComparer),
0 === a[0].time && a.push({
time: i,
value: a[0].value
}),
n.push(new THREE.NumberKeyframeTrack('.morphTargetInfluences[' + t[o].name + ']', a).scale(1 / r))
}
return new THREE.AnimationClip(e, - 1, n)
},
THREE.AnimationClip.findByName = function (e, t) {
for (var r = 0; r < e.length; r++) if (e[r].name === t) return e[r];
return null
},
THREE.AnimationClip.CreateClipsFromMorphTargetSequences = function (e, t) {
for (var r = {
}, i = /^([\w-]*?)([\d]+)$/, n = 0, o = e.length; o > n; n++) {
var a = e[n],
s = a.name.match(i);
if (s && 1 < s.length) {
var h = s[1];
(s = r[h]) || (r[h] = s = [
]),
s.push(a)
}
}
i = [
];
for (h in r) i.push(THREE.AnimationClip.CreateFromMorphTargetSequence(h, r[h], t));
return i
},
THREE.AnimationClip.parse = function (e) {
for (var t = [
], r = 0; r < e.tracks.length; r++) t.push(THREE.KeyframeTrack.parse(e.tracks[r]).scale(1 / e.fps));
return new THREE.AnimationClip(e.name, e.duration, t)
},
THREE.AnimationClip.parseAnimation = function (e, t, r) {
if (!e) return console.error(' no animation in JSONLoader data'),
null;
var i = function (e, t, r, i, n) {
for (var o = [
], a = 0; a < t.length; a++) {
var s = t[a];
void 0 !== s[r] && o.push({
time: s.time,
value: n(s)
})
}
return 0 < o.length ? new i(e, o) : null
},
n = [
],
o = e.name || 'default',
a = e.length || - 1,
s = e.fps || 30;
e = e.hierarchy || [
];
for (var h = 0; h < e.length; h++) {
var c = e[h].keys;
if (c && 0 != c.length) if (c[0].morphTargets) {
for (var a = {
}, u = 0; u < c.length; u++) if (c[u].morphTargets) for (var l = 0; l < c[u].morphTargets.length; l++) a[c[u].morphTargets[l]] = - 1;
for (var E in a) {
for (var p = [
], l = 0; l < c[u].morphTargets.length; l++) {
var d = c[u];
p.push({
time: d.time,
value: d.morphTarget === E ? 1 : 0
})
}
n.push(new THREE.NumberKeyframeTrack(r + '.morphTargetInfluence[' + E + ']', p))
}
a = a.length * (s || 1)
} else u = r + '.bones[' + t[h].name + ']',
(l = i(u + '.position', c, 'pos', THREE.VectorKeyframeTrack, function (e) {
return (new THREE.Vector3).fromArray(e.pos)
})) && n.push(l),
(l = i(u + '.quaternion', c, 'rot', THREE.QuaternionKeyframeTrack, function (e) {
return e.rot.slerp ? e.rot.clone() : (new THREE.Quaternion).fromArray(e.rot)
})) && n.push(l),
(c = i(u + '.scale', c, 'scl', THREE.VectorKeyframeTrack, function (e) {
return (new THREE.Vector3).fromArray(e.scl)
})) && n.push(c)
}
return 0 === n.length ? null : new THREE.AnimationClip(o, a, n)
},
THREE.AnimationMixer = function (e) {
this.root = e,
this.time = 0,
this.timeScale = 1,
this.actions = [
],
this.propertyBindingMap = {
}
},
THREE.AnimationMixer.prototype = {
constructor: THREE.AnimationMixer,
addAction: function (e) {
this.actions.push(e),
e.init(this.time),
e.mixer = this;
for (var t = e.clip.tracks, r = e.localRoot || this.root, i = 0; i < t.length; i++) {
var n = t[i],
o = r.uuid + '-' + n.name,
a = this.propertyBindingMap[o];
void 0 === a && (a = new THREE.PropertyBinding(r, n.name), this.propertyBindingMap[o] = a),
e.propertyBindings.push(a),
a.referenceCount += 1
}
},
removeAllActions: function () {
for (var e = 0; e < this.actions.length; e++) this.actions[e].mixer = null;
for (var t in this.propertyBindingMap) this.propertyBindingMap[t].unbind();
return this.actions = [
],
this.propertyBindingMap = {
},
this
},
removeAction: function (e) {
var t = this.actions.indexOf(e);
- 1 !== t && (this.actions.splice(t, 1), e.mixer = null),
t = e.localRoot || this.root,
e = e.clip.tracks;
for (var r = 0; r < e.length; r++) {
var i = t.uuid + '-' + e[r].name,
n = this.propertyBindingMap[i];
n.referenceCount -= 1,
0 >= n.referenceCount && (n.unbind(), delete this.propertyBindingMap[i])
}
return this
},
findActionByName: function (e) {
for (var t = 0; t < this.actions.length; t++) if (this.actions[t].name === e) return this.actions[t];
return null
},
play: function (e, t) {
return e.startTime = this.time,
this.addAction(e),
this
},
fadeOut: function (e, t) {
var r = [
];
return r.push({
time: this.time,
value: 1
}),
r.push({
time: this.time + t,
value: 0
}),
e.weight = new THREE.NumberKeyframeTrack('weight', r),
this
},
fadeIn: function (e, t) {
var r = [
];
return r.push({
time: this.time,
value: 0
}),
r.push({
time: this.time + t,
value: 1
}),
e.weight = new THREE.NumberKeyframeTrack('weight', r),
this
},
warp: function (e, t, r, i) {
var n = [
];
return n.push({
time: this.time,
value: t
}),
n.push({
time: this.time + i,
value: r
}),
e.timeScale = new THREE.NumberKeyframeTrack('timeScale', n),
this
},
crossFade: function (e, t, r, i) {
if (this.fadeOut(e, r), this.fadeIn(t, r), i) {
i = e.clip.duration / t.clip.duration;
var n = 1 / i;
this.warp(e, 1, i, r),
this.warp(t, n, 1, r)
}
return this
},
update: function (e) {
e *= this.timeScale,
this.time += e;
for (var t = 0; t < this.actions.length; t++) {
var r = this.actions[t],
i = r.getWeightAt(this.time),
n = r.getTimeScaleAt(this.time),
n = r.update(e * n);
if (!(0 >= r.weight) && r.enabled) for (var o = 0; o < n.length; o++) r.propertyBindings[o].accumulate(n[o], i)
}
for (var a in this.propertyBindingMap) this.propertyBindingMap[a].apply();
return this
}
},
THREE.EventDispatcher.prototype.apply(THREE.AnimationMixer.prototype),
THREE.AnimationUtils = {
getEqualsFunc: function (e) {
return e.equals ? function (e, t) {
return e.equals(t)
}
: function (e, t) {
return e === t
}
},
clone: function (e) {
if ('object' == typeof e) {
if (e.clone) return e.clone();
console.error('can not figure out how to copy exemplarValue', e)
}
return e
},
lerp: function (e, t, r, i) {
return THREE.AnimationUtils.getLerpFunc(e, i) (e, t, r)
},
lerp_object: function (e, t, r) {
return e.lerp(t, r)
},
slerp_object: function (e, t, r) {
return e.slerp(t, r)
},
lerp_number: function (e, t, r) {
return e * (1 - r) + t * r
},
lerp_boolean: function (e, t, r) {
return 0.5 > r ? e : t
},
lerp_boolean_immediate: function (e, t, r) {
return e
},
lerp_string: function (e, t, r) {
return 0.5 > r ? e : t
},
lerp_string_immediate: function (e, t, r) {
return e
},
getLerpFunc: function (e, t) {
if (void 0 === e || null === e) throw Error('examplarValue is null');
switch (typeof e) {
case 'object':
if (e.lerp) return THREE.AnimationUtils.lerp_object;
if (e.slerp) return THREE.AnimationUtils.slerp_object;
break;
case 'number':
return THREE.AnimationUtils.lerp_number;
case 'boolean':
return t ? THREE.AnimationUtils.lerp_boolean : THREE.AnimationUtils.lerp_boolean_immediate;
case 'string':
return t ? THREE.AnimationUtils.lerp_string : THREE.AnimationUtils.lerp_string_immediate
}
}
},
THREE.KeyframeTrack = function (e, t) {
if (void 0 === e) throw Error('track name is undefined');
if (void 0 === t || 0 === t.length) throw Error('no keys in track named ' + e);
this.name = e,
this.keys = t,
this.lastIndex = 0,
this.validate(),
this.optimize()
},
THREE.KeyframeTrack.prototype = {
constructor: THREE.KeyframeTrack,
getAt: function (e) {
for (; this.lastIndex < this.keys.length && e >= this.keys[this.lastIndex].time; ) this.lastIndex++;
for (; 0 < this.lastIndex && e < this.keys[this.lastIndex - 1].time; ) this.lastIndex--;
if (this.lastIndex >= this.keys.length) return this.setResult(this.keys[this.keys.length - 1].value),
this.result;
if (0 === this.lastIndex) return this.setResult(this.keys[0].value),
this.result;
var t = this.keys[this.lastIndex - 1];
if (this.setResult(t.value), t.constantToNext) return this.result;
var r = this.keys[this.lastIndex];
return this.result = this.lerpValues(this.result, r.value, (e - t.time) / (r.time - t.time))
},
shift: function (e) {
if (0 !== e) for (var t = 0; t < this.keys.length; t++) this.keys[t].time += e;
return this
},
scale: function (e) {
if (1 !== e) for (var t = 0; t < this.keys.length; t++) this.keys[t].time *= e;
return this
},
trim: function (e, t) {
for (var r = 0, i = 1; i < this.keys.length; i++) this.keys[i] <= e && r++;
for (var n = 0, i = this.keys.length - 2; i > 0 && this.keys[i] >= t; i++) n++;
return r + n > 0 && (this.keys = this.keys.splice(r, this.keys.length - n - r)),
this
},
validate: function () {
var e = null;
if (0 !== this.keys.length) {
for (var t = 0; t < this.keys.length; t++) {
var r = this.keys[t];
if (!r) return void console.error(' key is null in track', this, t);
if ('number' != typeof r.time || isNaN(r.time)) return void console.error(' key.time is not a valid number', this, t, r);
if (void 0 === r.value || null === r.value) return void console.error(' key.value is null in track', this, t, r);
if (e && e.time > r.time) return void console.error(' key.time is less than previous key time, out of order keys', this, t, r, e);
e = r
}
return this
}
console.error(' track is empty, no keys', this)
},
optimize: function () {
var e = [
],
t = this.keys[0];
e.push(t),
THREE.AnimationUtils.getEqualsFunc(t.value);
for (var r = 1; r < this.keys.length - 1; r++) {
var i = this.keys[r],
n = this.keys[r + 1];
t.time === i.time || this.compareValues(t.value, i.value) && this.compareValues(i.value, n.value) || (t.constantToNext = this.compareValues(t.value, i.value), e.push(i), t = i)
}
return e.push(this.keys[this.keys.length - 1]),
this.keys = e,
this
}
},
THREE.KeyframeTrack.keyComparer = function (e, t) {
return e.time - t.time
},
THREE.KeyframeTrack.parse = function (e) {
if (void 0 === e.type) throw Error('track type undefined, can not parse');
return THREE.KeyframeTrack.GetTrackTypeForTypeName(e.type).parse(e)
},
THREE.KeyframeTrack.GetTrackTypeForTypeName = function (e) {
switch (e.toLowerCase()) {
case 'vector':
case 'vector2':
case 'vector3':
case 'vector4':
return THREE.VectorKeyframeTrack;
case 'quaternion':
return THREE.QuaternionKeyframeTrack;
case 'integer':
case 'scalar':
case 'double':
case 'float':
case 'number':
return THREE.NumberKeyframeTrack;
case 'bool':
case 'boolean':
return THREE.BooleanKeyframeTrack;
case 'string':
return THREE.StringKeyframeTrack
}
throw Error('Unsupported typeName: ' + e)
},
THREE.PropertyBinding = function (e, t) {
this.rootNode = e,
this.trackName = t,
this.referenceCount = 0,
this.originalValue = null;
var r = THREE.PropertyBinding.parseTrackName(t);
this.directoryName = r.directoryName,
this.nodeName = r.nodeName,
this.objectName = r.objectName,
this.objectIndex = r.objectIndex,
this.propertyName = r.propertyName,
this.propertyIndex = r.propertyIndex,
this.node = THREE.PropertyBinding.findNode(e, this.nodeName) || e,
this.cumulativeValue = null,
this.cumulativeWeight = 0
},
THREE.PropertyBinding.prototype = {
constructor: THREE.PropertyBinding,
reset: function () {
this.cumulativeValue = null,
this.cumulativeWeight = 0
},
accumulate: function (e, t) {
this.isBound || this.bind(),
0 === this.cumulativeWeight ? t > 0 && (null === this.cumulativeValue && (this.cumulativeValue = THREE.AnimationUtils.clone(e)), this.cumulativeWeight = t) : (this.cumulativeValue = this.lerpValue(this.cumulativeValue, e, t / (this.cumulativeWeight + t)), this.cumulativeWeight += t)
},
unbind: function () {
this.isBound && (this.setValue(this.originalValue), this.triggerDirty = this.equalsValue = this.lerpValue = this.getValue = this.setValue = null, this.isBound = !1)
},
bind: function () {
if (!this.isBound) {
var e = this.node;
if (e) {
if (this.objectName) {
if ('materials' === this.objectName) {
if (!e.material) return void console.error(' can not bind to material as node does not have a material', this);
if (!e.material.materials) return void console.error(' can not bind to material.materials as node.material does not have a materials array', this);
e = e.material.materials
} else if ('bones' === this.objectName) {
if (!e.skeleton) return void console.error(' can not bind to bones as node does not have a skeleton', this);
for (var e = e.skeleton.bones, t = 0; t < e.length; t++) if (e[t].name === this.objectIndex) {
this.objectIndex = t;
break
}
} else {
if (void 0 === e[this.objectName]) return void console.error(' can not bind to objectName of node, undefined', this);
e = e[this.objectName]
}
if (void 0 !== this.objectIndex) {
if (void 0 === e[this.objectIndex]) return void console.error(' trying to bind to objectIndex of objectName, but is undefined:', this, e);
e = e[this.objectIndex]
}
}
var r = e[this.propertyName];
if (r) {
if (void 0 !== this.propertyIndex) {
if ('morphTargetInfluences' === this.propertyName) for (e.geometry || console.error(' can not bind to morphTargetInfluences becasuse node does not have a geometry', this), e.geometry.morphTargets || console.error(' can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets', this), t = 0; t < this.node.geometry.morphTargets.length; t++) if (e.geometry.morphTargets[t].name === this.propertyIndex) {
this.propertyIndex = t;
break
}
this.setValue = function (e) {
return this.equalsValue(r[this.propertyIndex], e) ? !1 : (r[this.propertyIndex] = e, !0)
},
this.getValue = function () {
return r[this.propertyIndex]
}
} else r.copy ? (this.setValue = function (e) {
return this.equalsValue(r, e) ? !1 : (r.copy(e), !0)
}, this.getValue = function () {
return r
}) : (this.setValue = function (t) {
return this.equalsValue(e[this.propertyName], t) ? !1 : (e[this.propertyName] = t, !0)
}, this.getValue = function () {
return e[this.propertyName]
});
void 0 !== e.needsUpdate ? this.triggerDirty = function () {
this.node.needsUpdate = !0
}
: void 0 !== e.matrixWorldNeedsUpdate && (this.triggerDirty = function () {
e.matrixWorldNeedsUpdate = !0
}),
this.originalValue = this.getValue(),
this.equalsValue = THREE.AnimationUtils.getEqualsFunc(this.originalValue),
this.lerpValue = THREE.AnimationUtils.getLerpFunc(this.originalValue, !0),
this.isBound = !0
} else console.error(' trying to update property for track: ' + this.nodeName + '.' + this.propertyName + ' but it wasn\'t found.', e)
} else console.error(' trying to update node for track: ' + this.trackName + ' but it wasn\'t found.')
}
},
apply: function () {
if (this.isBound || this.bind(), 0 < this.cumulativeWeight) {
if (1 > this.cumulativeWeight) {
var e = 1 - this.cumulativeWeight;
this.cumulativeValue = this.lerpValue(this.cumulativeValue, this.originalValue, e / (this.cumulativeWeight + e))
}
this.setValue(this.cumulativeValue) && this.triggerDirty && this.triggerDirty(),
this.cumulativeValue = null,
this.cumulativeWeight = 0
}
}
},
THREE.PropertyBinding.parseTrackName = function (e) {
var t = /^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,
r = t.exec(e);
if (!r) throw Error('cannot parse trackName at all: ' + e);
if (r.index === t.lastIndex && t.lastIndex++, t = {
directoryName: r[1],
nodeName: r[3],
objectName: r[5],
objectIndex: r[7],
propertyName: r[9],
propertyIndex: r[11]
}, null === t.propertyName || 0 === t.propertyName.length) throw Error('can not parse propertyName from trackName: ' + e);
return t
},
THREE.PropertyBinding.findNode = function (e, t) {
function r(e) {
for (var r = 0; r < e.bones.length; r++) {
var i = e.bones[r];
if (i.name === t) return i
}
return null
}
function i(e) {
for (var r = 0; r < e.length; r++) {
var n = e[r];
if (n.name === t || n.uuid === t || (n = i(n.children))) return n
}
return null
}
if (!t || '' === t || 'root' === t || '.' === t || - 1 === t || t === e.name || t === e.uuid) return e;
if (e.skeleton) {
var n = r(e.skeleton);
if (n) return n
}
return e.children && (n = i(e.children)) ? n : null
},
THREE.VectorKeyframeTrack = function (e, t) {
THREE.KeyframeTrack.call(this, e, t),
this.result = this.keys[0].value.clone()
},
THREE.VectorKeyframeTrack.prototype = Object.create(THREE.KeyframeTrack.prototype),
THREE.VectorKeyframeTrack.prototype.constructor = THREE.VectorKeyframeTrack,
THREE.VectorKeyframeTrack.prototype.setResult = function (e) {
this.result.copy(e)
},
THREE.VectorKeyframeTrack.prototype.lerpValues = function (e, t, r) {
return e.lerp(t, r)
},
THREE.VectorKeyframeTrack.prototype.compareValues = function (e, t) {
return e.equals(t)
},
THREE.VectorKeyframeTrack.prototype.clone = function () {
for (var e = [
], t = 0; t < this.keys.length; t++) {
var r = this.keys[t];
e.push({
time: r.time,
value: r.value.clone()
})
}
return new THREE.VectorKeyframeTrack(this.name, e)
},
THREE.VectorKeyframeTrack.parse = function (e) {
for (var t = THREE['Vector' + e.keys[0].value.length], r = [
], i = 0; i < e.keys.length; i++) {
var n = e.keys[i];
r.push({
value: (new t).fromArray(n.value),
time: n.time
})
}
return new THREE.VectorKeyframeTrack(e.name, r)
},
THREE.QuaternionKeyframeTrack = function (e, t) {
THREE.KeyframeTrack.call(this, e, t),
this.result = this.keys[0].value.clone()
},
THREE.QuaternionKeyframeTrack.prototype = Object.create(THREE.KeyframeTrack.prototype),
THREE.QuaternionKeyframeTrack.prototype.constructor = THREE.QuaternionKeyframeTrack,
THREE.QuaternionKeyframeTrack.prototype.setResult = function (e) {
this.result.copy(e)
},
THREE.QuaternionKeyframeTrack.prototype.lerpValues = function (e, t, r) {
return e.slerp(t, r)
},
THREE.QuaternionKeyframeTrack.prototype.compareValues = function (e, t) {
return e.equals(t)
},
THREE.QuaternionKeyframeTrack.prototype.multiply = function (e) {
for (var t = 0; t < this.keys.length; t++) this.keys[t].value.multiply(e);
return this
},
THREE.QuaternionKeyframeTrack.prototype.clone = function () {
for (var e = [
], t = 0; t < this.keys.length; t++) {
var r = this.keys[t];
e.push({
time: r.time,
value: r.value.clone()
})
}
return new THREE.QuaternionKeyframeTrack(this.name, e)
},
THREE.QuaternionKeyframeTrack.parse = function (e) {
for (var t = [
], r = 0; r < e.keys.length; r++) {
var i = e.keys[r];
t.push({
value: (new THREE.Quaternion).fromArray(i.value),
time: i.time
})
}
return new THREE.QuaternionKeyframeTrack(e.name, t)
},
THREE.StringKeyframeTrack = function (e, t) {
THREE.KeyframeTrack.call(this, e, t),
this.result = this.keys[0].value
},
THREE.StringKeyframeTrack.prototype = Object.create(THREE.KeyframeTrack.prototype),
THREE.StringKeyframeTrack.prototype.constructor = THREE.StringKeyframeTrack,
THREE.StringKeyframeTrack.prototype.setResult = function (e) {
this.result = e
},
THREE.StringKeyframeTrack.prototype.lerpValues = function (e, t, r) {
return 1 > r ? e : t
},
THREE.StringKeyframeTrack.prototype.compareValues = function (e, t) {
return e === t
},
THREE.StringKeyframeTrack.prototype.clone = function () {
for (var e = [
], t = 0; t < this.keys.length; t++) {
var r = this.keys[t];
e.push({
time: r.time,
value: r.value
})
}
return new THREE.StringKeyframeTrack(this.name, e)
},
THREE.StringKeyframeTrack.parse = function (e) {
return new THREE.StringKeyframeTrack(e.name, e.keys)
},
THREE.BooleanKeyframeTrack = function (e, t) {
THREE.KeyframeTrack.call(this, e, t),
this.result = this.keys[0].value
},
THREE.BooleanKeyframeTrack.prototype = Object.create(THREE.KeyframeTrack.prototype),
THREE.BooleanKeyframeTrack.prototype.constructor = THREE.BooleanKeyframeTrack,
THREE.BooleanKeyframeTrack.prototype.setResult = function (e) {
this.result = e
},
THREE.BooleanKeyframeTrack.prototype.lerpValues = function (e, t, r) {
return 1 > r ? e : t
},
THREE.BooleanKeyframeTrack.prototype.compareValues = function (e, t) {
return e === t
},
THREE.BooleanKeyframeTrack.prototype.clone = function () {
for (var e = [
], t = 0; t < this.keys.length; t++) {
var r = this.keys[t];
e.push({
time: r.time,
value: r.value
})
}
return new THREE.BooleanKeyframeTrack(this.name, e)
},
THREE.BooleanKeyframeTrack.parse = function (e) {
return new THREE.BooleanKeyframeTrack(e.name, e.keys)
},
THREE.NumberKeyframeTrack = function (e, t) {
THREE.KeyframeTrack.call(this, e, t),
this.result = this.keys[0].value
},
THREE.NumberKeyframeTrack.prototype = Object.create(THREE.KeyframeTrack.prototype),
THREE.NumberKeyframeTrack.prototype.constructor = THREE.NumberKeyframeTrack,
THREE.NumberKeyframeTrack.prototype.setResult = function (e) {
this.result = e
},
THREE.NumberKeyframeTrack.prototype.lerpValues = function (e, t, r) {
return e * (1 - r) + t * r
},
THREE.NumberKeyframeTrack.prototype.compareValues = function (e, t) {
return e === t
},
THREE.NumberKeyframeTrack.prototype.clone = function () {
for (var e = [
], t = 0; t < this.keys.length; t++) {
var r = this.keys[t];
e.push({
time: r.time,
value: r.value
})
}
return new THREE.NumberKeyframeTrack(this.name, e)
},
THREE.NumberKeyframeTrack.parse = function (e) {
return new THREE.NumberKeyframeTrack(e.name, e.keys)
},
THREE.Camera = function () {
THREE.Object3D.call(this),
this.type = 'Camera',
this.matrixWorldInverse = new THREE.Matrix4,
this.projectionMatrix = new THREE.Matrix4
},
THREE.Camera.prototype = Object.create(THREE.Object3D.prototype),
THREE.Camera.prototype.constructor = THREE.Camera,
THREE.Camera.prototype.getWorldDirection = function () {
var e = new THREE.Quaternion;
return function (t) {
return t = t || new THREE.Vector3,
this.getWorldQuaternion(e),
t.set(0, 0, - 1).applyQuaternion(e)
}
}(),
THREE.Camera.prototype.lookAt = function () {
var e = new THREE.Matrix4;
return function (t) {
e.lookAt(this.position, t, this.up),
this.quaternion.setFromRotationMatrix(e)
}
}(),
THREE.Camera.prototype.clone = function () {
return (new this.constructor).copy(this)
},
THREE.Camera.prototype.copy = function (e) {
return THREE.Object3D.prototype.copy.call(this, e),
this.matrixWorldInverse.copy(e.matrixWorldInverse),
this.projectionMatrix.copy(e.projectionMatrix),
this
},
THREE.CubeCamera = function (e, t, r) {
THREE.Object3D.call(this),
this.type = 'CubeCamera';
var i = new THREE.PerspectiveCamera(90, 1, e, t);
i.up.set(0, - 1, 0),
i.lookAt(new THREE.Vector3(1, 0, 0)),
this.add(i);
var n = new THREE.PerspectiveCamera(90, 1, e, t);
n.up.set(0, - 1, 0),
n.lookAt(new THREE.Vector3( - 1, 0, 0)),
this.add(n);
var o = new THREE.PerspectiveCamera(90, 1, e, t);
o.up.set(0, 0, 1),
o.lookAt(new THREE.Vector3(0, 1, 0)),
this.add(o);
var a = new THREE.PerspectiveCamera(90, 1, e, t);
a.up.set(0, 0, - 1),
a.lookAt(new THREE.Vector3(0, - 1, 0)),
this.add(a);
var s = new THREE.PerspectiveCamera(90, 1, e, t);
s.up.set(0, - 1, 0),
s.lookAt(new THREE.Vector3(0, 0, 1)),
this.add(s);
var h = new THREE.PerspectiveCamera(90, 1, e, t);
h.up.set(0, - 1, 0),
h.lookAt(new THREE.Vector3(0, 0, - 1)),
this.add(h),
this.renderTarget = new THREE.WebGLRenderTargetCube(r, r, {
format: THREE.RGBFormat,
magFilter: THREE.LinearFilter,
minFilter: THREE.LinearFilter
}),
this.updateCubeMap = function (e, t) {
null === this.parent && this.updateMatrixWorld();
var r = this.renderTarget,
c = r.texture.generateMipmaps;
r.texture.generateMipmaps = !1,
r.activeCubeFace = 0,
e.render(t, i, r),
r.activeCubeFace = 1,
e.render(t, n, r),
r.activeCubeFace = 2,
e.render(t, o, r),
r.activeCubeFace = 3,
e.render(t, a, r),
r.activeCubeFace = 4,
e.render(t, s, r),
r.texture.generateMipmaps = c,
r.activeCubeFace = 5,
e.render(t, h, r),
e.setRenderTarget(null)
}
},
THREE.CubeCamera.prototype = Object.create(THREE.Object3D.prototype),
THREE.CubeCamera.prototype.constructor = THREE.CubeCamera,
THREE.OrthographicCamera = function (e, t, r, i, n, o) {
THREE.Camera.call(this),
this.type = 'OrthographicCamera',
this.zoom = 1,
this.left = e,
this.right = t,
this.top = r,
this.bottom = i,
this.near = void 0 !== n ? n : 0.1,
this.far = void 0 !== o ? o : 2000,
this.updateProjectionMatrix()
},
THREE.OrthographicCamera.prototype = Object.create(THREE.Camera.prototype),
THREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera,
THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
var e = (this.right - this.left) / (2 * this.zoom),
t = (this.top - this.bottom) / (2 * this.zoom),
r = (this.right + this.left) / 2,
i = (this.top + this.bottom) / 2;
this.projectionMatrix.makeOrthographic(r - e, r + e, i + t, i - t, this.near, this.far)
},
THREE.OrthographicCamera.prototype.copy = function (e) {
return THREE.Camera.prototype.copy.call(this, e),
this.left = e.left,
this.right = e.right,
this.top = e.top,
this.bottom = e.bottom,
this.near = e.near,
this.far = e.far,
this.zoom = e.zoom,
this
},
THREE.OrthographicCamera.prototype.toJSON = function (e) {
return e = THREE.Object3D.prototype.toJSON.call(this, e),
e.object.zoom = this.zoom,
e.object.left = this.left,
e.object.right = this.right,
e.object.top = this.top,
e.object.bottom = this.bottom,
e.object.near = this.near,
e.object.far = this.far,
e
},
THREE.PerspectiveCamera = function (e, t, r, i) {
THREE.Camera.call(this),
this.type = 'PerspectiveCamera',
this.zoom = 1,
this.fov = void 0 !== e ? e : 50,
this.aspect = void 0 !== t ? t : 1,
this.near = void 0 !== r ? r : 0.1,
this.far = void 0 !== i ? i : 2000,
this.updateProjectionMatrix()
},
THREE.PerspectiveCamera.prototype = Object.create(THREE.Camera.prototype),
THREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera,
THREE.PerspectiveCamera.prototype.setLens = function (e, t) {
void 0 === t && (t = 24),
this.fov = 2 * THREE.Math.radToDeg(Math.atan(t / (2 * e))),
this.updateProjectionMatrix()
},
THREE.PerspectiveCamera.prototype.setViewOffset = function (e, t, r, i, n, o) {
this.fullWidth = e,
this.fullHeight = t,
this.x = r,
this.y = i,
this.width = n,
this.height = o,
this.updateProjectionMatrix()
},
THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
var e = THREE.Math.radToDeg(2 * Math.atan(Math.tan(0.5 * THREE.Math.degToRad(this.fov)) / this.zoom));
if (this.fullWidth) {
var t = this.fullWidth / this.fullHeight,
e = Math.tan(THREE.Math.degToRad(0.5 * e)) * this.near,
r = - e,
i = t * r,
t = Math.abs(t * e - i),
r = Math.abs(e - r);
this.projectionMatrix.makeFrustum(i + this.x * t / this.fullWidth, i + (this.x + this.width) * t / this.fullWidth, e - (this.y + this.height) * r / this.fullHeight, e - this.y * r / this.fullHeight, this.near, this.far)
} else this.projectionMatrix.makePerspective(e, this.aspect, this.near, this.far)
},
THREE.PerspectiveCamera.prototype.copy = function (e) {
return THREE.Camera.prototype.copy.call(this, e),
this.fov = e.fov,
this.aspect = e.aspect,
this.near = e.near,
this.far = e.far,
this.zoom = e.zoom,
this
},
THREE.PerspectiveCamera.prototype.toJSON = function (e) {
return e = THREE.Object3D.prototype.toJSON.call(this, e),
e.object.zoom = this.zoom,
e.object.fov = this.fov,
e.object.aspect = this.aspect,
e.object.near = this.near,
e.object.far = this.far,
e
},
THREE.Light = function (e) {
THREE.Object3D.call(this),
this.type = 'Light',
this.color = new THREE.Color(e),
this.receiveShadow = void 0
},
THREE.Light.prototype = Object.create(THREE.Object3D.prototype),
THREE.Light.prototype.constructor = THREE.Light,
Object.defineProperties(THREE.Light.prototype, {
onlyShadow: {
set: function (e) {
console.warn('THREE.Light: .onlyShadow has been removed.')
}
},
shadowCameraFov: {
set: function (e) {
this.shadow.camera.fov = e
}
},
shadowCameraLeft: {
set: function (e) {
this.shadow.camera.left = e
}
},
shadowCameraRight: {
set: function (e) {
this.shadow.camera.right = e
}
},
shadowCameraTop: {
set: function (e) {
this.shadow.camera.top = e
}
},
shadowCameraBottom: {
set: function (e) {
this.shadow.camera.bottom = e
}
},
shadowCameraNear: {
set: function (e) {
this.shadow.camera.near = e
}
},
shadowCameraFar: {
set: function (e) {
this.shadow.camera.far = e
}
},
shadowCameraVisible: {
set: function (e) {
console.warn('THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow ) instead.')
}
},
shadowBias: {
set: function (e) {
this.shadow.bias = e
}
},
shadowDarkness: {
set: function (e) {
this.shadow.darkness = e
}
},
shadowMapWidth: {
set: function (e) {
this.shadow.mapSize.width = e
}
},
shadowMapHeight: {
set: function (e) {
this.shadow.mapSize.height = e
}
}
}),
THREE.Light.prototype.copy = function (e) {
return THREE.Object3D.prototype.copy.call(this, e),
this.color.copy(e.color),
this
},
THREE.Light.prototype.toJSON = function (e) {
return e = THREE.Object3D.prototype.toJSON.call(this, e),
e.object.color = this.color.getHex(),
void 0 !== this.groundColor && (e.object.groundColor = this.groundColor.getHex()),
void 0 !== this.intensity && (e.object.intensity = this.intensity),
void 0 !== this.distance && (e.object.distance = this.distance),
void 0 !== this.angle && (e.object.angle = this.angle),
void 0 !== this.decay && (e.object.decay = this.decay),
void 0 !== this.exponent && (e.object.exponent = this.exponent),
e
},
THREE.LightShadow = function (e) {
this.camera = e,
this.bias = 0,
this.darkness = 1,
this.mapSize = new THREE.Vector2(512, 512),
this.matrix = this.map = null
},
THREE.LightShadow.prototype = {
constructor: THREE.LightShadow,
copy: function (e) {
this.camera = e.camera.clone(),
this.bias = e.bias,
this.darkness = e.darkness,
this.mapSize.copy(e.mapSize)
},
clone: function () {
return (new this.constructor).copy(this)
}
},
THREE.AmbientLight = function (e) {
THREE.Light.call(this, e),
this.type = 'AmbientLight',
this.castShadow = void 0
},
THREE.AmbientLight.prototype = Object.create(THREE.Light.prototype),
THREE.AmbientLight.prototype.constructor = THREE.AmbientLight,
THREE.DirectionalLight = function (e, t) {
THREE.Light.call(this, e),
this.type = 'DirectionalLight',
this.position.set(0, 1, 0),
this.updateMatrix(),
this.target = new THREE.Object3D,
this.intensity = void 0 !== t ? t : 1,
this.shadow = new THREE.LightShadow(new THREE.OrthographicCamera( - 500, 500, 500, - 500, 50, 5000))
},
THREE.DirectionalLight.prototype = Object.create(THREE.Light.prototype),
THREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight,
THREE.DirectionalLight.prototype.copy = function (e) {
return THREE.Light.prototype.copy.call(this, e),
this.intensity = e.intensity,
this.target = e.target.clone(),
this.shadow = e.shadow.clone(),
this
},
THREE.HemisphereLight = function (e, t, r) {
THREE.Light.call(this, e),
this.type = 'HemisphereLight',
this.castShadow = void 0,
this.position.set(0, 1, 0),
this.updateMatrix(),
this.groundColor = new THREE.Color(t),
this.intensity = void 0 !== r ? r : 1
},
THREE.HemisphereLight.prototype = Object.create(THREE.Light.prototype),
THREE.HemisphereLight.prototype.constructor = THREE.HemisphereLight,
THREE.HemisphereLight.prototype.copy = function (e) {
return THREE.Light.prototype.copy.call(this, e),
this.groundColor.copy(e.groundColor),
this.intensity = e.intensity,
this
},
THREE.PointLight = function (e, t, r, i) {
THREE.Light.call(this, e),
this.type = 'PointLight',
this.intensity = void 0 !== t ? t : 1,
this.distance = void 0 !== r ? r : 0,
this.decay = void 0 !== i ? i : 1,
this.shadow = new THREE.LightShadow(new THREE.PerspectiveCamera(90, 1, 1, 500))
},
THREE.PointLight.prototype = Object.create(THREE.Light.prototype),
THREE.PointLight.prototype.constructor = THREE.PointLight,
THREE.PointLight.prototype.copy = function (e) {
return THREE.Light.prototype.copy.call(this, e),
this.intensity = e.intensity,
this.distance = e.distance,
this.decay = e.decay,
this.shadow = e.shadow.clone(),
this
},
THREE.SpotLight = function (e, t, r, i, n, o) {
THREE.Light.call(this, e),
this.type = 'SpotLight',
this.position.set(0, 1, 0),
this.updateMatrix(),
this.target = new THREE.Object3D,
this.intensity = void 0 !== t ? t : 1,
this.distance = void 0 !== r ? r : 0,
this.angle = void 0 !== i ? i : Math.PI / 3,
this.exponent = void 0 !== n ? n : 10,
this.decay = void 0 !== o ? o : 1,
this.shadow = new THREE.LightShadow(new THREE.PerspectiveCamera(50, 1, 50, 5000))
},
THREE.SpotLight.prototype = Object.create(THREE.Light.prototype),
THREE.SpotLight.prototype.constructor = THREE.SpotLight,
THREE.SpotLight.prototype.copy = function (e) {
return THREE.Light.prototype.copy.call(this, e),
this.intensity = e.intensity,
this.distance = e.distance,
this.angle = e.angle,
this.exponent = e.exponent,
this.decay = e.decay,
this.target = e.target.clone(),
this.shadow = e.shadow.clone(),
this
},
THREE.Cache = {
enabled: !1,
files: {
},
add: function (e, t) {
!1 !== this.enabled && (this.files[e] = t)
},
get: function (e) {
return !1 !== this.enabled ? this.files[e] : void 0
},
remove: function (e) {
delete this.files[e]
},
clear: function () {
this.files = {
}
}
},
THREE.Loader = function () {
this.onLoadStart = function () {
},
this.onLoadProgress = function () {
},
this.onLoadComplete = function () {
}
},
THREE.Loader.prototype = {
constructor: THREE.Loader,
crossOrigin: void 0,
extractUrlBase: function (e) {
return e = e.split('/'),
1 === e.length ? './' : (e.pop(), e.join('/') + '/')
},
initMaterials: function (e, t, r) {
for (var i = [
], n = 0; n < e.length; ++n) i[n] = this.createMaterial(e[n], t, r);
return i
},
createMaterial: function () {
var e,
t,
r;
return function (i, n, o) {
function a(e, r, i, a, s) {
e = n + e;
var c = THREE.Loader.Handlers.get(e);
return null !== c ? e = c.load(e) : (t.setCrossOrigin(o), e = t.load(e)),
void 0 !== r && (e.repeat.fromArray(r), 1 !== r[0] && (e.wrapS = THREE.RepeatWrapping), 1 !== r[1] && (e.wrapT = THREE.RepeatWrapping)),
void 0 !== i && e.offset.fromArray(i),
void 0 !== a && ('repeat' === a[0] && (e.wrapS = THREE.RepeatWrapping), 'mirror' === a[0] && (e.wrapS = THREE.MirroredRepeatWrapping), 'repeat' === a[1] && (e.wrapT = THREE.RepeatWrapping), 'mirror' === a[1] && (e.wrapT = THREE.MirroredRepeatWrapping)),
void 0 !== s && (e.anisotropy = s),
r = THREE.Math.generateUUID(),
h[r] = e,
r
}
void 0 === e && (e = new THREE.Color),
void 0 === t && (t = new THREE.TextureLoader),
void 0 === r && (r = new THREE.MaterialLoader);
var s,
h = {
},
c = {
uuid: THREE.Math.generateUUID(),
type: 'MeshLambertMaterial'
};
for (s in i) {
var u = i[s];
switch (s) {
case 'DbgColor':
c.color = u;
break;
case 'DbgIndex':
case 'opticalDensity':
case 'illumination':
break;
case 'DbgName':
c.name = u;
break;
case 'blending':
c.blending = THREE[u];
break;
case 'colorDiffuse':
c.color = e.fromArray(u).getHex();
break;
case 'colorSpecular':
c.specular = e.fromArray(u).getHex();
break;
case 'colorEmissive':
c.emissive = e.fromArray(u).getHex();
break;
case 'specularCoef':
c.shininess = u;
break;
case 'shading':
'basic' === u.toLowerCase() && (c.type = 'MeshBasicMaterial'),
'phong' === u.toLowerCase() && (c.type = 'MeshPhongMaterial');
break;
case 'mapDiffuse':
c.map = a(u, i.mapDiffuseRepeat, i.mapDiffuseOffset, i.mapDiffuseWrap, i.mapDiffuseAnisotropy);
break;
case 'mapDiffuseRepeat':
case 'mapDiffuseOffset':
case 'mapDiffuseWrap':
case 'mapDiffuseAnisotropy':
break;
case 'mapLight':
c.lightMap = a(u, i.mapLightRepeat, i.mapLightOffset, i.mapLightWrap, i.mapLightAnisotropy);
break;
case 'mapLightRepeat':
case 'mapLightOffset':
case 'mapLightWrap':
case 'mapLightAnisotropy':
break;
case 'mapAO':
c.aoMap = a(u, i.mapAORepeat, i.mapAOOffset, i.mapAOWrap, i.mapAOAnisotropy);
break;
case 'mapAORepeat':
case 'mapAOOffset':
case 'mapAOWrap':
case 'mapAOAnisotropy':
break;
case 'mapBump':
c.bumpMap = a(u, i.mapBumpRepeat, i.mapBumpOffset, i.mapBumpWrap, i.mapBumpAnisotropy);
break;
case 'mapBumpScale':
c.bumpScale = u;
break;
case 'mapBumpRepeat':
case 'mapBumpOffset':
case 'mapBumpWrap':
case 'mapBumpAnisotropy':
break;
case 'mapNormal':
c.normalMap = a(u, i.mapNormalRepeat, i.mapNormalOffset, i.mapNormalWrap, i.mapNormalAnisotropy);
break;
case 'mapNormalFactor':
c.normalScale = [
u,
u
];
break;
case 'mapNormalRepeat':
case 'mapNormalOffset':
case 'mapNormalWrap':
case 'mapNormalAnisotropy':
break;
case 'mapSpecular':
c.specularMap = a(u, i.mapSpecularRepeat, i.mapSpecularOffset, i.mapSpecularWrap, i.mapSpecularAnisotropy);
break;
case 'mapSpecularRepeat':
case 'mapSpecularOffset':
case 'mapSpecularWrap':
case 'mapSpecularAnisotropy':
break;
case 'mapAlpha':
c.alphaMap = a(u, i.mapAlphaRepeat, i.mapAlphaOffset, i.mapAlphaWrap, i.mapAlphaAnisotropy);
break;
case 'mapAlphaRepeat':
case 'mapAlphaOffset':
case 'mapAlphaWrap':
case 'mapAlphaAnisotropy':
break;
case 'flipSided':
c.side = THREE.BackSide;
break;
case 'doubleSided':
c.side = THREE.DoubleSide;
break;
case 'transparency':
console.warn('THREE.Loader: transparency has been renamed to opacity'),
c.opacity = u;
break;
case 'opacity':
case 'transparent':
case 'depthTest':
case 'depthWrite':
case 'transparent':
case 'visible':
case 'wireframe':
c[s] = u;
break;
case 'vertexColors':
!0 === u && (c.vertexColors = THREE.VertexColors),
'face' === u && (c.vertexColors = THREE.FaceColors);
break;
default:
console.error('Loader.createMaterial: Unsupported', s, u)
}
}
return 'MeshPhongMaterial' !== c.type && delete c.specular,
1 > c.opacity && (c.transparent = !0),
r.setTextures(h),
r.parse(c)
}
}()
},
THREE.Loader.Handlers = {
handlers: [
],
add: function (e, t) {
this.handlers.push(e, t)
},
get: function (e) {
for (var t = this.handlers, r = 0, i = t.length; i > r; r += 2) {
var n = t[r + 1];
if (t[r].test(e)) return n
}
return null
}
},
THREE.XHRLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager
},
THREE.XHRLoader.prototype = {
constructor: THREE.XHRLoader,
load: function (e, t, r, i) {
var n = this,
o = THREE.Cache.get(e);
if (void 0 !== o) return t && setTimeout(function () {
t(o)
}, 0),
o;
var a = new XMLHttpRequest;
return a.open('GET', e, !0),
a.addEventListener('load', function (r) {
r = r.target.response,
THREE.Cache.add(e, r),
t && t(r),
n.manager.itemEnd(e)
}, !1),
void 0 !== r && a.addEventListener('progress', function (e) {
r(e)
}, !1),
a.addEventListener('error', function (t) {
i && i(t),
n.manager.itemError(e)
}, !1),
void 0 !== this.crossOrigin && (a.crossOrigin = this.crossOrigin),
void 0 !== this.responseType && (a.responseType = this.responseType),
void 0 !== this.withCredentials && (a.withCredentials = this.withCredentials),
a.send(null),
n.manager.itemStart(e),
a
},
setResponseType: function (e) {
this.responseType = e
},
setCrossOrigin: function (e) {
this.crossOrigin = e
},
setWithCredentials: function (e) {
this.withCredentials = e
}
},
THREE.ImageLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager
},
THREE.ImageLoader.prototype = {
constructor: THREE.ImageLoader,
load: function (e, t, r, i) {
var n = this,
o = THREE.Cache.get(e);
if (void 0 !== o) return n.manager.itemStart(e),
t ? setTimeout(function () {
t(o),
n.manager.itemEnd(e)
}, 0) : n.manager.itemEnd(e),
o;
var a = document.createElement('img');
return a.addEventListener('load', function (r) {
THREE.Cache.add(e, this),
t && t(this),
n.manager.itemEnd(e)
}, !1),
void 0 !== r && a.addEventListener('progress', function (e) {
r(e)
}, !1),
a.addEventListener('error', function (t) {
i && i(t),
n.manager.itemError(e)
}, !1),
void 0 !== this.crossOrigin && (a.crossOrigin = this.crossOrigin),
n.manager.itemStart(e),
a.src = e,
a
},
setCrossOrigin: function (e) {
this.crossOrigin = e
}
},
THREE.JSONLoader = function (e) {
'boolean' == typeof e && (console.warn('THREE.JSONLoader: showStatus parameter has been removed from constructor.'), e = void 0),
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager,
this.withCredentials = !1
},
THREE.JSONLoader.prototype = {
constructor: THREE.JSONLoader,
get statusDomElement() {
return void 0 === this._statusDomElement && (this._statusDomElement = document.createElement('div')),
console.warn('THREE.JSONLoader: .statusDomElement has been removed.'),
this._statusDomElement
},
load: function (e, t, r, i) {
var n = this,
o = this.texturePath && 'string' == typeof this.texturePath ? this.texturePath : THREE.Loader.prototype.extractUrlBase(e);
r = new THREE.XHRLoader(this.manager),
r.setCrossOrigin(this.crossOrigin),
r.setWithCredentials(this.withCredentials),
r.load(e, function (r) {
r = JSON.parse(r);
var i = r.metadata;
if (void 0 !== i) {
if ('object' === i.type) return void console.error('THREE.JSONLoader: ' + e + ' should be loaded with THREE.ObjectLoader instead.');
if ('scene' === i.type) return void console.error('THREE.JSONLoader: ' + e + ' should be loaded with THREE.SceneLoader instead.');
}
r = n.parse(r, o),
t(r.geometry, r.materials)
})
},
setCrossOrigin: function (e) {
this.crossOrigin = e
},
setTexturePath: function (e) {
this.texturePath = e
},
parse: function (e, t) {
var r = new THREE.Geometry,
i = void 0 !== e.scale ? 1 / e.scale : 1;
return function (t) {
var i,
n,
o,
a,
s,
h,
c,
u,
l,
E,
p,
d,
f,
m = e.faces;
h = e.vertices;
var T = e.normals,
g = e.colors,
v = 0;
if (void 0 !== e.uvs) {
for (i = 0; i < e.uvs.length; i++) e.uvs[i].length && v++;
for (i = 0; v > i; i++) r.faceVertexUvs[i] = [
]
}
for (a = 0, s = h.length; s > a; ) i = new THREE.Vector3,
i.x = h[a++] * t,
i.y = h[a++] * t,
i.z = h[a++] * t,
r.vertices.push(i);
for (a = 0, s = m.length; s > a; ) if (t = m[a++], l = 1 & t, o = 2 & t, i = 8 & t, c = 16 & t, E = 32 & t, h = 64 & t, t &= 128, l) {
if (l = new THREE.Face3, l.a = m[a], l.b = m[a + 1], l.c = m[a + 3], p = new THREE.Face3, p.a = m[a + 1], p.b = m[a + 2], p.c = m[a + 3], a += 4, o && (o = m[a++], l.materialIndex = o, p.materialIndex = o), o = r.faces.length, i) for (i = 0; v > i; i++) for (d = e.uvs[i], r.faceVertexUvs[i][o] = [
], r.faceVertexUvs[i][o + 1] = [
], n = 0; 4 > n; n++) u = m[a++],
f = d[2 * u],
u = d[2 * u + 1],
f = new THREE.Vector2(f, u),
2 !== n && r.faceVertexUvs[i][o].push(f),
0 !== n && r.faceVertexUvs[i][o + 1].push(f);
if (c && (c = 3 * m[a++], l.normal.set(T[c++], T[c++], T[c]), p.normal.copy(l.normal)), E) for (i = 0; 4 > i; i++) c = 3 * m[a++],
E = new THREE.Vector3(T[c++], T[c++], T[c]),
2 !== i && l.vertexNormals.push(E),
0 !== i && p.vertexNormals.push(E);
if (h && (h = m[a++], h = g[h], l.color.setHex(h), p.color.setHex(h)), t) for (i = 0; 4 > i; i++) h = m[a++],
h = g[h],
2 !== i && l.vertexColors.push(new THREE.Color(h)),
0 !== i && p.vertexColors.push(new THREE.Color(h));
r.faces.push(l),
r.faces.push(p)
} else {
if (l = new THREE.Face3, l.a = m[a++], l.b = m[a++], l.c = m[a++], o && (o = m[a++], l.materialIndex = o), o = r.faces.length, i) for (i = 0; v > i; i++) for (d = e.uvs[i], r.faceVertexUvs[i][o] = [
], n = 0; 3 > n; n++) u = m[a++],
f = d[2 * u],
u = d[2 * u + 1],
f = new THREE.Vector2(f, u),
r.faceVertexUvs[i][o].push(f);
if (c && (c = 3 * m[a++], l.normal.set(T[c++], T[c++], T[c])), E) for (i = 0; 3 > i; i++) c = 3 * m[a++],
E = new THREE.Vector3(T[c++], T[c++], T[c]),
l.vertexNormals.push(E);
if (h && (h = m[a++], l.color.setHex(g[h])), t) for (i = 0; 3 > i; i++) h = m[a++],
l.vertexColors.push(new THREE.Color(g[h]));
r.faces.push(l)
}
}(i),
function () {
var t = void 0 !== e.influencesPerVertex ? e.influencesPerVertex : 2;
if (e.skinWeights) for (var i = 0, n = e.skinWeights.length; n > i; i += t) r.skinWeights.push(new THREE.Vector4(e.skinWeights[i], t > 1 ? e.skinWeights[i + 1] : 0, t > 2 ? e.skinWeights[i + 2] : 0, t > 3 ? e.skinWeights[i + 3] : 0));
if (e.skinIndices) for (i = 0, n = e.skinIndices.length; n > i; i += t) r.skinIndices.push(new THREE.Vector4(e.skinIndices[i], t > 1 ? e.skinIndices[i + 1] : 0, t > 2 ? e.skinIndices[i + 2] : 0, t > 3 ? e.skinIndices[i + 3] : 0));
r.bones = e.bones,
r.bones && 0 < r.bones.length && (r.skinWeights.length !== r.skinIndices.length || r.skinIndices.length !== r.vertices.length) && console.warn('When skinning, number of vertices (' + r.vertices.length + '), skinIndices (' + r.skinIndices.length + '), and skinWeights (' + r.skinWeights.length + ') should match.')
}(),
function (t) {
if (void 0 !== e.morphTargets) for (var i = 0, n = e.morphTargets.length; n > i; i++) {
r.morphTargets[i] = {
},
r.morphTargets[i].name = e.morphTargets[i].name,
r.morphTargets[i].vertices = [
];
for (var o = r.morphTargets[i].vertices, a = e.morphTargets[i].vertices, s = 0, h = a.length; h > s; s += 3) {
var c = new THREE.Vector3;
c.x = a[s] * t,
c.y = a[s + 1] * t,
c.z = a[s + 2] * t,
o.push(c)
}
}
if (void 0 !== e.morphColors && 0 < e.morphColors.length) for (console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'), t = r.faces, o = e.morphColors[0].colors, i = 0, n = t.length; n > i; i++) t[i].color.fromArray(o, 3 * i)
}(i),
function () {
var t = [
],
i = [
];
void 0 !== e.animation && i.push(e.animation),
void 0 !== e.animations && (e.animations.length ? i = i.concat(e.animations) : i.push(e.animations));
for (var n = 0; n < i.length; n++) {
var o = THREE.AnimationClip.parseAnimation(i[n], r.bones);
o && t.push(o)
}
r.morphTargets && (i = THREE.AnimationClip.CreateClipsFromMorphTargetSequences(r.morphTargets, 10), t = t.concat(i)),
0 < t.length && (r.animations = t)
}(),
r.computeFaceNormals(),
r.computeBoundingSphere(),
void 0 === e.materials || 0 === e.materials.length ? {
geometry: r
}
: (i = THREE.Loader.prototype.initMaterials(e.materials, t, this.crossOrigin), {
geometry: r,
materials: i
})
}
},
THREE.LoadingManager = function (e, t, r) {
var i = this,
n = !1,
o = 0,
a = 0;
this.onStart = void 0,
this.onLoad = e,
this.onProgress = t,
this.onError = r,
this.itemStart = function (e) {
a++,
!1 === n && void 0 !== i.onStart && i.onStart(e, o, a),
n = !0
},
this.itemEnd = function (e) {
o++,
void 0 !== i.onProgress && i.onProgress(e, o, a),
o === a && (n = !1, void 0 !== i.onLoad) && i.onLoad()
},
this.itemError = function (e) {
void 0 !== i.onError && i.onError(e)
}
},
THREE.DefaultLoadingManager = new THREE.LoadingManager,
THREE.BufferGeometryLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager
},
THREE.BufferGeometryLoader.prototype = {
constructor: THREE.BufferGeometryLoader,
load: function (e, t, r, i) {
var n = this,
o = new THREE.XHRLoader(n.manager);
o.setCrossOrigin(this.crossOrigin),
o.load(e, function (e) {
t(n.parse(JSON.parse(e)))
}, r, i)
},
setCrossOrigin: function (e) {
this.crossOrigin = e
},
parse: function (e) {
var t = new THREE.BufferGeometry,
r = e.data.index;
void 0 !== r && (r = new self[r.type](r.array), t.setIndex(new THREE.BufferAttribute(r, 1)));
var i,
n = e.data.attributes;
for (i in n) {
var o = n[i],
r = new self[o.type](o.array);
t.addAttribute(i, new THREE.BufferAttribute(r, o.itemSize))
}
if (i = e.data.groups || e.data.drawcalls || e.data.offsets, void 0 !== i) for (r = 0, n = i.length; r !== n; ++r) o = i[r],
t.addGroup(o.start, o.count);
return e = e.data.boundingSphere,
void 0 !== e && (i = new THREE.Vector3, void 0 !== e.center && i.fromArray(e.center), t.boundingSphere = new THREE.Sphere(i, e.radius)),
t
}
},
THREE.MaterialLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager,
this.textures = {
}
},
THREE.MaterialLoader.prototype = {
constructor: THREE.MaterialLoader,
load: function (e, t, r, i) {
var n = this,
o = new THREE.XHRLoader(n.manager);
o.setCrossOrigin(this.crossOrigin),
o.load(e, function (e) {
t(n.parse(JSON.parse(e)))
}, r, i)
},
setCrossOrigin: function (e) {
this.crossOrigin = e
},
setTextures: function (e) {
this.textures = e
},
getTexture: function (e) {
var t = this.textures;
return void 0 === t[e] && console.warn('THREE.MaterialLoader: Undefined texture', e),
t[e]
},
parse: function (e) {
var t = new THREE[e.type];
if (t.uuid = e.uuid, void 0 !== e.name && (t.name = e.name), void 0 !== e.color && t.color.setHex(e.color), void 0 !== e.emissive && t.emissive.setHex(e.emissive), void 0 !== e.specular && t.specular.setHex(e.specular), void 0 !== e.shininess && (t.shininess = e.shininess), void 0 !== e.uniforms && (t.uniforms = e.uniforms), void 0 !== e.vertexShader && (t.vertexShader = e.vertexShader), void 0 !== e.fragmentShader && (t.fragmentShader = e.fragmentShader), void 0 !== e.vertexColors && (t.vertexColors = e.vertexColors), void 0 !== e.shading && (t.shading = e.shading), void 0 !== e.blending && (t.blending = e.blending), void 0 !== e.side && (t.side = e.side), void 0 !== e.opacity && (t.opacity = e.opacity), void 0 !== e.transparent && (t.transparent = e.transparent), void 0 !== e.alphaTest && (t.alphaTest = e.alphaTest), void 0 !== e.depthTest && (t.depthTest = e.depthTest), void 0 !== e.depthWrite && (t.depthWrite = e.depthWrite), void 0 !== e.wireframe && (t.wireframe = e.wireframe), void 0 !== e.wireframeLinewidth && (t.wireframeLinewidth = e.wireframeLinewidth), void 0 !== e.size && (t.size = e.size), void 0 !== e.sizeAttenuation && (t.sizeAttenuation = e.sizeAttenuation), void 0 !== e.map && (t.map = this.getTexture(e.map)), void 0 !== e.alphaMap && (t.alphaMap = this.getTexture(e.alphaMap), t.transparent = !0), void 0 !== e.bumpMap && (t.bumpMap = this.getTexture(e.bumpMap)), void 0 !== e.bumpScale && (t.bumpScale = e.bumpScale), void 0 !== e.normalMap && (t.normalMap = this.getTexture(e.normalMap)), e.normalScale && (t.normalScale = new THREE.Vector2(e.normalScale, e.normalScale)), void 0 !== e.displacementMap && (t.displacementMap = this.getTexture(e.displacementMap)), void 0 !== e.displacementScale && (t.displacementScale = e.displacementScale), void 0 !== e.displacementBias && (t.displacementBias = e.displacementBias), void 0 !== e.specularMap && (t.specularMap = this.getTexture(e.specularMap)), void 0 !== e.envMap && (t.envMap = this.getTexture(e.envMap), t.combine = THREE.MultiplyOperation), e.reflectivity && (t.reflectivity = e.reflectivity), void 0 !== e.lightMap && (t.lightMap = this.getTexture(e.lightMap)), void 0 !== e.lightMapIntensity && (t.lightMapIntensity = e.lightMapIntensity), void 0 !== e.aoMap && (t.aoMap = this.getTexture(e.aoMap)), void 0 !== e.aoMapIntensity && (t.aoMapIntensity = e.aoMapIntensity), void 0 !== e.materials) for (var r = 0, i = e.materials.length; i > r; r++) t.materials.push(this.parse(e.materials[r]));
return t
}
},
THREE.ObjectLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager,
this.texturePath = ''
},
THREE.ObjectLoader.prototype = {
constructor: THREE.ObjectLoader,
load: function (e, t, r, i) {
'' === this.texturePath && (this.texturePath = e.substring(0, e.lastIndexOf('/') + 1));
var n = this,
o = new THREE.XHRLoader(n.manager);
o.setCrossOrigin(this.crossOrigin),
o.load(e, function (e) {
n.parse(JSON.parse(e), t)
}, r, i)
},
setTexturePath: function (e) {
this.texturePath = e
},
setCrossOrigin: function (e) {
this.crossOrigin = e
},
parse: function (e, t) {
var r = this.parseGeometries(e.geometries),
i = this.parseImages(e.images, function () {
void 0 !== t && t(n)
}),
i = this.parseTextures(e.textures, i),
i = this.parseMaterials(e.materials, i),
n = this.parseObject(e.object, r, i);
return e.animations && (n.animations = this.parseAnimations(e.animations)),
void 0 !== e.images && 0 !== e.images.length || void 0 === t || t(n),
n
},
parseGeometries: function (e) {
var t = {
};
if (void 0 !== e) for (var r = new THREE.JSONLoader, i = new THREE.BufferGeometryLoader, n = 0, o = e.length; o > n; n++) {
var a,
s = e[n];
switch (s.type) {
case 'PlaneGeometry':
case 'PlaneBufferGeometry':
a = new THREE[s.type](s.width, s.height, s.widthSegments, s.heightSegments);
break;
case 'BoxGeometry':
case 'CubeGeometry':
a = new THREE.BoxGeometry(s.width, s.height, s.depth, s.widthSegments, s.heightSegments, s.depthSegments);
break;
case 'CircleBufferGeometry':
a = new THREE.CircleBufferGeometry(s.radius, s.segments, s.thetaStart, s.thetaLength);
break;
case 'CircleGeometry':
a = new THREE.CircleGeometry(s.radius, s.segments, s.thetaStart, s.thetaLength);
break;
case 'CylinderGeometry':
a = new THREE.CylinderGeometry(s.radiusTop, s.radiusBottom, s.height, s.radialSegments, s.heightSegments, s.openEnded, s.thetaStart, s.thetaLength);
break;
case 'SphereGeometry':
a = new THREE.SphereGeometry(s.radius, s.widthSegments, s.heightSegments, s.phiStart, s.phiLength, s.thetaStart, s.thetaLength);
break;
case 'SphereBufferGeometry':
a = new THREE.SphereBufferGeometry(s.radius, s.widthSegments, s.heightSegments, s.phiStart, s.phiLength, s.thetaStart, s.thetaLength);
break;
case 'DodecahedronGeometry':
a = new THREE.DodecahedronGeometry(s.radius, s.detail);
break;
case 'IcosahedronGeometry':
a = new THREE.IcosahedronGeometry(s.radius, s.detail);
break;
case 'OctahedronGeometry':
a = new THREE.OctahedronGeometry(s.radius, s.detail);
break;
case 'TetrahedronGeometry':
a = new THREE.TetrahedronGeometry(s.radius, s.detail);
break;
case 'RingGeometry':
a = new THREE.RingGeometry(s.innerRadius, s.outerRadius, s.thetaSegments, s.phiSegments, s.thetaStart, s.thetaLength);
break;
case 'TorusGeometry':
a = new THREE.TorusGeometry(s.radius, s.tube, s.radialSegments, s.tubularSegments, s.arc);
break;
case 'TorusKnotGeometry':
a = new THREE.TorusKnotGeometry(s.radius, s.tube, s.radialSegments, s.tubularSegments, s.p, s.q, s.heightScale);
break;
case 'BufferGeometry':
a = i.parse(s);
break;
case 'Geometry':
a = r.parse(s.data, this.texturePath).geometry;
break;
default:
console.warn('THREE.ObjectLoader: Unsupported geometry type "' + s.type + '"');
continue
}
a.uuid = s.uuid,
void 0 !== s.name && (a.name = s.name),
t[s.uuid] = a
}
return t
},
parseMaterials: function (e, t) {
var r = {
};
if (void 0 !== e) {
var i = new THREE.MaterialLoader;
i.setTextures(t);
for (var n = 0, o = e.length; o > n; n++) {
var a = i.parse(e[n]);
r[a.uuid] = a
}
}
return r
},
parseAnimations: function (e) {
for (var t = [
], r = 0; r < e.length; r++) {
var i = THREE.AnimationClip.parse(e[r]);
t.push(i)
}
return t
},
parseImages: function (e, t) {
function r(e) {
return i.manager.itemStart(e),
a.load(e, function () {
i.manager.itemEnd(e)
})
}
var i = this,
n = {
};
if (void 0 !== e && 0 < e.length) {
var o = new THREE.LoadingManager(t),
a = new THREE.ImageLoader(o);
a.setCrossOrigin(this.crossOrigin);
for (var o = 0, s = e.length; s > o; o++) {
var h = e[o],
c = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url) ? h.url : i.texturePath + h.url;
n[h.uuid] = r(c)
}
}
return n
},
parseTextures: function (e, t) {
function r(e) {
return 'number' == typeof e ? e : (console.warn('THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', e), THREE[e])
}
var i = {
};
if (void 0 !== e) for (var n = 0, o = e.length; o > n; n++) {
var a = e[n];
void 0 === a.image && console.warn('THREE.ObjectLoader: No "image" specified for', a.uuid),
void 0 === t[a.image] && console.warn('THREE.ObjectLoader: Undefined image', a.image);
var s = new THREE.Texture(t[a.image]);
s.needsUpdate = !0,
s.uuid = a.uuid,
void 0 !== a.name && (s.name = a.name),
void 0 !== a.mapping && (s.mapping = r(a.mapping)),
void 0 !== a.offset && (s.offset = new THREE.Vector2(a.offset[0], a.offset[1])),
void 0 !== a.repeat && (s.repeat = new THREE.Vector2(a.repeat[0], a.repeat[1])),
void 0 !== a.minFilter && (s.minFilter = r(a.minFilter)),
void 0 !== a.magFilter && (s.magFilter = r(a.magFilter)),
void 0 !== a.anisotropy && (s.anisotropy = a.anisotropy),
Array.isArray(a.wrap) && (s.wrapS = r(a.wrap[0]), s.wrapT = r(a.wrap[1])),
i[a.uuid] = s
}
return i
},
parseObject: function () {
var e = new THREE.Matrix4;
return function (t, r, i) {
function n(e) {
return void 0 === r[e] && console.warn('THREE.ObjectLoader: Undefined geometry', e),
r[e]
}
function o(e) {
return void 0 !== e ? (void 0 === i[e] && console.warn('THREE.ObjectLoader: Undefined material', e), i[e]) : void 0
}
var a;
switch (t.type) {
case 'Scene':
a = new THREE.Scene;
break;
case 'PerspectiveCamera':
a = new THREE.PerspectiveCamera(t.fov, t.aspect, t.near, t.far);
break;
case 'OrthographicCamera':
a = new THREE.OrthographicCamera(t.left, t.right, t.top, t.bottom, t.near, t.far);
break;
case 'AmbientLight':
a = new THREE.AmbientLight(t.color);
break;
case 'DirectionalLight':
a = new THREE.DirectionalLight(t.color, t.intensity);
break;
case 'PointLight':
a = new THREE.PointLight(t.color, t.intensity, t.distance, t.decay);
break;
case 'SpotLight':
a = new THREE.SpotLight(t.color, t.intensity, t.distance, t.angle, t.exponent, t.decay);
break;
case 'HemisphereLight':
a = new THREE.HemisphereLight(t.color, t.groundColor, t.intensity);
break;
case 'Mesh':
a = new THREE.Mesh(n(t.geometry), o(t.material));
break;
case 'LOD':
a = new THREE.LOD;
break;
case 'Line':
a = new THREE.Line(n(t.geometry), o(t.material), t.mode);
break;
case 'PointCloud':
case 'Points':
a = new THREE.Points(n(t.geometry), o(t.material));
break;
case 'Sprite':
a = new THREE.Sprite(o(t.material));
break;
case 'Group':
a = new THREE.Group;
break;
default:
a = new THREE.Object3D
}
if (a.uuid = t.uuid, void 0 !== t.name && (a.name = t.name), void 0 !== t.matrix ? (e.fromArray(t.matrix), e.decompose(a.position, a.quaternion, a.scale)) : (void 0 !== t.position && a.position.fromArray(t.position), void 0 !== t.rotation && a.rotation.fromArray(t.rotation), void 0 !== t.scale && a.scale.fromArray(t.scale)), void 0 !== t.castShadow && (a.castShadow = t.castShadow), void 0 !== t.receiveShadow && (a.receiveShadow = t.receiveShadow), void 0 !== t.visible && (a.visible = t.visible), void 0 !== t.userData && (a.userData = t.userData), void 0 !== t.children) for (var s in t.children) a.add(this.parseObject(t.children[s], r, i));
if ('LOD' === t.type) {
t = t.levels;
for (var h = 0; h < t.length; h++) {
var c = t[h];
s = a.getObjectByProperty('uuid', c.object),
void 0 !== s && a.addLevel(s, c.distance)
}
}
return a
}
}()
},
THREE.TextureLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager
},
THREE.TextureLoader.prototype = {
constructor: THREE.TextureLoader,
load: function (e, t, r, i) {
var n = new THREE.Texture,
o = new THREE.ImageLoader(this.manager);
return o.setCrossOrigin(this.crossOrigin),
o.load(e, function (e) {
n.image = e,
n.needsUpdate = !0,
void 0 !== t && t(n)
}, r, i),
n
},
setCrossOrigin: function (e) {
this.crossOrigin = e
}
},
THREE.CubeTextureLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager
},
THREE.CubeTextureLoader.prototype = {
constructor: THREE.CubeTextureLoader,
load: function (e, t, r, i) {
function n(r) {
a.load(e[r], function (e) {
o.images[r] = e,
s++,
6 === s && (o.needsUpdate = !0, t && t(o))
}, void 0, i)
}
var o = new THREE.CubeTexture([]),
a = new THREE.ImageLoader;
a.setCrossOrigin(this.crossOrigin);
var s = 0;
for (r = 0; r < e.length; ++r) n(r);
return o
},
setCrossOrigin: function (e) {
this.crossOrigin = e
}
},
THREE.DataTextureLoader = THREE.BinaryTextureLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager,
this._parser = null
},
THREE.BinaryTextureLoader.prototype = {
constructor: THREE.BinaryTextureLoader,
load: function (e, t, r, i) {
var n = this,
o = new THREE.DataTexture,
a = new THREE.XHRLoader(this.manager);
return a.setCrossOrigin(this.crossOrigin),
a.setResponseType('arraybuffer'),
a.load(e, function (e) {
(e = n._parser(e)) && (void 0 !== e.image ? o.image = e.image : void 0 !== e.data && (o.image.width = e.width, o.image.height = e.height, o.image.data = e.data), o.wrapS = void 0 !== e.wrapS ? e.wrapS : THREE.ClampToEdgeWrapping, o.wrapT = void 0 !== e.wrapT ? e.wrapT : THREE.ClampToEdgeWrapping, o.magFilter = void 0 !== e.magFilter ? e.magFilter : THREE.LinearFilter, o.minFilter = void 0 !== e.minFilter ? e.minFilter : THREE.LinearMipMapLinearFilter, o.anisotropy = void 0 !== e.anisotropy ? e.anisotropy : 1, void 0 !== e.format && (o.format = e.format), void 0 !== e.type && (o.type = e.type), void 0 !== e.mipmaps && (o.mipmaps = e.mipmaps), 1 === e.mipmapCount && (o.minFilter = THREE.LinearFilter), o.needsUpdate = !0, t && t(o, e))
}, r, i),
o
},
setCrossOrigin: function (e) {
this.crossOrigin = e
}
},
THREE.CompressedTextureLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager,
this._parser = null
},
THREE.CompressedTextureLoader.prototype = {
constructor: THREE.CompressedTextureLoader,
load: function (e, t, r, i) {
var n = this,
o = [
],
a = new THREE.CompressedTexture;
a.image = o;
var s = new THREE.XHRLoader(this.manager);
if (s.setCrossOrigin(this.crossOrigin), s.setResponseType('arraybuffer'), Array.isArray(e)) for (var h = 0, c = function (c) {
s.load(e[c], function (e) {
e = n._parser(e, !0),
o[c] = {
width: e.width,
height: e.height,
format: e.format,
mipmaps: e.mipmaps
},
h += 1,
6 === h && (1 === e.mipmapCount && (a.minFilter = THREE.LinearFilter), a.format = e.format, a.needsUpdate = !0, t && t(a))
}, r, i)
}, u = 0, l = e.length; l > u; ++u) c(u);
else s.load(e, function (e) {
if (e = n._parser(e, !0), e.isCubemap) for (var r = e.mipmaps.length / e.mipmapCount, i = 0; r > i; i++) {
o[i] = {
mipmaps: [
]
};
for (var s = 0; s < e.mipmapCount; s++) o[i].mipmaps.push(e.mipmaps[i * e.mipmapCount + s]),
o[i].format = e.format,
o[i].width = e.width,
o[i].height = e.height
} else a.image.width = e.width,
a.image.height = e.height,
a.mipmaps = e.mipmaps;
1 === e.mipmapCount && (a.minFilter = THREE.LinearFilter),
a.format = e.format,
a.needsUpdate = !0,
t && t(a)
}, r, i);
return a
},
setCrossOrigin: function (e) {
this.crossOrigin = e
}
},
THREE.Material = function () {
Object.defineProperty(this, 'id', {
value: THREE.MaterialIdCount++
}),
this.uuid = THREE.Math.generateUUID(),
this.name = '',
this.type = 'Material',
this.side = THREE.FrontSide,
this.opacity = 1,
this.transparent = !1,
this.blending = THREE.NormalBlending,
this.blendSrc = THREE.SrcAlphaFactor,
this.blendDst = THREE.OneMinusSrcAlphaFactor,
this.blendEquation = THREE.AddEquation,
this.blendEquationAlpha = this.blendDstAlpha = this.blendSrcAlpha = null,
this.depthFunc = THREE.LessEqualDepth,
this.colorWrite = this.depthWrite = this.depthTest = !0,
this.precision = null,
this.polygonOffset = !1,
this.overdraw = this.alphaTest = this.polygonOffsetUnits = this.polygonOffsetFactor = 0,
this._needsUpdate = this.visible = !0
},
THREE.Material.prototype = {
constructor: THREE.Material,
get needsUpdate() {
return this._needsUpdate
},
set needsUpdate(e) {
!0 === e && this.update(),
this._needsUpdate = e
},
setValues: function (e) {
if (void 0 !== e) for (var t in e) {
var r = e[t];
if (void 0 === r) console.warn('THREE.Material: \'' + t + '\' parameter is undefined.');
else {
var i = this[t];
void 0 === i ? console.warn('THREE.' + this.type + ': \'' + t + '\' is not a property of this material.') : i instanceof THREE.Color ? i.set(r) : i instanceof THREE.Vector3 && r instanceof THREE.Vector3 ? i.copy(r) : this[t] = 'overdraw' === t ? Number(r) : r
}
}
},
toJSON: function (e) {
var t = {
metadata: {
version: 4.4,
type: 'Material',
generator: 'Material.toJSON'
}
};
return t.uuid = this.uuid,
t.type = this.type,
'' !== this.name && (t.name = this.name),
this.color instanceof THREE.Color && (t.color = this.color.getHex()),
this.emissive instanceof THREE.Color && (t.emissive = this.emissive.getHex()),
this.specular instanceof THREE.Color && (t.specular = this.specular.getHex()),
void 0 !== this.shininess && (t.shininess = this.shininess),
this.map instanceof THREE.Texture && (t.map = this.map.toJSON(e).uuid),
this.alphaMap instanceof THREE.Texture && (t.alphaMap = this.alphaMap.toJSON(e).uuid),
this.lightMap instanceof THREE.Texture && (t.lightMap = this.lightMap.toJSON(e).uuid),
this.bumpMap instanceof THREE.Texture && (t.bumpMap = this.bumpMap.toJSON(e).uuid, t.bumpScale = this.bumpScale),
this.normalMap instanceof THREE.Texture && (t.normalMap = this.normalMap.toJSON(e).uuid, t.normalScale = this.normalScale),
this.displacementMap instanceof THREE.Texture && (t.displacementMap = this.displacementMap.toJSON(e).uuid, t.displacementScale = this.displacementScale, t.displacementBias = this.displacementBias),
this.specularMap instanceof THREE.Texture && (t.specularMap = this.specularMap.toJSON(e).uuid),
this.envMap instanceof THREE.Texture && (t.envMap = this.envMap.toJSON(e).uuid, t.reflectivity = this.reflectivity),
void 0 !== this.size && (t.size = this.size),
void 0 !== this.sizeAttenuation && (t.sizeAttenuation = this.sizeAttenuation),
void 0 !== this.vertexColors && this.vertexColors !== THREE.NoColors && (t.vertexColors = this.vertexColors),
void 0 !== this.shading && this.shading !== THREE.SmoothShading && (t.shading = this.shading),
void 0 !== this.blending && this.blending !== THREE.NormalBlending && (t.blending = this.blending),
void 0 !== this.side && this.side !== THREE.FrontSide && (t.side = this.side),
1 > this.opacity && (t.opacity = this.opacity),
!0 === this.transparent && (t.transparent = this.transparent),
0 < this.alphaTest && (t.alphaTest = this.alphaTest),
!0 === this.wireframe && (t.wireframe = this.wireframe),
1 < this.wireframeLinewidth && (t.wireframeLinewidth = this.wireframeLinewidth),
t
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.name = e.name,
this.side = e.side,
this.opacity = e.opacity,
this.transparent = e.transparent,
this.blending = e.blending,
this.blendSrc = e.blendSrc,
this.blendDst = e.blendDst,
this.blendEquation = e.blendEquation,
this.blendSrcAlpha = e.blendSrcAlpha,
this.blendDstAlpha = e.blendDstAlpha,
this.blendEquationAlpha = e.blendEquationAlpha,
this.depthFunc = e.depthFunc,
this.depthTest = e.depthTest,
this.depthWrite = e.depthWrite,
this.precision = e.precision,
this.polygonOffset = e.polygonOffset,
this.polygonOffsetFactor = e.polygonOffsetFactor,
this.polygonOffsetUnits = e.polygonOffsetUnits,
this.alphaTest = e.alphaTest,
this.overdraw = e.overdraw,
this.visible = e.visible,
this
},
update: function () {
this.dispatchEvent({
type: 'update'
})
},
dispose: function () {
this.dispatchEvent({
type: 'dispose'
})
},
get wrapAround() {
console.warn('THREE.' + this.type + ': .wrapAround has been removed.')
},
set wrapAround(e) {
console.warn('THREE.' + this.type + ': .wrapAround has been removed.')
},
get wrapRGB() {
return console.warn('THREE.' + this.type + ': .wrapRGB has been removed.'),
new THREE.Color
}
},
THREE.EventDispatcher.prototype.apply(THREE.Material.prototype),
THREE.MaterialIdCount = 0,
THREE.LineBasicMaterial = function (e) {
THREE.Material.call(this),
this.type = 'LineBasicMaterial',
this.color = new THREE.Color(16777215),
this.linewidth = 1,
this.linejoin = this.linecap = 'round',
this.vertexColors = THREE.NoColors,
this.fog = !0,
this.setValues(e)
},
THREE.LineBasicMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial,
THREE.LineBasicMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.color.copy(e.color),
this.linewidth = e.linewidth,
this.linecap = e.linecap,
this.linejoin = e.linejoin,
this.vertexColors = e.vertexColors,
this.fog = e.fog,
this
},
THREE.LineDashedMaterial = function (e) {
THREE.Material.call(this),
this.type = 'LineDashedMaterial',
this.color = new THREE.Color(16777215),
this.scale = this.linewidth = 1,
this.dashSize = 3,
this.gapSize = 1,
this.vertexColors = !1,
this.fog = !0,
this.setValues(e)
},
THREE.LineDashedMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.LineDashedMaterial.prototype.constructor = THREE.LineDashedMaterial,
THREE.LineDashedMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.color.copy(e.color),
this.linewidth = e.linewidth,
this.scale = e.scale,
this.dashSize = e.dashSize,
this.gapSize = e.gapSize,
this.vertexColors = e.vertexColors,
this.fog = e.fog,
this
},
THREE.MeshBasicMaterial = function (e) {
THREE.Material.call(this),
this.type = 'MeshBasicMaterial',
this.color = new THREE.Color(16777215),
this.aoMap = this.map = null,
this.aoMapIntensity = 1,
this.envMap = this.alphaMap = this.specularMap = null,
this.combine = THREE.MultiplyOperation,
this.reflectivity = 1,
this.refractionRatio = 0.98,
this.fog = !0,
this.shading = THREE.SmoothShading,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.wireframeLinejoin = this.wireframeLinecap = 'round',
this.vertexColors = THREE.NoColors,
this.morphTargets = this.skinning = !1,
this.setValues(e)
},
THREE.MeshBasicMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial,
THREE.MeshBasicMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.color.copy(e.color),
this.map = e.map,
this.aoMap = e.aoMap,
this.aoMapIntensity = e.aoMapIntensity,
this.specularMap = e.specularMap,
this.alphaMap = e.alphaMap,
this.envMap = e.envMap,
this.combine = e.combine,
this.reflectivity = e.reflectivity,
this.refractionRatio = e.refractionRatio,
this.fog = e.fog,
this.shading = e.shading,
this.wireframe = e.wireframe,
this.wireframeLinewidth = e.wireframeLinewidth,
this.wireframeLinecap = e.wireframeLinecap,
this.wireframeLinejoin = e.wireframeLinejoin,
this.vertexColors = e.vertexColors,
this.skinning = e.skinning,
this.morphTargets = e.morphTargets,
this
},
THREE.MeshLambertMaterial = function (e) {
THREE.Material.call(this),
this.type = 'MeshLambertMaterial',
this.color = new THREE.Color(16777215),
this.emissive = new THREE.Color(0),
this.envMap = this.alphaMap = this.specularMap = this.map = null,
this.combine = THREE.MultiplyOperation,
this.reflectivity = 1,
this.refractionRatio = 0.98,
this.fog = !0,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.wireframeLinejoin = this.wireframeLinecap = 'round',
this.vertexColors = THREE.NoColors,
this.morphNormals = this.morphTargets = this.skinning = !1,
this.setValues(e)
},
THREE.MeshLambertMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial,
THREE.MeshLambertMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.color.copy(e.color),
this.emissive.copy(e.emissive),
this.map = e.map,
this.specularMap = e.specularMap,
this.alphaMap = e.alphaMap,
this.envMap = e.envMap,
this.combine = e.combine,
this.reflectivity = e.reflectivity,
this.refractionRatio = e.refractionRatio,
this.fog = e.fog,
this.wireframe = e.wireframe,
this.wireframeLinewidth = e.wireframeLinewidth,
this.wireframeLinecap = e.wireframeLinecap,
this.wireframeLinejoin = e.wireframeLinejoin,
this.vertexColors = e.vertexColors,
this.skinning = e.skinning,
this.morphTargets = e.morphTargets,
this.morphNormals = e.morphNormals,
this
},
THREE.MeshPhongMaterial = function (e) {
THREE.Material.call(this),
this.type = 'MeshPhongMaterial',
this.color = new THREE.Color(16777215),
this.emissive = new THREE.Color(0),
this.specular = new THREE.Color(1118481),
this.shininess = 30,
this.metal = !1,
this.lightMap = this.map = null,
this.lightMapIntensity = 1,
this.aoMap = null,
this.aoMapIntensity = 1,
this.bumpMap = this.emissiveMap = null,
this.bumpScale = 1,
this.normalMap = null,
this.normalScale = new THREE.Vector2(1, 1),
this.displacementMap = null,
this.displacementScale = 1,
this.displacementBias = 0,
this.envMap = this.alphaMap = this.specularMap = null,
this.combine = THREE.MultiplyOperation,
this.reflectivity = 1,
this.refractionRatio = 0.98,
this.fog = !0,
this.shading = THREE.SmoothShading,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.wireframeLinejoin = this.wireframeLinecap = 'round',
this.vertexColors = THREE.NoColors,
this.morphNormals = this.morphTargets = this.skinning = !1,
this.setValues(e)
},
THREE.MeshPhongMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial,
THREE.MeshPhongMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.color.copy(e.color),
this.emissive.copy(e.emissive),
this.specular.copy(e.specular),
this.shininess = e.shininess,
this.metal = e.metal,
this.map = e.map,
this.lightMap = e.lightMap,
this.lightMapIntensity = e.lightMapIntensity,
this.aoMap = e.aoMap,
this.aoMapIntensity = e.aoMapIntensity,
this.emissiveMap = e.emissiveMap,
this.bumpMap = e.bumpMap,
this.bumpScale = e.bumpScale,
this.normalMap = e.normalMap,
this.normalScale.copy(e.normalScale),
this.displacementMap = e.displacementMap,
this.displacementScale = e.displacementScale,
this.displacementBias = e.displacementBias,
this.specularMap = e.specularMap,
this.alphaMap = e.alphaMap,
this.envMap = e.envMap,
this.combine = e.combine,
this.reflectivity = e.reflectivity,
this.refractionRatio = e.refractionRatio,
this.fog = e.fog,
this.shading = e.shading,
this.wireframe = e.wireframe,
this.wireframeLinewidth = e.wireframeLinewidth,
this.wireframeLinecap = e.wireframeLinecap,
this.wireframeLinejoin = e.wireframeLinejoin,
this.vertexColors = e.vertexColors,
this.skinning = e.skinning,
this.morphTargets = e.morphTargets,
this.morphNormals = e.morphNormals,
this
},
THREE.MeshDepthMaterial = function (e) {
THREE.Material.call(this),
this.type = 'MeshDepthMaterial',
this.wireframe = this.morphTargets = !1,
this.wireframeLinewidth = 1,
this.setValues(e)
},
THREE.MeshDepthMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshDepthMaterial.prototype.constructor = THREE.MeshDepthMaterial,
THREE.MeshDepthMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.wireframe = e.wireframe,
this.wireframeLinewidth = e.wireframeLinewidth,
this
},
THREE.MeshNormalMaterial = function (e) {
THREE.Material.call(this, e),
this.type = 'MeshNormalMaterial',
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.morphTargets = !1,
this.setValues(e)
},
THREE.MeshNormalMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshNormalMaterial.prototype.constructor = THREE.MeshNormalMaterial,
THREE.MeshNormalMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.wireframe = e.wireframe,
this.wireframeLinewidth = e.wireframeLinewidth,
this
},
THREE.MultiMaterial = function (e) {
this.uuid = THREE.Math.generateUUID(),
this.type = 'MultiMaterial',
this.materials = e instanceof Array ? e : [
],
this.visible = !0
},
THREE.MultiMaterial.prototype = {
constructor: THREE.MultiMaterial,
toJSON: function () {
for (var e = {
metadata: {
version: 4.2,
type: 'material',
generator: 'MaterialExporter'
},
uuid: this.uuid,
type: this.type,
materials: [
]
}, t = 0, r = this.materials.length; r > t; t++) e.materials.push(this.materials[t].toJSON());
return e.visible = this.visible,
e
},
clone: function () {
for (var e = new this.constructor, t = 0; t < this.materials.length; t++) e.materials.push(this.materials[t].clone());
return e.visible = this.visible,
e
}
},
THREE.MeshFaceMaterial = THREE.MultiMaterial,
THREE.PointsMaterial = function (e) {
THREE.Material.call(this),
this.type = 'PointsMaterial',
this.color = new THREE.Color(16777215),
this.map = null,
this.size = 1,
this.sizeAttenuation = !0,
this.vertexColors = THREE.NoColors,
this.fog = !0,
this.setValues(e)
},
THREE.PointsMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.PointsMaterial.prototype.constructor = THREE.PointsMaterial,
THREE.PointsMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.color.copy(e.color),
this.map = e.map,
this.size = e.size,
this.sizeAttenuation = e.sizeAttenuation,
this.vertexColors = e.vertexColors,
this.fog = e.fog,
this
},
THREE.PointCloudMaterial = function (e) {
return console.warn('THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.'),
new THREE.PointsMaterial(e)
},
THREE.ParticleBasicMaterial = function (e) {
return console.warn('THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.'),
new THREE.PointsMaterial(e)
},
THREE.ParticleSystemMaterial = function (e) {
return console.warn('THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.'),
new THREE.PointsMaterial(e)
},
THREE.ShaderMaterial = function (e) {
THREE.Material.call(this),
this.type = 'ShaderMaterial',
this.defines = {
},
this.uniforms = {
},
this.vertexShader = 'void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}',
this.fragmentShader = 'void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}',
this.shading = THREE.SmoothShading,
this.linewidth = 1,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.lights = this.fog = !1,
this.vertexColors = THREE.NoColors,
this.derivatives = this.morphNormals = this.morphTargets = this.skinning = !1,
this.defaultAttributeValues = {
color: [
1,
1,
1
],
uv: [
0,
0
],
uv2: [
0,
0
]
},
this.index0AttributeName = void 0,
void 0 !== e && (void 0 !== e.attributes && console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.'), this.setValues(e));
},
THREE.ShaderMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.ShaderMaterial.prototype.constructor = THREE.ShaderMaterial,
THREE.ShaderMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.fragmentShader = e.fragmentShader,
this.vertexShader = e.vertexShader,
this.uniforms = THREE.UniformsUtils.clone(e.uniforms),
this.attributes = e.attributes,
this.defines = e.defines,
this.shading = e.shading,
this.wireframe = e.wireframe,
this.wireframeLinewidth = e.wireframeLinewidth,
this.fog = e.fog,
this.lights = e.lights,
this.vertexColors = e.vertexColors,
this.skinning = e.skinning,
this.morphTargets = e.morphTargets,
this.morphNormals = e.morphNormals,
this.derivatives = e.derivatives,
this
},
THREE.ShaderMaterial.prototype.toJSON = function (e) {
return e = THREE.Material.prototype.toJSON.call(this, e),
e.uniforms = this.uniforms,
e.attributes = this.attributes,
e.vertexShader = this.vertexShader,
e.fragmentShader = this.fragmentShader,
e
},
THREE.RawShaderMaterial = function (e) {
THREE.ShaderMaterial.call(this, e),
this.type = 'RawShaderMaterial'
},
THREE.RawShaderMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype),
THREE.RawShaderMaterial.prototype.constructor = THREE.RawShaderMaterial,
THREE.SpriteMaterial = function (e) {
THREE.Material.call(this),
this.type = 'SpriteMaterial',
this.color = new THREE.Color(16777215),
this.map = null,
this.rotation = 0,
this.fog = !1,
this.setValues(e)
},
THREE.SpriteMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.SpriteMaterial.prototype.constructor = THREE.SpriteMaterial,
THREE.SpriteMaterial.prototype.copy = function (e) {
return THREE.Material.prototype.copy.call(this, e),
this.color.copy(e.color),
this.map = e.map,
this.rotation = e.rotation,
this.fog = e.fog,
this
},
THREE.Texture = function (e, t, r, i, n, o, a, s, h) {
Object.defineProperty(this, 'id', {
value: THREE.TextureIdCount++
}),
this.uuid = THREE.Math.generateUUID(),
this.sourceFile = this.name = '',
this.image = void 0 !== e ? e : THREE.Texture.DEFAULT_IMAGE,
this.mipmaps = [
],
this.mapping = void 0 !== t ? t : THREE.Texture.DEFAULT_MAPPING,
this.wrapS = void 0 !== r ? r : THREE.ClampToEdgeWrapping,
this.wrapT = void 0 !== i ? i : THREE.ClampToEdgeWrapping,
this.magFilter = void 0 !== n ? n : THREE.LinearFilter,
this.minFilter = void 0 !== o ? o : THREE.LinearMipMapLinearFilter,
this.anisotropy = void 0 !== h ? h : 1,
this.format = void 0 !== a ? a : THREE.RGBAFormat,
this.type = void 0 !== s ? s : THREE.UnsignedByteType,
this.offset = new THREE.Vector2(0, 0),
this.repeat = new THREE.Vector2(1, 1),
this.generateMipmaps = !0,
this.premultiplyAlpha = !1,
this.flipY = !0,
this.unpackAlignment = 4,
this.version = 0,
this.onUpdate = null
},
THREE.Texture.DEFAULT_IMAGE = void 0,
THREE.Texture.DEFAULT_MAPPING = THREE.UVMapping,
THREE.Texture.prototype = {
constructor: THREE.Texture,
set needsUpdate(e) {
!0 === e && this.version++
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.image = e.image,
this.mipmaps = e.mipmaps.slice(0),
this.mapping = e.mapping,
this.wrapS = e.wrapS,
this.wrapT = e.wrapT,
this.magFilter = e.magFilter,
this.minFilter = e.minFilter,
this.anisotropy = e.anisotropy,
this.format = e.format,
this.type = e.type,
this.offset.copy(e.offset),
this.repeat.copy(e.repeat),
this.generateMipmaps = e.generateMipmaps,
this.premultiplyAlpha = e.premultiplyAlpha,
this.flipY = e.flipY,
this.unpackAlignment = e.unpackAlignment,
this
},
toJSON: function (e) {
if (void 0 !== e.textures[this.uuid]) return e.textures[this.uuid];
var t = {
metadata: {
version: 4.4,
type: 'Texture',
generator: 'Texture.toJSON'
},
uuid: this.uuid,
name: this.name,
mapping: this.mapping,
repeat: [
this.repeat.x,
this.repeat.y
],
offset: [
this.offset.x,
this.offset.y
],
wrap: [
this.wrapS,
this.wrapT
],
minFilter: this.minFilter,
magFilter: this.magFilter,
anisotropy: this.anisotropy
};
if (void 0 !== this.image) {
var r = this.image;
if (void 0 === r.uuid && (r.uuid = THREE.Math.generateUUID()), void 0 === e.images[r.uuid]) {
var i,
n = e.images,
o = r.uuid,
a = r.uuid;
void 0 !== r.toDataURL ? i = r : (i = document.createElement('canvas'), i.width = r.width, i.height = r.height, i.getContext('2d').drawImage(r, 0, 0, r.width, r.height)),
i = 2048 < i.width || 2048 < i.height ? i.toDataURL('image/jpeg', 0.6) : i.toDataURL('image/png'),
n[o] = {
uuid: a,
url: i
}
}
t.image = r.uuid
}
return e.textures[this.uuid] = t
},
dispose: function () {
this.dispatchEvent({
type: 'dispose'
})
},
transformUv: function (e) {
if (this.mapping === THREE.UVMapping) {
if (e.multiply(this.repeat), e.add(this.offset), 0 > e.x || 1 < e.x) switch (this.wrapS) {
case THREE.RepeatWrapping:
e.x -= Math.floor(e.x);
break;
case THREE.ClampToEdgeWrapping:
e.x = 0 > e.x ? 0 : 1;
break;
case THREE.MirroredRepeatWrapping:
1 === Math.abs(Math.floor(e.x) % 2) ? e.x = Math.ceil(e.x) - e.x : e.x -= Math.floor(e.x)
}
if (0 > e.y || 1 < e.y) switch (this.wrapT) {
case THREE.RepeatWrapping:
e.y -= Math.floor(e.y);
break;
case THREE.ClampToEdgeWrapping:
e.y = 0 > e.y ? 0 : 1;
break;
case THREE.MirroredRepeatWrapping:
1 === Math.abs(Math.floor(e.y) % 2) ? e.y = Math.ceil(e.y) - e.y : e.y -= Math.floor(e.y)
}
this.flipY && (e.y = 1 - e.y)
}
}
},
THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype),
THREE.TextureIdCount = 0,
THREE.CanvasTexture = function (e, t, r, i, n, o, a, s, h) {
THREE.Texture.call(this, e, t, r, i, n, o, a, s, h),
this.needsUpdate = !0
},
THREE.CanvasTexture.prototype = Object.create(THREE.Texture.prototype),
THREE.CanvasTexture.prototype.constructor = THREE.CanvasTexture,
THREE.CubeTexture = function (e, t, r, i, n, o, a, s, h) {
t = void 0 !== t ? t : THREE.CubeReflectionMapping,
THREE.Texture.call(this, e, t, r, i, n, o, a, s, h),
this.images = e,
this.flipY = !1
},
THREE.CubeTexture.prototype = Object.create(THREE.Texture.prototype),
THREE.CubeTexture.prototype.constructor = THREE.CubeTexture,
THREE.CubeTexture.prototype.copy = function (e) {
return THREE.Texture.prototype.copy.call(this, e),
this.images = e.images,
this
},
THREE.CompressedTexture = function (e, t, r, i, n, o, a, s, h, c, u) {
THREE.Texture.call(this, null, o, a, s, h, c, i, n, u),
this.image = {
width: t,
height: r
},
this.mipmaps = e,
this.generateMipmaps = this.flipY = !1
},
THREE.CompressedTexture.prototype = Object.create(THREE.Texture.prototype),
THREE.CompressedTexture.prototype.constructor = THREE.CompressedTexture,
THREE.DataTexture = function (e, t, r, i, n, o, a, s, h, c, u) {
THREE.Texture.call(this, null, o, a, s, h, c, i, n, u),
this.image = {
data: e,
width: t,
height: r
},
this.magFilter = void 0 !== h ? h : THREE.NearestFilter,
this.minFilter = void 0 !== c ? c : THREE.NearestFilter,
this.generateMipmaps = this.flipY = !1
},
THREE.DataTexture.prototype = Object.create(THREE.Texture.prototype),
THREE.DataTexture.prototype.constructor = THREE.DataTexture,
THREE.VideoTexture = function (e, t, r, i, n, o, a, s, h) {
function c() {
requestAnimationFrame(c),
e.readyState === e.HAVE_ENOUGH_DATA && (u.needsUpdate = !0)
}
THREE.Texture.call(this, e, t, r, i, n, o, a, s, h),
this.generateMipmaps = !1;
var u = this;
c()
},
THREE.VideoTexture.prototype = Object.create(THREE.Texture.prototype),
THREE.VideoTexture.prototype.constructor = THREE.VideoTexture,
THREE.Group = function () {
THREE.Object3D.call(this),
this.type = 'Group'
},
THREE.Group.prototype = Object.create(THREE.Object3D.prototype),
THREE.Group.prototype.constructor = THREE.Group,
THREE.Points = function (e, t) {
THREE.Object3D.call(this),
this.type = 'Points',
this.geometry = void 0 !== e ? e : new THREE.Geometry,
this.material = void 0 !== t ? t : new THREE.PointsMaterial({
color: 16777215 * Math.random()
})
},
THREE.Points.prototype = Object.create(THREE.Object3D.prototype),
THREE.Points.prototype.constructor = THREE.Points,
THREE.Points.prototype.raycast = function () {
var e = new THREE.Matrix4,
t = new THREE.Ray;
return function (r, i) {
function n(e, n) {
var a = t.distanceSqToPoint(e);
if (h > a) {
var s = t.closestPointToPoint(e);
s.applyMatrix4(o.matrixWorld);
var c = r.ray.origin.distanceTo(s);
c < r.near || c > r.far || i.push({
distance: c,
distanceToRay: Math.sqrt(a),
point: s.clone(),
index: n,
face: null,
object: o
})
}
}
var o = this,
a = o.geometry,
s = r.params.Points.threshold;
if (e.getInverse(this.matrixWorld), t.copy(r.ray).applyMatrix4(e), null === a.boundingBox || !1 !== t.isIntersectionBox(a.boundingBox)) {
var s = s / ((this.scale.x + this.scale.y + this.scale.z) / 3),
h = s * s,
s = new THREE.Vector3;
if (a instanceof THREE.BufferGeometry) {
var c = a.index,
a = a.attributes.position.array;
if (null !== c) for (var u = c.array, c = 0, l = u.length; l > c; c++) {
var E = u[c];
s.fromArray(a, 3 * E),
n(s, E)
} else for (c = 0, u = a.length / 3; u > c; c++) s.fromArray(a, 3 * c),
n(s, c)
} else for (s = a.vertices, c = 0, u = s.length; u > c; c++) n(s[c], c)
}
}
}(),
THREE.Points.prototype.clone = function () {
return new this.constructor(this.geometry, this.material).copy(this)
},
THREE.PointCloud = function (e, t) {
return console.warn('THREE.PointCloud has been renamed to THREE.Points.'),
new THREE.Points(e, t)
},
THREE.ParticleSystem = function (e, t) {
return console.warn('THREE.ParticleSystem has been renamed to THREE.Points.'),
new THREE.Points(e, t)
},
THREE.Line = function (e, t, r) {
return 1 === r ? (console.warn('THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead.'), new THREE.LineSegments(e, t)) : (THREE.Object3D.call(this), this.type = 'Line', this.geometry = void 0 !== e ? e : new THREE.Geometry, void (this.material = void 0 !== t ? t : new THREE.LineBasicMaterial({
color: 16777215 * Math.random()
})))
},
THREE.Line.prototype = Object.create(THREE.Object3D.prototype),
THREE.Line.prototype.constructor = THREE.Line,
THREE.Line.prototype.raycast = function () {
var e = new THREE.Matrix4,
t = new THREE.Ray,
r = new THREE.Sphere;
return function (i, n) {
var o = i.linePrecision,
o = o * o,
a = this.geometry;
if (null === a.boundingSphere && a.computeBoundingSphere(), r.copy(a.boundingSphere), r.applyMatrix4(this.matrixWorld), !1 !== i.ray.isIntersectionSphere(r)) {
e.getInverse(this.matrixWorld),
t.copy(i.ray).applyMatrix4(e);
var s = new THREE.Vector3,
h = new THREE.Vector3,
c = new THREE.Vector3,
u = new THREE.Vector3,
l = this instanceof THREE.LineSegments ? 2 : 1;
if (a instanceof THREE.BufferGeometry) {
var E = a.index,
p = a.attributes;
if (null !== E) for (var a = E.array, p = p.position.array, E = 0, d = a.length - 1; d > E; E += l) {
var f = a[E + 1];
s.fromArray(p, 3 * a[E]),
h.fromArray(p, 3 * f),
f = t.distanceSqToSegment(s, h, u, c),
f > o || (u.applyMatrix4(this.matrixWorld), f = i.ray.origin.distanceTo(u), f < i.near || f > i.far || n.push({
distance: f,
point: c.clone().applyMatrix4(this.matrixWorld),
index: E,
face: null,
faceIndex: null,
object: this
}))
} else for (p = p.position.array, E = 0, d = p.length / 3 - 1; d > E; E += l) s.fromArray(p, 3 * E),
h.fromArray(p, 3 * E + 3),
f = t.distanceSqToSegment(s, h, u, c),
f > o || (u.applyMatrix4(this.matrixWorld), f = i.ray.origin.distanceTo(u), f < i.near || f > i.far || n.push({
distance: f,
point: c.clone().applyMatrix4(this.matrixWorld),
index: E,
face: null,
faceIndex: null,
object: this
}))
} else if (a instanceof THREE.Geometry) for (s = a.vertices, h = s.length, E = 0; h - 1 > E; E += l) f = t.distanceSqToSegment(s[E], s[E + 1], u, c),
f > o || (u.applyMatrix4(this.matrixWorld), f = i.ray.origin.distanceTo(u), f < i.near || f > i.far || n.push({
distance: f,
point: c.clone().applyMatrix4(this.matrixWorld),
index: E,
face: null,
faceIndex: null,
object: this
}))
}
}
}(),
THREE.Line.prototype.clone = function () {
return new this.constructor(this.geometry, this.material).copy(this)
},
THREE.LineStrip = 0,
THREE.LinePieces = 1,
THREE.LineSegments = function (e, t) {
THREE.Line.call(this, e, t),
this.type = 'LineSegments'
},
THREE.LineSegments.prototype = Object.create(THREE.Line.prototype),
THREE.LineSegments.prototype.constructor = THREE.LineSegments,
THREE.Mesh = function (e, t) {
THREE.Object3D.call(this),
this.type = 'Mesh',
this.geometry = void 0 !== e ? e : new THREE.Geometry,
this.material = void 0 !== t ? t : new THREE.MeshBasicMaterial({
color: 16777215 * Math.random()
}),
this.updateMorphTargets()
},
THREE.Mesh.prototype = Object.create(THREE.Object3D.prototype),
THREE.Mesh.prototype.constructor = THREE.Mesh,
THREE.Mesh.prototype.updateMorphTargets = function () {
if (void 0 !== this.geometry.morphTargets && 0 < this.geometry.morphTargets.length) {
this.morphTargetBase = - 1,
this.morphTargetInfluences = [
],
this.morphTargetDictionary = {
};
for (var e = 0, t = this.geometry.morphTargets.length; t > e; e++) this.morphTargetInfluences.push(0),
this.morphTargetDictionary[this.geometry.morphTargets[e].name] = e
}
},
THREE.Mesh.prototype.getMorphTargetIndexByName = function (e) {
return void 0 !== this.morphTargetDictionary[e] ? this.morphTargetDictionary[e] : (console.warn('THREE.Mesh.getMorphTargetIndexByName: morph target ' + e + ' does not exist. Returning 0.'), 0)
},
THREE.Mesh.prototype.raycast = function () {
function e(e, t, r, i, n, o, a) {
return THREE.Triangle.barycoordFromPoint(e, t, r, i, f),
n.multiplyScalar(f.x),
o.multiplyScalar(f.y),
a.multiplyScalar(f.z),
n.add(o).add(a),
n.clone()
}
function t(e, t, r, i, n, o, a) {
var s = e.material;
return null === (s.side === THREE.BackSide ? r.intersectTriangle(o, n, i, !0, a) : r.intersectTriangle(i, n, o, s.side !== THREE.DoubleSide, a)) ? null : (T.copy(a), T.applyMatrix4(e.matrixWorld), r = t.ray.origin.distanceTo(T), r < t.near || r > t.far ? null : {
distance: r,
point: T.clone(),
object: e
})
}
function r(r, i, n, o, c, u, l, f) {
return a.fromArray(o, 3 * u),
s.fromArray(o, 3 * l),
h.fromArray(o, 3 * f),
(r = t(r, i, n, a, s, h, m)) && (c && (E.fromArray(c, 2 * u), p.fromArray(c, 2 * l), d.fromArray(c, 2 * f), r.uv = e(m, a, s, h, E, p, d)), r.face = new THREE.Face3(u, l, f, THREE.Triangle.normal(a, s, h)), r.faceIndex = u),
r
}
var i = new THREE.Matrix4,
n = new THREE.Ray,
o = new THREE.Sphere,
a = new THREE.Vector3,
s = new THREE.Vector3,
h = new THREE.Vector3,
c = new THREE.Vector3,
u = new THREE.Vector3,
l = new THREE.Vector3,
E = new THREE.Vector2,
p = new THREE.Vector2,
d = new THREE.Vector2,
f = new THREE.Vector3,
m = new THREE.Vector3,
T = new THREE.Vector3;
return function (f, T) {
var g = this.geometry,
v = this.material;
if (void 0 !== v) {
null === g.boundingSphere && g.computeBoundingSphere();
var y = this.matrixWorld;
if (o.copy(g.boundingSphere), o.applyMatrix4(y), !1 !== f.ray.isIntersectionSphere(o) && (i.getInverse(y), n.copy(f.ray).applyMatrix4(i), null === g.boundingBox || !1 !== n.isIntersectionBox(g.boundingBox))) {
var R,
H;
if (g instanceof THREE.BufferGeometry) {
var x,
b,
v = g.index,
y = g.attributes,
g = y.position.array;
if (void 0 !== y.uv && (R = y.uv.array), null !== v) for (var y = v.array, _ = 0, w = y.length; w > _; _ += 3) v = y[_],
x = y[_ + 1],
b = y[_ + 2],
(H = r(this, f, n, g, R, v, x, b)) && (H.faceIndex = Math.floor(_ / 3), T.push(H));
else for (_ = 0, w = g.length; w > _; _ += 9) v = _ / 3,
x = v + 1,
b = v + 2,
(H = r(this, f, n, g, R, v, x, b)) && (H.index = v, T.push(H))
} else if (g instanceof THREE.Geometry) {
var M,
S,
y = v instanceof THREE.MeshFaceMaterial,
_ = !0 === y ? v.materials : null,
w = g.vertices;
x = g.faces,
b = g.faceVertexUvs[0],
0 < b.length && (R = b);
for (var A = 0, C = x.length; C > A; A++) {
var L = x[A];
if (H = !0 === y ? _[L.materialIndex] : v, void 0 !== H) {
if (b = w[L.a], M = w[L.b], S = w[L.c], !0 === H.morphTargets) {
H = g.morphTargets;
var P = this.morphTargetInfluences;
a.set(0, 0, 0),
s.set(0, 0, 0),
h.set(0, 0, 0);
for (var k = 0, D = H.length; D > k; k++) {
var F = P[k];
if (0 !== F) {
var V = H[k].vertices;
a.addScaledVector(c.subVectors(V[L.a], b), F),
s.addScaledVector(u.subVectors(V[L.b], M), F),
h.addScaledVector(l.subVectors(V[L.c], S), F)
}
}
a.add(b),
s.add(M),
h.add(S),
b = a,
M = s,
S = h
}(H = t(this, f, n, b, M, S, m)) && (R && (P = R[A], E.copy(P[0]), p.copy(P[1]), d.copy(P[2]), H.uv = e(m, b, M, S, E, p, d)), H.face = L, H.faceIndex = A, T.push(H))
}
}
}
}
}
}
}(),
THREE.Mesh.prototype.clone = function () {
return new this.constructor(this.geometry, this.material).copy(this)
},
THREE.Bone = function (e) {
THREE.Object3D.call(this),
this.type = 'Bone',
this.skin = e
},
THREE.Bone.prototype = Object.create(THREE.Object3D.prototype),
THREE.Bone.prototype.constructor = THREE.Bone,
THREE.Bone.prototype.copy = function (e) {
return THREE.Object3D.prototype.copy.call(this, e),
this.skin = e.skin,
this
},
THREE.Skeleton = function (e, t, r) {
if (this.useVertexTexture = void 0 !== r ? r : !0, this.identityMatrix = new THREE.Matrix4, e = e || [
], this.bones = e.slice(0), this.useVertexTexture ? (e = Math.sqrt(4 * this.bones.length), e = THREE.Math.nextPowerOfTwo(Math.ceil(e)), this.boneTextureHeight = this.boneTextureWidth = e = Math.max(e, 4), this.boneMatrices = new Float32Array(this.boneTextureWidth * this.boneTextureHeight * 4), this.boneTexture = new THREE.DataTexture(this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, THREE.RGBAFormat, THREE.FloatType)) : this.boneMatrices = new Float32Array(16 * this.bones.length), void 0 === t) this.calculateInverses();
else if (this.bones.length === t.length) this.boneInverses = t.slice(0);
else for (console.warn('THREE.Skeleton bonInverses is the wrong length.'), this.boneInverses = [
], t = 0, e = this.bones.length; e > t; t++) this.boneInverses.push(new THREE.Matrix4)
},
THREE.Skeleton.prototype.calculateInverses = function () {
this.boneInverses = [
];
for (var e = 0, t = this.bones.length; t > e; e++) {
var r = new THREE.Matrix4;
this.bones[e] && r.getInverse(this.bones[e].matrixWorld),
this.boneInverses.push(r)
}
},
THREE.Skeleton.prototype.pose = function () {
for (var e, t = 0, r = this.bones.length; r > t; t++) (e = this.bones[t]) && e.matrixWorld.getInverse(this.boneInverses[t]);
for (t = 0, r = this.bones.length; r > t; t++) (e = this.bones[t]) && (e.parent ? (e.matrix.getInverse(e.parent.matrixWorld), e.matrix.multiply(e.matrixWorld)) : e.matrix.copy(e.matrixWorld), e.matrix.decompose(e.position, e.quaternion, e.scale))
},
THREE.Skeleton.prototype.update = function () {
var e = new THREE.Matrix4;
return function () {
for (var t = 0, r = this.bones.length; r > t; t++) e.multiplyMatrices(this.bones[t] ? this.bones[t].matrixWorld : this.identityMatrix, this.boneInverses[t]),
e.flattenToArrayOffset(this.boneMatrices, 16 * t);
this.useVertexTexture && (this.boneTexture.needsUpdate = !0)
}
}(),
THREE.Skeleton.prototype.clone = function () {
return new THREE.Skeleton(this.bones, this.boneInverses, this.useVertexTexture)
},
THREE.SkinnedMesh = function (e, t, r) {
if (THREE.Mesh.call(this, e, t), this.type = 'SkinnedMesh', this.bindMode = 'attached', this.bindMatrix = new THREE.Matrix4, this.bindMatrixInverse = new THREE.Matrix4, e = [
], this.geometry && void 0 !== this.geometry.bones) {
for (var i, n = 0, o = this.geometry.bones.length; o > n; ++n) i = this.geometry.bones[n],
t = new THREE.Bone(this),
e.push(t),
t.name = i.name,
t.position.fromArray(i.pos),
t.quaternion.fromArray(i.rotq),
void 0 !== i.scl && t.scale.fromArray(i.scl);
for (n = 0, o = this.geometry.bones.length; o > n; ++n) i = this.geometry.bones[n],
- 1 !== i.parent && null !== i.parent ? e[i.parent].add(e[n]) : this.add(e[n])
}
this.normalizeSkinWeights(),
this.updateMatrixWorld(!0),
this.bind(new THREE.Skeleton(e, void 0, r), this.matrixWorld)
},
THREE.SkinnedMesh.prototype = Object.create(THREE.Mesh.prototype),
THREE.SkinnedMesh.prototype.constructor = THREE.SkinnedMesh,
THREE.SkinnedMesh.prototype.bind = function (e, t) {
this.skeleton = e,
void 0 === t && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), t = this.matrixWorld),
this.bindMatrix.copy(t),
this.bindMatrixInverse.getInverse(t)
},
THREE.SkinnedMesh.prototype.pose = function () {
this.skeleton.pose()
},
THREE.SkinnedMesh.prototype.normalizeSkinWeights = function () {
if (this.geometry instanceof THREE.Geometry) for (var e = 0; e < this.geometry.skinIndices.length; e++) {
var t = this.geometry.skinWeights[e],
r = 1 / t.lengthManhattan();
1 / 0 !== r ? t.multiplyScalar(r) : t.set(1)
}
},
THREE.SkinnedMesh.prototype.updateMatrixWorld = function (e) {
THREE.Mesh.prototype.updateMatrixWorld.call(this, !0),
'attached' === this.bindMode ? this.bindMatrixInverse.getInverse(this.matrixWorld) : 'detached' === this.bindMode ? this.bindMatrixInverse.getInverse(this.bindMatrix) : console.warn('THREE.SkinnedMesh unrecognized bindMode: ' + this.bindMode)
},
THREE.SkinnedMesh.prototype.clone = function () {
return new this.constructor(this.geometry, this.material, this.useVertexTexture).copy(this)
},
THREE.LOD = function () {
THREE.Object3D.call(this),
this.type = 'LOD',
Object.defineProperties(this, {
levels: {
enumerable: !0,
value: [
]
},
objects: {
get: function () {
return console.warn('THREE.LOD: .objects has been renamed to .levels.'),
this.levels
}
}
})
},
THREE.LOD.prototype = Object.create(THREE.Object3D.prototype),
THREE.LOD.prototype.constructor = THREE.LOD,
THREE.LOD.prototype.addLevel = function (e, t) {
void 0 === t && (t = 0),
t = Math.abs(t);
for (var r = this.levels, i = 0; i < r.length && !(t < r[i].distance); i++);
r.splice(i, 0, {
distance: t,
object: e
}),
this.add(e)
},
THREE.LOD.prototype.getObjectForDistance = function (e) {
for (var t = this.levels, r = 1, i = t.length; i > r && !(e < t[r].distance); r++);
return t[r - 1].object
},
THREE.LOD.prototype.raycast = function () {
var e = new THREE.Vector3;
return function (t, r) {
e.setFromMatrixPosition(this.matrixWorld);
var i = t.ray.origin.distanceTo(e);
this.getObjectForDistance(i).raycast(t, r)
}
}(),
THREE.LOD.prototype.update = function () {
var e = new THREE.Vector3,
t = new THREE.Vector3;
return function (r) {
var i = this.levels;
if (1 < i.length) {
e.setFromMatrixPosition(r.matrixWorld),
t.setFromMatrixPosition(this.matrixWorld),
r = e.distanceTo(t),
i[0].object.visible = !0;
for (var n = 1, o = i.length; o > n && r >= i[n].distance; n++) i[n - 1].object.visible = !1,
i[n].object.visible = !0;
for (; o > n; n++) i[n].object.visible = !1
}
}
}(),
THREE.LOD.prototype.copy = function (e) {
THREE.Object3D.prototype.copy.call(this, e, !1),
e = e.levels;
for (var t = 0, r = e.length; r > t; t++) {
var i = e[t];
this.addLevel(i.object.clone(), i.distance)
}
return this
},
THREE.LOD.prototype.toJSON = function (e) {
e = THREE.Object3D.prototype.toJSON.call(this, e),
e.object.levels = [
];
for (var t = this.levels, r = 0, i = t.length; i > r; r++) {
var n = t[r];
e.object.levels.push({
object: n.object.uuid,
distance: n.distance
})
}
return e
},
THREE.Sprite = function () {
var e = new Uint16Array([0,
1,
2,
0,
2,
3]),
t = new Float32Array([ - 0.5,
- 0.5,
0,
0.5,
- 0.5,
0,
0.5,
0.5,
0,
- 0.5,
0.5,
0]),
r = new Float32Array([0,
0,
1,
0,
1,
1,
0,
1]),
i = new THREE.BufferGeometry;
return i.setIndex(new THREE.BufferAttribute(e, 1)),
i.addAttribute('position', new THREE.BufferAttribute(t, 3)),
i.addAttribute('uv', new THREE.BufferAttribute(r, 2)),
function (e) {
THREE.Object3D.call(this),
this.type = 'Sprite',
this.geometry = i,
this.material = void 0 !== e ? e : new THREE.SpriteMaterial
}
}(),
THREE.Sprite.prototype = Object.create(THREE.Object3D.prototype),
THREE.Sprite.prototype.constructor = THREE.Sprite,
THREE.Sprite.prototype.raycast = function () {
var e = new THREE.Vector3;
return function (t, r) {
e.setFromMatrixPosition(this.matrixWorld);
var i = t.ray.distanceSqToPoint(e);
i > this.scale.x * this.scale.y || r.push({
distance: Math.sqrt(i),
point: this.position,
face: null,
object: this
})
}
}(),
THREE.Sprite.prototype.clone = function () {
return new this.constructor(this.material).copy(this)
},
THREE.Particle = THREE.Sprite,
THREE.LensFlare = function (e, t, r, i, n) {
THREE.Object3D.call(this),
this.lensFlares = [
],
this.positionScreen = new THREE.Vector3,
this.customUpdateCallback = void 0,
void 0 !== e && this.add(e, t, r, i, n)
},
THREE.LensFlare.prototype = Object.create(THREE.Object3D.prototype),
THREE.LensFlare.prototype.constructor = THREE.LensFlare,
THREE.LensFlare.prototype.add = function (e, t, r, i, n, o) {
void 0 === t && (t = - 1),
void 0 === r && (r = 0),
void 0 === o && (o = 1),
void 0 === n && (n = new THREE.Color(16777215)),
void 0 === i && (i = THREE.NormalBlending),
r = Math.min(r, Math.max(0, r)),
this.lensFlares.push({
texture: e,
size: t,
distance: r,
x: 0,
y: 0,
z: 0,
scale: 1,
rotation: 0,
opacity: o,
color: n,
blending: i
})
},
THREE.LensFlare.prototype.updateLensFlares = function () {
var e,
t,
r = this.lensFlares.length,
i = 2 * - this.positionScreen.x,
n = 2 * - this.positionScreen.y;
for (e = 0; r > e; e++) t = this.lensFlares[e],
t.x = this.positionScreen.x + i * t.distance,
t.y = this.positionScreen.y + n * t.distance,
t.wantedRotation = t.x * Math.PI * 0.25,
t.rotation += 0.25 * (t.wantedRotation - t.rotation)
},
THREE.LensFlare.prototype.copy = function (e) {
THREE.Object3D.prototype.copy.call(this, e),
this.positionScreen.copy(e.positionScreen),
this.customUpdateCallback = e.customUpdateCallback;
for (var t = 0, r = e.lensFlares.length; r > t; t++) this.lensFlares.push(e.lensFlares[t]);
return this
},
THREE.Scene = function () {
THREE.Object3D.call(this),
this.type = 'Scene',
this.overrideMaterial = this.fog = null,
this.autoUpdate = !0
},
THREE.Scene.prototype = Object.create(THREE.Object3D.prototype),
THREE.Scene.prototype.constructor = THREE.Scene,
THREE.Scene.prototype.copy = function (e) {
return THREE.Object3D.prototype.copy.call(this, e),
null !== e.fog && (this.fog = e.fog.clone()),
null !== e.overrideMaterial && (this.overrideMaterial = e.overrideMaterial.clone()),
this.autoUpdate = e.autoUpdate,
this.matrixAutoUpdate = e.matrixAutoUpdate,
this
},
THREE.Fog = function (e, t, r) {
this.name = '',
this.color = new THREE.Color(e),
this.near = void 0 !== t ? t : 1,
this.far = void 0 !== r ? r : 1000
},
THREE.Fog.prototype.clone = function () {
return new THREE.Fog(this.color.getHex(), this.near, this.far)
},
THREE.FogExp2 = function (e, t) {
this.name = '',
this.color = new THREE.Color(e),
this.density = void 0 !== t ? t : 0.00025
},
THREE.FogExp2.prototype.clone = function () {
return new THREE.FogExp2(this.color.getHex(), this.density)
},
THREE.ShaderChunk = {
},
THREE.ShaderChunk.alphamap_fragment = '#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n',
THREE.ShaderChunk.alphamap_pars_fragment = '#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n',
THREE.ShaderChunk.alphatest_fragment = '#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n',
THREE.ShaderChunk.aomap_fragment = '#ifdef USE_AOMAP\n\n\ttotalAmbientLight *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n',
THREE.ShaderChunk.aomap_pars_fragment = '#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif',
THREE.ShaderChunk.begin_vertex = '\nvec3 transformed = vec3( position );\n',
THREE.ShaderChunk.beginnormal_vertex = '\nvec3 objectNormal = vec3( normal );\n',
THREE.ShaderChunk.bumpmap_pars_fragment = '#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n',
THREE.ShaderChunk.color_fragment = '#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif',
THREE.ShaderChunk.color_pars_fragment = '#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n',
THREE.ShaderChunk.color_pars_vertex = '#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif',
THREE.ShaderChunk.color_vertex = '#ifdef USE_COLOR\n\n\tvColor.xyz = color.xyz;\n\n#endif',
THREE.ShaderChunk.common = '#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\n\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\n\treturn - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\n\tif ( decayExponent > 0.0 ) {\n\n\t return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t}\n\n\treturn 1.0;\n\n}\n\nvec3 F_Schlick( in vec3 specularColor, in float dotLH ) {\n\n\n\tfloat fresnel = exp2( ( -5.55437 * dotLH - 6.98316 ) * dotLH );\n\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n\n}\n\nfloat G_BlinnPhong_Implicit( /* in float dotNL, in float dotNV */ ) {\n\n\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( in float shininess, in float dotNH ) {\n\n\n\treturn ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( in vec3 specularColor, in float shininess, in vec3 normal, in vec3 lightDir, in vec3 viewDir ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( lightDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * G * D;\n\n}\n\nvec3 inputToLinear( in vec3 a ) {\n\n\t#ifdef GAMMA_INPUT\n\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\n\t#else\n\n\t\treturn a;\n\n\t#endif\n\n}\n\nvec3 linearToOutput( in vec3 a ) {\n\n\t#ifdef GAMMA_OUTPUT\n\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\n\t#else\n\n\t\treturn a;\n\n\t#endif\n\n}\n',
THREE.ShaderChunk.defaultnormal_vertex = '#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n',
THREE.ShaderChunk.displacementmap_vertex = '#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n\n#endif\n',
THREE.ShaderChunk.displacementmap_pars_vertex = '#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n',
THREE.ShaderChunk.emissivemap_fragment = '#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\temissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\n\ttotalEmissiveLight *= emissiveColor.rgb;\n\n#endif\n',
THREE.ShaderChunk.emissivemap_pars_fragment = '#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n',
THREE.ShaderChunk.envmap_fragment = '#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n',
THREE.ShaderChunk.envmap_pars_fragment = '#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n',
THREE.ShaderChunk.envmap_pars_vertex = '#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n',
THREE.ShaderChunk.envmap_vertex = '#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n',
THREE.ShaderChunk.fog_fragment = '#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif',
THREE.ShaderChunk.fog_pars_fragment = '#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif',
THREE.ShaderChunk.hemilight_fragment = '#if MAX_HEMI_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lightDir = hemisphereLightDirection[ i ];\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 lightColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalAmbientLight += lightColor;\n\n\t}\n\n#endif\n\n',
THREE.ShaderChunk.lightmap_fragment = '#ifdef USE_LIGHTMAP\n\n\ttotalAmbientLight += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n#endif\n',
THREE.ShaderChunk.lightmap_pars_fragment = '#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif',
THREE.ShaderChunk.lights_lambert_pars_vertex = '#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n',
THREE.ShaderChunk.lights_lambert_vertex = 'vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\nvec3 normal = normalize( transformedNormal );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = pointLightColor[ i ];\n\n\t\tvec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tvLightFront += lightColor * attenuation * saturate( dotProduct );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = spotLightColor[ i ];\n\n\t\tvec3 lightPosition = spotLightPosition[ i ];\n\t\tvec3 lVector = lightPosition - mvPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tattenuation *= spotEffect;\n\n\n\t\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\t\tvLightFront += lightColor * attenuation * saturate( dotProduct );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = directionalLightColor[ i ];\n\n\t\tvec3 lightDir = directionalLightDirection[ i ];\n\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tvLightFront += lightColor * saturate( dotProduct );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += lightColor * saturate( - dotProduct );\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lightDir = hemisphereLightDirection[ i ];\n\n\n\t\tfloat dotProduct = dot( normal, lightDir );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tfloat hemiDiffuseWeightBack = - 0.5 * dotProduct + 0.5;\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n',
THREE.ShaderChunk.lights_phong_fragment = 'vec3 viewDir = normalize( vViewPosition );\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = pointLightColor[ i ];\n\n\t\tvec3 lightPosition = pointLightPosition[ i ];\n\t\tvec3 lVector = lightPosition + vViewPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\n\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\n\n\t\ttotalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n\n\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n\t\ttotalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = spotLightColor[ i ];\n\n\t\tvec3 lightPosition = spotLightPosition[ i ];\n\t\tvec3 lVector = lightPosition + vViewPosition.xyz;\n\t\tvec3 lightDir = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tattenuation *= spotEffect;\n\n\n\t\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\n\n\t\t\ttotalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n\n\t\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n\t\t\ttotalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 lightColor = directionalLightColor[ i ];\n\n\t\tvec3 lightDir = directionalLightDirection[ i ];\n\n\n\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\n\n\t\ttotalDiffuseLight += lightColor * cosineTerm;\n\n\n\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n\t\ttotalSpecularLight += brdf * specularStrength * lightColor * cosineTerm;\n\n\t}\n\n#endif\n',
THREE.ShaderChunk.lights_phong_pars_fragment = 'uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n',
THREE.ShaderChunk.lights_phong_pars_vertex = '#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\n#endif\n',
THREE.ShaderChunk.lights_phong_vertex = '#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n',
THREE.ShaderChunk.linear_to_gamma_fragment = '\n\toutgoingLight = linearToOutput( outgoingLight );\n',
THREE.ShaderChunk.logdepthbuf_fragment = '#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif',
THREE.ShaderChunk.logdepthbuf_pars_fragment = '#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif\n',
THREE.ShaderChunk.logdepthbuf_pars_vertex = '#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif',
THREE.ShaderChunk.logdepthbuf_vertex = '#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif',
THREE.ShaderChunk.map_fragment = '#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\n\tdiffuseColor *= texelColor;\n\n#endif\n',
THREE.ShaderChunk.map_pars_fragment = '#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif',
THREE.ShaderChunk.map_particle_fragment = '#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n',
THREE.ShaderChunk.map_particle_pars_fragment = '#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n',
THREE.ShaderChunk.morphnormal_vertex = '#ifdef USE_MORPHNORMALS\n\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n#endif\n',
THREE.ShaderChunk.morphtarget_pars_vertex = '#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif',
THREE.ShaderChunk.morphtarget_vertex = '#ifdef USE_MORPHTARGETS\n\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n#endif\n',
THREE.ShaderChunk.normal_phong_fragment = '#ifndef FLAT_SHADED\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n\t#endif\n\n#else\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n',
THREE.ShaderChunk.normalmap_pars_fragment = '#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n',
THREE.ShaderChunk.project_vertex = '#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n',
THREE.ShaderChunk.shadowmap_fragment = '#ifdef USE_SHADOWMAP\n\n\tfor ( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tfloat texelSizeY = 1.0 / shadowMapSize[ i ].y;\n\n\t\tfloat shadow = 0.0;\n\n#if defined( POINT_LIGHT_SHADOWS )\n\n\t\tbool isPointLight = shadowDarkness[ i ] < 0.0;\n\n\t\tif ( isPointLight ) {\n\n\t\t\tfloat realShadowDarkness = abs( shadowDarkness[ i ] );\n\n\t\t\tvec3 lightToPosition = vShadowCoord[ i ].xyz;\n\n\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat dp = length( lightToPosition );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tconst float Dr = 1.25;\n\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tconst float Dr = 2.25;\n\t#endif\n\n\t\t\tfloat os = Dr * 2.0 * texelSizeY;\n\n\t\t\tconst vec3 Gsd = vec3( - 1, 0, 1 );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\t\t\tshadow *= realShadowDarkness * ( 1.0 / 21.0 );\n\n\t#else \n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat dp = length( lightToPosition );\n\n\t\t\tadjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\t\t\tshadow *= realShadowDarkness;\n\n\t#endif\n\n\t\t} else {\n\n#endif \n\t\t\tfloat texelSizeX = 1.0 / shadowMapSize[ i ].x;\n\n\t\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\n\t\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t\tbool frustumTest = all( frustumTestVec );\n\n\t\t\tif ( frustumTest ) {\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\n\t\t\t\t/*\n\t\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\t\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\t\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\t\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\t\tshadow += 1.0;\n\t\t\t\t\t}\n\t\t\t\t\tshadow /= 9.0;\n\t\t\t\t*/\n\n\t\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t\tconst float ShadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = texelSizeX;\n\t\t\t\tfloat yPixelOffset = texelSizeY;\n\n\t\t\t\tfloat dx0 = - 1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = - 1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfloat fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n\t\t\t\tshadow *= shadowDarkness[ i ];\n\n\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\n\t\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t\tfloat xPixelOffset = texelSizeX;\n\t\t\t\tfloat yPixelOffset = texelSizeY;\n\n\t\t\t\tfloat dx0 = - 1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = - 1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[ 0 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[ 0 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[ 0 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[ 1 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[ 1 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[ 1 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[ 2 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[ 2 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[ 2 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[ 0 ] = vec3( lessThan( depthKernel[ 0 ], shadowZ ) );\n\t\t\t\tshadowKernel[ 0 ] *= vec3( 0.25 );\n\n\t\t\t\tshadowKernel[ 1 ] = vec3( lessThan( depthKernel[ 1 ], shadowZ ) );\n\t\t\t\tshadowKernel[ 1 ] *= vec3( 0.25 );\n\n\t\t\t\tshadowKernel[ 2 ] = vec3( lessThan( depthKernel[ 2 ], shadowZ ) );\n\t\t\t\tshadowKernel[ 2 ] *= vec3( 0.25 );\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[ i ].xy );\n\n\t\t\t\tshadowKernel[ 0 ] = mix( shadowKernel[ 1 ], shadowKernel[ 0 ], fractionalCoord.x );\n\t\t\t\tshadowKernel[ 1 ] = mix( shadowKernel[ 2 ], shadowKernel[ 1 ], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[ 0 ][ 1 ], shadowKernel[ 0 ][ 0 ], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[ 0 ][ 2 ], shadowKernel[ 0 ][ 1 ], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[ 1 ][ 1 ], shadowKernel[ 1 ][ 0 ], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[ 1 ][ 2 ], shadowKernel[ 1 ][ 1 ], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) ) * shadowDarkness[ i ];\n\n\t#else \n\t\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\tshadow = shadowDarkness[ i ];\n\n\t#endif\n\n\t\t\t}\n\n#ifdef SHADOWMAP_DEBUG\n\n\t\t\tif ( inFrustum ) {\n\n\t\t\t\tif ( i == 0 ) {\n\n\t\t\t\t\toutgoingLight *= vec3( 1.0, 0.5, 0.0 );\n\n\t\t\t\t} else if ( i == 1 ) {\n\n\t\t\t\t\toutgoingLight *= vec3( 0.0, 1.0, 0.8 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toutgoingLight *= vec3( 0.0, 0.5, 1.0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n#endif\n\n#if defined( POINT_LIGHT_SHADOWS )\n\n\t\t}\n\n#endif\n\n\t\tshadowMask = shadowMask * vec3( 1.0 - shadow );\n\n\t}\n\n#endif\n',
THREE.ShaderChunk.shadowmap_pars_fragment = '#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n\t#if defined(POINT_LIGHT_SHADOWS)\n\n\n\t\tvoid adjustShadowValue1K( const float testDepth, const vec4 textureData, const float bias, inout float shadowValue ) {\n\n\t\t\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\t\tif ( testDepth >= dot( textureData, bitSh ) * 1000.0 + bias )\n\t\t\t\tshadowValue += 1.0;\n\n\t\t}\n\n\n\t\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\n\t\t\tvec3 absV = abs( v );\n\n\n\t\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\t\tabsV *= scaleToCube;\n\n\n\t\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\n\n\t\t\tvec2 planar = v.xy;\n\n\t\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\t\tif ( absV.z >= almostOne ) {\n\n\t\t\t\tif ( v.z > 0.0 )\n\t\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\t\tfloat signX = sign( v.x );\n\t\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t\t} else if ( absV.y >= almostOne ) {\n\n\t\t\t\tfloat signY = sign( v.y );\n\t\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\t\tplanar.y = v.z * signY - 2.0;\n\n\t\t\t}\n\n\n\t\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t\t}\n\n\t#endif\n\n#endif\n',
THREE.ShaderChunk.shadowmap_pars_vertex = '#ifdef USE_SHADOWMAP\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n#endif',
THREE.ShaderChunk.shadowmap_vertex = '#ifdef USE_SHADOWMAP\n\n\tfor ( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif',
THREE.ShaderChunk.skinbase_vertex = '#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif',
THREE.ShaderChunk.skinning_pars_vertex = '#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n',
THREE.ShaderChunk.skinning_vertex = '#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n',
THREE.ShaderChunk.skinnormal_vertex = '#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n',
THREE.ShaderChunk.specularmap_fragment = 'float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif',
THREE.ShaderChunk.specularmap_pars_fragment = '#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif',
THREE.ShaderChunk.uv2_pars_fragment = '#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif',
THREE.ShaderChunk.uv2_pars_vertex = '#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n#endif',
THREE.ShaderChunk.uv2_vertex = '#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = uv2;\n\n#endif',
THREE.ShaderChunk.uv_pars_fragment = '#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n\tvarying vec2 vUv;\n\n#endif',
THREE.ShaderChunk.uv_pars_vertex = '#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n',
THREE.ShaderChunk.uv_vertex = '#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif',
THREE.ShaderChunk.worldpos_vertex = '#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n\t#endif\n\n#endif\n',
THREE.UniformsUtils = {
merge: function (e) {
for (var t = {
}, r = 0; r < e.length; r++) {
var i,
n = this.clone(e[r]);
for (i in n) t[i] = n[i]
}
return t
},
clone: function (e) {
var t,
r = {
};
for (t in e) {
r[t] = {
};
for (var i in e[t]) {
var n = e[t][i];
n instanceof THREE.Color || n instanceof THREE.Vector2 || n instanceof THREE.Vector3 || n instanceof THREE.Vector4 || n instanceof THREE.Matrix3 || n instanceof THREE.Matrix4 || n instanceof THREE.Texture ? r[t][i] = n.clone() : Array.isArray(n) ? r[t][i] = n.slice() : r[t][i] = n
}
}
return r
}
},
THREE.UniformsLib = {
common: {
diffuse: {
type: 'c',
value: new THREE.Color(15658734)
},
opacity: {
type: 'f',
value: 1
},
map: {
type: 't',
value: null
},
offsetRepeat: {
type: 'v4',
value: new THREE.Vector4(0, 0, 1, 1)
},
specularMap: {
type: 't',
value: null
},
alphaMap: {
type: 't',
value: null
},
envMap: {
type: 't',
value: null
},
flipEnvMap: {
type: 'f',
value: - 1
},
reflectivity: {
type: 'f',
value: 1
},
refractionRatio: {
type: 'f',
value: 0.98
}
},
aomap: {
aoMap: {
type: 't',
value: null
},
aoMapIntensity: {
type: 'f',
value: 1
}
},
lightmap: {
lightMap: {
type: 't',
value: null
},
lightMapIntensity: {
type: 'f',
value: 1
}
},
emissivemap: {
emissiveMap: {
type: 't',
value: null
}
},
bumpmap: {
bumpMap: {
type: 't',
value: null
},
bumpScale: {
type: 'f',
value: 1
}
},
normalmap: {
normalMap: {
type: 't',
value: null
},
normalScale: {
type: 'v2',
value: new THREE.Vector2(1, 1)
}
},
displacementmap: {
displacementMap: {
type: 't',
value: null
},
displacementScale: {
type: 'f',
value: 1
},
displacementBias: {
type: 'f',
value: 0
}
},
fog: {
fogDensity: {
type: 'f',
value: 0.00025
},
fogNear: {
type: 'f',
value: 1
},
fogFar: {
type: 'f',
value: 2000
},
fogColor: {
type: 'c',
value: new THREE.Color(16777215)
}
},
lights: {
ambientLightColor: {
type: 'fv',
value: [
]
},
directionalLightDirection: {
type: 'fv',
value: [
]
},
directionalLightColor: {
type: 'fv',
value: [
]
},
hemisphereLightDirection: {
type: 'fv',
value: [
]
},
hemisphereLightSkyColor: {
type: 'fv',
value: [
]
},
hemisphereLightGroundColor: {
type: 'fv',
value: [
]
},
pointLightColor: {
type: 'fv',
value: [
]
},
pointLightPosition: {
type: 'fv',
value: [
]
},
pointLightDistance: {
type: 'fv1',
value: [
]
},
pointLightDecay: {
type: 'fv1',
value: [
]
},
spotLightColor: {
type: 'fv',
value: [
]
},
spotLightPosition: {
type: 'fv',
value: [
]
},
spotLightDirection: {
type: 'fv',
value: [
]
},
spotLightDistance: {
type: 'fv1',
value: [
]
},
spotLightAngleCos: {
type: 'fv1',
value: [
]
},
spotLightExponent: {
type: 'fv1',
value: [
]
},
spotLightDecay: {
type: 'fv1',
value: [
]
}
},
points: {
psColor: {
type: 'c',
value: new THREE.Color(15658734)
},
opacity: {
type: 'f',
value: 1
},
size: {
type: 'f',
value: 1
},
scale: {
type: 'f',
value: 1
},
map: {
type: 't',
value: null
},
offsetRepeat: {
type: 'v4',
value: new THREE.Vector4(0, 0, 1, 1)
},
fogDensity: {
type: 'f',
value: 0.00025
},
fogNear: {
type: 'f',
value: 1
},
fogFar: {
type: 'f',
value: 2000
},
fogColor: {
type: 'c',
value: new THREE.Color(16777215)
}
},
shadowmap: {
shadowMap: {
type: 'tv',
value: [
]
},
shadowMapSize: {
type: 'v2v',
value: [
]
},
shadowBias: {
type: 'fv1',
value: [
]
},
shadowDarkness: {
type: 'fv1',
value: [
]
},
shadowMatrix: {
type: 'm4v',
value: [
]
}
}
},
THREE.ShaderLib = {
basic: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common,
THREE.UniformsLib.aomap,
THREE.UniformsLib.fog,
THREE.UniformsLib.shadowmap]),
vertexShader: [
THREE.ShaderChunk.common,
THREE.ShaderChunk.uv_pars_vertex,
THREE.ShaderChunk.uv2_pars_vertex,
THREE.ShaderChunk.envmap_pars_vertex,
THREE.ShaderChunk.color_pars_vertex,
THREE.ShaderChunk.morphtarget_pars_vertex,
THREE.ShaderChunk.skinning_pars_vertex,
THREE.ShaderChunk.shadowmap_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {',
THREE.ShaderChunk.uv_vertex,
THREE.ShaderChunk.uv2_vertex,
THREE.ShaderChunk.color_vertex,
THREE.ShaderChunk.skinbase_vertex,
'\t#ifdef USE_ENVMAP',
THREE.ShaderChunk.beginnormal_vertex,
THREE.ShaderChunk.morphnormal_vertex,
THREE.ShaderChunk.skinnormal_vertex,
THREE.ShaderChunk.defaultnormal_vertex,
'\t#endif',
THREE.ShaderChunk.begin_vertex,
THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.skinning_vertex,
THREE.ShaderChunk.project_vertex,
THREE.ShaderChunk.logdepthbuf_vertex,
THREE.ShaderChunk.worldpos_vertex,
THREE.ShaderChunk.envmap_vertex,
THREE.ShaderChunk.shadowmap_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform vec3 diffuse;\nuniform float opacity;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.color_pars_fragment,
THREE.ShaderChunk.uv_pars_fragment,
THREE.ShaderChunk.uv2_pars_fragment,
THREE.ShaderChunk.map_pars_fragment,
THREE.ShaderChunk.alphamap_pars_fragment,
THREE.ShaderChunk.aomap_pars_fragment,
THREE.ShaderChunk.envmap_pars_fragment,
THREE.ShaderChunk.fog_pars_fragment,
THREE.ShaderChunk.shadowmap_pars_fragment,
THREE.ShaderChunk.specularmap_pars_fragment,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tvec3 totalAmbientLight = vec3( 1.0 );\n\tvec3 shadowMask = vec3( 1.0 );',
THREE.ShaderChunk.logdepthbuf_fragment,
THREE.ShaderChunk.map_fragment,
THREE.ShaderChunk.color_fragment,
THREE.ShaderChunk.alphamap_fragment,
THREE.ShaderChunk.alphatest_fragment,
THREE.ShaderChunk.specularmap_fragment,
THREE.ShaderChunk.aomap_fragment,
THREE.ShaderChunk.shadowmap_fragment,
'\toutgoingLight = diffuseColor.rgb * totalAmbientLight * shadowMask;',
THREE.ShaderChunk.envmap_fragment,
THREE.ShaderChunk.linear_to_gamma_fragment,
THREE.ShaderChunk.fog_fragment,
'\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}'
].join('\n')
},
lambert: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common,
THREE.UniformsLib.fog,
THREE.UniformsLib.lights,
THREE.UniformsLib.shadowmap,
{
emissive: {
type: 'c',
value: new THREE.Color(0)
}
}
]),
vertexShader: [
'#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif',
THREE.ShaderChunk.common,
THREE.ShaderChunk.uv_pars_vertex,
THREE.ShaderChunk.uv2_pars_vertex,
THREE.ShaderChunk.envmap_pars_vertex,
THREE.ShaderChunk.lights_lambert_pars_vertex,
THREE.ShaderChunk.color_pars_vertex,
THREE.ShaderChunk.morphtarget_pars_vertex,
THREE.ShaderChunk.skinning_pars_vertex,
THREE.ShaderChunk.shadowmap_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {',
THREE.ShaderChunk.uv_vertex,
THREE.ShaderChunk.uv2_vertex,
THREE.ShaderChunk.color_vertex,
THREE.ShaderChunk.beginnormal_vertex,
THREE.ShaderChunk.morphnormal_vertex,
THREE.ShaderChunk.skinbase_vertex,
THREE.ShaderChunk.skinnormal_vertex,
THREE.ShaderChunk.defaultnormal_vertex,
THREE.ShaderChunk.begin_vertex,
THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.skinning_vertex,
THREE.ShaderChunk.project_vertex,
THREE.ShaderChunk.logdepthbuf_vertex,
THREE.ShaderChunk.worldpos_vertex,
THREE.ShaderChunk.envmap_vertex,
THREE.ShaderChunk.lights_lambert_vertex,
THREE.ShaderChunk.shadowmap_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform vec3 ambientLightColor;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif',
THREE.ShaderChunk.common,
THREE.ShaderChunk.color_pars_fragment,
THREE.ShaderChunk.uv_pars_fragment,
THREE.ShaderChunk.uv2_pars_fragment,
THREE.ShaderChunk.map_pars_fragment,
THREE.ShaderChunk.alphamap_pars_fragment,
THREE.ShaderChunk.envmap_pars_fragment,
THREE.ShaderChunk.fog_pars_fragment,
THREE.ShaderChunk.shadowmap_pars_fragment,
THREE.ShaderChunk.specularmap_pars_fragment,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tvec3 totalAmbientLight = ambientLightColor;\n\tvec3 shadowMask = vec3( 1.0 );',
THREE.ShaderChunk.logdepthbuf_fragment,
THREE.ShaderChunk.map_fragment,
THREE.ShaderChunk.color_fragment,
THREE.ShaderChunk.alphamap_fragment,
THREE.ShaderChunk.alphatest_fragment,
THREE.ShaderChunk.specularmap_fragment,
THREE.ShaderChunk.shadowmap_fragment,
'\t#ifdef DOUBLE_SIDED\n\t\tif ( gl_FrontFacing )\n\t\t\toutgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + emissive;\n\t\telse\n\t\t\toutgoingLight += diffuseColor.rgb * ( vLightBack * shadowMask + totalAmbientLight ) + emissive;\n\t#else\n\t\toutgoingLight += diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + emissive;\n\t#endif',
THREE.ShaderChunk.envmap_fragment,
THREE.ShaderChunk.linear_to_gamma_fragment,
THREE.ShaderChunk.fog_fragment,
'\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}'
].join('\n')
},
phong: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common,
THREE.UniformsLib.aomap,
THREE.UniformsLib.lightmap,
THREE.UniformsLib.emissivemap,
THREE.UniformsLib.bumpmap,
THREE.UniformsLib.normalmap,
THREE.UniformsLib.displacementmap,
THREE.UniformsLib.fog,
THREE.UniformsLib.lights,
THREE.UniformsLib.shadowmap,
{
emissive: {
type: 'c',
value: new THREE.Color(0)
},
specular: {
type: 'c',
value: new THREE.Color(1118481)
},
shininess: {
type: 'f',
value: 30
}
}
]),
vertexShader: [
'#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif',
THREE.ShaderChunk.common,
THREE.ShaderChunk.uv_pars_vertex,
THREE.ShaderChunk.uv2_pars_vertex,
THREE.ShaderChunk.displacementmap_pars_vertex,
THREE.ShaderChunk.envmap_pars_vertex,
THREE.ShaderChunk.lights_phong_pars_vertex,
THREE.ShaderChunk.color_pars_vertex,
THREE.ShaderChunk.morphtarget_pars_vertex,
THREE.ShaderChunk.skinning_pars_vertex,
THREE.ShaderChunk.shadowmap_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {',
THREE.ShaderChunk.uv_vertex,
THREE.ShaderChunk.uv2_vertex,
THREE.ShaderChunk.color_vertex,
THREE.ShaderChunk.beginnormal_vertex,
THREE.ShaderChunk.morphnormal_vertex,
THREE.ShaderChunk.skinbase_vertex,
THREE.ShaderChunk.skinnormal_vertex,
THREE.ShaderChunk.defaultnormal_vertex,
'#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif',
THREE.ShaderChunk.begin_vertex,
THREE.ShaderChunk.displacementmap_vertex,
THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.skinning_vertex,
THREE.ShaderChunk.project_vertex,
THREE.ShaderChunk.logdepthbuf_vertex,
'\tvViewPosition = - mvPosition.xyz;',
THREE.ShaderChunk.worldpos_vertex,
THREE.ShaderChunk.envmap_vertex,
THREE.ShaderChunk.lights_phong_vertex,
THREE.ShaderChunk.shadowmap_vertex,
'}'
].join('\n'),
fragmentShader: [
'#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.color_pars_fragment,
THREE.ShaderChunk.uv_pars_fragment,
THREE.ShaderChunk.uv2_pars_fragment,
THREE.ShaderChunk.map_pars_fragment,
THREE.ShaderChunk.alphamap_pars_fragment,
THREE.ShaderChunk.aomap_pars_fragment,
THREE.ShaderChunk.lightmap_pars_fragment,
THREE.ShaderChunk.emissivemap_pars_fragment,
THREE.ShaderChunk.envmap_pars_fragment,
THREE.ShaderChunk.fog_pars_fragment,
THREE.ShaderChunk.lights_phong_pars_fragment,
THREE.ShaderChunk.shadowmap_pars_fragment,
THREE.ShaderChunk.bumpmap_pars_fragment,
THREE.ShaderChunk.normalmap_pars_fragment,
THREE.ShaderChunk.specularmap_pars_fragment,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tvec3 totalAmbientLight = ambientLightColor;\n\tvec3 totalEmissiveLight = emissive;\n\tvec3 shadowMask = vec3( 1.0 );',
THREE.ShaderChunk.logdepthbuf_fragment,
THREE.ShaderChunk.map_fragment,
THREE.ShaderChunk.color_fragment,
THREE.ShaderChunk.alphamap_fragment,
THREE.ShaderChunk.alphatest_fragment,
THREE.ShaderChunk.specularmap_fragment,
THREE.ShaderChunk.normal_phong_fragment,
THREE.ShaderChunk.lightmap_fragment,
THREE.ShaderChunk.hemilight_fragment,
THREE.ShaderChunk.aomap_fragment,
THREE.ShaderChunk.emissivemap_fragment,
THREE.ShaderChunk.lights_phong_fragment,
THREE.ShaderChunk.shadowmap_fragment,
'totalDiffuseLight *= shadowMask;\ntotalSpecularLight *= shadowMask;\n#ifdef METAL\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;\n#else\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;\n#endif',
THREE.ShaderChunk.envmap_fragment,
THREE.ShaderChunk.linear_to_gamma_fragment,
THREE.ShaderChunk.fog_fragment,
'\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}'
].join('\n')
},
points: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.points,
THREE.UniformsLib.shadowmap]),
vertexShader: [
'uniform float size;\nuniform float scale;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.color_pars_vertex,
THREE.ShaderChunk.shadowmap_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {',
THREE.ShaderChunk.color_vertex,
'\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\tgl_Position = projectionMatrix * mvPosition;',
THREE.ShaderChunk.logdepthbuf_vertex,
THREE.ShaderChunk.worldpos_vertex,
THREE.ShaderChunk.shadowmap_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform vec3 psColor;\nuniform float opacity;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.color_pars_fragment,
THREE.ShaderChunk.map_particle_pars_fragment,
THREE.ShaderChunk.fog_pars_fragment,
THREE.ShaderChunk.shadowmap_pars_fragment,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( psColor, opacity );\n\tvec3 shadowMask = vec3( 1.0 );',
THREE.ShaderChunk.logdepthbuf_fragment,
THREE.ShaderChunk.map_particle_fragment,
THREE.ShaderChunk.color_fragment,
THREE.ShaderChunk.alphatest_fragment,
THREE.ShaderChunk.shadowmap_fragment,
'\toutgoingLight = diffuseColor.rgb * shadowMask;',
THREE.ShaderChunk.fog_fragment,
'\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}'
].join('\n')
},
dashed: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common,
THREE.UniformsLib.fog,
{
scale: {
type: 'f',
value: 1
},
dashSize: {
type: 'f',
value: 1
},
totalSize: {
type: 'f',
value: 2
}
}
]),
vertexShader: [
'uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.color_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {',
THREE.ShaderChunk.color_vertex,
'\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;',
THREE.ShaderChunk.logdepthbuf_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.color_pars_fragment,
THREE.ShaderChunk.fog_pars_fragment,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );',
THREE.ShaderChunk.logdepthbuf_fragment,
THREE.ShaderChunk.color_fragment,
'\toutgoingLight = diffuseColor.rgb;',
THREE.ShaderChunk.fog_fragment,
'\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}'
].join('\n')
},
depth: {
uniforms: {
mNear: {
type: 'f',
value: 1
},
mFar: {
type: 'f',
value: 2000
},
opacity: {
type: 'f',
value: 1
}
},
vertexShader: [
THREE.ShaderChunk.common,
THREE.ShaderChunk.morphtarget_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {',
THREE.ShaderChunk.begin_vertex,
THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.project_vertex,
THREE.ShaderChunk.logdepthbuf_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform float mNear;\nuniform float mFar;\nuniform float opacity;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {',
THREE.ShaderChunk.logdepthbuf_fragment,
'\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}'
].join('\n')
},
normal: {
uniforms: {
opacity: {
type: 'f',
value: 1
}
},
vertexShader: [
'varying vec3 vNormal;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.morphtarget_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {\n\tvNormal = normalize( normalMatrix * normal );',
THREE.ShaderChunk.begin_vertex,
THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.project_vertex,
THREE.ShaderChunk.logdepthbuf_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform float opacity;\nvarying vec3 vNormal;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );',
THREE.ShaderChunk.logdepthbuf_fragment,
'}'
].join('\n')
},
cube: {
uniforms: {
tCube: {
type: 't',
value: null
},
tFlip: {
type: 'f',
value: - 1
}
},
vertexShader: [
'varying vec3 vWorldPosition;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
THREE.ShaderChunk.logdepthbuf_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );',
THREE.ShaderChunk.logdepthbuf_fragment,
'}'
].join('\n')
},
equirect: {
uniforms: {
tEquirect: {
type: 't',
value: null
},
tFlip: {
type: 'f',
value: - 1
}
},
vertexShader: [
'varying vec3 vWorldPosition;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
THREE.ShaderChunk.logdepthbuf_vertex,
'}'
].join('\n'),
fragmentShader: [
'uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'void main() {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );',
THREE.ShaderChunk.logdepthbuf_fragment,
'}'
].join('\n')
},
depthRGBA: {
uniforms: {
},
vertexShader: [
THREE.ShaderChunk.common,
THREE.ShaderChunk.morphtarget_pars_vertex,
THREE.ShaderChunk.skinning_pars_vertex,
THREE.ShaderChunk.logdepthbuf_pars_vertex,
'void main() {',
THREE.ShaderChunk.skinbase_vertex,
THREE.ShaderChunk.begin_vertex,
THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.skinning_vertex,
THREE.ShaderChunk.project_vertex,
THREE.ShaderChunk.logdepthbuf_vertex,
'}'
].join('\n'),
fragmentShader: [
THREE.ShaderChunk.common,
THREE.ShaderChunk.logdepthbuf_pars_fragment,
'vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {',
THREE.ShaderChunk.logdepthbuf_fragment,
'\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}'
].join('\n')
},
distanceRGBA: {
uniforms: {
lightPos: {
type: 'v3',
value: new THREE.Vector3(0, 0, 0)
}
},
vertexShader: [
'varying vec4 vWorldPosition;',
THREE.ShaderChunk.common,
THREE.ShaderChunk.morphtarget_pars_vertex,
THREE.ShaderChunk.skinning_pars_vertex,
'void main() {',
THREE.ShaderChunk.skinbase_vertex,
THREE.ShaderChunk.begin_vertex,
THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.skinning_vertex,
THREE.ShaderChunk.project_vertex,
THREE.ShaderChunk.worldpos_vertex,
'vWorldPosition = worldPosition;\n}'
].join('\n'),
fragmentShader: [
'uniform vec3 lightPos;\nvarying vec4 vWorldPosition;',
THREE.ShaderChunk.common,
'vec4 pack1K ( float depth ) {\n depth /= 1000.0;\n const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = fract( depth * bitSh );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}'
].join('\n')
}
},
THREE.WebGLRenderer = function (e) {
function t(e, t, r, i) {
!0 === O && (e *= i, t *= i, r *= i),
Te.clearColor(e, t, r, i)
}
function r() {
Re.init(),
Te.viewport(ie, ne, oe, ae),
t(G.r, G.g, G.b, I)
}
function i() {
te = Z = null,
ee = '',
$ = - 1,
pe = !0,
Re.reset()
}
function n(e) {
e.preventDefault(),
i(),
r(),
He.clear()
}
function o(e) {
e = e.target,
e.removeEventListener('dispose', o);
e: {
var t = He.get(e);
if (e.image && t.__image__webglTextureCube) Te.deleteTexture(t.__image__webglTextureCube);
else {
if (void 0 === t.__webglInit) break e;
Te.deleteTexture(t.__webglTexture)
}
He['delete'](e)
}
fe.textures--
}
function a(e) {
e = e.target,
e.removeEventListener('dispose', a);
var t = He.get(e),
r = He.get(e.texture);
if (e && void 0 !== r.__webglTexture) {
if (Te.deleteTexture(r.__webglTexture), e instanceof THREE.WebGLRenderTargetCube) for (r = 0; 6 > r; r++) Te.deleteFramebuffer(t.__webglFramebuffer[r]),
Te.deleteRenderbuffer(t.__webglRenderbuffer[r]);
else Te.deleteFramebuffer(t.__webglFramebuffer),
Te.deleteRenderbuffer(t.__webglRenderbuffer);
He['delete'](e.texture),
He['delete'](e)
}
fe.textures--
}
function s(e) {
e = e.target,
e.removeEventListener('dispose', s),
h(e),
He['delete'](e)
}
function h(e) {
var t = He.get(e).program;
e.program = void 0,
void 0 !== t && be.releaseProgram(t)
}
function c(e, t) {
return t[0] - e[0]
}
function u(e, t) {
return e.object.renderOrder !== t.object.renderOrder ? e.object.renderOrder - t.object.renderOrder : e.material.id !== t.material.id ? e.material.id - t.material.id : e.z !== t.z ? e.z - t.z : e.id - t.id
}
function l(e, t) {
return e.object.renderOrder !== t.object.renderOrder ? e.object.renderOrder - t.object.renderOrder : e.z !== t.z ? t.z - e.z : e.id - t.id
}
function E(e, t, r, i, n) {
var o;
r.transparent ? (i = W, o = ++X) : (i = z, o = ++j),
o = i[o],
void 0 !== o ? (o.id = e.id, o.object = e, o.geometry = t, o.material = r, o.z = le.z, o.group = n) : (o = {
id: e.id,
object: e,
geometry: t,
material: r,
z: le.z,
group: n
}, i.push(o))
}
function p(e, t) {
if (!1 !== e.visible) {
if (0 !== (e.channels.mask & t.channels.mask)) if (e instanceof THREE.Light) N.push(e);
else if (e instanceof THREE.Sprite) Y.push(e);
else if (e instanceof THREE.LensFlare) K.push(e);
else if (e instanceof THREE.ImmediateRenderObject) !0 === Q.sortObjects && (le.setFromMatrixPosition(e.matrixWorld), le.applyProjection(ue)),
E(e, null, e.material, le.z, null);
else if ((e instanceof THREE.Mesh || e instanceof THREE.Line || e instanceof THREE.Points) && (e instanceof THREE.SkinnedMesh && e.skeleton.update(), !1 === e.frustumCulled || !0 === ce.intersectsObject(e))) {
var r = e.material;
if (!0 === r.visible) {
!0 === Q.sortObjects && (le.setFromMatrixPosition(e.matrixWorld), le.applyProjection(ue));
var i = xe.update(e);
if (r instanceof THREE.MeshFaceMaterial) for (var n = i.groups, o = r.materials, r = 0, a = n.length; a > r; r++) {
var s = n[r],
h = o[s.materialIndex];
!0 === h.visible && E(e, i, h, le.z, s)
} else E(e, i, r, le.z, null)
}
}
for (i = e.children, r = 0, a = i.length; a > r; r++) p(i[r], t)
}
}
function d(e, t, r, i, n) {
for (var o = 0, a = e.length; a > o; o++) {
var s = e[o],
h = s.object,
c = s.geometry,
u = void 0 === n ? s.material : n,
s = s.group;
if (h.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse, h.matrixWorld), h.normalMatrix.getNormalMatrix(h.modelViewMatrix), h instanceof THREE.ImmediateRenderObject) {
f(u);
var l = m(t, r, i, u, h);
ee = '',
h.render(function (e) {
Q.renderBufferImmediate(e, l, u)
})
} else Q.renderBufferDirect(t, r, i, c, u, h, s)
}
}
function f(e) {
e.side !== THREE.DoubleSide ? Re.enable(Te.CULL_FACE) : Re.disable(Te.CULL_FACE),
Re.setFlipSided(e.side === THREE.BackSide),
!0 === e.transparent ? Re.setBlending(e.blending, e.blendEquation, e.blendSrc, e.blendDst, e.blendEquationAlpha, e.blendSrcAlpha, e.blendDstAlpha) : Re.setBlending(THREE.NoBlending),
Re.setDepthFunc(e.depthFunc),
Re.setDepthTest(e.depthTest),
Re.setDepthWrite(e.depthWrite),
Re.setColorWrite(e.colorWrite),
Re.setPolygonOffset(e.polygonOffset, e.polygonOffsetFactor, e.polygonOffsetUnits)
}
function m(e, t, r, i, n) {
re = 0;
var o = He.get(i);
if (i.needsUpdate || !o.program) {
e: {
var a = He.get(i),
c = be.getParameters(i, t, r, n),
u = be.getProgramCode(i, c),
l = a.program,
E = !0;
if (void 0 === l) i.addEventListener('dispose', s);
else if (l.code !== u) h(i);
else {
if (void 0 !== c.shaderID) break e;
E = !1
}
if (E && (c.shaderID ? (l = THREE.ShaderLib[c.shaderID], a.__webglShader = {
name: i.type,
uniforms: THREE.UniformsUtils.clone(l.uniforms),
vertexShader: l.vertexShader,
fragmentShader: l.fragmentShader
}) : a.__webglShader = {
name: i.type,
uniforms: i.uniforms,
vertexShader: i.vertexShader,
fragmentShader: i.fragmentShader
}, i.__webglShader = a.__webglShader, l = be.acquireProgram(i, c, u), a.program = l, i.program = l), c = l.getAttributes(), i.morphTargets) for (u = i.numSupportedMorphTargets = 0; u < Q.maxMorphTargets; u++) 0 <= c['morphTarget' + u] && i.numSupportedMorphTargets++;
if (i.morphNormals) for (u = i.numSupportedMorphNormals = 0; u < Q.maxMorphNormals; u++) 0 <= c['morphNormal' + u] && i.numSupportedMorphNormals++;
a.uniformsList = [
];
var p,
c = a.program.getUniforms();
for (p in a.__webglShader.uniforms) (u = c[p]) && a.uniformsList.push([a.__webglShader.uniforms[p],
u])
}
i.needsUpdate = !1
}
if (u = l = E = !1, a = o.program, p = a.getUniforms(), c = o.__webglShader.uniforms, a.id !== Z && (Te.useProgram(a.program), Z = a.id, u = l = E = !0), i.id !== $ && ( - 1 === $ && (u = !0), $ = i.id, l = !0), (E || e !== te) && (Te.uniformMatrix4fv(p.projectionMatrix, !1, e.projectionMatrix.elements), ye.logarithmicDepthBuffer && Te.uniform1f(p.logDepthBufFC, 2 / (Math.log(e.far + 1) / Math.LN2)), e !== te && (te = e), (i instanceof THREE.ShaderMaterial || i instanceof THREE.MeshPhongMaterial || i.envMap) && void 0 !== p.cameraPosition && (le.setFromMatrixPosition(e.matrixWorld), Te.uniform3f(p.cameraPosition, le.x, le.y, le.z)), (i instanceof THREE.MeshPhongMaterial || i instanceof THREE.MeshLambertMaterial || i instanceof THREE.MeshBasicMaterial || i instanceof THREE.ShaderMaterial || i.skinning) && void 0 !== p.viewMatrix && Te.uniformMatrix4fv(p.viewMatrix, !1, e.matrixWorldInverse.elements)), i.skinning && (n.bindMatrix && void 0 !== p.bindMatrix && Te.uniformMatrix4fv(p.bindMatrix, !1, n.bindMatrix.elements), n.bindMatrixInverse && void 0 !== p.bindMatrixInverse && Te.uniformMatrix4fv(p.bindMatrixInverse, !1, n.bindMatrixInverse.elements), ye.floatVertexTextures && n.skeleton && n.skeleton.useVertexTexture ? (void 0 !== p.boneTexture && (E = g(), Te.uniform1i(p.boneTexture, E), Q.setTexture(n.skeleton.boneTexture, E)), void 0 !== p.boneTextureWidth && Te.uniform1i(p.boneTextureWidth, n.skeleton.boneTextureWidth), void 0 !== p.boneTextureHeight && Te.uniform1i(p.boneTextureHeight, n.skeleton.boneTextureHeight)) : n.skeleton && n.skeleton.boneMatrices && void 0 !== p.boneGlobalMatrices && Te.uniformMatrix4fv(p.boneGlobalMatrices, !1, n.skeleton.boneMatrices)), l) {
if (r && i.fog && (c.fogColor.value = r.color, r instanceof THREE.Fog ? (c.fogNear.value = r.near, c.fogFar.value = r.far) : r instanceof THREE.FogExp2 && (c.fogDensity.value = r.density)), i instanceof THREE.MeshPhongMaterial || i instanceof THREE.MeshLambertMaterial || i.lights) {
if (pe) {
var d,
f,
m,
y,
u = !0,
R = E = 0,
H = 0,
_ = de,
w = e.matrixWorldInverse,
M = _.directional.colors,
S = _.directional.positions,
C = _.point.colors,
L = _.point.positions,
P = _.point.distances,
k = _.point.decays,
D = _.spot.colors,
F = _.spot.positions,
V = _.spot.distances,
U = _.spot.directions,
O = _.spot.anglesCos,
B = _.spot.exponents,
G = _.spot.decays,
I = _.hemi.skyColors,
N = _.hemi.groundColors,
z = _.hemi.positions,
j = 0,
W = 0,
X = 0,
q = 0,
Y = 0,
K = 0,
J = 0,
ee = 0,
ie = d = 0;
for (r = y = ie = 0, l = t.length; l > r; r++) d = t[r],
f = d.color,
m = d.intensity,
y = d.distance,
d instanceof THREE.AmbientLight ? d.visible && (E += f.r, R += f.g, H += f.b) : d instanceof THREE.DirectionalLight ? (Y += 1, d.visible && (Ee.setFromMatrixPosition(d.matrixWorld), le.setFromMatrixPosition(d.target.matrixWorld), Ee.sub(le), Ee.transformDirection(w), d = 3 * j, S[d + 0] = Ee.x, S[d + 1] = Ee.y, S[d + 2] = Ee.z, v(M, d, f, m), j += 1)) : d instanceof THREE.PointLight ? (K += 1, d.visible && (ie = 3 * W, v(C, ie, f, m), le.setFromMatrixPosition(d.matrixWorld), le.applyMatrix4(w), L[ie + 0] = le.x, L[ie + 1] = le.y, L[ie + 2] = le.z, P[W] = y, k[W] = 0 === d.distance ? 0 : d.decay, W += 1)) : d instanceof THREE.SpotLight ? (J += 1, d.visible && (ie = 3 * X, v(D, ie, f, m), Ee.setFromMatrixPosition(d.matrixWorld), le.copy(Ee).applyMatrix4(w), F[ie + 0] = le.x, F[ie + 1] = le.y, F[ie + 2] = le.z, V[X] = y, le.setFromMatrixPosition(d.target.matrixWorld), Ee.sub(le), Ee.transformDirection(w), U[ie + 0] = Ee.x, U[ie + 1] = Ee.y, U[ie + 2] = Ee.z, O[X] = Math.cos(d.angle), B[X] = d.exponent, G[X] = 0 === d.distance ? 0 : d.decay, X += 1)) : d instanceof THREE.HemisphereLight && (ee += 1, d.visible && (Ee.setFromMatrixPosition(d.matrixWorld), Ee.transformDirection(w), y = 3 * q, z[y + 0] = Ee.x, z[y + 1] = Ee.y, z[y + 2] = Ee.z, f = d.color, d = d.groundColor, v(I, y, f, m), v(N, y, d, m), q += 1));
for (r = 3 * j, l = Math.max(M.length, 3 * Y); l > r; r++) M[r] = 0;
for (r = 3 * W, l = Math.max(C.length, 3 * K); l > r; r++) C[r] = 0;
for (r = 3 * X, l = Math.max(D.length, 3 * J); l > r; r++) D[r] = 0;
for (r = 3 * q, l = Math.max(I.length, 3 * ee); l > r; r++) I[r] = 0;
for (r = 3 * q, l = Math.max(N.length, 3 * ee); l > r; r++) N[r] = 0;
_.directional.length = j,
_.point.length = W,
_.spot.length = X,
_.hemi.length = q,
_.ambient[0] = E,
_.ambient[1] = R,
_.ambient[2] = H,
pe = !1
}
u ? (u = de, c.ambientLightColor.value = u.ambient, c.directionalLightColor.value = u.directional.colors, c.directionalLightDirection.value = u.directional.positions, c.pointLightColor.value = u.point.colors, c.pointLightPosition.value = u.point.positions, c.pointLightDistance.value = u.point.distances, c.pointLightDecay.value = u.point.decays, c.spotLightColor.value = u.spot.colors, c.spotLightPosition.value = u.spot.positions, c.spotLightDistance.value = u.spot.distances, c.spotLightDirection.value = u.spot.directions, c.spotLightAngleCos.value = u.spot.anglesCos, c.spotLightExponent.value = u.spot.exponents, c.spotLightDecay.value = u.spot.decays, c.hemisphereLightSkyColor.value = u.hemi.skyColors, c.hemisphereLightGroundColor.value = u.hemi.groundColors, c.hemisphereLightDirection.value = u.hemi.positions, T(c, !0)) : T(c, !1)
}
if (i instanceof THREE.MeshBasicMaterial || i instanceof THREE.MeshLambertMaterial || i instanceof THREE.MeshPhongMaterial) {
c.opacity.value = i.opacity,
c.diffuse.value = i.color,
i.emissive && (c.emissive.value = i.emissive),
c.map.value = i.map,
c.specularMap.value = i.specularMap,
c.alphaMap.value = i.alphaMap,
i.aoMap && (c.aoMap.value = i.aoMap, c.aoMapIntensity.value = i.aoMapIntensity);
var ne;
i.map ? ne = i.map : i.specularMap ? ne = i.specularMap : i.displacementMap ? ne = i.displacementMap : i.normalMap ? ne = i.normalMap : i.bumpMap ? ne = i.bumpMap : i.alphaMap ? ne = i.alphaMap : i.emissiveMap && (ne = i.emissiveMap),
void 0 !== ne && (ne instanceof THREE.WebGLRenderTarget && (ne = ne.texture), u = ne.offset, ne = ne.repeat, c.offsetRepeat.value.set(u.x, u.y, ne.x, ne.y)),
c.envMap.value = i.envMap,
c.flipEnvMap.value = i.envMap instanceof THREE.WebGLRenderTargetCube ? 1 : - 1,
c.reflectivity.value = i.reflectivity,
c.refractionRatio.value = i.refractionRatio
}
if (i instanceof THREE.LineBasicMaterial ? (c.diffuse.value = i.color, c.opacity.value = i.opacity) : i instanceof THREE.LineDashedMaterial ? (c.diffuse.value = i.color, c.opacity.value = i.opacity, c.dashSize.value = i.dashSize, c.totalSize.value = i.dashSize + i.gapSize, c.scale.value = i.scale) : i instanceof THREE.PointsMaterial ? (c.psColor.value = i.color, c.opacity.value = i.opacity, c.size.value = i.size, c.scale.value = A.height / 2, c.map.value = i.map, null !== i.map && (e = i.map.offset, ne = i.map.repeat, c.offsetRepeat.value.set(e.x, e.y, ne.x, ne.y))) : i instanceof THREE.MeshPhongMaterial ? (c.specular.value = i.specular, c.shininess.value = Math.max(i.shininess, 0.0001), i.lightMap && (c.lightMap.value = i.lightMap, c.lightMapIntensity.value = i.lightMapIntensity), i.emissiveMap && (c.emissiveMap.value = i.emissiveMap), i.bumpMap && (c.bumpMap.value = i.bumpMap, c.bumpScale.value = i.bumpScale), i.normalMap && (c.normalMap.value = i.normalMap, c.normalScale.value.copy(i.normalScale)), i.displacementMap && (c.displacementMap.value = i.displacementMap, c.displacementScale.value = i.displacementScale, c.displacementBias.value = i.displacementBias)) : i instanceof THREE.MeshDepthMaterial ? (c.mNear.value = e.near, c.mFar.value = e.far, c.opacity.value = i.opacity) : i instanceof THREE.MeshNormalMaterial && (c.opacity.value = i.opacity), n.receiveShadow && !i._shadowPass && c.shadowMatrix) for (e = i = 0, ne = t.length; ne > e; e++) u = t[e],
!0 === u.castShadow && (u instanceof THREE.PointLight || u instanceof THREE.SpotLight || u instanceof THREE.DirectionalLight) && (r = u.shadow, u instanceof THREE.PointLight ? (le.setFromMatrixPosition(u.matrixWorld).negate(), r.matrix.identity().setPosition(le), c.shadowDarkness.value[i] = - r.darkness) : c.shadowDarkness.value[i] = r.darkness, c.shadowMatrix.value[i] = r.matrix, c.shadowMap.value[i] = r.map, c.shadowMapSize.value[i] = r.mapSize, c.shadowBias.value[i] = r.bias, i++);
for (t = o.uniformsList, o = 0, i = t.length; i > o; o++) if (e = t[o][0], !1 !== e.needsUpdate) switch (c = e.type, r = e.value, ne = t[o][1], c) {
case '1i':
Te.uniform1i(ne, r);
break;
case '1f':
Te.uniform1f(ne, r);
break;
case '2f':
Te.uniform2f(ne, r[0], r[1]);
break;
case '3f':
Te.uniform3f(ne, r[0], r[1], r[2]);
break;
case '4f':
Te.uniform4f(ne, r[0], r[1], r[2], r[3]);
break;
case '1iv':
Te.uniform1iv(ne, r);
break;
case '3iv':
Te.uniform3iv(ne, r);
break;
case '1fv':
Te.uniform1fv(ne, r);
break;
case '2fv':
Te.uniform2fv(ne, r);
break;
case '3fv':
Te.uniform3fv(ne, r);
break;
case '4fv':
Te.uniform4fv(ne, r);
break;
case 'Matrix3fv':
Te.uniformMatrix3fv(ne, !1, r);
break;
case 'Matrix4fv':
Te.uniformMatrix4fv(ne, !1, r);
break;
case 'i':
Te.uniform1i(ne, r);
break;
case 'f':
Te.uniform1f(ne, r);
break;
case 'v2':
Te.uniform2f(ne, r.x, r.y);
break;
case 'v3':
Te.uniform3f(ne, r.x, r.y, r.z);
break;
case 'v4':
Te.uniform4f(ne, r.x, r.y, r.z, r.w);
break;
case 'c':
Te.uniform3f(ne, r.r, r.g, r.b);
break;
case 'iv1':
Te.uniform1iv(ne, r);
break;
case 'iv':
Te.uniform3iv(ne, r);
break;
case 'fv1':
Te.uniform1fv(ne, r);
break;
case 'fv':
Te.uniform3fv(ne, r);
break;
case 'v2v':
for (void 0 === e._array && (e._array = new Float32Array(2 * r.length)), l = c = 0, u = r.length; u > c; c++, l += 2) e._array[l + 0] = r[c].x,
e._array[l + 1] = r[c].y;
Te.uniform2fv(ne, e._array);
break;
case 'v3v':
for (void 0 === e._array && (e._array = new Float32Array(3 * r.length)), l = c = 0, u = r.length; u > c; c++, l += 3) e._array[l + 0] = r[c].x,
e._array[l + 1] = r[c].y,
e._array[l + 2] = r[c].z;
Te.uniform3fv(ne, e._array);
break;
case 'v4v':
for (void 0 === e._array && (e._array = new Float32Array(4 * r.length)), l = c = 0, u = r.length; u > c; c++, l += 4) e._array[l + 0] = r[c].x,
e._array[l + 1] = r[c].y,
e._array[l + 2] = r[c].z,
e._array[l + 3] = r[c].w;
Te.uniform4fv(ne, e._array);
break;
case 'm3':
Te.uniformMatrix3fv(ne, !1, r.elements);
break;
case 'm3v':
for (void 0 === e._array && (e._array = new Float32Array(9 * r.length)), c = 0, u = r.length; u > c; c++) r[c].flattenToArrayOffset(e._array, 9 * c);
Te.uniformMatrix3fv(ne, !1, e._array);
break;
case 'm4':
Te.uniformMatrix4fv(ne, !1, r.elements);
break;
case 'm4v':
for (void 0 === e._array && (e._array = new Float32Array(16 * r.length)), c = 0, u = r.length; u > c; c++) r[c].flattenToArrayOffset(e._array, 16 * c);
Te.uniformMatrix4fv(ne, !1, e._array);
break;
case 't':
if (l = g(), Te.uniform1i(ne, l), !r) continue;
r instanceof THREE.CubeTexture || Array.isArray(r.image) && 6 === r.image.length ? x(r, l) : r instanceof THREE.WebGLRenderTargetCube ? b(r.texture, l) : r instanceof THREE.WebGLRenderTarget ? Q.setTexture(r.texture, l) : Q.setTexture(r, l);
break;
case 'tv':
for (void 0 === e._array && (e._array = [
]), c = 0, u = e.value.length; u > c; c++) e._array[c] = g();
for (Te.uniform1iv(ne, e._array), c = 0, u = e.value.length; u > c; c++) r = e.value[c],
l = e._array[c],
r && (r instanceof THREE.CubeTexture || r.image instanceof Array && 6 === r.image.length ? x(r, l) : r instanceof THREE.WebGLRenderTarget ? Q.setTexture(r.texture, l) : r instanceof THREE.WebGLRenderTargetCube ? b(r.texture, l) : Q.setTexture(r, l));
break;
default:
console.warn('THREE.WebGLRenderer: Unknown uniform type: ' + c)
}
}
return Te.uniformMatrix4fv(p.modelViewMatrix, !1, n.modelViewMatrix.elements),
p.normalMatrix && Te.uniformMatrix3fv(p.normalMatrix, !1, n.normalMatrix.elements),
void 0 !== p.modelMatrix && Te.uniformMatrix4fv(p.modelMatrix, !1, n.matrixWorld.elements),
a
}
function T(e, t) {
e.ambientLightColor.needsUpdate = t,
e.directionalLightColor.needsUpdate = t,
e.directionalLightDirection.needsUpdate = t,
e.pointLightColor.needsUpdate = t,
e.pointLightPosition.needsUpdate = t,
e.pointLightDistance.needsUpdate = t,
e.pointLightDecay.needsUpdate = t,
e.spotLightColor.needsUpdate = t,
e.spotLightPosition.needsUpdate = t,
e.spotLightDistance.needsUpdate = t,
e.spotLightDirection.needsUpdate = t,
e.spotLightAngleCos.needsUpdate = t,
e.spotLightExponent.needsUpdate = t,
e.spotLightDecay.needsUpdate = t,
e.hemisphereLightSkyColor.needsUpdate = t,
e.hemisphereLightGroundColor.needsUpdate = t,
e.hemisphereLightDirection.needsUpdate = t
}
function g() {
var e = re;
return e >= ye.maxTextures && console.warn('WebGLRenderer: trying to use ' + e + ' texture units while this GPU supports only ' + ye.maxTextures),
re += 1,
e
}
function v(e, t, r, i) {
e[t + 0] = r.r * i,
e[t + 1] = r.g * i,
e[t + 2] = r.b * i
}
function y(e, t, r) {
r ? (Te.texParameteri(e, Te.TEXTURE_WRAP_S, S(t.wrapS)), Te.texParameteri(e, Te.TEXTURE_WRAP_T, S(t.wrapT)), Te.texParameteri(e, Te.TEXTURE_MAG_FILTER, S(t.magFilter)), Te.texParameteri(e, Te.TEXTURE_MIN_FILTER, S(t.minFilter))) : (Te.texParameteri(e, Te.TEXTURE_WRAP_S, Te.CLAMP_TO_EDGE), Te.texParameteri(e, Te.TEXTURE_WRAP_T, Te.CLAMP_TO_EDGE), t.wrapS === THREE.ClampToEdgeWrapping && t.wrapT === THREE.ClampToEdgeWrapping || console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.', t), Te.texParameteri(e, Te.TEXTURE_MAG_FILTER, M(t.magFilter)), Te.texParameteri(e, Te.TEXTURE_MIN_FILTER, M(t.minFilter)), t.minFilter !== THREE.NearestFilter && t.minFilter !== THREE.LinearFilter && console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.', t)),
!(r = ve.get('EXT_texture_filter_anisotropic')) || t.type === THREE.FloatType && null === ve.get('OES_texture_float_linear') || t.type === THREE.HalfFloatType && null === ve.get('OES_texture_half_float_linear') || !(1 < t.anisotropy || He.get(t).__currentAnisotropy) || (Te.texParameterf(e, r.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(t.anisotropy, Q.getMaxAnisotropy())), He.get(t).__currentAnisotropy = t.anisotropy)
}
function R(e, t) {
if (e.width > t || e.height > t) {
var r = t / Math.max(e.width, e.height),
i = document.createElement('canvas');
return i.width = Math.floor(e.width * r),
i.height = Math.floor(e.height * r),
i.getContext('2d').drawImage(e, 0, 0, e.width, e.height, 0, 0, i.width, i.height),
console.warn('THREE.WebGLRenderer: image is too big (' + e.width + 'x' + e.height + '). Resized to ' + i.width + 'x' + i.height, e),
i
}
return e
}
function H(e) {
return THREE.Math.isPowerOfTwo(e.width) && THREE.Math.isPowerOfTwo(e.height)
}
function x(e, t) {
var r = He.get(e);
if (6 === e.image.length) if (0 < e.version && r.__version !== e.version) {
r.__image__webglTextureCube || (e.addEventListener('dispose', o), r.__image__webglTextureCube = Te.createTexture(), fe.textures++),
Re.activeTexture(Te.TEXTURE0 + t),
Re.bindTexture(Te.TEXTURE_CUBE_MAP, r.__image__webglTextureCube),
Te.pixelStorei(Te.UNPACK_FLIP_Y_WEBGL, e.flipY);
for (var i = e instanceof THREE.CompressedTexture, n = e.image[0] instanceof THREE.DataTexture, a = [
], s = 0; 6 > s; s++) a[s] = !Q.autoScaleCubemaps || i || n ? n ? e.image[s].image : e.image[s] : R(e.image[s], ye.maxCubemapSize);
var h = H(a[0]),
c = S(e.format),
u = S(e.type);
for (y(Te.TEXTURE_CUBE_MAP, e, h), s = 0; 6 > s; s++) if (i) for (var l, E = a[s].mipmaps, p = 0, d = E.length; d > p; p++) l = E[p],
e.format !== THREE.RGBAFormat && e.format !== THREE.RGBFormat ? - 1 < Re.getCompressedTextureFormats().indexOf(c) ? Re.compressedTexImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X + s, p, c, l.width, l.height, 0, l.data) : console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()') : Re.texImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X + s, p, c, l.width, l.height, 0, c, u, l.data);
else n ? Re.texImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X + s, 0, c, a[s].width, a[s].height, 0, c, u, a[s].data) : Re.texImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X + s, 0, c, c, u, a[s]);
e.generateMipmaps && h && Te.generateMipmap(Te.TEXTURE_CUBE_MAP),
r.__version = e.version,
e.onUpdate && e.onUpdate(e)
} else Re.activeTexture(Te.TEXTURE0 + t),
Re.bindTexture(Te.TEXTURE_CUBE_MAP, r.__image__webglTextureCube)
}
function b(e, t) {
Re.activeTexture(Te.TEXTURE0 + t),
Re.bindTexture(Te.TEXTURE_CUBE_MAP, He.get(e).__webglTexture)
}
function _(e, t, r) {
Te.bindFramebuffer(Te.FRAMEBUFFER, e),
Te.framebufferTexture2D(Te.FRAMEBUFFER, Te.COLOR_ATTACHMENT0, r, He.get(t.texture).__webglTexture, 0)
}
function w(e, t) {
Te.bindRenderbuffer(Te.RENDERBUFFER, e),
t.depthBuffer && !t.stencilBuffer ? (Te.renderbufferStorage(Te.RENDERBUFFER, Te.DEPTH_COMPONENT16, t.width, t.height), Te.framebufferRenderbuffer(Te.FRAMEBUFFER, Te.DEPTH_ATTACHMENT, Te.RENDERBUFFER, e)) : t.depthBuffer && t.stencilBuffer ? (Te.renderbufferStorage(Te.RENDERBUFFER, Te.DEPTH_STENCIL, t.width, t.height), Te.framebufferRenderbuffer(Te.FRAMEBUFFER, Te.DEPTH_STENCIL_ATTACHMENT, Te.RENDERBUFFER, e)) : Te.renderbufferStorage(Te.RENDERBUFFER, Te.RGBA4, t.width, t.height)
}
function M(e) {
return e === THREE.NearestFilter || e === THREE.NearestMipMapNearestFilter || e === THREE.NearestMipMapLinearFilter ? Te.NEAREST : Te.LINEAR
}
function S(e) {
var t;
if (e === THREE.RepeatWrapping) return Te.REPEAT;
if (e === THREE.ClampToEdgeWrapping) return Te.CLAMP_TO_EDGE;
if (e === THREE.MirroredRepeatWrapping) return Te.MIRRORED_REPEAT;
if (e === THREE.NearestFilter) return Te.NEAREST;
if (e === THREE.NearestMipMapNearestFilter) return Te.NEAREST_MIPMAP_NEAREST;
if (e === THREE.NearestMipMapLinearFilter) return Te.NEAREST_MIPMAP_LINEAR;
if (e === THREE.LinearFilter) return Te.LINEAR;
if (e === THREE.LinearMipMapNearestFilter) return Te.LINEAR_MIPMAP_NEAREST;
if (e === THREE.LinearMipMapLinearFilter) return Te.LINEAR_MIPMAP_LINEAR;
if (e === THREE.UnsignedByteType) return Te.UNSIGNED_BYTE;
if (e === THREE.UnsignedShort4444Type) return Te.UNSIGNED_SHORT_4_4_4_4;
if (e === THREE.UnsignedShort5551Type) return Te.UNSIGNED_SHORT_5_5_5_1;
if (e === THREE.UnsignedShort565Type) return Te.UNSIGNED_SHORT_5_6_5;
if (e === THREE.ByteType) return Te.BYTE;
if (e === THREE.ShortType) return Te.SHORT;
if (e === THREE.UnsignedShortType) return Te.UNSIGNED_SHORT;
if (e === THREE.IntType) return Te.INT;
if (e === THREE.UnsignedIntType) return Te.UNSIGNED_INT;
if (e === THREE.FloatType) return Te.FLOAT;
if (t = ve.get('OES_texture_half_float'), null !== t && e === THREE.HalfFloatType) return t.HALF_FLOAT_OES;
if (e === THREE.AlphaFormat) return Te.ALPHA;
if (e === THREE.RGBFormat) return Te.RGB;
if (e === THREE.RGBAFormat) return Te.RGBA;
if (e === THREE.LuminanceFormat) return Te.LUMINANCE;
if (e === THREE.LuminanceAlphaFormat) return Te.LUMINANCE_ALPHA;
if (e === THREE.AddEquation) return Te.FUNC_ADD;
if (e === THREE.SubtractEquation) return Te.FUNC_SUBTRACT;
if (e === THREE.ReverseSubtractEquation) return Te.FUNC_REVERSE_SUBTRACT;
if (e === THREE.ZeroFactor) return Te.ZERO;
if (e === THREE.OneFactor) return Te.ONE;
if (e === THREE.SrcColorFactor) return Te.SRC_COLOR;
if (e === THREE.OneMinusSrcColorFactor) return Te.ONE_MINUS_SRC_COLOR;
if (e === THREE.SrcAlphaFactor) return Te.SRC_ALPHA;
if (e === THREE.OneMinusSrcAlphaFactor) return Te.ONE_MINUS_SRC_ALPHA;
if (e === THREE.DstAlphaFactor) return Te.DST_ALPHA;
if (e === THREE.OneMinusDstAlphaFactor) return Te.ONE_MINUS_DST_ALPHA;
if (e === THREE.DstColorFactor) return Te.DST_COLOR;
if (e === THREE.OneMinusDstColorFactor) return Te.ONE_MINUS_DST_COLOR;
if (e === THREE.SrcAlphaSaturateFactor) return Te.SRC_ALPHA_SATURATE;
if (t = ve.get('WEBGL_compressed_texture_s3tc'), null !== t) {
if (e === THREE.RGB_S3TC_DXT1_Format) return t.COMPRESSED_RGB_S3TC_DXT1_EXT;
if (e === THREE.RGBA_S3TC_DXT1_Format) return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;
if (e === THREE.RGBA_S3TC_DXT3_Format) return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;
if (e === THREE.RGBA_S3TC_DXT5_Format) return t.COMPRESSED_RGBA_S3TC_DXT5_EXT
}
if (t = ve.get('WEBGL_compressed_texture_pvrtc'), null !== t) {
if (e === THREE.RGB_PVRTC_4BPPV1_Format) return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
if (e === THREE.RGB_PVRTC_2BPPV1_Format) return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
if (e === THREE.RGBA_PVRTC_4BPPV1_Format) return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
if (e === THREE.RGBA_PVRTC_2BPPV1_Format) return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
}
if (t = ve.get('EXT_blend_minmax'), null !== t) {
if (e === THREE.MinEquation) return t.MIN_EXT;
if (e === THREE.MaxEquation) return t.MAX_EXT
}
return 0
}
console.log('THREE.WebGLRenderer', THREE.REVISION),
e = e || {
};
var A = void 0 !== e.canvas ? e.canvas : document.createElement('canvas'),
C = void 0 !== e.context ? e.context : null,
L = A.width,
P = A.height,
k = 1,
D = void 0 !== e.alpha ? e.alpha : !1,
F = void 0 !== e.depth ? e.depth : !0,
V = void 0 !== e.stencil ? e.stencil : !0,
U = void 0 !== e.antialias ? e.antialias : !1,
O = void 0 !== e.premultipliedAlpha ? e.premultipliedAlpha : !0,
B = void 0 !== e.preserveDrawingBuffer ? e.preserveDrawingBuffer : !1,
G = new THREE.Color(0),
I = 0,
N = [
],
z = [
],
j = - 1,
W = [
],
X = - 1,
q = new Float32Array(8),
Y = [
],
K = [
];
this.domElement = A,
this.context = null,
this.sortObjects = this.autoClearStencil = this.autoClearDepth = this.autoClearColor = this.autoClear = !0,
this.gammaFactor = 2,
this.gammaOutput = this.gammaInput = !1,
this.maxMorphTargets = 8,
this.maxMorphNormals = 4,
this.autoScaleCubemaps = !0;
var Q = this,
Z = null,
J = null,
$ = - 1,
ee = '',
te = null,
re = 0,
ie = 0,
ne = 0,
oe = A.width,
ae = A.height,
se = 0,
he = 0,
ce = new THREE.Frustum,
ue = new THREE.Matrix4,
le = new THREE.Vector3,
Ee = new THREE.Vector3,
pe = !0,
de = {
ambient: [
0,
0,
0
],
directional: {
length: 0,
colors: [
],
positions: [
]
},
point: {
length: 0,
colors: [
],
positions: [
],
distances: [
],
decays: [
]
},
spot: {
length: 0,
colors: [
],
positions: [
],
distances: [
],
directions: [
],
anglesCos: [
],
exponents: [
],
decays: [
]
},
hemi: {
length: 0,
skyColors: [
],
groundColors: [
],
positions: [
]
}
},
fe = {
geometries: 0,
textures: 0
},
me = {
calls: 0,
vertices: 0,
faces: 0,
points: 0
};
this.info = {
render: me,
memory: fe,
programs: null
};
var Te;
try {
if (D = {
alpha: D,
depth: F,
stencil: V,
antialias: U,
premultipliedAlpha: O,
preserveDrawingBuffer: B
}, Te = C || A.getContext('webgl', D) || A.getContext('experimental-webgl', D), null === Te) {
if (null !== A.getContext('webgl')) throw 'Error creating WebGL context with your selected attributes.';
throw 'Error creating WebGL context.'
}
A.addEventListener('webglcontextlost', n, !1)
} catch (ge) {
console.error('THREE.WebGLRenderer: ' + ge)
}
var ve = new THREE.WebGLExtensions(Te);
ve.get('OES_texture_float'),
ve.get('OES_texture_float_linear'),
ve.get('OES_texture_half_float'),
ve.get('OES_texture_half_float_linear'),
ve.get('OES_standard_derivatives'),
ve.get('ANGLE_instanced_arrays'),
ve.get('OES_element_index_uint') && (THREE.BufferGeometry.MaxIndex = 4294967296);
var ye = new THREE.WebGLCapabilities(Te, ve, e),
Re = new THREE.WebGLState(Te, ve, S),
He = new THREE.WebGLProperties,
xe = new THREE.WebGLObjects(Te, He, this.info),
be = new THREE.WebGLPrograms(this, ye);
this.info.programs = be.programs;
var _e = new THREE.WebGLBufferRenderer(Te, ve, me),
we = new THREE.WebGLIndexedBufferRenderer(Te, ve, me);
r(),
this.context = Te,
this.capabilities = ye,
this.extensions = ve,
this.state = Re;
var Me = new THREE.WebGLShadowMap(this, N, xe);
this.shadowMap = Me;
var Se = new THREE.SpritePlugin(this, Y),
Ae = new THREE.LensFlarePlugin(this, K);
this.getContext = function () {
return Te
},
this.getContextAttributes = function () {
return Te.getContextAttributes()
},
this.forceContextLoss = function () {
ve.get('WEBGL_lose_context').loseContext()
},
this.getMaxAnisotropy = function () {
var e;
return function () {
if (void 0 !== e) return e;
var t = ve.get('EXT_texture_filter_anisotropic');
return e = null !== t ? Te.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0
}
}(),
this.getPrecision = function () {
return ye.precision
},
this.getPixelRatio = function () {
return k
},
this.setPixelRatio = function (e) {
void 0 !== e && (k = e)
},
this.getSize = function () {
return {
width: L,
height: P
}
},
this.setSize = function (e, t, r) {
L = e,
P = t,
A.width = e * k,
A.height = t * k,
!1 !== r && (A.style.width = e + 'px', A.style.height = t + 'px'),
this.setViewport(0, 0, e, t)
},
this.setViewport = function (e, t, r, i) {
ie = e * k,
ne = t * k,
oe = r * k,
ae = i * k,
Te.viewport(ie, ne, oe, ae)
},
this.getViewport = function (e) {
e.x = ie / k,
e.y = ne / k,
e.z = oe / k,
e.w = ae / k
},
this.setScissor = function (e, t, r, i) {
Te.scissor(e * k, t * k, r * k, i * k)
},
this.enableScissorTest = function (e) {
Re.setScissorTest(e)
},
this.getClearColor = function () {
return G
},
this.setClearColor = function (e, r) {
G.set(e),
I = void 0 !== r ? r : 1,
t(G.r, G.g, G.b, I)
},
this.getClearAlpha = function () {
return I
},
this.setClearAlpha = function (e) {
I = e,
t(G.r, G.g, G.b, I)
},
this.clear = function (e, t, r) {
var i = 0;
(void 0 === e || e) && (i |= Te.COLOR_BUFFER_BIT),
(void 0 === t || t) && (i |= Te.DEPTH_BUFFER_BIT),
(void 0 === r || r) && (i |= Te.STENCIL_BUFFER_BIT),
Te.clear(i)
},
this.clearColor = function () {
Te.clear(Te.COLOR_BUFFER_BIT)
},
this.clearDepth = function () {
Te.clear(Te.DEPTH_BUFFER_BIT)
},
this.clearStencil = function () {
Te.clear(Te.STENCIL_BUFFER_BIT)
},
this.clearTarget = function (e, t, r, i) {
this.setRenderTarget(e),
this.clear(t, r, i)
},
this.resetGLState = i,
this.dispose = function () {
A.removeEventListener('webglcontextlost', n, !1)
},
this.renderBufferImmediate = function (e, t, r) {
Re.initAttributes();
var i = He.get(e);
if (e.hasPositions && !i.position && (i.position = Te.createBuffer()), e.hasNormals && !i.normal && (i.normal = Te.createBuffer()), e.hasUvs && !i.uv && (i.uv = Te.createBuffer()), e.hasColors && !i.color && (i.color = Te.createBuffer()), t = t.getAttributes(), e.hasPositions && (Te.bindBuffer(Te.ARRAY_BUFFER, i.position), Te.bufferData(Te.ARRAY_BUFFER, e.positionArray, Te.DYNAMIC_DRAW), Re.enableAttribute(t.position), Te.vertexAttribPointer(t.position, 3, Te.FLOAT, !1, 0, 0)), e.hasNormals) {
if (Te.bindBuffer(Te.ARRAY_BUFFER, i.normal), 'MeshPhongMaterial' !== r.type && r.shading === THREE.FlatShading) for (var n = 0, o = 3 * e.count; o > n; n += 9) {
var a = e.normalArray,
s = (a[n + 0] + a[n + 3] + a[n + 6]) / 3,
h = (a[n + 1] + a[n + 4] + a[n + 7]) / 3,
c = (a[n + 2] + a[n + 5] + a[n + 8]) / 3;
a[n + 0] = s,
a[n + 1] = h,
a[n + 2] = c,
a[n + 3] = s,
a[n + 4] = h,
a[n + 5] = c,
a[n + 6] = s,
a[n + 7] = h,
a[n + 8] = c
}
Te.bufferData(Te.ARRAY_BUFFER, e.normalArray, Te.DYNAMIC_DRAW),
Re.enableAttribute(t.normal),
Te.vertexAttribPointer(t.normal, 3, Te.FLOAT, !1, 0, 0)
}
e.hasUvs && r.map && (Te.bindBuffer(Te.ARRAY_BUFFER, i.uv), Te.bufferData(Te.ARRAY_BUFFER, e.uvArray, Te.DYNAMIC_DRAW), Re.enableAttribute(t.uv), Te.vertexAttribPointer(t.uv, 2, Te.FLOAT, !1, 0, 0)),
e.hasColors && r.vertexColors !== THREE.NoColors && (Te.bindBuffer(Te.ARRAY_BUFFER, i.color), Te.bufferData(Te.ARRAY_BUFFER, e.colorArray, Te.DYNAMIC_DRAW), Re.enableAttribute(t.color), Te.vertexAttribPointer(t.color, 3, Te.FLOAT, !1, 0, 0)),
Re.disableUnusedAttributes(),
Te.drawArrays(Te.TRIANGLES, 0, e.count),
e.count = 0
},
this.renderBufferDirect = function (e, t, r, i, n, o, a) {
f(n);
var s = m(e, t, r, n, o),
h = !1;
if (e = i.id + '_' + s.id + '_' + n.wireframe, e !== ee && (ee = e, h = !0), t = o.morphTargetInfluences, void 0 !== t) {
for (e = [
], r = 0, h = t.length; h > r; r++) {
var u = t[r];
e.push([u,
r])
}
e.sort(c),
8 < e.length && (e.length = 8);
var l = i.morphAttributes;
for (r = 0, h = e.length; h > r; r++) u = e[r],
q[r] = u[0],
0 !== u[0] ? (t = u[1], !0 === n.morphTargets && l.position && i.addAttribute('morphTarget' + r, l.position[t]), !0 === n.morphNormals && l.normal && i.addAttribute('morphNormal' + r, l.normal[t])) : (!0 === n.morphTargets && i.removeAttribute('morphTarget' + r), !0 === n.morphNormals && i.removeAttribute('morphNormal' + r));
e = s.getUniforms(),
null !== e.morphTargetInfluences && Te.uniform1fv(e.morphTargetInfluences, q),
h = !0
}
if (t = i.index, r = i.attributes.position, !0 === n.wireframe && (t = xe.getWireframeAttribute(i)), null !== t ? (e = we, e.setIndex(t)) : e = _e, h) {
var E,
h = void 0;
if (i instanceof THREE.InstancedBufferGeometry && (E = ve.get('ANGLE_instanced_arrays'), null === E)) console.error('THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');
else {
void 0 === h && (h = 0),
Re.initAttributes();
var p,
u = i.attributes,
s = s.getAttributes(),
l = n.defaultAttributeValues;
for (p in s) {
var d = s[p];
if (d >= 0) {
var T = u[p];
if (void 0 !== T) {
var g = T.itemSize,
v = xe.getAttributeBuffer(T);
if (T instanceof THREE.InterleavedBufferAttribute) {
var y = T.data,
R = y.stride,
T = T.offset;
y instanceof THREE.InstancedInterleavedBuffer ? (Re.enableAttributeAndDivisor(d, y.meshPerAttribute, E), void 0 === i.maxInstancedCount && (i.maxInstancedCount = y.meshPerAttribute * y.count)) : Re.enableAttribute(d),
Te.bindBuffer(Te.ARRAY_BUFFER, v),
Te.vertexAttribPointer(d, g, Te.FLOAT, !1, R * y.array.BYTES_PER_ELEMENT, (h * R + T) * y.array.BYTES_PER_ELEMENT)
} else T instanceof THREE.InstancedBufferAttribute ? (Re.enableAttributeAndDivisor(d, T.meshPerAttribute, E), void 0 === i.maxInstancedCount && (i.maxInstancedCount = T.meshPerAttribute * T.count)) : Re.enableAttribute(d),
Te.bindBuffer(Te.ARRAY_BUFFER, v),
Te.vertexAttribPointer(d, g, Te.FLOAT, !1, 0, h * g * 4)
} else if (void 0 !== l && (g = l[p], void 0 !== g)) switch (g.length) {
case 2:
Te.vertexAttrib2fv(d, g);
break;
case 3:
Te.vertexAttrib3fv(d, g);
break;
case 4:
Te.vertexAttrib4fv(d, g);
break;
default:
Te.vertexAttrib1fv(d, g)
}
}
}
Re.disableUnusedAttributes()
}
null !== t && Te.bindBuffer(Te.ELEMENT_ARRAY_BUFFER, xe.getAttributeBuffer(t))
}
E = 1 / 0,
null !== t ? E = t.count : void 0 !== r && (E = r.count),
p = i.drawRange.start,
t = i.drawRange.count,
r = null !== a ? a.start : 0,
h = null !== a ? a.count : 1 / 0,
a = Math.max(0, p, r),
E = Math.min(0 + E, p + t, r + h) - 1,
E = Math.max(0, E - a + 1),
o instanceof THREE.Mesh ? (!0 === n.wireframe ? (Re.setLineWidth(n.wireframeLinewidth * k), e.setMode(Te.LINES)) : e.setMode(Te.TRIANGLES), i instanceof THREE.InstancedBufferGeometry && 0 < i.maxInstancedCount ? e.renderInstances(i) : e.render(a, E)) : o instanceof THREE.Line ? (i = n.linewidth, void 0 === i && (i = 1), Re.setLineWidth(i * k), o instanceof THREE.LineSegments ? e.setMode(Te.LINES) : e.setMode(Te.LINE_STRIP), e.render(a, E)) : o instanceof THREE.Points && (e.setMode(Te.POINTS), e.render(a, E))
},
this.render = function (e, t, r, i) {
if (!1 == t instanceof THREE.Camera) console.error('THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.');
else {
var n = e.fog;
ee = '',
$ = - 1,
te = null,
pe = !0,
!0 === e.autoUpdate && e.updateMatrixWorld(),
null === t.parent && t.updateMatrixWorld(),
t.matrixWorldInverse.getInverse(t.matrixWorld),
ue.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse),
ce.setFromMatrix(ue),
N.length = 0,
X = j = - 1,
Y.length = 0,
K.length = 0,
p(e, t),
z.length = j + 1,
W.length = X + 1,
!0 === Q.sortObjects && (z.sort(u), W.sort(l)),
Me.render(e),
me.calls = 0,
me.vertices = 0,
me.faces = 0,
me.points = 0,
this.setRenderTarget(r),
(this.autoClear || i) && this.clear(this.autoClearColor, this.autoClearDepth, this.autoClearStencil),
e.overrideMaterial ? (i = e.overrideMaterial, d(z, t, N, n, i), d(W, t, N, n, i)) : (Re.setBlending(THREE.NoBlending), d(z, t, N, n), d(W, t, N, n)),
Se.render(e, t),
Ae.render(e, t, se, he),
r && (e = r.texture, t = H(r), e.generateMipmaps && t && e.minFilter !== THREE.NearestFilter && e.minFilter !== THREE.LinearFilter && (e = r instanceof THREE.WebGLRenderTargetCube ? Te.TEXTURE_CUBE_MAP : Te.TEXTURE_2D, r = He.get(r.texture).__webglTexture, Re.bindTexture(e, r), Te.generateMipmap(e), Re.bindTexture(e, null))),
Re.setDepthTest(!0),
Re.setDepthWrite(!0),
Re.setColorWrite(!0)
}
},
this.setFaceCulling = function (e, t) {
e === THREE.CullFaceNone ? Re.disable(Te.CULL_FACE) : (t === THREE.FrontFaceDirectionCW ? Te.frontFace(Te.CW) : Te.frontFace(Te.CCW), e === THREE.CullFaceBack ? Te.cullFace(Te.BACK) : e === THREE.CullFaceFront ? Te.cullFace(Te.FRONT) : Te.cullFace(Te.FRONT_AND_BACK), Re.enable(Te.CULL_FACE))
},
this.setTexture = function (e, t) {
var r = He.get(e);
if (0 < e.version && r.__version !== e.version) {
var i = e.image;
if (void 0 === i) console.warn('THREE.WebGLRenderer: Texture marked for update but image is undefined', e);
else if (!1 === i.complete) console.warn('THREE.WebGLRenderer: Texture marked for update but image is incomplete', e);
else {
if (void 0 === r.__webglInit && (r.__webglInit = !0, e.addEventListener('dispose', o), r.__webglTexture = Te.createTexture(), fe.textures++), Re.activeTexture(Te.TEXTURE0 + t), Re.bindTexture(Te.TEXTURE_2D, r.__webglTexture), Te.pixelStorei(Te.UNPACK_FLIP_Y_WEBGL, e.flipY), Te.pixelStorei(Te.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e.premultiplyAlpha), Te.pixelStorei(Te.UNPACK_ALIGNMENT, e.unpackAlignment), e.image = R(e.image, ye.maxTextureSize), (e.wrapS !== THREE.ClampToEdgeWrapping || e.wrapT !== THREE.ClampToEdgeWrapping || e.minFilter !== THREE.NearestFilter && e.minFilter !== THREE.LinearFilter) && !1 === H(e.image)) {
if (i = e.image, i instanceof HTMLImageElement || i instanceof HTMLCanvasElement) {
var n = document.createElement('canvas');
n.width = THREE.Math.nearestPowerOfTwo(i.width),
n.height = THREE.Math.nearestPowerOfTwo(i.height),
n.getContext('2d').drawImage(i, 0, 0, n.width, n.height),
console.warn('THREE.WebGLRenderer: image is not power of two (' + i.width + 'x' + i.height + '). Resized to ' + n.width + 'x' + n.height, i),
i = n
}
e.image = i
}
var a = e.image,
i = H(a),
n = S(e.format),
s = S(e.type);
y(Te.TEXTURE_2D, e, i);
var h = e.mipmaps;
if (e instanceof THREE.DataTexture) if (0 < h.length && i) {
for (var c = 0, u = h.length; u > c; c++) a = h[c],
Re.texImage2D(Te.TEXTURE_2D, c, n, a.width, a.height, 0, n, s, a.data);
e.generateMipmaps = !1
} else Re.texImage2D(Te.TEXTURE_2D, 0, n, a.width, a.height, 0, n, s, a.data);
else if (e instanceof THREE.CompressedTexture) for (c = 0, u = h.length; u > c; c++) a = h[c],
e.format !== THREE.RGBAFormat && e.format !== THREE.RGBFormat ? - 1 < Re.getCompressedTextureFormats().indexOf(n) ? Re.compressedTexImage2D(Te.TEXTURE_2D, c, n, a.width, a.height, 0, a.data) : console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()') : Re.texImage2D(Te.TEXTURE_2D, c, n, a.width, a.height, 0, n, s, a.data);
else if (0 < h.length && i) {
for (c = 0, u = h.length; u > c; c++) a = h[c],
Re.texImage2D(Te.TEXTURE_2D, c, n, n, s, a);
e.generateMipmaps = !1
} else Re.texImage2D(Te.TEXTURE_2D, 0, n, n, s, e.image);
e.generateMipmaps && i && Te.generateMipmap(Te.TEXTURE_2D),
r.__version = e.version,
e.onUpdate && e.onUpdate(e)
}
} else Re.activeTexture(Te.TEXTURE0 + t),
Re.bindTexture(Te.TEXTURE_2D, r.__webglTexture)
},
this.setRenderTarget = function (e) {
var t = e instanceof THREE.WebGLRenderTargetCube;
if (e && void 0 === He.get(e).__webglFramebuffer) {
var r = He.get(e),
i = He.get(e.texture);
void 0 === e.depthBuffer && (e.depthBuffer = !0),
void 0 === e.stencilBuffer && (e.stencilBuffer = !0),
e.addEventListener('dispose', a),
i.__webglTexture = Te.createTexture(),
fe.textures++;
var n = H(e),
o = S(e.texture.format),
s = S(e.texture.type);
if (t) {
for (r.__webglFramebuffer = [
], r.__webglRenderbuffer = [
], Re.bindTexture(Te.TEXTURE_CUBE_MAP, i.__webglTexture), y(Te.TEXTURE_CUBE_MAP, e.texture, n), i = 0; 6 > i; i++) r.__webglFramebuffer[i] = Te.createFramebuffer(),
r.__webglRenderbuffer[i] = Te.createRenderbuffer(),
Re.texImage2D(Te.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, o, e.width, e.height, 0, o, s, null),
_(r.__webglFramebuffer[i], e, Te.TEXTURE_CUBE_MAP_POSITIVE_X + i),
w(r.__webglRenderbuffer[i], e);
e.texture.generateMipmaps && n && Te.generateMipmap(Te.TEXTURE_CUBE_MAP)
} else r.__webglFramebuffer = Te.createFramebuffer(),
r.__webglRenderbuffer = e.shareDepthFrom ? e.shareDepthFrom.__webglRenderbuffer : Te.createRenderbuffer(),
Re.bindTexture(Te.TEXTURE_2D, i.__webglTexture),
y(Te.TEXTURE_2D, e.texture, n),
Re.texImage2D(Te.TEXTURE_2D, 0, o, e.width, e.height, 0, o, s, null),
_(r.__webglFramebuffer, e, Te.TEXTURE_2D),
e.shareDepthFrom ? e.depthBuffer && !e.stencilBuffer ? Te.framebufferRenderbuffer(Te.FRAMEBUFFER, Te.DEPTH_ATTACHMENT, Te.RENDERBUFFER, r.__webglRenderbuffer) : e.depthBuffer && e.stencilBuffer && Te.framebufferRenderbuffer(Te.FRAMEBUFFER, Te.DEPTH_STENCIL_ATTACHMENT, Te.RENDERBUFFER, r.__webglRenderbuffer) : w(r.__webglRenderbuffer, e),
e.texture.generateMipmaps && n && Te.generateMipmap(Te.TEXTURE_2D);
t ? Re.bindTexture(Te.TEXTURE_CUBE_MAP, null) : Re.bindTexture(Te.TEXTURE_2D, null),
Te.bindRenderbuffer(Te.RENDERBUFFER, null),
Te.bindFramebuffer(Te.FRAMEBUFFER, null)
}
e ? (r = He.get(e), i = t ? r.__webglFramebuffer[e.activeCubeFace] : r.__webglFramebuffer, r = e.width, n = e.height, s = o = 0) : (i = null, r = oe, n = ae, o = ie, s = ne),
i !== J && (Te.bindFramebuffer(Te.FRAMEBUFFER, i), Te.viewport(o, s, r, n), J = i),
t && (i = He.get(e.texture), Te.framebufferTexture2D(Te.FRAMEBUFFER, Te.COLOR_ATTACHMENT0, Te.TEXTURE_CUBE_MAP_POSITIVE_X + e.activeCubeFace, i.__webglTexture, 0)),
se = r,
he = n
},
this.readRenderTargetPixels = function (e, t, r, i, n, o) {
if (!1 == e instanceof THREE.WebGLRenderTarget) console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.');
else {
var a = He.get(e).__webglFramebuffer;
if (a) {
var s = !1;
a !== J && (Te.bindFramebuffer(Te.FRAMEBUFFER, a), s = !0);
try {
var h = e.texture;
h.format !== THREE.RGBAFormat && S(h.format) !== Te.getParameter(Te.IMPLEMENTATION_COLOR_READ_FORMAT) ? console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.') : h.type === THREE.UnsignedByteType || S(h.type) === Te.getParameter(Te.IMPLEMENTATION_COLOR_READ_TYPE) || h.type === THREE.FloatType && ve.get('WEBGL_color_buffer_float') || h.type === THREE.HalfFloatType && ve.get('EXT_color_buffer_half_float') ? Te.checkFramebufferStatus(Te.FRAMEBUFFER) === Te.FRAMEBUFFER_COMPLETE ? Te.readPixels(t, r, i, n, S(h.format), S(h.type), o) : console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.') : console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.')
} finally {
s && Te.bindFramebuffer(Te.FRAMEBUFFER, J)
}
}
}
},
this.supportsFloatTextures = function () {
return console.warn('THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).'),
ve.get('OES_texture_float')
},
this.supportsHalfFloatTextures = function () {
return console.warn('THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).'),
ve.get('OES_texture_half_float')
},
this.supportsStandardDerivatives = function () {
return console.warn('THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).'),
ve.get('OES_standard_derivatives')
},
this.supportsCompressedTextureS3TC = function () {
return console.warn('THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).'),
ve.get('WEBGL_compressed_texture_s3tc')
},
this.supportsCompressedTexturePVRTC = function () {
return console.warn('THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).'),
ve.get('WEBGL_compressed_texture_pvrtc')
},
this.supportsBlendMinMax = function () {
return console.warn('THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).'),
ve.get('EXT_blend_minmax')
},
this.supportsVertexTextures = function () {
return ye.vertexTextures
},
this.supportsInstancedArrays = function () {
return console.warn('THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).'),
ve.get('ANGLE_instanced_arrays')
},
this.initMaterial = function () {
console.warn('THREE.WebGLRenderer: .initMaterial() has been removed.')
},
this.addPrePlugin = function () {
console.warn('THREE.WebGLRenderer: .addPrePlugin() has been removed.')
},
this.addPostPlugin = function () {
console.warn('THREE.WebGLRenderer: .addPostPlugin() has been removed.')
},
this.updateShadowMap = function () {
console.warn('THREE.WebGLRenderer: .updateShadowMap() has been removed.')
},
Object.defineProperties(this, {
shadowMapEnabled: {
get: function () {
return Me.enabled
},
set: function (e) {
console.warn('THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.'),
Me.enabled = e
}
},
shadowMapType: {
get: function () {
return Me.type
},
set: function (e) {
console.warn('THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.'),
Me.type = e
}
},
shadowMapCullFace: {
get: function () {
return Me.cullFace
},
set: function (e) {
console.warn('THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.'),
Me.cullFace = e
}
},
shadowMapDebug: {
get: function () {
return Me.debug
},
set: function (e) {
console.warn('THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.'),
Me.debug = e
}
}
})
},
THREE.WebGLRenderTarget = function (e, t, r) {
this.uuid = THREE.Math.generateUUID(),
this.width = e,
this.height = t,
r = r || {
},
void 0 === r.minFilter && (r.minFilter = THREE.LinearFilter),
this.texture = new THREE.Texture(void 0, void 0, r.wrapS, r.wrapT, r.magFilter, r.minFilter, r.format, r.type, r.anisotropy),
this.depthBuffer = void 0 !== r.depthBuffer ? r.depthBuffer : !0,
this.stencilBuffer = void 0 !== r.stencilBuffer ? r.stencilBuffer : !0,
this.shareDepthFrom = void 0 !== r.shareDepthFrom ? r.shareDepthFrom : null
},
THREE.WebGLRenderTarget.prototype = {
constructor: THREE.WebGLRenderTarget,
get wrapS() {
return console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'),
this.texture.wrapS
},
set wrapS(e) {
console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'),
this.texture.wrapS = e
},
get wrapT() {
return console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.'),
this.texture.wrapT
},
set wrapT(e) {
console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.'),
this.texture.wrapT = e
},
get magFilter() {
return console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.'),
this.texture.magFilter
},
set magFilter(e) {
console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.'),
this.texture.magFilter = e
},
get minFilter() {
return console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.'),
this.texture.minFilter
},
set minFilter(e) {
console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.'),
this.texture.minFilter = e
},
get anisotropy() {
return console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.'),
this.texture.anisotropy
},
set anisotropy(e) {
console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.'),
this.texture.anisotropy = e
},
get offset() {
return console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.'),
this.texture.offset
},
set offset(e) {
console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.'),
this.texture.offset = e
},
get repeat() {
return console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.'),
this.texture.repeat
},
set repeat(e) {
console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.'),
this.texture.repeat = e
},
get format() {
return console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'),
this.texture.format
},
set format(e) {
console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'),
this.texture.format = e
},
get type() {
return console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.'),
this.texture.type
},
set type(e) {
console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.'),
this.texture.type = e
},
get generateMipmaps() {
return console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.'),
this.texture.generateMipmaps
},
set generateMipmaps(e) {
console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.'),
this.texture.generateMipmaps = e
},
setSize: function (e, t) {
(this.width !== e || this.height !== t) && (this.width = e, this.height = t, this.dispose())
},
clone: function () {
return (new this.constructor).copy(this)
},
copy: function (e) {
return this.width = e.width,
this.height = e.height,
this.texture = e.texture.clone(),
this.depthBuffer = e.depthBuffer,
this.stencilBuffer = e.stencilBuffer,
this.shareDepthFrom = e.shareDepthFrom,
this
},
dispose: function () {
this.dispatchEvent({
type: 'dispose'
})
}
},
THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype),
THREE.WebGLRenderTargetCube = function (e, t, r) {
THREE.WebGLRenderTarget.call(this, e, t, r),
this.activeCubeFace = 0
},
THREE.WebGLRenderTargetCube.prototype = Object.create(THREE.WebGLRenderTarget.prototype),
THREE.WebGLRenderTargetCube.prototype.constructor = THREE.WebGLRenderTargetCube,
THREE.WebGLBufferRenderer = function (e, t, r) {
var i;
this.setMode = function (e) {
i = e
},
this.render = function (t, n) {
e.drawArrays(i, t, n),
r.calls++,
r.vertices += n,
i === e.TRIANGLES && (r.faces += n / 3)
},
this.renderInstances = function (e) {
var r = t.get('ANGLE_instanced_arrays');
if (null === r) console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');
else {
var n = e.attributes.position;
n instanceof THREE.InterleavedBufferAttribute ? r.drawArraysInstancedANGLE(i, 0, n.data.count, e.maxInstancedCount) : r.drawArraysInstancedANGLE(i, 0, n.count, e.maxInstancedCount)
}
}
},
THREE.WebGLIndexedBufferRenderer = function (e, t, r) {
var i,
n,
o;
this.setMode = function (e) {
i = e
},
this.setIndex = function (r) {
r.array instanceof Uint32Array && t.get('OES_element_index_uint') ? (n = e.UNSIGNED_INT, o = 4) : (n = e.UNSIGNED_SHORT, o = 2)
},
this.render = function (t, a) {
e.drawElements(i, a, n, t * o),
r.calls++,
r.vertices += a,
i === e.TRIANGLES && (r.faces += a / 3)
},
this.renderInstances = function (e) {
var r = t.get('ANGLE_instanced_arrays');
null === r ? console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.') : r.drawElementsInstancedANGLE(i, e.index.array.length, n, 0, e.maxInstancedCount)
}
},
THREE.WebGLExtensions = function (e) {
var t = {
};
this.get = function (r) {
if (void 0 !== t[r]) return t[r];
var i;
switch (r) {
case 'EXT_texture_filter_anisotropic':
i = e.getExtension('EXT_texture_filter_anisotropic') || e.getExtension('MOZ_EXT_texture_filter_anisotropic') || e.getExtension('WEBKIT_EXT_texture_filter_anisotropic');
break;
case 'WEBGL_compressed_texture_s3tc':
i = e.getExtension('WEBGL_compressed_texture_s3tc') || e.getExtension('MOZ_WEBGL_compressed_texture_s3tc') || e.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');
break;
case 'WEBGL_compressed_texture_pvrtc':
i = e.getExtension('WEBGL_compressed_texture_pvrtc') || e.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');
break;
default:
i = e.getExtension(r)
}
return null === i && console.warn('THREE.WebGLRenderer: ' + r + ' extension not supported.'),
t[r] = i
}
},
THREE.WebGLCapabilities = function (e, t, r) {
function i(t) {
if ('highp' === t) {
if (0 < e.getShaderPrecisionFormat(e.VERTEX_SHADER, e.HIGH_FLOAT).precision && 0 < e.getShaderPrecisionFormat(e.FRAGMENT_SHADER, e.HIGH_FLOAT).precision) return 'highp';
t = 'mediump'
}
return 'mediump' === t && 0 < e.getShaderPrecisionFormat(e.VERTEX_SHADER, e.MEDIUM_FLOAT).precision && 0 < e.getShaderPrecisionFormat(e.FRAGMENT_SHADER, e.MEDIUM_FLOAT).precision ? 'mediump' : 'lowp'
}
this.getMaxPrecision = i,
this.precision = void 0 !== r.precision ? r.precision : 'highp',
this.logarithmicDepthBuffer = void 0 !== r.logarithmicDepthBuffer ? r.logarithmicDepthBuffer : !1,
this.maxTextures = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),
this.maxVertexTextures = e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
this.maxTextureSize = e.getParameter(e.MAX_TEXTURE_SIZE),
this.maxCubemapSize = e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),
this.maxAttributes = e.getParameter(e.MAX_VERTEX_ATTRIBS),
this.maxVertexUniforms = e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),
this.maxVaryings = e.getParameter(e.MAX_VARYING_VECTORS),
this.maxFragmentUniforms = e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),
this.vertexTextures = 0 < this.maxVertexTextures,
this.floatFragmentTextures = !!t.get('OES_texture_float'),
this.floatVertexTextures = this.vertexTextures && this.floatFragmentTextures,
r = i(this.precision),
r !== this.precision && (console.warn('THREE.WebGLRenderer:', this.precision, 'not supported, using', r, 'instead.'), this.precision = r),
this.logarithmicDepthBuffer && (this.logarithmicDepthBuffer = !!t.get('EXT_frag_depth'))
},
THREE.WebGLGeometries = function (e, t, r) {
function i(e) {
e = e.target;
var a,
s = o[e.id].attributes;
for (a in s) n(s[a]);
e.removeEventListener('dispose', i),
delete o[e.id],
a = t.get(e),
a.wireframe && n(a.wireframe),
r.memory.geometries--
}
function n(r) {
var i;
i = r instanceof THREE.InterleavedBufferAttribute ? t.get(r.data).__webglBuffer : t.get(r).__webglBuffer,
void 0 !== i && (e.deleteBuffer(i), r instanceof THREE.InterleavedBufferAttribute ? t['delete'](r.data) : t['delete'](r))
}
var o = {
};
this.get = function (e) {
var t = e.geometry;
if (void 0 !== o[t.id]) return o[t.id];
t.addEventListener('dispose', i);
var n;
return t instanceof THREE.BufferGeometry ? n = t : t instanceof THREE.Geometry && (void 0 === t._bufferGeometry && (t._bufferGeometry = (new THREE.BufferGeometry).setFromObject(e)), n = t._bufferGeometry),
o[t.id] = n,
r.memory.geometries++,
n
}
},
THREE.WebGLObjects = function (e, t, r) {
function i(r, i) {
var n = r instanceof THREE.InterleavedBufferAttribute ? r.data : r,
o = t.get(n);
void 0 === o.__webglBuffer ? (o.__webglBuffer = e.createBuffer(), e.bindBuffer(i, o.__webglBuffer), e.bufferData(i, n.array, n.dynamic ? e.DYNAMIC_DRAW : e.STATIC_DRAW), o.version = n.version) : o.version !== n.version && (e.bindBuffer(i, o.__webglBuffer), !1 === n.dynamic || - 1 === n.updateRange.count ? e.bufferSubData(i, 0, n.array) : 0 === n.updateRange.count ? console.error('THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually.') : (e.bufferSubData(i, n.updateRange.offset * n.array.BYTES_PER_ELEMENT, n.array.subarray(n.updateRange.offset, n.updateRange.offset + n.updateRange.count)), n.updateRange.count = 0), o.version = n.version)
}
function n(e, t, r) {
if (t > r) {
var i = t;
t = r,
r = i
}
return i = e[t],
void 0 === i ? (e[t] = [
r
], !0) : - 1 === i.indexOf(r) ? (i.push(r), !0) : !1
}
var o = new THREE.WebGLGeometries(e, t, r);
this.getAttributeBuffer = function (e) {
return e instanceof THREE.InterleavedBufferAttribute ? t.get(e.data).__webglBuffer : t.get(e).__webglBuffer
},
this.getWireframeAttribute = function (r) {
var o = t.get(r);
if (void 0 !== o.wireframe) return o.wireframe;
var a = [
],
s = r.index,
h = r.attributes;
if (r = h.position, null !== s) for (var h = {
}, s = s.array, c = 0, u = s.length; u > c; c += 3) {
var l = s[c + 0],
E = s[c + 1],
p = s[c + 2];
n(h, l, E) && a.push(l, E),
n(h, E, p) && a.push(E, p),
n(h, p, l) && a.push(p, l)
} else for (s = h.position.array, c = 0, u = s.length / 3 - 1; u > c; c += 3) l = c + 0,
E = c + 1,
p = c + 2,
a.push(l, E, E, p, p, l);
return a = new THREE.BufferAttribute(new (65535 < r.count ? Uint32Array : Uint16Array) (a), 1),
i(a, e.ELEMENT_ARRAY_BUFFER),
o.wireframe = a
},
this.update = function (t) {
var r = o.get(t);
t.geometry instanceof THREE.Geometry && r.updateFromObject(t),
t = r.index;
var n = r.attributes;
null !== t && i(t, e.ELEMENT_ARRAY_BUFFER);
for (var a in n) i(n[a], e.ARRAY_BUFFER);
t = r.morphAttributes;
for (a in t) for (var n = t[a], s = 0, h = n.length; h > s; s++) i(n[s], e.ARRAY_BUFFER);
return r
}
},
THREE.WebGLProgram = function () {
function e(e) {
var t,
r = [
];
for (t in e) {
var i = e[t];
!1 !== i && r.push('#define ' + t + ' ' + i)
}
return r.join('\n')
}
function t(e) {
return '' !== e
}
var r = 0;
return function (i, n, o, a) {
var s = i.context,
h = o.defines,
c = o.__webglShader.vertexShader,
u = o.__webglShader.fragmentShader,
l = 'SHADOWMAP_TYPE_BASIC';
a.shadowMapType === THREE.PCFShadowMap ? l = 'SHADOWMAP_TYPE_PCF' : a.shadowMapType === THREE.PCFSoftShadowMap && (l = 'SHADOWMAP_TYPE_PCF_SOFT');
var E = 'ENVMAP_TYPE_CUBE',
p = 'ENVMAP_MODE_REFLECTION',
d = 'ENVMAP_BLENDING_MULTIPLY';
if (a.envMap) {
switch (o.envMap.mapping) {
case THREE.CubeReflectionMapping:
case THREE.CubeRefractionMapping:
E = 'ENVMAP_TYPE_CUBE';
break;
case THREE.EquirectangularReflectionMapping:
case THREE.EquirectangularRefractionMapping:
E = 'ENVMAP_TYPE_EQUIREC';
break;
case THREE.SphericalReflectionMapping:
E = 'ENVMAP_TYPE_SPHERE'
}
switch (o.envMap.mapping) {
case THREE.CubeRefractionMapping:
case THREE.EquirectangularRefractionMapping:
p = 'ENVMAP_MODE_REFRACTION'
}
switch (o.combine) {
case THREE.MultiplyOperation:
d = 'ENVMAP_BLENDING_MULTIPLY';
break;
case THREE.MixOperation:
d = 'ENVMAP_BLENDING_MIX';
break;
case THREE.AddOperation:
d = 'ENVMAP_BLENDING_ADD'
}
}
var f = 0 < i.gammaFactor ? i.gammaFactor : 1,
m = e(h),
T = s.createProgram();
o instanceof THREE.RawShaderMaterial ? i = h = '' : (h = [
'precision ' + a.precision + ' float;',
'precision ' + a.precision + ' int;',
'#define SHADER_NAME ' + o.__webglShader.name,
m,
a.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',
i.gammaInput ? '#define GAMMA_INPUT' : '',
i.gammaOutput ? '#define GAMMA_OUTPUT' : '',
'#define GAMMA_FACTOR ' + f,
'#define MAX_DIR_LIGHTS ' + a.maxDirLights,
'#define MAX_POINT_LIGHTS ' + a.maxPointLights,
'#define MAX_SPOT_LIGHTS ' + a.maxSpotLights,
'#define MAX_HEMI_LIGHTS ' + a.maxHemiLights,
'#define MAX_SHADOWS ' + a.maxShadows,
'#define MAX_BONES ' + a.maxBones,
a.map ? '#define USE_MAP' : '',
a.envMap ? '#define USE_ENVMAP' : '',
a.envMap ? '#define ' + p : '',
a.lightMap ? '#define USE_LIGHTMAP' : '',
a.aoMap ? '#define USE_AOMAP' : '',
a.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
a.bumpMap ? '#define USE_BUMPMAP' : '',
a.normalMap ? '#define USE_NORMALMAP' : '',
a.displacementMap && a.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '',
a.specularMap ? '#define USE_SPECULARMAP' : '',
a.alphaMap ? '#define USE_ALPHAMAP' : '',
a.vertexColors ? '#define USE_COLOR' : '',
a.flatShading ? '#define FLAT_SHADED' : '',
a.skinning ? '#define USE_SKINNING' : '',
a.useVertexTexture ? '#define BONE_TEXTURE' : '',
a.morphTargets ? '#define USE_MORPHTARGETS' : '',
a.morphNormals && !1 === a.flatShading ? '#define USE_MORPHNORMALS' : '',
a.doubleSided ? '#define DOUBLE_SIDED' : '',
a.flipSided ? '#define FLIP_SIDED' : '',
a.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',
a.shadowMapEnabled ? '#define ' + l : '',
a.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',
0 < a.pointLightShadows ? '#define POINT_LIGHT_SHADOWS' : '',
a.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
a.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
a.logarithmicDepthBuffer && i.extensions.get('EXT_frag_depth') ? '#define USE_LOGDEPTHBUF_EXT' : '',
'uniform mat4 modelMatrix;',
'uniform mat4 modelViewMatrix;',
'uniform mat4 projectionMatrix;',
'uniform mat4 viewMatrix;',
'uniform mat3 normalMatrix;',
'uniform vec3 cameraPosition;',
'attribute vec3 position;',
'attribute vec3 normal;',
'attribute vec2 uv;',
'#ifdef USE_COLOR',
'\tattribute vec3 color;',
'#endif',
'#ifdef USE_MORPHTARGETS',
'\tattribute vec3 morphTarget0;',
'\tattribute vec3 morphTarget1;',
'\tattribute vec3 morphTarget2;',
'\tattribute vec3 morphTarget3;',
'\t#ifdef USE_MORPHNORMALS',
'\t\tattribute vec3 morphNormal0;',
'\t\tattribute vec3 morphNormal1;',
'\t\tattribute vec3 morphNormal2;',
'\t\tattribute vec3 morphNormal3;',
'\t#else',
'\t\tattribute vec3 morphTarget4;',
'\t\tattribute vec3 morphTarget5;',
'\t\tattribute vec3 morphTarget6;',
'\t\tattribute vec3 morphTarget7;',
'\t#endif',
'#endif',
'#ifdef USE_SKINNING',
'\tattribute vec4 skinIndex;',
'\tattribute vec4 skinWeight;',
'#endif',
'\n'
].filter(t).join('\n'), i = [
a.bumpMap || a.normalMap || a.flatShading || o.derivatives ? '#extension GL_OES_standard_derivatives : enable' : '',
a.logarithmicDepthBuffer && i.extensions.get('EXT_frag_depth') ? '#extension GL_EXT_frag_depth : enable' : '',
'precision ' + a.precision + ' float;',
'precision ' + a.precision + ' int;',
'#define SHADER_NAME ' + o.__webglShader.name,
m,
'#define MAX_DIR_LIGHTS ' + a.maxDirLights,
'#define MAX_POINT_LIGHTS ' + a.maxPointLights,
'#define MAX_SPOT_LIGHTS ' + a.maxSpotLights,
'#define MAX_HEMI_LIGHTS ' + a.maxHemiLights,
'#define MAX_SHADOWS ' + a.maxShadows,
a.alphaTest ? '#define ALPHATEST ' + a.alphaTest : '',
i.gammaInput ? '#define GAMMA_INPUT' : '',
i.gammaOutput ? '#define GAMMA_OUTPUT' : '',
'#define GAMMA_FACTOR ' + f,
a.useFog && a.fog ? '#define USE_FOG' : '',
a.useFog && a.fogExp ? '#define FOG_EXP2' : '',
a.map ? '#define USE_MAP' : '',
a.envMap ? '#define USE_ENVMAP' : '',
a.envMap ? '#define ' + E : '',
a.envMap ? '#define ' + p : '',
a.envMap ? '#define ' + d : '',
a.lightMap ? '#define USE_LIGHTMAP' : '',
a.aoMap ? '#define USE_AOMAP' : '',
a.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
a.bumpMap ? '#define USE_BUMPMAP' : '',
a.normalMap ? '#define USE_NORMALMAP' : '',
a.specularMap ? '#define USE_SPECULARMAP' : '',
a.alphaMap ? '#define USE_ALPHAMAP' : '',
a.vertexColors ? '#define USE_COLOR' : '',
a.flatShading ? '#define FLAT_SHADED' : '',
a.metal ? '#define METAL' : '',
a.doubleSided ? '#define DOUBLE_SIDED' : '',
a.flipSided ? '#define FLIP_SIDED' : '',
a.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',
a.shadowMapEnabled ? '#define ' + l : '',
a.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',
0 < a.pointLightShadows ? '#define POINT_LIGHT_SHADOWS' : '',
a.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
a.logarithmicDepthBuffer && i.extensions.get('EXT_frag_depth') ? '#define USE_LOGDEPTHBUF_EXT' : '',
'uniform mat4 viewMatrix;',
'uniform vec3 cameraPosition;',
'\n'
].filter(t).join('\n')),
u = i + u,
c = THREE.WebGLShader(s, s.VERTEX_SHADER, h + c),
u = THREE.WebGLShader(s, s.FRAGMENT_SHADER, u),
s.attachShader(T, c),
s.attachShader(T, u),
void 0 !== o.index0AttributeName ? s.bindAttribLocation(T, 0, o.index0AttributeName) : !0 === a.morphTargets && s.bindAttribLocation(T, 0, 'position'),
s.linkProgram(T),
a = s.getProgramInfoLog(T),
l = s.getShaderInfoLog(c),
E = s.getShaderInfoLog(u),
d = p = !0,
!1 === s.getProgramParameter(T, s.LINK_STATUS) ? (p = !1, console.error('THREE.WebGLProgram: shader error: ', s.getError(), 'gl.VALIDATE_STATUS', s.getProgramParameter(T, s.VALIDATE_STATUS), 'gl.getProgramInfoLog', a, l, E)) : '' !== a ? console.warn('THREE.WebGLProgram: gl.getProgramInfoLog()', a) : ('' === l || '' === E) && (d = !1),
d && (this.diagnostics = {
runnable: p,
material: o,
programLog: a,
vertexShader: {
log: l,
prefix: h
},
fragmentShader: {
log: E,
prefix: i
}
}),
s.deleteShader(c),
s.deleteShader(u);
var g;
this.getUniforms = function () {
if (void 0 === g) {
for (var e = {
}, t = s.getProgramParameter(T, s.ACTIVE_UNIFORMS), r = 0; t > r; r++) {
var i = s.getActiveUniform(T, r).name,
n = s.getUniformLocation(T, i),
o = i.lastIndexOf('[0]');
- 1 !== o && o === i.length - 3 && (e[i.substr(0, o)] = n),
e[i] = n
}
g = e
}
return g
};
var v;
return this.getAttributes = function () {
if (void 0 === v) {
for (var e = {
}, t = s.getProgramParameter(T, s.ACTIVE_ATTRIBUTES), r = 0; t > r; r++) {
var i = s.getActiveAttrib(T, r).name;
e[i] = s.getAttribLocation(T, i)
}
v = e
}
return v
},
this.destroy = function () {
s.deleteProgram(T),
this.program = void 0
},
Object.defineProperties(this, {
uniforms: {
get: function () {
return console.warn('THREE.WebGLProgram: .uniforms is now .getUniforms().'),
this.getUniforms()
}
},
attributes: {
get: function () {
return console.warn('THREE.WebGLProgram: .attributes is now .getAttributes().'),
this.getAttributes()
}
}
}),
this.id = r++,
this.code = n,
this.usedTimes = 1,
this.program = T,
this.vertexShader = c,
this.fragmentShader = u,
this
}
}(),
THREE.WebGLPrograms = function (e, t) {
var r = [
],
i = {
MeshDepthMaterial: 'depth',
MeshNormalMaterial: 'normal',
MeshBasicMaterial: 'basic',
MeshLambertMaterial: 'lambert',
MeshPhongMaterial: 'phong',
LineBasicMaterial: 'basic',
LineDashedMaterial: 'dashed',
PointsMaterial: 'points'
},
n = 'precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals maxDirLights maxPointLights maxSpotLights maxHemiLights maxShadows shadowMapEnabled pointLightShadows shadowMapType shadowMapDebug alphaTest metal doubleSided flipSided'.split(' ');
this.getParameters = function (r, n, o, a) {
var s,
h,
c,
u,
l,
E = i[r.type];
s = l = u = c = h = 0;
for (var p = n.length; p > s; s++) {
var d = n[s];
!1 !== d.visible && (d instanceof THREE.DirectionalLight && h++, d instanceof THREE.PointLight && c++, d instanceof THREE.SpotLight && u++, d instanceof THREE.HemisphereLight && l++)
}
for (var d = s = p = 0, f = n.length; f > d; d++) {
var m = n[d];
m.castShadow && ((m instanceof THREE.SpotLight || m instanceof THREE.DirectionalLight) && p++, m instanceof THREE.PointLight && (p++, s++))
}
return n = p,
t.floatVertexTextures && a && a.skeleton && a.skeleton.useVertexTexture ? p = 1024 : (p = Math.floor((t.maxVertexUniforms - 20) / 4), void 0 !== a && a instanceof THREE.SkinnedMesh && (p = Math.min(a.skeleton.bones.length, p), p < a.skeleton.bones.length && console.warn('WebGLRenderer: too many bones - ' + a.skeleton.bones.length + ', this GPU supports just ' + p + ' (try OpenGL instead of ANGLE)'))),
d = e.getPrecision(),
null !== r.precision && (d = t.getMaxPrecision(r.precision), d !== r.precision && console.warn('THREE.WebGLRenderer.initMaterial:', r.precision, 'not supported, using', d, 'instead.')),
{
shaderID: E,
precision: d,
supportsVertexTextures: t.vertexTextures,
map: !!r.map,
envMap: !!r.envMap,
envMapMode: r.envMap && r.envMap.mapping,
lightMap: !!r.lightMap,
aoMap: !!r.aoMap,
emissiveMap: !!r.emissiveMap,
bumpMap: !!r.bumpMap,
normalMap: !!r.normalMap,
displacementMap: !!r.displacementMap,
specularMap: !!r.specularMap,
alphaMap: !!r.alphaMap,
combine: r.combine,
vertexColors: r.vertexColors,
fog: o,
useFog: r.fog,
fogExp: o instanceof THREE.FogExp2,
flatShading: r.shading === THREE.FlatShading,
sizeAttenuation: r.sizeAttenuation,
logarithmicDepthBuffer: t.logarithmicDepthBuffer,
skinning: r.skinning,
maxBones: p,
useVertexTexture: t.floatVertexTextures && a && a.skeleton && a.skeleton.useVertexTexture,
morphTargets: r.morphTargets,
morphNormals: r.morphNormals,
maxMorphTargets: e.maxMorphTargets,
maxMorphNormals: e.maxMorphNormals,
maxDirLights: h,
maxPointLights: c,
maxSpotLights: u,
maxHemiLights: l,
maxShadows: n,
pointLightShadows: s,
shadowMapEnabled: e.shadowMap.enabled && a.receiveShadow && n > 0,
shadowMapType: e.shadowMap.type,
shadowMapDebug: e.shadowMap.debug,
alphaTest: r.alphaTest,
metal: r.metal,
doubleSided: r.side === THREE.DoubleSide,
flipSided: r.side === THREE.BackSide
}
},
this.getProgramCode = function (e, t) {
var r = [
];
if (t.shaderID ? r.push(t.shaderID) : (r.push(e.fragmentShader), r.push(e.vertexShader)), void 0 !== e.defines) for (var i in e.defines) r.push(i),
r.push(e.defines[i]);
for (i = 0; i < n.length; i++) {
var o = n[i];
r.push(o),
r.push(t[o])
}
return r.join()
},
this.acquireProgram = function (t, i, n) {
for (var o, a = 0, s = r.length; s > a; a++) {
var h = r[a];
if (h.code === n) {
o = h,
++o.usedTimes;
break
}
}
return void 0 === o && (o = new THREE.WebGLProgram(e, n, t, i), r.push(o)),
o
},
this.releaseProgram = function (e) {
if (0 === --e.usedTimes) {
var t = r.indexOf(e);
r[t] = r[r.length - 1],
r.pop(),
e.destroy()
}
},
this.programs = r
},
THREE.WebGLProperties = function () {
var e = {
};
this.get = function (t) {
t = t.uuid;
var r = e[t];
return void 0 === r && (r = {
}, e[t] = r),
r
},
this['delete'] = function (t) {
delete e[t.uuid]
},
this.clear = function () {
e = {
}
}
},
THREE.WebGLShader = function () {
function e(e) {
e = e.split('\n');
for (var t = 0; t < e.length; t++) e[t] = t + 1 + ': ' + e[t];
return e.join('\n')
}
return function (t, r, i) {
var n = t.createShader(r);
return t.shaderSource(n, i),
t.compileShader(n),
!1 === t.getShaderParameter(n, t.COMPILE_STATUS) && console.error('THREE.WebGLShader: Shader couldn\'t compile.'),
'' !== t.getShaderInfoLog(n) && console.warn('THREE.WebGLShader: gl.getShaderInfoLog()', r === t.VERTEX_SHADER ? 'vertex' : 'fragment', t.getShaderInfoLog(n), e(i)),
n
}
}(),
THREE.WebGLShadowMap = function (e, t, r) {
function i(e, t, r, i) {
var n = e.geometry,
o = null,
o = E,
a = e.customDepthMaterial;
return r && (o = p, a = e.customDistanceMaterial),
a ? o = a : (e = e instanceof THREE.SkinnedMesh && t.skinning, a = 0, void 0 !== n.morphTargets && 0 < n.morphTargets.length && t.morphTargets && (a |= 1), e && (a |= 2), o = o[a]),
o.visible = t.visible,
o.wireframe = t.wireframe,
o.wireframeLinewidth = t.wireframeLinewidth,
r && void 0 !== o.uniforms.lightPos && o.uniforms.lightPos.value.copy(i),
o
}
function n(e, t) {
if (!1 !== e.visible) {
(e instanceof THREE.Mesh || e instanceof THREE.Line || e instanceof THREE.Points) && e.castShadow && (!1 === e.frustumCulled || !0 === s.intersectsObject(e)) && !0 === e.material.visible && (e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse, e.matrixWorld), l.push(e));
for (var r = e.children, i = 0, o = r.length; o > i; i++) n(r[i], t)
}
}
var o = e.context,
a = e.state,
s = new THREE.Frustum,
h = new THREE.Matrix4;
new THREE.Vector3,
new THREE.Vector3;
for (var c = new THREE.Vector3, u = new THREE.Vector3, l = [
], E = Array(4), p = Array(4), d = [
new THREE.Vector3(1, 0, 0),
new THREE.Vector3( - 1, 0, 0),
new THREE.Vector3(0, 0, 1),
new THREE.Vector3(0, 0, - 1),
new THREE.Vector3(0, 1, 0),
new THREE.Vector3(0, - 1, 0)
], f = [
new THREE.Vector3(0, 1, 0),
new THREE.Vector3(0, 1, 0),
new THREE.Vector3(0, 1, 0),
new THREE.Vector3(0, 1, 0),
new THREE.Vector3(0, 0, 1),
new THREE.Vector3(0, 0, - 1)
], m = [
new THREE.Vector4,
new THREE.Vector4,
new THREE.Vector4,
new THREE.Vector4,
new THREE.Vector4,
new THREE.Vector4
], T = new THREE.Vector4, g = THREE.ShaderLib.depthRGBA, v = THREE.UniformsUtils.clone(g.uniforms), y = THREE.ShaderLib.distanceRGBA, R = THREE.UniformsUtils.clone(y.uniforms), H = 0; 4 !== H; ++H) {
var x = 0 !== (1 & H),
b = 0 !== (2 & H),
_ = new THREE.ShaderMaterial({
uniforms: v,
vertexShader: g.vertexShader,
fragmentShader: g.fragmentShader,
morphTargets: x,
skinning: b
});
_._shadowPass = !0,
E[H] = _,
x = new THREE.ShaderMaterial({
uniforms: R,
vertexShader: y.vertexShader,
fragmentShader: y.fragmentShader,
morphTargets: x,
skinning: b
}),
x._shadowPass = !0,
p[H] = x
}
var w = this;
this.enabled = !1,
this.autoUpdate = !0,
this.needsUpdate = !1,
this.type = THREE.PCFShadowMap,
this.cullFace = THREE.CullFaceFront,
this.render = function (E) {
var p,
g;
if (!1 !== w.enabled && (!1 !== w.autoUpdate || !1 !== w.needsUpdate)) {
o.clearColor(1, 1, 1, 1),
a.disable(o.BLEND),
a.enable(o.CULL_FACE),
o.frontFace(o.CCW),
o.cullFace(w.cullFace === THREE.CullFaceFront ? o.FRONT : o.BACK),
a.setDepthTest(!0),
e.getViewport(T);
for (var v = 0, y = t.length; y > v; v++) {
var R = t[v];
if (!0 === R.castShadow) {
var H = R.shadow,
x = H.camera,
b = H.mapSize;
if (R instanceof THREE.PointLight) {
p = 6,
g = !0;
var _ = b.x / 4,
M = b.y / 2;
m[0].set(2 * _, M, _, M),
m[1].set(0, M, _, M),
m[2].set(3 * _, M, _, M),
m[3].set(_, M, _, M),
m[4].set(3 * _, 0, _, M),
m[5].set(_, 0, _, M)
} else p = 1,
g = !1;
for (null === H.map && (_ = THREE.LinearFilter, w.type === THREE.PCFSoftShadowMap && (_ = THREE.NearestFilter), H.map = new THREE.WebGLRenderTarget(b.x, b.y, {
minFilter: _,
magFilter: _,
format: THREE.RGBAFormat
}), H.matrix = new THREE.Matrix4, R instanceof THREE.SpotLight && (x.aspect = b.x / b.y), x.updateProjectionMatrix()), b = H.map, H = H.matrix, u.setFromMatrixPosition(R.matrixWorld), x.position.copy(u), e.setRenderTarget(b), e.clear(), b = 0; p > b; b++) for (g ? (c.copy(x.position), c.add(d[b]), x.up.copy(f[b]), x.lookAt(c), _ = m[b], e.setViewport(_.x, _.y, _.z, _.w)) : (c.setFromMatrixPosition(R.target.matrixWorld), x.lookAt(c)), x.updateMatrixWorld(), x.matrixWorldInverse.getInverse(x.matrixWorld), H.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1), H.multiply(x.projectionMatrix), H.multiply(x.matrixWorldInverse), h.multiplyMatrices(x.projectionMatrix, x.matrixWorldInverse), s.setFromMatrix(h), l.length = 0, n(E, x), _ = 0, M = l.length; M > _; _++) {
var S = l[_],
A = r.update(S),
C = S.material;
if (C instanceof THREE.MeshFaceMaterial) for (var L = A.groups, C = C.materials, P = 0, k = L.length; k > P; P++) {
var D = L[P],
F = C[D.materialIndex];
!0 === F.visible && (F = i(S, F, g, u), e.renderBufferDirect(x, t, null, A, F, S, D))
} else F = i(S, C, g, u),
e.renderBufferDirect(x, t, null, A, F, S, null)
}
e.resetGLState()
}
}
e.setViewport(T.x, T.y, T.z, T.w),
E = e.getClearColor(),
p = e.getClearAlpha(),
e.setClearColor(E, p),
a.enable(o.BLEND),
w.cullFace === THREE.CullFaceFront && o.cullFace(o.BACK),
e.resetGLState(),
w.needsUpdate = !1
}
}
},
THREE.WebGLState = function (e, t, r) {
var i = this,
n = new Uint8Array(16),
o = new Uint8Array(16),
a = new Uint8Array(16),
s = {
},
h = null,
c = null,
u = null,
l = null,
E = null,
p = null,
d = null,
f = null,
m = null,
T = null,
g = null,
v = null,
y = null,
R = null,
H = null,
x = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),
b = void 0,
_ = {
};
this.init = function () {
e.clearColor(0, 0, 0, 1),
e.clearDepth(1),
e.clearStencil(0),
this.enable(e.DEPTH_TEST),
e.depthFunc(e.LEQUAL),
e.frontFace(e.CCW),
e.cullFace(e.BACK),
this.enable(e.CULL_FACE),
this.enable(e.BLEND),
e.blendEquation(e.FUNC_ADD),
e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA)
},
this.initAttributes = function () {
for (var e = 0, t = n.length; t > e; e++) n[e] = 0
},
this.enableAttribute = function (r) {
n[r] = 1,
0 === o[r] && (e.enableVertexAttribArray(r), o[r] = 1),
0 !== a[r] && (t.get('ANGLE_instanced_arrays').vertexAttribDivisorANGLE(r, 0), a[r] = 0)
},
this.enableAttributeAndDivisor = function (t, r, i) {
n[t] = 1,
0 === o[t] && (e.enableVertexAttribArray(t), o[t] = 1),
a[t] !== r && (i.vertexAttribDivisorANGLE(t, r), a[t] = r)
},
this.disableUnusedAttributes = function () {
for (var t = 0, r = o.length; r > t; t++) o[t] !== n[t] && (e.disableVertexAttribArray(t), o[t] = 0)
},
this.enable = function (t) {
!0 !== s[t] && (e.enable(t), s[t] = !0)
},
this.disable = function (t) {
!1 !== s[t] && (e.disable(t), s[t] = !1)
},
this.getCompressedTextureFormats = function () {
if (null === h && (h = [
], t.get('WEBGL_compressed_texture_pvrtc') || t.get('WEBGL_compressed_texture_s3tc'))) for (var r = e.getParameter(e.COMPRESSED_TEXTURE_FORMATS), i = 0; i < r.length; i++) h.push(r[i]);
return h
},
this.setBlending = function (t, i, n, o, a, s, h) {
t !== c && (t === THREE.NoBlending ? this.disable(e.BLEND) : t === THREE.AdditiveBlending ? (this.enable(e.BLEND), e.blendEquation(e.FUNC_ADD), e.blendFunc(e.SRC_ALPHA, e.ONE)) : t === THREE.SubtractiveBlending ? (this.enable(e.BLEND), e.blendEquation(e.FUNC_ADD), e.blendFunc(e.ZERO, e.ONE_MINUS_SRC_COLOR)) : t === THREE.MultiplyBlending ? (this.enable(e.BLEND), e.blendEquation(e.FUNC_ADD), e.blendFunc(e.ZERO, e.SRC_COLOR)) : t === THREE.CustomBlending ? this.enable(e.BLEND) : (this.enable(e.BLEND), e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD), e.blendFuncSeparate(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA)), c = t),
t === THREE.CustomBlending ? (a = a || i, s = s || n, h = h || o, (i !== u || a !== p) && (e.blendEquationSeparate(r(i), r(a)), u = i, p = a), (n !== l || o !== E || s !== d || h !== f) && (e.blendFuncSeparate(r(n), r(o), r(s), r(h)), l = n, E = o, d = s, f = h)) : f = d = p = E = l = u = null
},
this.setDepthFunc = function (t) {
if (m !== t) {
if (t) switch (t) {
case THREE.NeverDepth:
e.depthFunc(e.NEVER);
break;
case THREE.AlwaysDepth:
e.depthFunc(e.ALWAYS);
break;
case THREE.LessDepth:
e.depthFunc(e.LESS);
break;
case THREE.LessEqualDepth:
e.depthFunc(e.LEQUAL);
break;
case THREE.EqualDepth:
e.depthFunc(e.EQUAL);
break;
case THREE.GreaterEqualDepth:
e.depthFunc(e.GEQUAL);
break;
case THREE.GreaterDepth:
e.depthFunc(e.GREATER);
break;
case THREE.NotEqualDepth:
e.depthFunc(e.NOTEQUAL);
break;
default:
e.depthFunc(e.LEQUAL)
} else e.depthFunc(e.LEQUAL);
m = t
}
},
this.setDepthTest = function (t) {
t ? this.enable(e.DEPTH_TEST) : this.disable(e.DEPTH_TEST)
},
this.setDepthWrite = function (t) {
T !== t && (e.depthMask(t), T = t)
},
this.setColorWrite = function (t) {
g !== t && (e.colorMask(t, t, t, t), g = t)
},
this.setFlipSided = function (t) {
v !== t && (t ? e.frontFace(e.CW) : e.frontFace(e.CCW), v = t)
},
this.setLineWidth = function (t) {
t !== y && (e.lineWidth(t), y = t)
},
this.setPolygonOffset = function (t, r, i) {
t ? this.enable(e.POLYGON_OFFSET_FILL) : this.disable(e.POLYGON_OFFSET_FILL),
!t || R === r && H === i || (e.polygonOffset(r, i), R = r, H = i)
},
this.setScissorTest = function (t) {
t ? this.enable(e.SCISSOR_TEST) : this.disable(e.SCISSOR_TEST)
},
this.activeTexture = function (t) {
void 0 === t && (t = e.TEXTURE0 + x - 1),
b !== t && (e.activeTexture(t), b = t)
},
this.bindTexture = function (t, r) {
void 0 === b && i.activeTexture();
var n = _[b];
void 0 === n && (n = {
type: void 0,
texture: void 0
}, _[b] = n),
(n.type !== t || n.texture !== r) && (e.bindTexture(t, r), n.type = t, n.texture = r)
},
this.compressedTexImage2D = function () {
try {
e.compressedTexImage2D.apply(e, arguments)
} catch (t) {
console.error(t)
}
},
this.texImage2D = function () {
try {
e.texImage2D.apply(e, arguments)
} catch (t) {
console.error(t)
}
},
this.reset = function () {
for (var t = 0; t < o.length; t++) 1 === o[t] && (e.disableVertexAttribArray(t), o[t] = 0);
s = {
},
v = g = T = c = h = null
}
},
THREE.LensFlarePlugin = function (e, t) {
var r,
i,
n,
o,
a,
s,
h,
c,
u,
l,
E,
p,
d,
f,
m,
T,
g = e.context,
v = e.state;
this.render = function (y, R, H, x) {
if (0 !== t.length) {
y = new THREE.Vector3;
var b = x / H,
_ = 0.5 * H,
w = 0.5 * x,
M = 16 / x,
S = new THREE.Vector2(M * b, M),
A = new THREE.Vector3(1, 1, 0),
C = new THREE.Vector2(1, 1);
if (void 0 === d) {
var M = new Float32Array([ - 1,
- 1,
0,
0,
1,
- 1,
1,
0,
1,
1,
1,
1,
- 1,
1,
0,
1]),
L = new Uint16Array([0,
1,
2,
0,
2,
3]);
E = g.createBuffer(),
p = g.createBuffer(),
g.bindBuffer(g.ARRAY_BUFFER, E),
g.bufferData(g.ARRAY_BUFFER, M, g.STATIC_DRAW),
g.bindBuffer(g.ELEMENT_ARRAY_BUFFER, p),
g.bufferData(g.ELEMENT_ARRAY_BUFFER, L, g.STATIC_DRAW),
m = g.createTexture(),
T = g.createTexture(),
v.bindTexture(g.TEXTURE_2D, m),
g.texImage2D(g.TEXTURE_2D, 0, g.RGB, 16, 16, 0, g.RGB, g.UNSIGNED_BYTE, null),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_S, g.CLAMP_TO_EDGE),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_T, g.CLAMP_TO_EDGE),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MAG_FILTER, g.NEAREST),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MIN_FILTER, g.NEAREST),
v.bindTexture(g.TEXTURE_2D, T),
g.texImage2D(g.TEXTURE_2D, 0, g.RGBA, 16, 16, 0, g.RGBA, g.UNSIGNED_BYTE, null),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_S, g.CLAMP_TO_EDGE),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_WRAP_T, g.CLAMP_TO_EDGE),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MAG_FILTER, g.NEAREST),
g.texParameteri(g.TEXTURE_2D, g.TEXTURE_MIN_FILTER, g.NEAREST);
var M = (f = 0 < g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS)) ? {
vertexShader: 'uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}',
fragmentShader: 'uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}'
}
: {
vertexShader: 'uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}',
fragmentShader: 'precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}'
},
L = g.createProgram(),
P = g.createShader(g.FRAGMENT_SHADER),
k = g.createShader(g.VERTEX_SHADER),
D = 'precision ' + e.getPrecision() + ' float;\n';
g.shaderSource(P, D + M.fragmentShader),
g.shaderSource(k, D + M.vertexShader),
g.compileShader(P),
g.compileShader(k),
g.attachShader(L, P),
g.attachShader(L, k),
g.linkProgram(L),
d = L,
u = g.getAttribLocation(d, 'position'),
l = g.getAttribLocation(d, 'uv'),
r = g.getUniformLocation(d, 'renderType'),
i = g.getUniformLocation(d, 'map'),
n = g.getUniformLocation(d, 'occlusionMap'),
o = g.getUniformLocation(d, 'opacity'),
a = g.getUniformLocation(d, 'color'),
s = g.getUniformLocation(d, 'scale'),
h = g.getUniformLocation(d, 'rotation'),
c = g.getUniformLocation(d, 'screenPosition')
}
for (g.useProgram(d), v.initAttributes(), v.enableAttribute(u), v.enableAttribute(l), v.disableUnusedAttributes(), g.uniform1i(n, 0), g.uniform1i(i, 1), g.bindBuffer(g.ARRAY_BUFFER, E), g.vertexAttribPointer(u, 2, g.FLOAT, !1, 16, 0), g.vertexAttribPointer(l, 2, g.FLOAT, !1, 16, 8), g.bindBuffer(g.ELEMENT_ARRAY_BUFFER, p), v.disable(g.CULL_FACE), g.depthMask(!1), L = 0, P = t.length; P > L; L++) if (M = 16 / x, S.set(M * b, M), k = t[L], y.set(k.matrixWorld.elements[12], k.matrixWorld.elements[13], k.matrixWorld.elements[14]), y.applyMatrix4(R.matrixWorldInverse), y.applyProjection(R.projectionMatrix), A.copy(y), C.x = A.x * _ + _, C.y = A.y * w + w, f || 0 < C.x && C.x < H && 0 < C.y && C.y < x) {
v.activeTexture(g.TEXTURE0),
v.bindTexture(g.TEXTURE_2D, null),
v.activeTexture(g.TEXTURE1),
v.bindTexture(g.TEXTURE_2D, m),
g.copyTexImage2D(g.TEXTURE_2D, 0, g.RGB, C.x - 8, C.y - 8, 16, 16, 0),
g.uniform1i(r, 0),
g.uniform2f(s, S.x, S.y),
g.uniform3f(c, A.x, A.y, A.z),
v.disable(g.BLEND),
v.enable(g.DEPTH_TEST),
g.drawElements(g.TRIANGLES, 6, g.UNSIGNED_SHORT, 0),
v.activeTexture(g.TEXTURE0),
v.bindTexture(g.TEXTURE_2D, T),
g.copyTexImage2D(g.TEXTURE_2D, 0, g.RGBA, C.x - 8, C.y - 8, 16, 16, 0),
g.uniform1i(r, 1),
v.disable(g.DEPTH_TEST),
v.activeTexture(g.TEXTURE1),
v.bindTexture(g.TEXTURE_2D, m),
g.drawElements(g.TRIANGLES, 6, g.UNSIGNED_SHORT, 0),
k.positionScreen.copy(A),
k.customUpdateCallback ? k.customUpdateCallback(k) : k.updateLensFlares(),
g.uniform1i(r, 2),
v.enable(g.BLEND);
for (var D = 0, F = k.lensFlares.length; F > D; D++) {
var V = k.lensFlares[D];
0.001 < V.opacity && 0.001 < V.scale && (A.x = V.x, A.y = V.y, A.z = V.z, M = V.size * V.scale / x, S.x = M * b, S.y = M, g.uniform3f(c, A.x, A.y, A.z), g.uniform2f(s, S.x, S.y), g.uniform1f(h, V.rotation), g.uniform1f(o, V.opacity), g.uniform3f(a, V.color.r, V.color.g, V.color.b), v.setBlending(V.blending, V.blendEquation, V.blendSrc, V.blendDst), e.setTexture(V.texture, 1), g.drawElements(g.TRIANGLES, 6, g.UNSIGNED_SHORT, 0))
}
}
v.enable(g.CULL_FACE),
v.enable(g.DEPTH_TEST),
g.depthMask(!0),
e.resetGLState()
}
}
},
THREE.SpritePlugin = function (e, t) {
function r(e, t) {
return e.z !== t.z ? t.z - e.z : t.id - e.id
}
var i,
n,
o,
a,
s,
h,
c,
u,
l,
E,
p,
d,
f,
m,
T,
g,
v,
y,
R,
H,
x,
b = e.context,
_ = e.state,
w = new THREE.Vector3,
M = new THREE.Quaternion,
S = new THREE.Vector3;
this.render = function (A, C) {
if (0 !== t.length) {
if (void 0 === H) {
var L = new Float32Array([ - 0.5,
- 0.5,
0,
0,
0.5,
- 0.5,
1,
0,
0.5,
0.5,
1,
1,
- 0.5,
0.5,
0,
1]),
P = new Uint16Array([0,
1,
2,
0,
2,
3]);
y = b.createBuffer(),
R = b.createBuffer(),
b.bindBuffer(b.ARRAY_BUFFER, y),
b.bufferData(b.ARRAY_BUFFER, L, b.STATIC_DRAW),
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, R),
b.bufferData(b.ELEMENT_ARRAY_BUFFER, P, b.STATIC_DRAW);
var L = b.createProgram(),
P = b.createShader(b.VERTEX_SHADER),
k = b.createShader(b.FRAGMENT_SHADER);
b.shaderSource(P, [
'precision ' + e.getPrecision() + ' float;',
'uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}'
].join('\n')),
b.shaderSource(k, [
'precision ' + e.getPrecision() + ' float;',
'uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}'
].join('\n')),
b.compileShader(P),
b.compileShader(k),
b.attachShader(L, P),
b.attachShader(L, k),
b.linkProgram(L),
H = L,
g = b.getAttribLocation(H, 'position'),
v = b.getAttribLocation(H, 'uv'),
i = b.getUniformLocation(H, 'uvOffset'),
n = b.getUniformLocation(H, 'uvScale'),
o = b.getUniformLocation(H, 'rotation'),
a = b.getUniformLocation(H, 'scale'),
s = b.getUniformLocation(H, 'color'),
h = b.getUniformLocation(H, 'map'),
c = b.getUniformLocation(H, 'opacity'),
u = b.getUniformLocation(H, 'modelViewMatrix'),
l = b.getUniformLocation(H, 'projectionMatrix'),
E = b.getUniformLocation(H, 'fogType'),
p = b.getUniformLocation(H, 'fogDensity'),
d = b.getUniformLocation(H, 'fogNear'),
f = b.getUniformLocation(H, 'fogFar'),
m = b.getUniformLocation(H, 'fogColor'),
T = b.getUniformLocation(H, 'alphaTest'),
L = document.createElement('canvas'),
L.width = 8,
L.height = 8,
P = L.getContext('2d'),
P.fillStyle = 'white',
P.fillRect(0, 0, 8, 8),
x = new THREE.Texture(L),
x.needsUpdate = !0
}
b.useProgram(H),
_.initAttributes(),
_.enableAttribute(g),
_.enableAttribute(v),
_.disableUnusedAttributes(),
_.disable(b.CULL_FACE),
_.enable(b.BLEND),
b.bindBuffer(b.ARRAY_BUFFER, y),
b.vertexAttribPointer(g, 2, b.FLOAT, !1, 16, 0),
b.vertexAttribPointer(v, 2, b.FLOAT, !1, 16, 8),
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, R),
b.uniformMatrix4fv(l, !1, C.projectionMatrix.elements),
_.activeTexture(b.TEXTURE0),
b.uniform1i(h, 0),
P = L = 0,
(k = A.fog) ? (b.uniform3f(m, k.color.r, k.color.g, k.color.b), k instanceof THREE.Fog ? (b.uniform1f(d, k.near), b.uniform1f(f, k.far), b.uniform1i(E, 1), P = L = 1) : k instanceof THREE.FogExp2 && (b.uniform1f(p, k.density), b.uniform1i(E, 2), P = L = 2)) : (b.uniform1i(E, 0), P = L = 0);
for (var k = 0, D = t.length; D > k; k++) {
var F = t[k];
F.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse, F.matrixWorld),
F.z = - F.modelViewMatrix.elements[14]
}
t.sort(r);
for (var V = [
], k = 0, D = t.length; D > k; k++) {
var F = t[k],
U = F.material;
b.uniform1f(T, U.alphaTest),
b.uniformMatrix4fv(u, !1, F.modelViewMatrix.elements),
F.matrixWorld.decompose(w, M, S),
V[0] = S.x,
V[1] = S.y,
F = 0,
A.fog && U.fog && (F = P),
L !== F && (b.uniform1i(E, F), L = F),
null !== U.map ? (b.uniform2f(i, U.map.offset.x, U.map.offset.y), b.uniform2f(n, U.map.repeat.x, U.map.repeat.y)) : (b.uniform2f(i, 0, 0), b.uniform2f(n, 1, 1)),
b.uniform1f(c, U.opacity),
b.uniform3f(s, U.color.r, U.color.g, U.color.b),
b.uniform1f(o, U.rotation),
b.uniform2fv(a, V),
_.setBlending(U.blending, U.blendEquation, U.blendSrc, U.blendDst),
_.setDepthTest(U.depthTest),
_.setDepthWrite(U.depthWrite),
U.map && U.map.image && U.map.image.width ? e.setTexture(U.map, 0) : e.setTexture(x, 0),
b.drawElements(b.TRIANGLES, 6, b.UNSIGNED_SHORT, 0)
}
_.enable(b.CULL_FACE),
e.resetGLState()
}
}
},
THREE.CurveUtils = {
tangentQuadraticBezier: function (e, t, r, i) {
return 2 * (1 - e) * (r - t) + 2 * e * (i - r)
},
tangentCubicBezier: function (e, t, r, i, n) {
return - 3 * t * (1 - e) * (1 - e) + 3 * r * (1 - e) * (1 - e) - 6 * e * r * (1 - e) + 6 * e * i * (1 - e) - 3 * e * e * i + 3 * e * e * n
},
tangentSpline: function (e, t, r, i, n) {
return 6 * e * e - 6 * e + (3 * e * e - 4 * e + 1) + ( - 6 * e * e + 6 * e) + (3 * e * e - 2 * e)
},
interpolate: function (e, t, r, i, n) {
e = 0.5 * (r - e),
i = 0.5 * (i - t);
var o = n * n;
return (2 * t - 2 * r + e + i) * n * o + ( - 3 * t + 3 * r - 2 * e - i) * o + e * n + t
}
},
THREE.GeometryUtils = {
merge: function (e, t, r) {
console.warn('THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.');
var i;
t instanceof THREE.Mesh && (t.matrixAutoUpdate && t.updateMatrix(), i = t.matrix, t = t.geometry),
e.merge(t, i, r)
},
center: function (e) {
return console.warn('THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.'),
e.center()
}
},
THREE.ImageUtils = {
crossOrigin: void 0,
loadTexture: function (e, t, r, i) {
console.warn('THREE.ImageUtils.loadTexture is being deprecated. Use THREE.TextureLoader() instead.');
var n = new THREE.TextureLoader;
return n.setCrossOrigin(this.crossOrigin),
e = n.load(e, r, void 0, i),
t && (e.mapping = t),
e
},
loadTextureCube: function (e, t, r, i) {
console.warn('THREE.ImageUtils.loadTextureCube is being deprecated. Use THREE.CubeTextureLoader() instead.');
var n = new THREE.CubeTextureLoader;
return n.setCrossOrigin(this.crossOrigin),
e = n.load(e, r, void 0, i),
t && (e.mapping = t),
e
},
loadCompressedTexture: function () {
console.error('THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.')
},
loadCompressedTextureCube: function () {
console.error('THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.')
}
},
THREE.SceneUtils = {
createMultiMaterialObject: function (e, t) {
for (var r = new THREE.Group, i = 0, n = t.length; n > i; i++) r.add(new THREE.Mesh(e, t[i]));
return r
},
detach: function (e, t, r) {
e.applyMatrix(t.matrixWorld),
t.remove(e),
r.add(e)
},
attach: function (e, t, r) {
var i = new THREE.Matrix4;
i.getInverse(r.matrixWorld),
e.applyMatrix(i),
t.remove(e),
r.add(e)
}
},
THREE.ShapeUtils = {
area: function (e) {
for (var t = e.length, r = 0, i = t - 1, n = 0; t > n; i = n++) r += e[i].x * e[n].y - e[n].x * e[i].y;
return 0.5 * r
},
triangulate: function () {
return function (e, t) {
var r = e.length;
if (3 > r) return null;
var i,
n,
o,
a = [
],
s = [
],
h = [
];
if (0 < THREE.ShapeUtils.area(e)) for (n = 0; r > n; n++) s[n] = n;
else for (n = 0; r > n; n++) s[n] = r - 1 - n;
var c = 2 * r;
for (n = r - 1; r > 2; ) {
if (0 >= c--) {
console.warn('THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()');
break
}
i = n,
i >= r && (i = 0),
n = i + 1,
n >= r && (n = 0),
o = n + 1,
o >= r && (o = 0);
var u;
e: {
var l = u = void 0,
E = void 0,
p = void 0,
d = void 0,
f = void 0,
m = void 0,
T = void 0,
g = void 0,
l = e[s[i]].x,
E = e[s[i]].y,
p = e[s[n]].x,
d = e[s[n]].y,
f = e[s[o]].x,
m = e[s[o]].y;
if (Number.EPSILON > (p - l) * (m - E) - (d - E) * (f - l)) u = !1;
else {
var v = void 0,
y = void 0,
R = void 0,
H = void 0,
x = void 0,
b = void 0,
_ = void 0,
w = void 0,
M = void 0,
S = void 0,
M = w = _ = g = T = void 0,
v = f - p,
y = m - d,
R = l - f,
H = E - m,
x = p - l,
b = d - E;
for (u = 0; r > u; u++) if (T = e[s[u]].x, g = e[s[u]].y, !(T === l && g === E || T === p && g === d || T === f && g === m) && (_ = T - l, w = g - E, M = T - p, S = g - d, T -= f, g -= m, M = v * S - y * M, _ = x * w - b * _, w = R * g - H * T, M >= - Number.EPSILON && w >= - Number.EPSILON && _ >= - Number.EPSILON)) {
u = !1;
break e
}
u = !0
}
}
if (u) {
for (a.push([e[s[i]],
e[s[n]],
e[s[o]]]), h.push([s[i],
s[n],
s[o]]), i = n, o = n + 1; r > o; i++, o++) s[i] = s[o];
r--,
c = 2 * r
}
}
return t ? h : a
}
}(),
triangulateShape: function (e, t) {
function r(e, t, r) {
return e.x !== t.x ? e.x < t.x ? e.x <= r.x && r.x <= t.x : t.x <= r.x && r.x <= e.x : e.y < t.y ? e.y <= r.y && r.y <= t.y : t.y <= r.y && r.y <= e.y
}
function i(e, t, i, n, o) {
var a = t.x - e.x,
s = t.y - e.y,
h = n.x - i.x,
c = n.y - i.y,
u = e.x - i.x,
l = e.y - i.y,
E = s * h - a * c,
p = s * u - a * l;
if (Math.abs(E) > Number.EPSILON) {
if (E > 0) {
if (0 > p || p > E) return [];
if (h = c * u - h * l, 0 > h || h > E) return []
} else {
if (p > 0 || E > p) return [];
if (h = c * u - h * l, h > 0 || E > h) return []
}
return 0 === h ? !o || 0 !== p && p !== E ? [
e
] : [
] : h === E ? !o || 0 !== p && p !== E ? [
t
] : [
] : 0 === p ? [
i
] : p === E ? [
n
] : (o = h / E, [
{
x: e.x + o * a,
y: e.y + o * s
}
])
}
return 0 !== p || c * u !== h * l ? [
] : (s = 0 === a && 0 === s, h = 0 === h && 0 === c, s && h ? e.x !== i.x || e.y !== i.y ? [
] : [
e
] : s ? r(i, n, e) ? [
e
] : [
] : h ? r(e, t, i) ? [
i
] : [
] : (0 !== a ? (e.x < t.x ? (a = e, h = e.x, s = t, e = t.x) : (a = t, h = t.x, s = e, e = e.x), i.x < n.x ? (t = i, E = i.x, c = n, i = n.x) : (t = n, E = n.x, c = i, i = i.x)) : (e.y < t.y ? (a = e, h = e.y, s = t, e = t.y) : (a = t, h = t.y, s = e, e = e.y), i.y < n.y ? (t = i, E = i.y, c = n, i = n.y) : (t = n, E = n.y, c = i, i = i.y)), E >= h ? E > e ? [
] : e === E ? o ? [
] : [
t
] : i >= e ? [
t,
s
] : [
t,
c
] : h > i ? [
] : h === i ? o ? [
] : [
a
] : i >= e ? [
a,
s
] : [
a,
c
]))
}
function n(e, t, r, i) {
var n = t.x - e.x,
o = t.y - e.y;
t = r.x - e.x,
r = r.y - e.y;
var a = i.x - e.x;
return i = i.y - e.y,
e = n * r - o * t,
n = n * i - o * a,
Math.abs(e) > Number.EPSILON ? (t = a * r - i * t, e > 0 ? n >= 0 && t >= 0 : n >= 0 || t >= 0) : n > 0
}
var o,
a,
s,
h,
c,
u = {
};
for (s = e.concat(), o = 0, a = t.length; a > o; o++) Array.prototype.push.apply(s, t[o]);
for (o = 0, a = s.length; a > o; o++) c = s[o].x + ':' + s[o].y,
void 0 !== u[c] && console.warn('THREE.Shape: Duplicate point', c),
u[c] = o;
o = function (e, t) {
function r(e, t) {
var r = m.length - 1,
i = e - 1;
0 > i && (i = r);
var o = e + 1;
return o > r && (o = 0),
(r = n(m[e], m[i], m[o], s[t])) ? (r = s.length - 1, i = t - 1, 0 > i && (i = r), o = t + 1, o > r && (o = 0), (r = n(s[t], s[i], s[o], m[e])) ? !0 : !1) : !1
}
function o(e, t) {
var r,
n;
for (r = 0; r < m.length; r++) if (n = r + 1, n %= m.length, n = i(e, t, m[r], m[n], !0), 0 < n.length) return !0;
return !1
}
function a(e, r) {
var n,
o,
a,
s;
for (n = 0; n < T.length; n++) for (o = t[T[n]], a = 0; a < o.length; a++) if (s = a + 1, s %= o.length, s = i(e, r, o[a], o[s], !0), 0 < s.length) return !0;
return !1
}
var s,
h,
c,
u,
l,
E,
p,
d,
f,
m = e.concat(),
T = [
],
g = [
],
v = 0;
for (h = t.length; h > v; v++) T.push(v);
p = 0;
for (var y = 2 * T.length; 0 < T.length; ) {
if (y--, 0 > y) {
console.log('Infinite Loop! Holes left:' + T.length + ', Probably Hole outside Shape!');
break
}
for (c = p; c < m.length; c++) {
for (u = m[c], h = - 1, v = 0; v < T.length; v++) if (l = T[v], E = u.x + ':' + u.y + ':' + l, void 0 === g[E]) {
for (s = t[l], d = 0; d < s.length; d++) if (l = s[d], r(c, d) && !o(u, l) && !a(u, l)) {
h = d,
T.splice(v, 1),
p = m.slice(0, c + 1),
l = m.slice(c),
d = s.slice(h),
f = s.slice(0, h + 1),
m = p.concat(d).concat(f).concat(l),
p = c;
break
}
if (h >= 0) break;
g[E] = !0
}
if (h >= 0) break
}
}
return m
}(e, t);
var l = THREE.ShapeUtils.triangulate(o, !1);
for (o = 0, a = l.length; a > o; o++) for (h = l[o], s = 0; 3 > s; s++) c = h[s].x + ':' + h[s].y,
c = u[c],
void 0 !== c && (h[s] = c);
return l.concat()
},
isClockWise: function (e) {
return 0 > THREE.ShapeUtils.area(e)
},
b2: function () {
return function (e, t, r, i) {
var n = 1 - e;
return n * n * t + 2 * (1 - e) * e * r + e * e * i
}
}(),
b3: function () {
return function (e, t, r, i, n) {
var o = 1 - e,
a = 1 - e;
return o * o * o * t + 3 * a * a * e * r + 3 * (1 - e) * e * e * i + e * e * e * n
}
}()
},
THREE.Audio = function (e) {
THREE.Object3D.call(this),
this.type = 'Audio',
this.context = e.context,
this.source = this.context.createBufferSource(),
this.source.onended = this.onEnded.bind(this),
this.gain = this.context.createGain(),
this.gain.connect(this.context.destination),
this.panner = this.context.createPanner(),
this.panner.connect(this.gain),
this.autoplay = !1,
this.startTime = 0,
this.playbackRate = 1,
this.isPlaying = !1
},
THREE.Audio.prototype = Object.create(THREE.Object3D.prototype),
THREE.Audio.prototype.constructor = THREE.Audio,
THREE.Audio.prototype.load = function (e) {
var t = this,
r = new XMLHttpRequest;
return r.open('GET', e, !0),
r.responseType = 'arraybuffer',
r.onload = function (e) {
t.context.decodeAudioData(this.response, function (e) {
t.source.buffer = e,
t.autoplay && t.play()
})
},
r.send(),
this
},
THREE.Audio.prototype.play = function () {
if (!0 === this.isPlaying) console.warn('THREE.Audio: Audio is already playing.');
else {
var e = this.context.createBufferSource();
e.buffer = this.source.buffer,
e.loop = this.source.loop,
e.onended = this.source.onended,
e.start(0, this.startTime),
e.playbackRate.value = this.playbackRate,
this.isPlaying = !0,
this.source = e,
this.connect()
}
},
THREE.Audio.prototype.pause = function () {
this.source.stop(),
this.startTime = this.context.currentTime
},
THREE.Audio.prototype.stop = function () {
this.source.stop(),
this.startTime = 0
},
THREE.Audio.prototype.connect = function () {
void 0 !== this.filter ? (this.source.connect(this.filter), this.filter.connect(this.panner)) : this.source.connect(this.panner)
},
THREE.Audio.prototype.disconnect = function () {
void 0 !== this.filter ? (this.source.disconnect(this.filter), this.filter.disconnect(this.panner)) : this.source.disconnect(this.panner)
},
THREE.Audio.prototype.setFilter = function (e) {
!0 === this.isPlaying ? (this.disconnect(), this.filter = e, this.connect()) : this.filter = e
},
THREE.Audio.prototype.getFilter = function () {
return this.filter
},
THREE.Audio.prototype.setPlaybackRate = function (e) {
this.playbackRate = e,
!0 === this.isPlaying && (this.source.playbackRate.value = this.playbackRate)
},
THREE.Audio.prototype.getPlaybackRate = function () {
return this.playbackRate
},
THREE.Audio.prototype.onEnded = function () {
this.isPlaying = !1
},
THREE.Audio.prototype.setLoop = function (e) {
this.source.loop = e
},
THREE.Audio.prototype.getLoop = function () {
return this.source.loop
},
THREE.Audio.prototype.setRefDistance = function (e) {
this.panner.refDistance = e
},
THREE.Audio.prototype.getRefDistance = function () {
return this.panner.refDistance
},
THREE.Audio.prototype.setRolloffFactor = function (e) {
this.panner.rolloffFactor = e
},
THREE.Audio.prototype.getRolloffFactor = function () {
return this.panner.rolloffFactor
},
THREE.Audio.prototype.setVolume = function (e) {
this.gain.gain.value = e
},
THREE.Audio.prototype.getVolume = function () {
return this.gain.gain.value
},
THREE.Audio.prototype.updateMatrixWorld = function () {
var e = new THREE.Vector3;
return function (t) {
THREE.Object3D.prototype.updateMatrixWorld.call(this, t),
e.setFromMatrixPosition(this.matrixWorld),
this.panner.setPosition(e.x, e.y, e.z)
}
}(),
THREE.AudioListener = function () {
THREE.Object3D.call(this),
this.type = 'AudioListener',
this.context = new (window.AudioContext || window.webkitAudioContext)
},
THREE.AudioListener.prototype = Object.create(THREE.Object3D.prototype),
THREE.AudioListener.prototype.constructor = THREE.AudioListener,
THREE.AudioListener.prototype.updateMatrixWorld = function () {
var e = new THREE.Vector3,
t = new THREE.Quaternion,
r = new THREE.Vector3,
i = new THREE.Vector3;
return function (n) {
THREE.Object3D.prototype.updateMatrixWorld.call(this, n),
n = this.context.listener;
var o = this.up;
this.matrixWorld.decompose(e, t, r),
i.set(0, 0, - 1).applyQuaternion(t),
n.setPosition(e.x, e.y, e.z),
n.setOrientation(i.x, i.y, i.z, o.x, o.y, o.z)
}
}(),
THREE.Curve = function () {
},
THREE.Curve.prototype = {
constructor: THREE.Curve,
getPoint: function (e) {
return console.warn('THREE.Curve: Warning, getPoint() not implemented!'),
null
},
getPointAt: function (e) {
return e = this.getUtoTmapping(e),
this.getPoint(e)
},
getPoints: function (e) {
e || (e = 5);
var t,
r = [
];
for (t = 0; e >= t; t++) r.push(this.getPoint(t / e));
return r
},
getSpacedPoints: function (e) {
e || (e = 5);
var t,
r = [
];
for (t = 0; e >= t; t++) r.push(this.getPointAt(t / e));
return r
},
getLength: function () {
var e = this.getLengths();
return e[e.length - 1]
},
getLengths: function (e) {
if (e || (e = this.__arcLengthDivisions ? this.__arcLengthDivisions : 200), this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate) return this.cacheArcLengths;
this.needsUpdate = !1;
var t,
r,
i = [
],
n = this.getPoint(0),
o = 0;
for (i.push(0), r = 1; e >= r; r++) t = this.getPoint(r / e),
o += t.distanceTo(n),
i.push(o),
n = t;
return this.cacheArcLengths = i
},
updateArcLengths: function () {
this.needsUpdate = !0,
this.getLengths()
},
getUtoTmapping: function (e, t) {
var r,
i = this.getLengths(),
n = 0,
o = i.length;
r = t ? t : e * i[o - 1];
for (var a, s = 0, h = o - 1; h >= s; ) if (n = Math.floor(s + (h - s) / 2), a = i[n] - r, 0 > a) s = n + 1;
else {
if (!(a > 0)) {
h = n;
break
}
h = n - 1
}
return n = h,
i[n] === r ? n / (o - 1) : (s = i[n], i = (n + (r - s) / (i[n + 1] - s)) / (o - 1))
},
getTangent: function (e) {
var t = e - 0.0001;
return e += 0.0001,
0 > t && (t = 0),
e > 1 && (e = 1),
t = this.getPoint(t),
this.getPoint(e).clone().sub(t).normalize()
},
getTangentAt: function (e) {
return e = this.getUtoTmapping(e),
this.getTangent(e)
}
},
THREE.Curve.Utils = THREE.CurveUtils,
THREE.Curve.create = function (e, t) {
return e.prototype = Object.create(THREE.Curve.prototype),
e.prototype.constructor = e,
e.prototype.getPoint = t,
e
},
THREE.CurvePath = function () {
this.curves = [
],
this.autoClose = !1
},
THREE.CurvePath.prototype = Object.create(THREE.Curve.prototype),
THREE.CurvePath.prototype.constructor = THREE.CurvePath,
THREE.CurvePath.prototype.add = function (e) {
this.curves.push(e)
},
THREE.CurvePath.prototype.closePath = function () {
var e = this.curves[0].getPoint(0),
t = this.curves[this.curves.length - 1].getPoint(1);
e.equals(t) || this.curves.push(new THREE.LineCurve(t, e))
},
THREE.CurvePath.prototype.getPoint = function (e) {
for (var t = e * this.getLength(), r = this.getCurveLengths(), i = 0; i < r.length; ) {
if (r[i] >= t) return e = this.curves[i],
t = 1 - (r[i] - t) / e.getLength(),
e.getPointAt(t);
i++
}
return null
},
THREE.CurvePath.prototype.getLength = function () {
var e = this.getCurveLengths();
return e[e.length - 1]
},
THREE.CurvePath.prototype.getCurveLengths = function () {
if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths;
for (var e = [
], t = 0, r = 0, i = this.curves.length; i > r; r++) t += this.curves[r].getLength(),
e.push(t);
return this.cacheLengths = e
},
THREE.CurvePath.prototype.createPointsGeometry = function (e) {
return e = this.getPoints(e, !0),
this.createGeometry(e)
},
THREE.CurvePath.prototype.createSpacedPointsGeometry = function (e) {
return e = this.getSpacedPoints(e, !0),
this.createGeometry(e)
},
THREE.CurvePath.prototype.createGeometry = function (e) {
for (var t = new THREE.Geometry, r = 0, i = e.length; i > r; r++) {
var n = e[r];
t.vertices.push(new THREE.Vector3(n.x, n.y, n.z || 0))
}
return t
},
THREE.Path = function (e) {
THREE.CurvePath.call(this),
this.actions = [
],
e && this.fromPoints(e)
},
THREE.Path.prototype = Object.create(THREE.CurvePath.prototype),
THREE.Path.prototype.constructor = THREE.Path,
THREE.Path.prototype.fromPoints = function (e) {
this.moveTo(e[0].x, e[0].y);
for (var t = 1, r = e.length; r > t; t++) this.lineTo(e[t].x, e[t].y)
},
THREE.Path.prototype.moveTo = function (e, t) {
this.actions.push({
action: 'moveTo',
args: [
e,
t
]
})
},
THREE.Path.prototype.lineTo = function (e, t) {
var r = this.actions[this.actions.length - 1].args,
r = new THREE.LineCurve(new THREE.Vector2(r[r.length - 2], r[r.length - 1]), new THREE.Vector2(e, t));
this.curves.push(r),
this.actions.push({
action: 'lineTo',
args: [
e,
t
]
})
},
THREE.Path.prototype.quadraticCurveTo = function (e, t, r, i) {
var n = this.actions[this.actions.length - 1].args,
n = new THREE.QuadraticBezierCurve(new THREE.Vector2(n[n.length - 2], n[n.length - 1]), new THREE.Vector2(e, t), new THREE.Vector2(r, i));
this.curves.push(n),
this.actions.push({
action: 'quadraticCurveTo',
args: [
e,
t,
r,
i
]
})
},
THREE.Path.prototype.bezierCurveTo = function (e, t, r, i, n, o) {
var a = this.actions[this.actions.length - 1].args,
a = new THREE.CubicBezierCurve(new THREE.Vector2(a[a.length - 2], a[a.length - 1]), new THREE.Vector2(e, t), new THREE.Vector2(r, i), new THREE.Vector2(n, o));
this.curves.push(a),
this.actions.push({
action: 'bezierCurveTo',
args: [
e,
t,
r,
i,
n,
o
]
})
},
THREE.Path.prototype.splineThru = function (e) {
var t = Array.prototype.slice.call(arguments),
r = this.actions[this.actions.length - 1].args,
r = [
new THREE.Vector2(r[r.length - 2], r[r.length - 1])
];
Array.prototype.push.apply(r, e),
r = new THREE.SplineCurve(r),
this.curves.push(r),
this.actions.push({
action: 'splineThru',
args: t
})
},
THREE.Path.prototype.arc = function (e, t, r, i, n, o) {
var a = this.actions[this.actions.length - 1].args;
this.absarc(e + a[a.length - 2], t + a[a.length - 1], r, i, n, o)
},
THREE.Path.prototype.absarc = function (e, t, r, i, n, o) {
this.absellipse(e, t, r, r, i, n, o)
},
THREE.Path.prototype.ellipse = function (e, t, r, i, n, o, a, s) {
var h = this.actions[this.actions.length - 1].args;
this.absellipse(e + h[h.length - 2], t + h[h.length - 1], r, i, n, o, a, s)
},
THREE.Path.prototype.absellipse = function (e, t, r, i, n, o, a, s) {
var h = [
e,
t,
r,
i,
n,
o,
a,
s || 0
];
e = new THREE.EllipseCurve(e, t, r, i, n, o, a, s),
this.curves.push(e),
e = e.getPoint(1),
h.push(e.x),
h.push(e.y),
this.actions.push({
action: 'ellipse',
args: h
})
},
THREE.Path.prototype.getSpacedPoints = function (e, t) {
e || (e = 40);
for (var r = [
], i = 0; e > i; i++) r.push(this.getPoint(i / e));
return r
},
THREE.Path.prototype.getPoints = function (e, t) {
e = e || 12;
for (var r, i, n, o, a, s, h, c, u, l, E = THREE.ShapeUtils.b2, p = THREE.ShapeUtils.b3, d = [
], f = 0, m = this.actions.length; m > f; f++) {
u = this.actions[f];
var T = u.args;
switch (u.action) {
case 'moveTo':
d.push(new THREE.Vector2(T[0], T[1]));
break;
case 'lineTo':
d.push(new THREE.Vector2(T[0], T[1]));
break;
case 'quadraticCurveTo':
for (r = T[2], i = T[3], a = T[0], s = T[1], 0 < d.length ? (u = d[d.length - 1], h = u.x, c = u.y) : (u = this.actions[f - 1].args, h = u[u.length - 2], c = u[u.length - 1]), T = 1; e >= T; T++) l = T / e,
u = E(l, h, a, r),
l = E(l, c, s, i),
d.push(new THREE.Vector2(u, l));
break;
case 'bezierCurveTo':
for (r = T[4], i = T[5], a = T[0], s = T[1], n = T[2], o = T[3], 0 < d.length ? (u = d[d.length - 1], h = u.x, c = u.y) : (u = this.actions[f - 1].args, h = u[u.length - 2], c = u[u.length - 1]), T = 1; e >= T; T++) l = T / e,
u = p(l, h, a, n, r),
l = p(l, c, s, o, i),
d.push(new THREE.Vector2(u, l));
break;
case 'splineThru':
for (u = this.actions[f - 1].args, l = [
new THREE.Vector2(u[u.length - 2], u[u.length - 1])
], u = e * T[0].length, l = l.concat(T[0]), l = new THREE.SplineCurve(l), T = 1; u >= T; T++) d.push(l.getPointAt(T / u));
break;
case 'arc':
for (r = T[0], i = T[1], s = T[2], n = T[3], u = T[4], a = !!T[5], h = u - n, c = 2 * e, T = 1; c >= T; T++) l = T / c,
a || (l = 1 - l),
l = n + l * h,
u = r + s * Math.cos(l),
l = i + s * Math.sin(l),
d.push(new THREE.Vector2(u, l));
break;
case 'ellipse':
r = T[0],
i = T[1],
s = T[2],
o = T[3],
n = T[4],
u = T[5],
a = !!T[6];
var g = T[7];
h = u - n,
c = 2 * e;
var v,
y;
for (0 !== g && (v = Math.cos(g), y = Math.sin(g)), T = 1; c >= T; T++) {
if (l = T / c, a || (l = 1 - l), l = n + l * h, u = r + s * Math.cos(l), l = i + o * Math.sin(l), 0 !== g) {
var R = u;
u = (R - r) * v - (l - i) * y + r,
l = (R - r) * y + (l - i) * v + i
}
d.push(new THREE.Vector2(u, l))
}
}
}
return E = d[d.length - 1],
Math.abs(E.x - d[0].x) < Number.EPSILON && Math.abs(E.y - d[0].y) < Number.EPSILON && d.splice(d.length - 1, 1),
t && d.push(d[0]),
d
},
THREE.Path.prototype.toShapes = function (e, t) {
function r(e) {
for (var t = [
], r = 0, i = e.length; i > r; r++) {
var n = e[r],
o = new THREE.Shape;
o.actions = n.actions,
o.curves = n.curves,
t.push(o)
}
return t
}
function i(e, t) {
for (var r = t.length, i = !1, n = r - 1, o = 0; r > o; n = o++) {
var a = t[n],
s = t[o],
h = s.x - a.x,
c = s.y - a.y;
if (Math.abs(c) > Number.EPSILON) {
if (0 > c && (a = t[o], h = - h, s = t[n], c = - c), !(e.y < a.y || e.y > s.y)) if (e.y === a.y) {
if (e.x === a.x) return !0
} else {
if (n = c * (e.x - a.x) - h * (e.y - a.y), 0 === n) return !0;
0 > n || (i = !i)
}
} else if (e.y === a.y && (s.x <= e.x && e.x <= a.x || a.x <= e.x && e.x <= s.x)) return !0
}
return i
}
var n = THREE.ShapeUtils.isClockWise,
o = function (e) {
for (var t = [
], r = new THREE.Path, i = 0, n = e.length; n > i; i++) {
var o = e[i],
a = o.args,
o = o.action;
'moveTo' === o && 0 !== r.actions.length && (t.push(r), r = new THREE.Path),
r[o].apply(r, a)
}
return 0 !== r.actions.length && t.push(r),
t
}(this.actions);
if (0 === o.length) return [];
if (!0 === t) return r(o);
var a,
s,
h,
c = [
];
if (1 === o.length) return s = o[0],
h = new THREE.Shape,
h.actions = s.actions,
h.curves = s.curves,
c.push(h),
c;
var u = !n(o[0].getPoints()),
u = e ? !u : u;
h = [
];
var l,
E = [
],
p = [
],
d = 0;
E[d] = void 0,
p[d] = [
];
for (var f = 0, m = o.length; m > f; f++) s = o[f],
l = s.getPoints(),
a = n(l),
(a = e ? !a : a) ? (!u && E[d] && d++, E[d] = {
s: new THREE.Shape,
p: l
}, E[d].s.actions = s.actions, E[d].s.curves = s.curves, u && d++, p[d] = [
]) : p[d].push({
h: s,
p: l[0]
});
if (!E[0]) return r(o);
if (1 < E.length) {
for (f = !1, s = [
], n = 0, o = E.length; o > n; n++) h[n] = [
];
for (n = 0, o = E.length; o > n; n++) for (a = p[n], u = 0; u < a.length; u++) {
for (d = a[u], l = !0, m = 0; m < E.length; m++) i(d.p, E[m].p) && (n !== m && s.push({
froms: n,
tos: m,
hole: u
}), l ? (l = !1, h[m].push(d)) : f = !0);
l && h[n].push(d)
}
0 < s.length && (f || (p = h))
}
for (f = 0, n = E.length; n > f; f++) for (h = E[f].s, c.push(h), s = p[f], o = 0, a = s.length; a > o; o++) h.holes.push(s[o].h);
return c
},
THREE.Shape = function () {
THREE.Path.apply(this, arguments),
this.holes = [
]
},
THREE.Shape.prototype = Object.create(THREE.Path.prototype),
THREE.Shape.prototype.constructor = THREE.Shape,
THREE.Shape.prototype.extrude = function (e) {
return new THREE.ExtrudeGeometry(this, e)
},
THREE.Shape.prototype.makeGeometry = function (e) {
return new THREE.ShapeGeometry(this, e)
},
THREE.Shape.prototype.getPointsHoles = function (e) {
for (var t = [
], r = 0, i = this.holes.length; i > r; r++) t[r] = this.holes[r].getPoints(e);
return t
},
THREE.Shape.prototype.extractAllPoints = function (e) {
return {
shape: this.getPoints(e),
holes: this.getPointsHoles(e)
}
},
THREE.Shape.prototype.extractPoints = function (e) {
return this.extractAllPoints(e)
},
THREE.Shape.Utils = THREE.ShapeUtils,
THREE.LineCurve = function (e, t) {
this.v1 = e,
this.v2 = t
},
THREE.LineCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.LineCurve.prototype.constructor = THREE.LineCurve,
THREE.LineCurve.prototype.getPoint = function (e) {
var t = this.v2.clone().sub(this.v1);
return t.multiplyScalar(e).add(this.v1),
t
},
THREE.LineCurve.prototype.getPointAt = function (e) {
return this.getPoint(e)
},
THREE.LineCurve.prototype.getTangent = function (e) {
return this.v2.clone().sub(this.v1).normalize()
},
THREE.QuadraticBezierCurve = function (e, t, r) {
this.v0 = e,
this.v1 = t,
this.v2 = r
},
THREE.QuadraticBezierCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.QuadraticBezierCurve.prototype.constructor = THREE.QuadraticBezierCurve,
THREE.QuadraticBezierCurve.prototype.getPoint = function (e) {
var t = THREE.ShapeUtils.b2;
return new THREE.Vector2(t(e, this.v0.x, this.v1.x, this.v2.x), t(e, this.v0.y, this.v1.y, this.v2.y))
},
THREE.QuadraticBezierCurve.prototype.getTangent = function (e) {
var t = THREE.CurveUtils.tangentQuadraticBezier;
return new THREE.Vector2(t(e, this.v0.x, this.v1.x, this.v2.x), t(e, this.v0.y, this.v1.y, this.v2.y)).normalize()
},
THREE.CubicBezierCurve = function (e, t, r, i) {
this.v0 = e,
this.v1 = t,
this.v2 = r,
this.v3 = i
},
THREE.CubicBezierCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.CubicBezierCurve.prototype.constructor = THREE.CubicBezierCurve,
THREE.CubicBezierCurve.prototype.getPoint = function (e) {
var t = THREE.ShapeUtils.b3;
return new THREE.Vector2(t(e, this.v0.x, this.v1.x, this.v2.x, this.v3.x), t(e, this.v0.y, this.v1.y, this.v2.y, this.v3.y))
},
THREE.CubicBezierCurve.prototype.getTangent = function (e) {
var t = THREE.CurveUtils.tangentCubicBezier;
return new THREE.Vector2(t(e, this.v0.x, this.v1.x, this.v2.x, this.v3.x), t(e, this.v0.y, this.v1.y, this.v2.y, this.v3.y)).normalize()
},
THREE.SplineCurve = function (e) {
this.points = void 0 == e ? [
] : e
},
THREE.SplineCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.SplineCurve.prototype.constructor = THREE.SplineCurve,
THREE.SplineCurve.prototype.getPoint = function (e) {
var t = this.points;
e *= t.length - 1;
var r = Math.floor(e);
e -= r;
var i = t[0 === r ? r : r - 1],
n = t[r],
o = t[r > t.length - 2 ? t.length - 1 : r + 1],
t = t[r > t.length - 3 ? t.length - 1 : r + 2],
r = THREE.CurveUtils.interpolate;
return new THREE.Vector2(r(i.x, n.x, o.x, t.x, e), r(i.y, n.y, o.y, t.y, e))
},
THREE.EllipseCurve = function (e, t, r, i, n, o, a, s) {
this.aX = e,
this.aY = t,
this.xRadius = r,
this.yRadius = i,
this.aStartAngle = n,
this.aEndAngle = o,
this.aClockwise = a,
this.aRotation = s || 0
},
THREE.EllipseCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.EllipseCurve.prototype.constructor = THREE.EllipseCurve,
THREE.EllipseCurve.prototype.getPoint = function (e) {
var t = this.aEndAngle - this.aStartAngle;
0 > t && (t += 2 * Math.PI),
t > 2 * Math.PI && (t -= 2 * Math.PI),
t = !0 === this.aClockwise ? this.aEndAngle + (1 - e) * (2 * Math.PI - t) : this.aStartAngle + e * t,
e = this.aX + this.xRadius * Math.cos(t);
var r = this.aY + this.yRadius * Math.sin(t);
if (0 !== this.aRotation) {
var t = Math.cos(this.aRotation),
i = Math.sin(this.aRotation),
n = e;
e = (n - this.aX) * t - (r - this.aY) * i + this.aX,
r = (n - this.aX) * i + (r - this.aY) * t + this.aY
}
return new THREE.Vector2(e, r)
},
THREE.ArcCurve = function (e, t, r, i, n, o) {
THREE.EllipseCurve.call(this, e, t, r, r, i, n, o)
},
THREE.ArcCurve.prototype = Object.create(THREE.EllipseCurve.prototype),
THREE.ArcCurve.prototype.constructor = THREE.ArcCurve,
THREE.LineCurve3 = THREE.Curve.create(function (e, t) {
this.v1 = e,
this.v2 = t
}, function (e) {
var t = new THREE.Vector3;
return t.subVectors(this.v2, this.v1),
t.multiplyScalar(e),
t.add(this.v1),
t
}),
THREE.QuadraticBezierCurve3 = THREE.Curve.create(function (e, t, r) {
this.v0 = e,
this.v1 = t,
this.v2 = r
}, function (e) {
var t = THREE.ShapeUtils.b2;
return new THREE.Vector3(t(e, this.v0.x, this.v1.x, this.v2.x), t(e, this.v0.y, this.v1.y, this.v2.y), t(e, this.v0.z, this.v1.z, this.v2.z))
}),
THREE.CubicBezierCurve3 = THREE.Curve.create(function (e, t, r, i) {
this.v0 = e,
this.v1 = t,
this.v2 = r,
this.v3 = i
}, function (e) {
var t = THREE.ShapeUtils.b3;
return new THREE.Vector3(t(e, this.v0.x, this.v1.x, this.v2.x, this.v3.x), t(e, this.v0.y, this.v1.y, this.v2.y, this.v3.y), t(e, this.v0.z, this.v1.z, this.v2.z, this.v3.z))
}),
THREE.SplineCurve3 = THREE.Curve.create(function (e) {
console.warn('THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3'),
this.points = void 0 == e ? [
] : e
}, function (e) {
var t = this.points;
e *= t.length - 1;
var r = Math.floor(e);
e -= r;
var i = t[0 == r ? r : r - 1],
n = t[r],
o = t[r > t.length - 2 ? t.length - 1 : r + 1],
t = t[r > t.length - 3 ? t.length - 1 : r + 2],
r = THREE.CurveUtils.interpolate;
return new THREE.Vector3(r(i.x, n.x, o.x, t.x, e), r(i.y, n.y, o.y, t.y, e), r(i.z, n.z, o.z, t.z, e))
}),
THREE.CatmullRomCurve3 = function () {
function e() {
}
var t = new THREE.Vector3,
r = new e,
i = new e,
n = new e;
return e.prototype.init = function (e, t, r, i) {
this.c0 = e,
this.c1 = r,
this.c2 = - 3 * e + 3 * t - 2 * r - i,
this.c3 = 2 * e - 2 * t + r + i
},
e.prototype.initNonuniformCatmullRom = function (e, t, r, i, n, o, a) {
e = ((t - e) / n - (r - e) / (n + o) + (r - t) / o) * o,
i = ((r - t) / o - (i - t) / (o + a) + (i - r) / a) * o,
this.init(t, r, e, i)
},
e.prototype.initCatmullRom = function (e, t, r, i, n) {
this.init(t, r, n * (r - e), n * (i - t))
},
e.prototype.calc = function (e) {
var t = e * e;
return this.c0 + this.c1 * e + this.c2 * t + this.c3 * t * e
},
THREE.Curve.create(function (e) {
this.points = e || [
]
}, function (e) {
var o,
a,
s = this.points;
a = s.length,
2 > a && console.log('duh, you need at least 2 points'),
e *= a - 1,
o = Math.floor(e),
e -= o,
0 === e && o === a - 1 && (o = a - 2, e = 1);
var h,
c,
u;
if (0 === o ? (t.subVectors(s[0], s[1]).add(s[0]), h = t) : h = s[o - 1], c = s[o], u = s[o + 1], a > o + 2 ? s = s[o + 2] : (t.subVectors(s[a - 1], s[a - 2]).add(s[a - 2]), s = t), void 0 === this.type || 'centripetal' === this.type || 'chordal' === this.type) {
var l = 'chordal' === this.type ? 0.5 : 0.25;
a = Math.pow(h.distanceToSquared(c), l),
o = Math.pow(c.distanceToSquared(u), l),
l = Math.pow(u.distanceToSquared(s), l),
0.0001 > o && (o = 1),
0.0001 > a && (a = o),
0.0001 > l && (l = o),
r.initNonuniformCatmullRom(h.x, c.x, u.x, s.x, a, o, l),
i.initNonuniformCatmullRom(h.y, c.y, u.y, s.y, a, o, l),
n.initNonuniformCatmullRom(h.z, c.z, u.z, s.z, a, o, l)
} else 'catmullrom' === this.type && (a = void 0 !== this.tension ? this.tension : 0.5, r.initCatmullRom(h.x, c.x, u.x, s.x, a), i.initCatmullRom(h.y, c.y, u.y, s.y, a), n.initCatmullRom(h.z, c.z, u.z, s.z, a));
return new THREE.Vector3(r.calc(e), i.calc(e), n.calc(e))
})
}(),
THREE.ClosedSplineCurve3 = THREE.Curve.create(function (e) {
this.points = void 0 == e ? [
] : e
}, function (e) {
var t = this.points;
e *= t.length - 0;
var r = Math.floor(e);
e -= r;
var r = r + (r > 0 ? 0 : (Math.floor(Math.abs(r) / t.length) + 1) * t.length),
i = t[(r - 1) % t.length],
n = t[r % t.length],
o = t[(r + 1) % t.length],
t = t[(r + 2) % t.length],
r = THREE.CurveUtils.interpolate;
return new THREE.Vector3(r(i.x, n.x, o.x, t.x, e), r(i.y, n.y, o.y, t.y, e), r(i.z, n.z, o.z, t.z, e))
}),
THREE.BoxGeometry = function (e, t, r, i, n, o) {
function a(e, t, r, i, n, o, a, h) {
var c,
u = s.widthSegments,
l = s.heightSegments,
E = n / 2,
p = o / 2,
d = s.vertices.length;
'x' === e && 'y' === t || 'y' === e && 'x' === t ? c = 'z' : 'x' === e && 'z' === t || 'z' === e && 'x' === t ? (c = 'y', l = s.depthSegments) : ('z' === e && 'y' === t || 'y' === e && 'z' === t) && (c = 'x', u = s.depthSegments);
var f = u + 1,
m = l + 1,
T = n / u,
g = o / l,
v = new THREE.Vector3;
for (v[c] = a > 0 ? 1 : - 1, n = 0; m > n; n++) for (o = 0; f > o; o++) {
var y = new THREE.Vector3;
y[e] = (o * T - E) * r,
y[t] = (n * g - p) * i,
y[c] = a,
s.vertices.push(y)
}
for (n = 0; l > n; n++) for (o = 0; u > o; o++) p = o + f * n,
e = o + f * (n + 1),
t = o + 1 + f * (n + 1),
r = o + 1 + f * n,
i = new THREE.Vector2(o / u, 1 - n / l),
a = new THREE.Vector2(o / u, 1 - (n + 1) / l),
c = new THREE.Vector2((o + 1) / u, 1 - (n + 1) / l),
E = new THREE.Vector2((o + 1) / u, 1 - n / l),
p = new THREE.Face3(p + d, e + d, r + d),
p.normal.copy(v),
p.vertexNormals.push(v.clone(), v.clone(), v.clone()),
p.materialIndex = h,
s.faces.push(p),
s.faceVertexUvs[0].push([i,
a,
E]),
p = new THREE.Face3(e + d, t + d, r + d),
p.normal.copy(v),
p.vertexNormals.push(v.clone(), v.clone(), v.clone()),
p.materialIndex = h,
s.faces.push(p),
s.faceVertexUvs[0].push([a.clone(),
c,
E.clone()])
}
THREE.Geometry.call(this),
this.type = 'BoxGeometry',
this.parameters = {
width: e,
height: t,
depth: r,
widthSegments: i,
heightSegments: n,
depthSegments: o
},
this.widthSegments = i || 1,
this.heightSegments = n || 1,
this.depthSegments = o || 1;
var s = this;
i = e / 2,
n = t / 2,
o = r / 2,
a('z', 'y', - 1, - 1, r, t, i, 0),
a('z', 'y', 1, - 1, r, t, - i, 1),
a('x', 'z', 1, 1, e, r, n, 2),
a('x', 'z', 1, - 1, e, r, - n, 3),
a('x', 'y', 1, - 1, e, t, o, 4),
a('x', 'y', - 1, - 1, e, t, - o, 5),
this.mergeVertices()
},
THREE.BoxGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.BoxGeometry.prototype.constructor = THREE.BoxGeometry,
THREE.BoxGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.BoxGeometry(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments)
},
THREE.CubeGeometry = THREE.BoxGeometry,
THREE.CircleGeometry = function (e, t, r, i) {
THREE.Geometry.call(this),
this.type = 'CircleGeometry',
this.parameters = {
radius: e,
segments: t,
thetaStart: r,
thetaLength: i
},
this.fromBufferGeometry(new THREE.CircleBufferGeometry(e, t, r, i))
},
THREE.CircleGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.CircleGeometry.prototype.constructor = THREE.CircleGeometry,
THREE.CircleGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.CircleGeometry(e.radius, e.segments, e.thetaStart, e.thetaLength)
},
THREE.CircleBufferGeometry = function (e, t, r, i) {
THREE.BufferGeometry.call(this),
this.type = 'CircleBufferGeometry',
this.parameters = {
radius: e,
segments: t,
thetaStart: r,
thetaLength: i
},
e = e || 50,
t = void 0 !== t ? Math.max(3, t) : 8,
r = void 0 !== r ? r : 0,
i = void 0 !== i ? i : 2 * Math.PI;
var n = t + 2,
o = new Float32Array(3 * n),
a = new Float32Array(3 * n),
n = new Float32Array(2 * n);
a[2] = 1,
n[0] = 0.5,
n[1] = 0.5;
for (var s = 0, h = 3, c = 2; t >= s; s++, h += 3, c += 2) {
var u = r + s / t * i;
o[h] = e * Math.cos(u),
o[h + 1] = e * Math.sin(u),
a[h + 2] = 1,
n[c] = (o[h] / e + 1) / 2,
n[c + 1] = (o[h + 1] / e + 1) / 2
}
for (r = [
], h = 1; t >= h; h++) r.push(h, h + 1, 0);
this.setIndex(new THREE.BufferAttribute(new Uint16Array(r), 1)),
this.addAttribute('position', new THREE.BufferAttribute(o, 3)),
this.addAttribute('normal', new THREE.BufferAttribute(a, 3)),
this.addAttribute('uv', new THREE.BufferAttribute(n, 2)),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, e)
},
THREE.CircleBufferGeometry.prototype = Object.create(THREE.BufferGeometry.prototype),
THREE.CircleBufferGeometry.prototype.constructor = THREE.CircleBufferGeometry,
THREE.CircleBufferGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.CircleBufferGeometry(e.radius, e.segments, e.thetaStart, e.thetaLength)
},
THREE.CylinderGeometry = function (e, t, r, i, n, o, a, s) {
THREE.Geometry.call(this),
this.type = 'CylinderGeometry',
this.parameters = {
radiusTop: e,
radiusBottom: t,
height: r,
radialSegments: i,
heightSegments: n,
openEnded: o,
thetaStart: a,
thetaLength: s
},
e = void 0 !== e ? e : 20,
t = void 0 !== t ? t : 20,
r = void 0 !== r ? r : 100,
i = i || 8,
n = n || 1,
o = void 0 !== o ? o : !1,
a = void 0 !== a ? a : 0,
s = void 0 !== s ? s : 2 * Math.PI;
var h,
c,
u = r / 2,
l = [
],
E = [
];
for (c = 0; n >= c; c++) {
var p = [
],
d = [
],
f = c / n,
m = f * (t - e) + e;
for (h = 0; i >= h; h++) {
var T = h / i,
g = new THREE.Vector3;
g.x = m * Math.sin(T * s + a),
g.y = - f * r + u,
g.z = m * Math.cos(T * s + a),
this.vertices.push(g),
p.push(this.vertices.length - 1),
d.push(new THREE.Vector2(T, 1 - f))
}
l.push(p),
E.push(d)
}
for (r = (t - e) / r, h = 0; i > h; h++) for (0 !== e ? (a = this.vertices[l[0][h]].clone(), s = this.vertices[l[0][h + 1]].clone()) : (a = this.vertices[l[1][h]].clone(), s = this.vertices[l[1][h + 1]].clone()), a.setY(Math.sqrt(a.x * a.x + a.z * a.z) * r).normalize(), s.setY(Math.sqrt(s.x * s.x + s.z * s.z) * r).normalize(), c = 0; n > c; c++) {
var p = l[c][h],
d = l[c + 1][h],
f = l[c + 1][h + 1],
m = l[c][h + 1],
T = a.clone(),
g = a.clone(),
v = s.clone(),
y = s.clone(),
R = E[c][h].clone(),
H = E[c + 1][h].clone(),
x = E[c + 1][h + 1].clone(),
b = E[c][h + 1].clone();
this.faces.push(new THREE.Face3(p, d, m, [
T,
g,
y
])),
this.faceVertexUvs[0].push([R,
H,
b]),
this.faces.push(new THREE.Face3(d, f, m, [
g.clone(),
v,
y.clone()
])),
this.faceVertexUvs[0].push([H.clone(),
x,
b.clone()])
}
if (!1 === o && e > 0) for (this.vertices.push(new THREE.Vector3(0, u, 0)), h = 0; i > h; h++) p = l[0][h],
d = l[0][h + 1],
f = this.vertices.length - 1,
T = new THREE.Vector3(0, 1, 0),
g = new THREE.Vector3(0, 1, 0),
v = new THREE.Vector3(0, 1, 0),
R = E[0][h].clone(),
H = E[0][h + 1].clone(),
x = new THREE.Vector2(H.x, 0),
this.faces.push(new THREE.Face3(p, d, f, [
T,
g,
v
], void 0, 1)),
this.faceVertexUvs[0].push([R,
H,
x]);
if (!1 === o && t > 0) for (this.vertices.push(new THREE.Vector3(0, - u, 0)), h = 0; i > h; h++) p = l[n][h + 1],
d = l[n][h],
f = this.vertices.length - 1,
T = new THREE.Vector3(0, - 1, 0),
g = new THREE.Vector3(0, - 1, 0),
v = new THREE.Vector3(0, - 1, 0),
R = E[n][h + 1].clone(),
H = E[n][h].clone(),
x = new THREE.Vector2(H.x, 1),
this.faces.push(new THREE.Face3(p, d, f, [
T,
g,
v
], void 0, 2)),
this.faceVertexUvs[0].push([R,
H,
x]);
this.computeFaceNormals()
},
THREE.CylinderGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.CylinderGeometry.prototype.constructor = THREE.CylinderGeometry,
THREE.CylinderGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.CylinderGeometry(e.radiusTop, e.radiusBottom, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength)
},
THREE.EdgesGeometry = function (e, t) {
function r(e, t) {
return e - t
}
THREE.BufferGeometry.call(this);
var i,
n = Math.cos(THREE.Math.degToRad(void 0 !== t ? t : 1)),
o = [
0,
0
],
a = {
},
s = [
'a',
'b',
'c'
];
e instanceof THREE.BufferGeometry ? (i = new THREE.Geometry, i.fromBufferGeometry(e)) : i = e.clone(),
i.mergeVertices(),
i.computeFaceNormals();
var h = i.vertices;
i = i.faces;
for (var c = 0, u = i.length; u > c; c++) for (var l = i[c], E = 0; 3 > E; E++) {
o[0] = l[s[E]],
o[1] = l[s[(E + 1) % 3]],
o.sort(r);
var p = o.toString();
void 0 === a[p] ? a[p] = {
vert1: o[0],
vert2: o[1],
face1: c,
face2: void 0
}
: a[p].face2 = c
}
o = [
];
for (p in a) s = a[p],
(void 0 === s.face2 || i[s.face1].normal.dot(i[s.face2].normal) <= n) && (c = h[s.vert1], o.push(c.x), o.push(c.y), o.push(c.z), c = h[s.vert2], o.push(c.x), o.push(c.y), o.push(c.z));
this.addAttribute('position', new THREE.BufferAttribute(new Float32Array(o), 3))
},
THREE.EdgesGeometry.prototype = Object.create(THREE.BufferGeometry.prototype),
THREE.EdgesGeometry.prototype.constructor = THREE.EdgesGeometry,
THREE.ExtrudeGeometry = function (e, t) {
'undefined' != typeof e && (THREE.Geometry.call(this), this.type = 'ExtrudeGeometry', e = Array.isArray(e) ? e : [
e
], this.addShapeList(e, t), this.computeFaceNormals())
},
THREE.ExtrudeGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry,
THREE.ExtrudeGeometry.prototype.addShapeList = function (e, t) {
for (var r = e.length, i = 0; r > i; i++) this.addShape(e[i], t)
},
THREE.ExtrudeGeometry.prototype.addShape = function (e, t) {
function r(e, t, r) {
return t || console.error('THREE.ExtrudeGeometry: vec does not exist'),
t.clone().multiplyScalar(r).add(e)
}
function i(e, t, r) {
var i = 1,
i = e.x - t.x,
n = e.y - t.y,
o = r.x - e.x,
a = r.y - e.y,
s = i * i + n * n;
if (Math.abs(i * a - n * o) > Number.EPSILON) {
var h = Math.sqrt(s),
c = Math.sqrt(o * o + a * a),
s = t.x - n / h;
if (t = t.y + i / h, o = ((r.x - a / c - s) * a - (r.y + o / c - t) * o) / (i * a - n * o), r = s + i * o - e.x, e = t + n * o - e.y, i = r * r + e * e, 2 >= i) return new THREE.Vector2(r, e);
i = Math.sqrt(i / 2)
} else e = !1,
i > Number.EPSILON ? o > Number.EPSILON && (e = !0) : i < - Number.EPSILON ? o < - Number.EPSILON && (e = !0) : Math.sign(n) === Math.sign(a) && (e = !0),
e ? (r = - n, e = i, i = Math.sqrt(s)) : (r = i, e = n, i = Math.sqrt(s / 2));
return new THREE.Vector2(r / i, e / i)
}
function n(e, t) {
var r,
i;
for (O = e.length; 0 <= --O; ) {
r = O,
i = O - 1,
0 > i && (i = e.length - 1);
for (var n = 0, o = g + 2 * f, n = 0; o > n; n++) {
var a = V * n,
s = V * (n + 1),
h = t + r + a,
a = t + i + a,
c = t + i + s,
s = t + r + s,
h = h + w,
a = a + w,
c = c + w,
s = s + w;
_.faces.push(new THREE.Face3(h, a, s, null, null, 1)),
_.faces.push(new THREE.Face3(a, c, s, null, null, 1)),
h = R.generateSideWallUV(_, h, a, c, s),
_.faceVertexUvs[0].push([h[0],
h[1],
h[3]]),
_.faceVertexUvs[0].push([h[1],
h[2],
h[3]])
}
}
}
function o(e, t, r) {
_.vertices.push(new THREE.Vector3(e, t, r))
}
function a(e, t, r) {
e += w,
t += w,
r += w,
_.faces.push(new THREE.Face3(e, t, r, null, null, 0)),
e = R.generateTopUV(_, e, t, r),
_.faceVertexUvs[0].push(e)
}
var s,
h,
c,
u,
l,
E = void 0 !== t.amount ? t.amount : 100,
p = void 0 !== t.bevelThickness ? t.bevelThickness : 6,
d = void 0 !== t.bevelSize ? t.bevelSize : p - 2,
f = void 0 !== t.bevelSegments ? t.bevelSegments : 3,
m = void 0 !== t.bevelEnabled ? t.bevelEnabled : !0,
T = void 0 !== t.curveSegments ? t.curveSegments : 12,
g = void 0 !== t.steps ? t.steps : 1,
v = t.extrudePath,
y = !1,
R = void 0 !== t.UVGenerator ? t.UVGenerator : THREE.ExtrudeGeometry.WorldUVGenerator;
v && (s = v.getSpacedPoints(g), y = !0, m = !1, h = void 0 !== t.frames ? t.frames : new THREE.TubeGeometry.FrenetFrames(v, g, !1), c = new THREE.Vector3, u = new THREE.Vector3, l = new THREE.Vector3),
m || (d = p = f = 0);
var H,
x,
b,
_ = this,
w = this.vertices.length,
v = e.extractPoints(T),
T = v.shape,
M = v.holes;
if (v = !THREE.ShapeUtils.isClockWise(T)) {
for (T = T.reverse(), x = 0, b = M.length; b > x; x++) H = M[x],
THREE.ShapeUtils.isClockWise(H) && (M[x] = H.reverse());
v = !1
}
var S = THREE.ShapeUtils.triangulateShape(T, M),
A = T;
for (x = 0, b = M.length; b > x; x++) H = M[x],
T = T.concat(H);
var C,
L,
P,
k,
D,
F,
V = T.length,
U = S.length,
v = [
],
O = 0;
for (P = A.length, C = P - 1, L = O + 1; P > O; O++, C++, L++) C === P && (C = 0),
L === P && (L = 0),
v[O] = i(A[O], A[C], A[L]);
var B,
G = [
],
I = v.concat();
for (x = 0, b = M.length; b > x; x++) {
for (H = M[x], B = [
], O = 0, P = H.length, C = P - 1, L = O + 1; P > O; O++, C++, L++) C === P && (C = 0),
L === P && (L = 0),
B[O] = i(H[O], H[C], H[L]);
G.push(B),
I = I.concat(B)
}
for (C = 0; f > C; C++) {
for (P = C / f, k = p * (1 - P), L = d * Math.sin(P * Math.PI / 2), O = 0, P = A.length; P > O; O++) D = r(A[O], v[O], L),
o(D.x, D.y, - k);
for (x = 0, b = M.length; b > x; x++) for (H = M[x], B = G[x], O = 0, P = H.length; P > O; O++) D = r(H[O], B[O], L),
o(D.x, D.y, - k)
}
for (L = d, O = 0; V > O; O++) D = m ? r(T[O], I[O], L) : T[O],
y ? (u.copy(h.normals[0]).multiplyScalar(D.x), c.copy(h.binormals[0]).multiplyScalar(D.y), l.copy(s[0]).add(u).add(c), o(l.x, l.y, l.z)) : o(D.x, D.y, 0);
for (P = 1; g >= P; P++) for (O = 0; V > O; O++) D = m ? r(T[O], I[O], L) : T[O],
y ? (u.copy(h.normals[P]).multiplyScalar(D.x), c.copy(h.binormals[P]).multiplyScalar(D.y), l.copy(s[P]).add(u).add(c), o(l.x, l.y, l.z)) : o(D.x, D.y, E / g * P);
for (C = f - 1; C >= 0; C--) {
for (P = C / f, k = p * (1 - P), L = d * Math.sin(P * Math.PI / 2), O = 0, P = A.length; P > O; O++) D = r(A[O], v[O], L),
o(D.x, D.y, E + k);
for (x = 0, b = M.length; b > x; x++) for (H = M[x], B = G[x], O = 0, P = H.length; P > O; O++) D = r(H[O], B[O], L),
y ? o(D.x, D.y + s[g - 1].y, s[g - 1].x + k) : o(D.x, D.y, E + k)
}
!function () {
if (m) {
var e;
for (e = 0 * V, O = 0; U > O; O++) F = S[O],
a(F[2] + e, F[1] + e, F[0] + e);
for (e = g + 2 * f, e *= V, O = 0; U > O; O++) F = S[O],
a(F[0] + e, F[1] + e, F[2] + e)
} else {
for (O = 0; U > O; O++) F = S[O],
a(F[2], F[1], F[0]);
for (O = 0; U > O; O++) F = S[O],
a(F[0] + V * g, F[1] + V * g, F[2] + V * g)
}
}(),
function () {
var e = 0;
for (n(A, e), e += A.length, x = 0, b = M.length; b > x; x++) H = M[x],
n(H, e),
e += H.length
}()
},
THREE.ExtrudeGeometry.WorldUVGenerator = {
generateTopUV: function (e, t, r, i) {
return e = e.vertices,
t = e[t],
r = e[r],
i = e[i],
[
new THREE.Vector2(t.x, t.y),
new THREE.Vector2(r.x, r.y),
new THREE.Vector2(i.x, i.y)
]
},
generateSideWallUV: function (e, t, r, i, n) {
return e = e.vertices,
t = e[t],
r = e[r],
i = e[i],
n = e[n],
0.01 > Math.abs(t.y - r.y) ? [
new THREE.Vector2(t.x, 1 - t.z),
new THREE.Vector2(r.x, 1 - r.z),
new THREE.Vector2(i.x, 1 - i.z),
new THREE.Vector2(n.x, 1 - n.z)
] : [
new THREE.Vector2(t.y, 1 - t.z),
new THREE.Vector2(r.y, 1 - r.z),
new THREE.Vector2(i.y, 1 - i.z),
new THREE.Vector2(n.y, 1 - n.z)
]
}
},
THREE.ShapeGeometry = function (e, t) {
THREE.Geometry.call(this),
this.type = 'ShapeGeometry',
!1 === Array.isArray(e) && (e = [
e
]),
this.addShapeList(e, t),
this.computeFaceNormals()
},
THREE.ShapeGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ShapeGeometry.prototype.constructor = THREE.ShapeGeometry,
THREE.ShapeGeometry.prototype.addShapeList = function (e, t) {
for (var r = 0, i = e.length; i > r; r++) this.addShape(e[r], t);
return this
},
THREE.ShapeGeometry.prototype.addShape = function (e, t) {
void 0 === t && (t = {
});
var r,
i,
n,
o = t.material,
a = void 0 === t.UVGenerator ? THREE.ExtrudeGeometry.WorldUVGenerator : t.UVGenerator,
s = this.vertices.length;
r = e.extractPoints(void 0 !== t.curveSegments ? t.curveSegments : 12);
var h = r.shape,
c = r.holes;
if (!THREE.ShapeUtils.isClockWise(h)) for (h = h.reverse(), r = 0, i = c.length; i > r; r++) n = c[r],
THREE.ShapeUtils.isClockWise(n) && (c[r] = n.reverse());
var u = THREE.ShapeUtils.triangulateShape(h, c);
for (r = 0, i = c.length; i > r; r++) n = c[r],
h = h.concat(n);
for (c = h.length, i = u.length, r = 0; c > r; r++) n = h[r],
this.vertices.push(new THREE.Vector3(n.x, n.y, 0));
for (r = 0; i > r; r++) c = u[r],
h = c[0] + s,
n = c[1] + s,
c = c[2] + s,
this.faces.push(new THREE.Face3(h, n, c, null, null, o)),
this.faceVertexUvs[0].push(a.generateTopUV(this, h, n, c))
},
THREE.LatheGeometry = function (e, t, r, i) {
THREE.Geometry.call(this),
this.type = 'LatheGeometry',
this.parameters = {
points: e,
segments: t,
phiStart: r,
phiLength: i
},
t = t || 12,
r = r || 0,
i = i || 2 * Math.PI;
for (var n = 1 / (e.length - 1), o = 1 / t, a = 0, s = t; s >= a; a++) for (var h = r + a * o * i, c = Math.cos(h), u = Math.sin(h), h = 0, l = e.length; l > h; h++) {
var E = e[h],
p = new THREE.Vector3;
p.x = c * E.x - u * E.y,
p.y = u * E.x + c * E.y,
p.z = E.z,
this.vertices.push(p)
}
for (r = e.length, a = 0, s = t; s > a; a++) for (h = 0, l = e.length - 1; l > h; h++) {
t = u = h + r * a,
i = u + r;
var c = u + 1 + r,
u = u + 1,
E = a * o,
p = h * n,
d = E + o,
f = p + n;
this.faces.push(new THREE.Face3(t, i, u)),
this.faceVertexUvs[0].push([new THREE.Vector2(E, p),
new THREE.Vector2(d, p),
new THREE.Vector2(E, f)]),
this.faces.push(new THREE.Face3(i, c, u)),
this.faceVertexUvs[0].push([new THREE.Vector2(d, p),
new THREE.Vector2(d, f),
new THREE.Vector2(E, f)])
}
this.mergeVertices(),
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.LatheGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.LatheGeometry.prototype.constructor = THREE.LatheGeometry,
THREE.PlaneGeometry = function (e, t, r, i) {
THREE.Geometry.call(this),
this.type = 'PlaneGeometry',
this.parameters = {
width: e,
height: t,
widthSegments: r,
heightSegments: i
},
this.fromBufferGeometry(new THREE.PlaneBufferGeometry(e, t, r, i))
},
THREE.PlaneGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.PlaneGeometry.prototype.constructor = THREE.PlaneGeometry,
THREE.PlaneGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.PlaneGeometry(e.width, e.height, e.widthSegments, e.heightSegments)
},
THREE.PlaneBufferGeometry = function (e, t, r, i) {
THREE.BufferGeometry.call(this),
this.type = 'PlaneBufferGeometry',
this.parameters = {
width: e,
height: t,
widthSegments: r,
heightSegments: i
};
var n = e / 2,
o = t / 2;
r = Math.floor(r) || 1,
i = Math.floor(i) || 1;
var a = r + 1,
s = i + 1,
h = e / r,
c = t / i;
t = new Float32Array(a * s * 3),
e = new Float32Array(a * s * 3);
for (var u = new Float32Array(a * s * 2), l = 0, E = 0, p = 0; s > p; p++) for (var d = p * c - o, f = 0; a > f; f++) t[l] = f * h - n,
t[l + 1] = - d,
e[l + 2] = 1,
u[E] = f / r,
u[E + 1] = 1 - p / i,
l += 3,
E += 2;
for (l = 0, n = new (65535 < t.length / 3 ? Uint32Array : Uint16Array) (r * i * 6), p = 0; i > p; p++) for (f = 0; r > f; f++) o = f + a * (p + 1),
s = f + 1 + a * (p + 1),
h = f + 1 + a * p,
n[l] = f + a * p,
n[l + 1] = o,
n[l + 2] = h,
n[l + 3] = o,
n[l + 4] = s,
n[l + 5] = h,
l += 6;
this.setIndex(new THREE.BufferAttribute(n, 1)),
this.addAttribute('position', new THREE.BufferAttribute(t, 3)),
this.addAttribute('normal', new THREE.BufferAttribute(e, 3)),
this.addAttribute('uv', new THREE.BufferAttribute(u, 2))
},
THREE.PlaneBufferGeometry.prototype = Object.create(THREE.BufferGeometry.prototype),
THREE.PlaneBufferGeometry.prototype.constructor = THREE.PlaneBufferGeometry,
THREE.PlaneBufferGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.PlaneBufferGeometry(e.width, e.height, e.widthSegments, e.heightSegments)
},
THREE.RingGeometry = function (e, t, r, i, n, o) {
THREE.Geometry.call(this),
this.type = 'RingGeometry',
this.parameters = {
innerRadius: e,
outerRadius: t,
thetaSegments: r,
phiSegments: i,
thetaStart: n,
thetaLength: o
},
e = e || 0,
t = t || 50,
n = void 0 !== n ? n : 0,
o = void 0 !== o ? o : 2 * Math.PI,
r = void 0 !== r ? Math.max(3, r) : 8,
i = void 0 !== i ? Math.max(1, i) : 8;
var a,
s = [
],
h = e,
c = (t - e) / i;
for (e = 0; i + 1 > e; e++) {
for (a = 0; r + 1 > a; a++) {
var u = new THREE.Vector3,
l = n + a / r * o;
u.x = h * Math.cos(l),
u.y = h * Math.sin(l),
this.vertices.push(u),
s.push(new THREE.Vector2((u.x / t + 1) / 2, (u.y / t + 1) / 2))
}
h += c
}
for (t = new THREE.Vector3(0, 0, 1), e = 0; i > e; e++) for (n = e * (r + 1), a = 0; r > a; a++) o = l = a + n,
c = l + r + 1,
u = l + r + 2,
this.faces.push(new THREE.Face3(o, c, u, [
t.clone(),
t.clone(),
t.clone()
])),
this.faceVertexUvs[0].push([s[o].clone(),
s[c].clone(),
s[u].clone()]),
o = l,
c = l + r + 2,
u = l + 1,
this.faces.push(new THREE.Face3(o, c, u, [
t.clone(),
t.clone(),
t.clone()
])),
this.faceVertexUvs[0].push([s[o].clone(),
s[c].clone(),
s[u].clone()]);
this.computeFaceNormals(),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, h)
},
THREE.RingGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.RingGeometry.prototype.constructor = THREE.RingGeometry,
THREE.RingGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.RingGeometry(e.innerRadius, e.outerRadius, e.thetaSegments, e.phiSegments, e.thetaStart, e.thetaLength)
},
THREE.SphereGeometry = function (e, t, r, i, n, o, a) {
THREE.Geometry.call(this),
this.type = 'SphereGeometry',
this.parameters = {
radius: e,
widthSegments: t,
heightSegments: r,
phiStart: i,
phiLength: n,
thetaStart: o,
thetaLength: a
},
this.fromBufferGeometry(new THREE.SphereBufferGeometry(e, t, r, i, n, o, a))
},
THREE.SphereGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.SphereGeometry.prototype.constructor = THREE.SphereGeometry,
THREE.SphereGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.SphereGeometry(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength)
},
THREE.SphereBufferGeometry = function (e, t, r, i, n, o, a) {
THREE.BufferGeometry.call(this),
this.type = 'SphereBufferGeometry',
this.parameters = {
radius: e,
widthSegments: t,
heightSegments: r,
phiStart: i,
phiLength: n,
thetaStart: o,
thetaLength: a
},
e = e || 50,
t = Math.max(3, Math.floor(t) || 8),
r = Math.max(2, Math.floor(r) || 6),
i = void 0 !== i ? i : 0,
n = void 0 !== n ? n : 2 * Math.PI,
o = void 0 !== o ? o : 0,
a = void 0 !== a ? a : Math.PI;
for (var s = o + a, h = (t + 1) * (r + 1), c = new THREE.BufferAttribute(new Float32Array(3 * h), 3), u = new THREE.BufferAttribute(new Float32Array(3 * h), 3), h = new THREE.BufferAttribute(new Float32Array(2 * h), 2), l = 0, E = [
], p = new THREE.Vector3, d = 0; r >= d; d++) {
for (var f = [
], m = d / r, T = 0; t >= T; T++) {
var g = T / t,
v = - e * Math.cos(i + g * n) * Math.sin(o + m * a),
y = e * Math.cos(o + m * a),
R = e * Math.sin(i + g * n) * Math.sin(o + m * a);
p.set(v, y, R).normalize(),
c.setXYZ(l, v, y, R),
u.setXYZ(l, p.x, p.y, p.z),
h.setXY(l, g, 1 - m),
f.push(l),
l++
}
E.push(f)
}
for (i = [
], d = 0; r > d; d++) for (T = 0; t > T; T++) n = E[d][T + 1],
a = E[d][T],
l = E[d + 1][T],
p = E[d + 1][T + 1],
(0 !== d || o > 0) && i.push(n, a, p),
(d !== r - 1 || s < Math.PI) && i.push(a, l, p);
this.setIndex(new (65535 < c.count ? THREE.Uint32Attribute : THREE.Uint16Attribute) (i, 1)),
this.addAttribute('position', c),
this.addAttribute('normal', u),
this.addAttribute('uv', h),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, e)
},
THREE.SphereBufferGeometry.prototype = Object.create(THREE.BufferGeometry.prototype),
THREE.SphereBufferGeometry.prototype.constructor = THREE.SphereBufferGeometry,
THREE.SphereBufferGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.SphereBufferGeometry(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength)
},
THREE.TorusGeometry = function (e, t, r, i, n) {
THREE.Geometry.call(this),
this.type = 'TorusGeometry',
this.parameters = {
radius: e,
tube: t,
radialSegments: r,
tubularSegments: i,
arc: n
},
e = e || 100,
t = t || 40,
r = r || 8,
i = i || 6,
n = n || 2 * Math.PI;
for (var o = new THREE.Vector3, a = [
], s = [
], h = 0; r >= h; h++) for (var c = 0; i >= c; c++) {
var u = c / i * n,
l = h / r * Math.PI * 2;
o.x = e * Math.cos(u),
o.y = e * Math.sin(u);
var E = new THREE.Vector3;
E.x = (e + t * Math.cos(l)) * Math.cos(u),
E.y = (e + t * Math.cos(l)) * Math.sin(u),
E.z = t * Math.sin(l),
this.vertices.push(E),
a.push(new THREE.Vector2(c / i, h / r)),
s.push(E.clone().sub(o).normalize())
}
for (h = 1; r >= h; h++) for (c = 1; i >= c; c++) e = (i + 1) * h + c - 1,
t = (i + 1) * (h - 1) + c - 1,
n = (i + 1) * (h - 1) + c,
o = (i + 1) * h + c,
u = new THREE.Face3(e, t, o, [
s[e].clone(),
s[t].clone(),
s[o].clone()
]),
this.faces.push(u),
this.faceVertexUvs[0].push([a[e].clone(),
a[t].clone(),
a[o].clone()]),
u = new THREE.Face3(t, n, o, [
s[t].clone(),
s[n].clone(),
s[o].clone()
]),
this.faces.push(u),
this.faceVertexUvs[0].push([a[t].clone(),
a[n].clone(),
a[o].clone()]);
this.computeFaceNormals()
},
THREE.TorusGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TorusGeometry.prototype.constructor = THREE.TorusGeometry,
THREE.TorusGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.TorusGeometry(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.arc)
},
THREE.TorusKnotGeometry = function (e, t, r, i, n, o, a) {
function s(e, t, r, i, n) {
var o = Math.cos(e),
a = Math.sin(e);
return e *= t / r,
t = Math.cos(e),
o *= i * (2 + t) * 0.5,
a = i * (2 + t) * a * 0.5,
i = n * i * Math.sin(e) * 0.5,
new THREE.Vector3(o, a, i)
}
THREE.Geometry.call(this),
this.type = 'TorusKnotGeometry',
this.parameters = {
radius: e,
tube: t,
radialSegments: r,
tubularSegments: i,
p: n,
q: o,
heightScale: a
},
e = e || 100,
t = t || 40,
r = r || 64,
i = i || 8,
n = n || 2,
o = o || 3,
a = a || 1;
for (var h = Array(r), c = new THREE.Vector3, u = new THREE.Vector3, l = new THREE.Vector3, E = 0; r > E; ++E) {
h[E] = Array(i);
var p = E / r * 2 * n * Math.PI,
d = s(p, o, n, e, a),
p = s(p + 0.01, o, n, e, a);
for (c.subVectors(p, d), u.addVectors(p, d), l.crossVectors(c, u), u.crossVectors(l, c), l.normalize(), u.normalize(), p = 0; i > p; ++p) {
var f = p / i * 2 * Math.PI,
m = - t * Math.cos(f),
f = t * Math.sin(f),
T = new THREE.Vector3;
T.x = d.x + m * u.x + f * l.x,
T.y = d.y + m * u.y + f * l.y,
T.z = d.z + m * u.z + f * l.z,
h[E][p] = this.vertices.push(T) - 1
}
}
for (E = 0; r > E; ++E) for (p = 0; i > p; ++p) n = (E + 1) % r,
o = (p + 1) % i,
e = h[E][p],
t = h[n][p],
n = h[n][o],
o = h[E][o],
a = new THREE.Vector2(E / r, p / i),
c = new THREE.Vector2((E + 1) / r, p / i),
u = new THREE.Vector2((E + 1) / r, (p + 1) / i),
l = new THREE.Vector2(E / r, (p + 1) / i),
this.faces.push(new THREE.Face3(e, t, o)),
this.faceVertexUvs[0].push([a,
c,
l]),
this.faces.push(new THREE.Face3(t, n, o)),
this.faceVertexUvs[0].push([c.clone(),
u,
l.clone()]);
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.TorusKnotGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TorusKnotGeometry.prototype.constructor = THREE.TorusKnotGeometry,
THREE.TorusKnotGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.TorusKnotGeometry(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.p, e.q, e.heightScale)
},
THREE.TubeGeometry = function (e, t, r, i, n, o) {
THREE.Geometry.call(this),
this.type = 'TubeGeometry',
this.parameters = {
path: e,
segments: t,
radius: r,
radialSegments: i,
closed: n,
taper: o
},
t = t || 64,
r = r || 1,
i = i || 8,
n = n || !1,
o = o || THREE.TubeGeometry.NoTaper;
var a,
s,
h,
c,
u,
l,
E,
p,
d,
f,
m = [
],
T = t + 1,
g = new THREE.Vector3;
for (p = new THREE.TubeGeometry.FrenetFrames(e, t, n), d = p.normals, f = p.binormals, this.tangents = p.tangents, this.normals = d, this.binormals = f, p = 0; T > p; p++) for (m[p] = [
], h = p / (T - 1), E = e.getPointAt(h), a = d[p], s = f[p], u = r * o(h), h = 0; i > h; h++) c = h / i * 2 * Math.PI,
l = - u * Math.cos(c),
c = u * Math.sin(c),
g.copy(E),
g.x += l * a.x + c * s.x,
g.y += l * a.y + c * s.y,
g.z += l * a.z + c * s.z,
m[p][h] = this.vertices.push(new THREE.Vector3(g.x, g.y, g.z)) - 1;
for (p = 0; t > p; p++) for (h = 0; i > h; h++) o = n ? (p + 1) % t : p + 1,
T = (h + 1) % i,
e = m[p][h],
r = m[o][h],
o = m[o][T],
T = m[p][T],
g = new THREE.Vector2(p / t, h / i),
d = new THREE.Vector2((p + 1) / t, h / i),
f = new THREE.Vector2((p + 1) / t, (h + 1) / i),
a = new THREE.Vector2(p / t, (h + 1) / i),
this.faces.push(new THREE.Face3(e, r, T)),
this.faceVertexUvs[0].push([g,
d,
a]),
this.faces.push(new THREE.Face3(r, o, T)),
this.faceVertexUvs[0].push([d.clone(),
f,
a.clone()]);
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.TubeGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TubeGeometry.prototype.constructor = THREE.TubeGeometry,
THREE.TubeGeometry.prototype.clone = function () {
return new this.constructor(this.parameters.path, this.parameters.segments, this.parameters.radius, this.parameters.radialSegments, this.parameters.closed, this.parameters.taper)
},
THREE.TubeGeometry.NoTaper = function (e) {
return 1
},
THREE.TubeGeometry.SinusoidalTaper = function (e) {
return Math.sin(Math.PI * e)
},
THREE.TubeGeometry.FrenetFrames = function (e, t, r) {
var i = new THREE.Vector3,
n = [
],
o = [
],
a = [
],
s = new THREE.Vector3,
h = new THREE.Matrix4;
t += 1;
var c,
u,
l;
for (this.tangents = n, this.normals = o, this.binormals = a, c = 0; t > c; c++) u = c / (t - 1),
n[c] = e.getTangentAt(u),
n[c].normalize();
for (o[0] = new THREE.Vector3, a[0] = new THREE.Vector3, e = Number.MAX_VALUE, c = Math.abs(n[0].x), u = Math.abs(n[0].y), l = Math.abs(n[0].z), e >= c && (e = c, i.set(1, 0, 0)), e >= u && (e = u, i.set(0, 1, 0)), e >= l && i.set(0, 0, 1), s.crossVectors(n[0], i).normalize(), o[0].crossVectors(n[0], s), a[0].crossVectors(n[0], o[0]), c = 1; t > c; c++) o[c] = o[c - 1].clone(),
a[c] = a[c - 1].clone(),
s.crossVectors(n[c - 1], n[c]),
s.length() > Number.EPSILON && (s.normalize(), i = Math.acos(THREE.Math.clamp(n[c - 1].dot(n[c]), - 1, 1)), o[c].applyMatrix4(h.makeRotationAxis(s, i))),
a[c].crossVectors(n[c], o[c]);
if (r) for (i = Math.acos(THREE.Math.clamp(o[0].dot(o[t - 1]), - 1, 1)), i /= t - 1, 0 < n[0].dot(s.crossVectors(o[0], o[t - 1])) && (i = - i), c = 1; t > c; c++) o[c].applyMatrix4(h.makeRotationAxis(n[c], i * c)),
a[c].crossVectors(n[c], o[c])
},
THREE.PolyhedronGeometry = function (e, t, r, i) {
function n(e) {
var t = e.normalize().clone();
t.index = h.vertices.push(t) - 1;
var r = Math.atan2(e.z, - e.x) / 2 / Math.PI + 0.5;
return e = Math.atan2( - e.y, Math.sqrt(e.x * e.x + e.z * e.z)) / Math.PI + 0.5,
t.uv = new THREE.Vector2(r, 1 - e),
t
}
function o(e, t, r, i) {
i = new THREE.Face3(e.index, t.index, r.index, [
e.clone(),
t.clone(),
r.clone()
], void 0, i),
h.faces.push(i),
m.copy(e).add(t).add(r).divideScalar(3),
i = Math.atan2(m.z, - m.x),
h.faceVertexUvs[0].push([s(e.uv, e, i),
s(t.uv, t, i),
s(r.uv, r, i)])
}
function a(e, t) {
for (var r = Math.pow(2, t), i = n(h.vertices[e.a]), a = n(h.vertices[e.b]), s = n(h.vertices[e.c]), c = [
], u = e.materialIndex, l = 0; r >= l; l++) {
c[l] = [
];
for (var E = n(i.clone().lerp(s, l / r)), p = n(a.clone().lerp(s, l / r)), d = r - l, f = 0; d >= f; f++) c[l][f] = 0 === f && l === r ? E : n(E.clone().lerp(p, f / d))
}
for (l = 0; r > l; l++) for (f = 0; 2 * (r - l) - 1 > f; f++) i = Math.floor(f / 2),
0 === f % 2 ? o(c[l][i + 1], c[l + 1][i], c[l][i], u) : o(c[l][i + 1], c[l + 1][i + 1], c[l + 1][i], u)
}
function s(e, t, r) {
return 0 > r && 1 === e.x && (e = new THREE.Vector2(e.x - 1, e.y)),
0 === t.x && 0 === t.z && (e = new THREE.Vector2(r / 2 / Math.PI + 0.5, e.y)),
e.clone()
}
THREE.Geometry.call(this),
this.type = 'PolyhedronGeometry',
this.parameters = {
vertices: e,
indices: t,
radius: r,
detail: i
},
r = r || 1,
i = i || 0;
for (var h = this, c = 0, u = e.length; u > c; c += 3) n(new THREE.Vector3(e[c], e[c + 1], e[c + 2]));
e = this.vertices;
for (var l = [
], E = c = 0, u = t.length; u > c; c += 3, E++) {
var p = e[t[c]],
d = e[t[c + 1]],
f = e[t[c + 2]];
l[E] = new THREE.Face3(p.index, d.index, f.index, [
p.clone(),
d.clone(),
f.clone()
], void 0, E)
}
for (var m = new THREE.Vector3, c = 0, u = l.length; u > c; c++) a(l[c], i);
for (c = 0, u = this.faceVertexUvs[0].length; u > c; c++) t = this.faceVertexUvs[0][c],
i = t[0].x,
e = t[1].x,
l = t[2].x,
E = Math.max(i, e, l),
p = Math.min(i, e, l),
E > 0.9 && 0.1 > p && (0.2 > i && (t[0].x += 1), 0.2 > e && (t[1].x += 1), 0.2 > l && (t[2].x += 1));
for (c = 0, u = this.vertices.length; u > c; c++) this.vertices[c].multiplyScalar(r);
this.mergeVertices(),
this.computeFaceNormals(),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, r)
},
THREE.PolyhedronGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.PolyhedronGeometry.prototype.constructor = THREE.PolyhedronGeometry,
THREE.PolyhedronGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.PolyhedronGeometry(e.vertices, e.indices, e.radius, e.detail)
},
THREE.DodecahedronGeometry = function (e, t) {
var r = (1 + Math.sqrt(5)) / 2,
i = 1 / r;
THREE.PolyhedronGeometry.call(this, [
- 1,
- 1,
- 1,
- 1,
- 1,
1,
- 1,
1,
- 1,
- 1,
1,
1,
1,
- 1,
- 1,
1,
- 1,
1,
1,
1,
- 1,
1,
1,
1,
0,
- i,
- r,
0,
- i,
r,
0,
i,
- r,
0,
i,
r,
- i,
- r,
0,
- i,
r,
0,
i,
- r,
0,
i,
r,
0,
- r,
0,
- i,
r,
0,
- i,
- r,
0,
i,
r,
0,
i
], [
3,
11,
7,
3,
7,
15,
3,
15,
13,
7,
19,
17,
7,
17,
6,
7,
6,
15,
17,
4,
8,
17,
8,
10,
17,
10,
6,
8,
0,
16,
8,
16,
2,
8,
2,
10,
0,
12,
1,
0,
1,
18,
0,
18,
16,
6,
10,
2,
6,
2,
13,
6,
13,
15,
2,
16,
18,
2,
18,
3,
2,
3,
13,
18,
1,
9,
18,
9,
11,
18,
11,
3,
4,
14,
12,
4,
12,
0,
4,
0,
8,
11,
9,
5,
11,
5,
19,
11,
19,
7,
19,
5,
14,
19,
14,
4,
19,
4,
17,
1,
12,
14,
1,
14,
5,
1,
5,
9
], e, t),
this.type = 'DodecahedronGeometry',
this.parameters = {
radius: e,
detail: t
}
},
THREE.DodecahedronGeometry.prototype = Object.create(THREE.PolyhedronGeometry.prototype),
THREE.DodecahedronGeometry.prototype.constructor = THREE.DodecahedronGeometry,
THREE.DodecahedronGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.DodecahedronGeometry(e.radius, e.detail)
},
THREE.IcosahedronGeometry = function (e, t) {
var r = (1 + Math.sqrt(5)) / 2;
THREE.PolyhedronGeometry.call(this, [
- 1,
r,
0,
1,
r,
0,
- 1,
- r,
0,
1,
- r,
0,
0,
- 1,
r,
0,
1,
r,
0,
- 1,
- r,
0,
1,
- r,
r,
0,
- 1,
r,
0,
1,
- r,
0,
- 1,
- r,
0,
1
], [
0,
11,
5,
0,
5,
1,
0,
1,
7,
0,
7,
10,
0,
10,
11,
1,
5,
9,
5,
11,
4,
11,
10,
2,
10,
7,
6,
7,
1,
8,
3,
9,
4,
3,
4,
2,
3,
2,
6,
3,
6,
8,
3,
8,
9,
4,
9,
5,
2,
4,
11,
6,
2,
10,
8,
6,
7,
9,
8,
1
], e, t),
this.type = 'IcosahedronGeometry',
this.parameters = {
radius: e,
detail: t
}
},
THREE.IcosahedronGeometry.prototype = Object.create(THREE.PolyhedronGeometry.prototype),
THREE.IcosahedronGeometry.prototype.constructor = THREE.IcosahedronGeometry,
THREE.IcosahedronGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.IcosahedronGeometry(e.radius, e.detail)
},
THREE.OctahedronGeometry = function (e, t) {
THREE.PolyhedronGeometry.call(this, [
1,
0,
0,
- 1,
0,
0,
0,
1,
0,
0,
- 1,
0,
0,
0,
1,
0,
0,
- 1
], [
0,
2,
4,
0,
4,
3,
0,
3,
5,
0,
5,
2,
1,
2,
5,
1,
5,
3,
1,
3,
4,
1,
4,
2
], e, t),
this.type = 'OctahedronGeometry',
this.parameters = {
radius: e,
detail: t
}
},
THREE.OctahedronGeometry.prototype = Object.create(THREE.PolyhedronGeometry.prototype),
THREE.OctahedronGeometry.prototype.constructor = THREE.OctahedronGeometry,
THREE.OctahedronGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.OctahedronGeometry(e.radius, e.detail)
},
THREE.TetrahedronGeometry = function (e, t) {
THREE.PolyhedronGeometry.call(this, [
1,
1,
1,
- 1,
- 1,
1,
- 1,
1,
- 1,
1,
- 1,
- 1
], [
2,
1,
0,
0,
3,
2,
1,
3,
0,
2,
3,
1
], e, t),
this.type = 'TetrahedronGeometry',
this.parameters = {
radius: e,
detail: t
}
},
THREE.TetrahedronGeometry.prototype = Object.create(THREE.PolyhedronGeometry.prototype),
THREE.TetrahedronGeometry.prototype.constructor = THREE.TetrahedronGeometry,
THREE.TetrahedronGeometry.prototype.clone = function () {
var e = this.parameters;
return new THREE.TetrahedronGeometry(e.radius, e.detail)
},
THREE.ParametricGeometry = function (e, t, r) {
THREE.Geometry.call(this),
this.type = 'ParametricGeometry',
this.parameters = {
func: e,
slices: t,
stacks: r
};
var i,
n,
o,
a,
s = this.vertices,
h = this.faces,
c = this.faceVertexUvs[0],
u = t + 1;
for (i = 0; r >= i; i++) for (a = i / r, n = 0; t >= n; n++) o = n / t,
o = e(o, a),
s.push(o);
var l,
E,
p,
d;
for (i = 0; r > i; i++) for (n = 0; t > n; n++) e = i * u + n,
s = i * u + n + 1,
a = (i + 1) * u + n + 1,
o = (i + 1) * u + n,
l = new THREE.Vector2(n / t, i / r),
E = new THREE.Vector2((n + 1) / t, i / r),
p = new THREE.Vector2((n + 1) / t, (i + 1) / r),
d = new THREE.Vector2(n / t, (i + 1) / r),
h.push(new THREE.Face3(e, s, o)),
c.push([l,
E,
d]),
h.push(new THREE.Face3(s, a, o)),
c.push([E.clone(),
p,
d.clone()]);
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.ParametricGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ParametricGeometry.prototype.constructor = THREE.ParametricGeometry,
THREE.WireframeGeometry = function (e) {
function t(e, t) {
return e - t
}
THREE.BufferGeometry.call(this);
var r = [
0,
0
],
i = {
},
n = [
'a',
'b',
'c'
];
if (e instanceof THREE.Geometry) {
var o = e.vertices,
a = e.faces,
s = 0,
h = new Uint32Array(6 * a.length);
e = 0;
for (var c = a.length; c > e; e++) for (var u = a[e], l = 0; 3 > l; l++) {
r[0] = u[n[l]],
r[1] = u[n[(l + 1) % 3]],
r.sort(t);
var E = r.toString();
void 0 === i[E] && (h[2 * s] = r[0], h[2 * s + 1] = r[1], i[E] = !0, s++)
}
for (r = new Float32Array(6 * s), e = 0, c = s; c > e; e++) for (l = 0; 2 > l; l++) i = o[h[2 * e + l]],
s = 6 * e + 3 * l,
r[s + 0] = i.x,
r[s + 1] = i.y,
r[s + 2] = i.z;
this.addAttribute('position', new THREE.BufferAttribute(r, 3))
} else if (e instanceof THREE.BufferGeometry) {
if (null !== e.index) {
for (c = e.index.array, o = e.attributes.position, n = e.drawcalls, s = 0, 0 === n.length && e.addGroup(0, c.length), h = new Uint32Array(2 * c.length), a = 0, u = n.length; u > a; ++a) {
e = n[a],
l = e.start,
E = e.count,
e = l;
for (var p = l + E; p > e; e += 3) for (l = 0; 3 > l; l++) r[0] = c[e + l],
r[1] = c[e + (l + 1) % 3],
r.sort(t),
E = r.toString(),
void 0 === i[E] && (h[2 * s] = r[0], h[2 * s + 1] = r[1], i[E] = !0, s++)
}
for (r = new Float32Array(6 * s), e = 0, c = s; c > e; e++) for (l = 0; 2 > l; l++) s = 6 * e + 3 * l,
i = h[2 * e + l],
r[s + 0] = o.getX(i),
r[s + 1] = o.getY(i),
r[s + 2] = o.getZ(i)
} else for (o = e.attributes.position.array, s = o.length / 3, h = s / 3, r = new Float32Array(6 * s), e = 0, c = h; c > e; e++) for (l = 0; 3 > l; l++) s = 18 * e + 6 * l,
h = 9 * e + 3 * l,
r[s + 0] = o[h],
r[s + 1] = o[h + 1],
r[s + 2] = o[h + 2],
i = 9 * e + (l + 1) % 3 * 3,
r[s + 3] = o[i],
r[s + 4] = o[i + 1],
r[s + 5] = o[i + 2];
this.addAttribute('position', new THREE.BufferAttribute(r, 3))
}
},
THREE.WireframeGeometry.prototype = Object.create(THREE.BufferGeometry.prototype),
THREE.WireframeGeometry.prototype.constructor = THREE.WireframeGeometry,
THREE.AxisHelper = function (e) {
e = e || 1;
var t = new Float32Array([0,
0,
0,
e,
0,
0,
0,
0,
0,
0,
e,
0,
0,
0,
0,
0,
0,
e]),
r = new Float32Array([1,
0,
0,
1,
0.6,
0,
0,
1,
0,
0.6,
1,
0,
0,
0,
1,
0,
0.6,
1]);
e = new THREE.BufferGeometry,
e.addAttribute('position', new THREE.BufferAttribute(t, 3)),
e.addAttribute('color', new THREE.BufferAttribute(r, 3)),
t = new THREE.LineBasicMaterial({
vertexColors: THREE.VertexColors
}),
THREE.LineSegments.call(this, e, t)
},
THREE.AxisHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.AxisHelper.prototype.constructor = THREE.AxisHelper,
THREE.ArrowHelper = function () {
var e = new THREE.Geometry;
e.vertices.push(new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 1, 0));
var t = new THREE.CylinderGeometry(0, 0.5, 1, 5, 1);
return t.translate(0, - 0.5, 0),
function (r, i, n, o, a, s) {
THREE.Object3D.call(this),
void 0 === o && (o = 16776960),
void 0 === n && (n = 1),
void 0 === a && (a = 0.2 * n),
void 0 === s && (s = 0.2 * a),
this.position.copy(i),
n > a && (this.line = new THREE.Line(e, new THREE.LineBasicMaterial({
color: o
})), this.line.matrixAutoUpdate = !1, this.add(this.line)),
this.cone = new THREE.Mesh(t, new THREE.MeshBasicMaterial({
color: o
})),
this.cone.matrixAutoUpdate = !1,
this.add(this.cone),
this.setDirection(r),
this.setLength(n, a, s)
}
}(),
THREE.ArrowHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.ArrowHelper.prototype.constructor = THREE.ArrowHelper,
THREE.ArrowHelper.prototype.setDirection = function () {
var e,
t = new THREE.Vector3;
return function (r) {
0.99999 < r.y ? this.quaternion.set(0, 0, 0, 1) : - 0.99999 > r.y ? this.quaternion.set(1, 0, 0, 0) : (t.set(r.z, 0, - r.x).normalize(), e = Math.acos(r.y), this.quaternion.setFromAxisAngle(t, e))
}
}(),
THREE.ArrowHelper.prototype.setLength = function (e, t, r) {
void 0 === t && (t = 0.2 * e),
void 0 === r && (r = 0.2 * t),
e > t && (this.line.scale.set(1, e - t, 1), this.line.updateMatrix()),
this.cone.scale.set(r, t, r),
this.cone.position.y = e,
this.cone.updateMatrix()
},
THREE.ArrowHelper.prototype.setColor = function (e) {
void 0 !== this.line && this.line.material.color.set(e),
this.cone.material.color.set(e)
},
THREE.BoxHelper = function (e) {
var t = new Uint16Array([0,
1,
1,
2,
2,
3,
3,
0,
4,
5,
5,
6,
6,
7,
7,
4,
0,
4,
1,
5,
2,
6,
3,
7]),
r = new Float32Array(24),
i = new THREE.BufferGeometry;
i.setIndex(new THREE.BufferAttribute(t, 1)),
i.addAttribute('position', new THREE.BufferAttribute(r, 3)),
THREE.LineSegments.call(this, i, new THREE.LineBasicMaterial({
color: 16776960
})),
void 0 !== e && this.update(e)
},
THREE.BoxHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.BoxHelper.prototype.constructor = THREE.BoxHelper,
THREE.BoxHelper.prototype.update = function () {
var e = new THREE.Box3;
return function (t) {
if (e.setFromObject(t), !e.empty()) {
t = e.min;
var r = e.max,
i = this.geometry.attributes.position,
n = i.array;
n[0] = r.x,
n[1] = r.y,
n[2] = r.z,
n[3] = t.x,
n[4] = r.y,
n[5] = r.z,
n[6] = t.x,
n[7] = t.y,
n[8] = r.z,
n[9] = r.x,
n[10] = t.y,
n[11] = r.z,
n[12] = r.x,
n[13] = r.y,
n[14] = t.z,
n[15] = t.x,
n[16] = r.y,
n[17] = t.z,
n[18] = t.x,
n[19] = t.y,
n[20] = t.z,
n[21] = r.x,
n[22] = t.y,
n[23] = t.z,
i.needsUpdate = !0,
this.geometry.computeBoundingSphere()
}
}
}(),
THREE.BoundingBoxHelper = function (e, t) {
var r = void 0 !== t ? t : 8947848;
this.object = e,
this.box = new THREE.Box3,
THREE.Mesh.call(this, new THREE.BoxGeometry(1, 1, 1), new THREE.MeshBasicMaterial({
color: r,
wireframe: !0
}))
},
THREE.BoundingBoxHelper.prototype = Object.create(THREE.Mesh.prototype),
THREE.BoundingBoxHelper.prototype.constructor = THREE.BoundingBoxHelper,
THREE.BoundingBoxHelper.prototype.update = function () {
this.box.setFromObject(this.object),
this.box.size(this.scale),
this.box.center(this.position)
},
THREE.CameraHelper = function (e) {
function t(e, t, i) {
r(e, i),
r(t, i)
}
function r(e, t) {
i.vertices.push(new THREE.Vector3),
i.colors.push(new THREE.Color(t)),
void 0 === o[e] && (o[e] = [
]),
o[e].push(i.vertices.length - 1)
}
var i = new THREE.Geometry,
n = new THREE.LineBasicMaterial({
color: 16777215,
vertexColors: THREE.FaceColors
}),
o = {
};
t('n1', 'n2', 16755200),
t('n2', 'n4', 16755200),
t('n4', 'n3', 16755200),
t('n3', 'n1', 16755200),
t('f1', 'f2', 16755200),
t('f2', 'f4', 16755200),
t('f4', 'f3', 16755200),
t('f3', 'f1', 16755200),
t('n1', 'f1', 16755200),
t('n2', 'f2', 16755200),
t('n3', 'f3', 16755200),
t('n4', 'f4', 16755200),
t('p', 'n1', 16711680),
t('p', 'n2', 16711680),
t('p', 'n3', 16711680),
t('p', 'n4', 16711680),
t('u1', 'u2', 43775),
t('u2', 'u3', 43775),
t('u3', 'u1', 43775),
t('c', 't', 16777215),
t('p', 'c', 3355443),
t('cn1', 'cn2', 3355443),
t('cn3', 'cn4', 3355443),
t('cf1', 'cf2', 3355443),
t('cf3', 'cf4', 3355443),
THREE.LineSegments.call(this, i, n),
this.camera = e,
this.camera.updateProjectionMatrix(),
this.matrix = e.matrixWorld,
this.matrixAutoUpdate = !1,
this.pointMap = o,
this.update()
},
THREE.CameraHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.CameraHelper.prototype.constructor = THREE.CameraHelper,
THREE.CameraHelper.prototype.update = function () {
function e(e, o, a, s) {
if (i.set(o, a, s).unproject(n), e = r[e], void 0 !== e) for (o = 0, a = e.length; a > o; o++) t.vertices[e[o]].copy(i)
}
var t,
r,
i = new THREE.Vector3,
n = new THREE.Camera;
return function () {
t = this.geometry,
r = this.pointMap,
n.projectionMatrix.copy(this.camera.projectionMatrix),
e('c', 0, 0, - 1),
e('t', 0, 0, 1),
e('n1', - 1, - 1, - 1),
e('n2', 1, - 1, - 1),
e('n3', - 1, 1, - 1),
e('n4', 1, 1, - 1),
e('f1', - 1, - 1, 1),
e('f2', 1, - 1, 1),
e('f3', - 1, 1, 1),
e('f4', 1, 1, 1),
e('u1', 0.7, 1.1, - 1),
e('u2', - 0.7, 1.1, - 1),
e('u3', 0, 2, - 1),
e('cf1', - 1, 0, 1),
e('cf2', 1, 0, 1),
e('cf3', 0, - 1, 1),
e('cf4', 0, 1, 1),
e('cn1', - 1, 0, - 1),
e('cn2', 1, 0, - 1),
e('cn3', 0, - 1, - 1),
e('cn4', 0, 1, - 1),
t.verticesNeedUpdate = !0
}
}(),
THREE.DirectionalLightHelper = function (e, t) {
THREE.Object3D.call(this),
this.light = e,
this.light.updateMatrixWorld(),
this.matrix = e.matrixWorld,
this.matrixAutoUpdate = !1,
t = t || 1;
var r = new THREE.Geometry;
r.vertices.push(new THREE.Vector3( - t, t, 0), new THREE.Vector3(t, t, 0), new THREE.Vector3(t, - t, 0), new THREE.Vector3( - t, - t, 0), new THREE.Vector3( - t, t, 0));
var i = new THREE.LineBasicMaterial({
fog: !1
});
i.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.lightPlane = new THREE.Line(r, i),
this.add(this.lightPlane),
r = new THREE.Geometry,
r.vertices.push(new THREE.Vector3, new THREE.Vector3),
i = new THREE.LineBasicMaterial({
fog: !1
}),
i.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.targetLine = new THREE.Line(r, i),
this.add(this.targetLine),
this.update()
},
THREE.DirectionalLightHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.DirectionalLightHelper.prototype.constructor = THREE.DirectionalLightHelper,
THREE.DirectionalLightHelper.prototype.dispose = function () {
this.lightPlane.geometry.dispose(),
this.lightPlane.material.dispose(),
this.targetLine.geometry.dispose(),
this.targetLine.material.dispose()
},
THREE.DirectionalLightHelper.prototype.update = function () {
var e = new THREE.Vector3,
t = new THREE.Vector3,
r = new THREE.Vector3;
return function () {
e.setFromMatrixPosition(this.light.matrixWorld),
t.setFromMatrixPosition(this.light.target.matrixWorld),
r.subVectors(t, e),
this.lightPlane.lookAt(r),
this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.targetLine.geometry.vertices[1].copy(r),
this.targetLine.geometry.verticesNeedUpdate = !0,
this.targetLine.material.color.copy(this.lightPlane.material.color)
}
}(),
THREE.EdgesHelper = function (e, t, r) {
t = void 0 !== t ? t : 16777215,
THREE.LineSegments.call(this, new THREE.EdgesGeometry(e.geometry, r), new THREE.LineBasicMaterial({
color: t
})),
this.matrix = e.matrixWorld,
this.matrixAutoUpdate = !1
},
THREE.EdgesHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.EdgesHelper.prototype.constructor = THREE.EdgesHelper,
THREE.FaceNormalsHelper = function (e, t, r, i) {
this.object = e,
this.size = void 0 !== t ? t : 1,
e = void 0 !== r ? r : 16776960,
i = void 0 !== i ? i : 1,
t = 0,
r = this.object.geometry,
r instanceof THREE.Geometry ? t = r.faces.length : console.warn('THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.'),
r = new THREE.BufferGeometry,
t = new THREE.Float32Attribute(6 * t, 3),
r.addAttribute('position', t),
THREE.LineSegments.call(this, r, new THREE.LineBasicMaterial({
color: e,
linewidth: i
})),
this.matrixAutoUpdate = !1,
this.update()
},
THREE.FaceNormalsHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.FaceNormalsHelper.prototype.constructor = THREE.FaceNormalsHelper,
THREE.FaceNormalsHelper.prototype.update = function () {
var e = new THREE.Vector3,
t = new THREE.Vector3,
r = new THREE.Matrix3;
return function () {
this.object.updateMatrixWorld(!0),
r.getNormalMatrix(this.object.matrixWorld);
for (var i = this.object.matrixWorld, n = this.geometry.attributes.position, o = this.object.geometry, a = o.vertices, o = o.faces, s = 0, h = 0, c = o.length; c > h; h++) {
var u = o[h],
l = u.normal;
e.copy(a[u.a]).add(a[u.b]).add(a[u.c]).divideScalar(3).applyMatrix4(i),
t.copy(l).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),
n.setXYZ(s, e.x, e.y, e.z),
s += 1,
n.setXYZ(s, t.x, t.y, t.z),
s += 1
}
return n.needsUpdate = !0,
this
}
}(),
THREE.GridHelper = function (e, t) {
var r = new THREE.Geometry,
i = new THREE.LineBasicMaterial({
vertexColors: THREE.VertexColors
});
this.color1 = new THREE.Color(4473924),
this.color2 = new THREE.Color(8947848);
for (var n = - e; e >= n; n += t) {
r.vertices.push(new THREE.Vector3( - e, 0, n), new THREE.Vector3(e, 0, n), new THREE.Vector3(n, 0, - e), new THREE.Vector3(n, 0, e));
var o = 0 === n ? this.color1 : this.color2;
r.colors.push(o, o, o, o)
}
THREE.LineSegments.call(this, r, i)
},
THREE.GridHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.GridHelper.prototype.constructor = THREE.GridHelper,
THREE.GridHelper.prototype.setColors = function (e, t) {
this.color1.set(e),
this.color2.set(t),
this.geometry.colorsNeedUpdate = !0
},
THREE.HemisphereLightHelper = function (e, t) {
THREE.Object3D.call(this),
this.light = e,
this.light.updateMatrixWorld(),
this.matrix = e.matrixWorld,
this.matrixAutoUpdate = !1,
this.colors = [
new THREE.Color,
new THREE.Color
];
var r = new THREE.SphereGeometry(t, 4, 2);
r.rotateX( - Math.PI / 2);
for (var i = 0; 8 > i; i++) r.faces[i].color = this.colors[4 > i ? 0 : 1];
i = new THREE.MeshBasicMaterial({
vertexColors: THREE.FaceColors,
wireframe: !0
}),
this.lightSphere = new THREE.Mesh(r, i),
this.add(this.lightSphere),
this.update()
},
THREE.HemisphereLightHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.HemisphereLightHelper.prototype.constructor = THREE.HemisphereLightHelper,
THREE.HemisphereLightHelper.prototype.dispose = function () {
this.lightSphere.geometry.dispose(),
this.lightSphere.material.dispose()
},
THREE.HemisphereLightHelper.prototype.update = function () {
var e = new THREE.Vector3;
return function () {
this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),
this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),
this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),
this.lightSphere.geometry.colorsNeedUpdate = !0
}
}(),
THREE.PointLightHelper = function (e, t) {
this.light = e,
this.light.updateMatrixWorld();
var r = new THREE.SphereGeometry(t, 4, 2),
i = new THREE.MeshBasicMaterial({
wireframe: !0,
fog: !1
});
i.color.copy(this.light.color).multiplyScalar(this.light.intensity),
THREE.Mesh.call(this, r, i),
this.matrix = this.light.matrixWorld,
this.matrixAutoUpdate = !1
},
THREE.PointLightHelper.prototype = Object.create(THREE.Mesh.prototype),
THREE.PointLightHelper.prototype.constructor = THREE.PointLightHelper,
THREE.PointLightHelper.prototype.dispose = function () {
this.geometry.dispose(),
this.material.dispose()
},
THREE.PointLightHelper.prototype.update = function () {
this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)
},
THREE.SkeletonHelper = function (e) {
this.bones = this.getBoneList(e);
for (var t = new THREE.Geometry, r = 0; r < this.bones.length; r++) this.bones[r].parent instanceof THREE.Bone && (t.vertices.push(new THREE.Vector3), t.vertices.push(new THREE.Vector3), t.colors.push(new THREE.Color(0, 0, 1)), t.colors.push(new THREE.Color(0, 1, 0)));
t.dynamic = !0,
r = new THREE.LineBasicMaterial({
vertexColors: THREE.VertexColors,
depthTest: !1,
depthWrite: !1,
transparent: !0
}),
THREE.LineSegments.call(this, t, r),
this.root = e,
this.matrix = e.matrixWorld,
this.matrixAutoUpdate = !1,
this.update()
},
THREE.SkeletonHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.SkeletonHelper.prototype.constructor = THREE.SkeletonHelper,
THREE.SkeletonHelper.prototype.getBoneList = function (e) {
var t = [
];
e instanceof THREE.Bone && t.push(e);
for (var r = 0; r < e.children.length; r++) t.push.apply(t, this.getBoneList(e.children[r]));
return t
},
THREE.SkeletonHelper.prototype.update = function () {
for (var e = this.geometry, t = (new THREE.Matrix4).getInverse(this.root.matrixWorld), r = new THREE.Matrix4, i = 0, n = 0; n < this.bones.length; n++) {
var o = this.bones[n];
o.parent instanceof THREE.Bone && (r.multiplyMatrices(t, o.matrixWorld), e.vertices[i].setFromMatrixPosition(r), r.multiplyMatrices(t, o.parent.matrixWorld), e.vertices[i + 1].setFromMatrixPosition(r), i += 2)
}
e.verticesNeedUpdate = !0,
e.computeBoundingSphere()
},
THREE.SpotLightHelper = function (e) {
THREE.Object3D.call(this),
this.light = e,
this.light.updateMatrixWorld(),
this.matrix = e.matrixWorld,
this.matrixAutoUpdate = !1,
e = new THREE.CylinderGeometry(0, 1, 1, 8, 1, !0),
e.translate(0, - 0.5, 0),
e.rotateX( - Math.PI / 2);
var t = new THREE.MeshBasicMaterial({
wireframe: !0,
fog: !1
});
this.cone = new THREE.Mesh(e, t),
this.add(this.cone),
this.update()
},
THREE.SpotLightHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.SpotLightHelper.prototype.constructor = THREE.SpotLightHelper,
THREE.SpotLightHelper.prototype.dispose = function () {
this.cone.geometry.dispose(),
this.cone.material.dispose()
},
THREE.SpotLightHelper.prototype.update = function () {
var e = new THREE.Vector3,
t = new THREE.Vector3;
return function () {
var r = this.light.distance ? this.light.distance : 10000,
i = r * Math.tan(this.light.angle);
this.cone.scale.set(i, i, r),
e.setFromMatrixPosition(this.light.matrixWorld),
t.setFromMatrixPosition(this.light.target.matrixWorld),
this.cone.lookAt(t.sub(e)),
this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)
}
}(),
THREE.VertexNormalsHelper = function (e, t, r, i) {
this.object = e,
this.size = void 0 !== t ? t : 1,
e = void 0 !== r ? r : 16711680,
i = void 0 !== i ? i : 1,
t = 0,
r = this.object.geometry,
r instanceof THREE.Geometry ? t = 3 * r.faces.length : r instanceof THREE.BufferGeometry && (t = r.attributes.normal.count),
r = new THREE.BufferGeometry,
t = new THREE.Float32Attribute(6 * t, 3),
r.addAttribute('position', t),
THREE.LineSegments.call(this, r, new THREE.LineBasicMaterial({
color: e,
linewidth: i
})),
this.matrixAutoUpdate = !1,
this.update()
},
THREE.VertexNormalsHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.VertexNormalsHelper.prototype.constructor = THREE.VertexNormalsHelper,
THREE.VertexNormalsHelper.prototype.update = function () {
var e = new THREE.Vector3,
t = new THREE.Vector3,
r = new THREE.Matrix3;
return function () {
var i = [
'a',
'b',
'c'
];
this.object.updateMatrixWorld(!0),
r.getNormalMatrix(this.object.matrixWorld);
var n = this.object.matrixWorld,
o = this.geometry.attributes.position,
a = this.object.geometry;
if (a instanceof THREE.Geometry) for (var s = a.vertices, h = a.faces, c = a = 0, u = h.length; u > c; c++) for (var l = h[c], E = 0, p = l.vertexNormals.length; p > E; E++) {
var d = l.vertexNormals[E];
e.copy(s[l[i[E]]]).applyMatrix4(n),
t.copy(d).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),
o.setXYZ(a, e.x, e.y, e.z),
a += 1,
o.setXYZ(a, t.x, t.y, t.z),
a += 1
} else if (a instanceof THREE.BufferGeometry) for (i = a.attributes.position, s = a.attributes.normal, E = a = 0, p = i.count; p > E; E++) e.set(i.getX(E), i.getY(E), i.getZ(E)).applyMatrix4(n),
t.set(s.getX(E), s.getY(E), s.getZ(E)),
t.applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),
o.setXYZ(a, e.x, e.y, e.z),
a += 1,
o.setXYZ(a, t.x, t.y, t.z),
a += 1;
return o.needsUpdate = !0,
this
}
}(),
THREE.WireframeHelper = function (e, t) {
var r = void 0 !== t ? t : 16777215;
THREE.LineSegments.call(this, new THREE.WireframeGeometry(e.geometry), new THREE.LineBasicMaterial({
color: r
})),
this.matrix = e.matrixWorld,
this.matrixAutoUpdate = !1
},
THREE.WireframeHelper.prototype = Object.create(THREE.LineSegments.prototype),
THREE.WireframeHelper.prototype.constructor = THREE.WireframeHelper,
THREE.ImmediateRenderObject = function (e) {
THREE.Object3D.call(this),
this.material = e,
this.render = function (e) {
}
},
THREE.ImmediateRenderObject.prototype = Object.create(THREE.Object3D.prototype),
THREE.ImmediateRenderObject.prototype.constructor = THREE.ImmediateRenderObject,
THREE.MorphBlendMesh = function (e, t) {
THREE.Mesh.call(this, e, t),
this.animationsMap = {
},
this.animationsList = [
];
var r = this.geometry.morphTargets.length;
this.createAnimation('__default', 0, r - 1, r / 1),
this.setAnimationWeight('__default', 1)
},
THREE.MorphBlendMesh.prototype = Object.create(THREE.Mesh.prototype),
THREE.MorphBlendMesh.prototype.constructor = THREE.MorphBlendMesh,
THREE.MorphBlendMesh.prototype.createAnimation = function (e, t, r, i) {
t = {
start: t,
end: r,
length: r - t + 1,
fps: i,
duration: (r - t) / i,
lastFrame: 0,
currentFrame: 0,
active: !1,
time: 0,
direction: 1,
weight: 1,
directionBackwards: !1,
mirroredLoop: !1
},
this.animationsMap[e] = t,
this.animationsList.push(t)
},
THREE.MorphBlendMesh.prototype.autoCreateAnimations = function (e) {
for (var t, r = /([a-z]+)_?(\d+)/, i = {
}, n = this.geometry, o = 0, a = n.morphTargets.length; a > o; o++) {
var s = n.morphTargets[o].name.match(r);
if (s && 1 < s.length) {
var h = s[1];
i[h] || (i[h] = {
start: 1 / 0,
end: - (1 / 0)
}),
s = i[h],
o < s.start && (s.start = o),
o > s.end && (s.end = o),
t || (t = h)
}
}
for (h in i) s = i[h],
this.createAnimation(h, s.start, s.end, e);
this.firstAnimation = t
},
THREE.MorphBlendMesh.prototype.setAnimationDirectionForward = function (e) {
(e = this.animationsMap[e]) && (e.direction = 1, e.directionBackwards = !1)
},
THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward = function (e) {
(e = this.animationsMap[e]) && (e.direction = - 1, e.directionBackwards = !0)
},
THREE.MorphBlendMesh.prototype.setAnimationFPS = function (e, t) {
var r = this.animationsMap[e];
r && (r.fps = t, r.duration = (r.end - r.start) / r.fps)
},
THREE.MorphBlendMesh.prototype.setAnimationDuration = function (e, t) {
var r = this.animationsMap[e];
r && (r.duration = t, r.fps = (r.end - r.start) / r.duration)
},
THREE.MorphBlendMesh.prototype.setAnimationWeight = function (e, t) {
var r = this.animationsMap[e];
r && (r.weight = t)
},
THREE.MorphBlendMesh.prototype.setAnimationTime = function (e, t) {
var r = this.animationsMap[e];
r && (r.time = t)
},
THREE.MorphBlendMesh.prototype.getAnimationTime = function (e) {
var t = 0;
return (e = this.animationsMap[e]) && (t = e.time),
t
},
THREE.MorphBlendMesh.prototype.getAnimationDuration = function (e) {
var t = - 1;
return (e = this.animationsMap[e]) && (t = e.duration),
t
},
THREE.MorphBlendMesh.prototype.playAnimation = function (e) {
var t = this.animationsMap[e];
t ? (t.time = 0, t.active = !0) : console.warn('THREE.MorphBlendMesh: animation[' + e + '] undefined in .playAnimation()')
},
THREE.MorphBlendMesh.prototype.stopAnimation = function (e) {
(e = this.animationsMap[e]) && (e.active = !1)
},
THREE.MorphBlendMesh.prototype.update = function (e) {
for (var t = 0, r = this.animationsList.length; r > t; t++) {
var i = this.animationsList[t];
if (i.active) {
var n = i.duration / i.length;
i.time += i.direction * e,
i.mirroredLoop ? (i.time > i.duration || 0 > i.time) && (i.direction *= - 1, i.time > i.duration && (i.time = i.duration, i.directionBackwards = !0), 0 > i.time && (i.time = 0, i.directionBackwards = !1)) : (i.time %= i.duration, 0 > i.time && (i.time += i.duration));
var o = i.start + THREE.Math.clamp(Math.floor(i.time / n), 0, i.length - 1),
a = i.weight;
o !== i.currentFrame && (this.morphTargetInfluences[i.lastFrame] = 0, this.morphTargetInfluences[i.currentFrame] = 1 * a, this.morphTargetInfluences[o] = 0, i.lastFrame = i.currentFrame, i.currentFrame = o),
n = i.time % n / n,
i.directionBackwards && (n = 1 - n),
i.currentFrame !== i.lastFrame ? (this.morphTargetInfluences[i.currentFrame] = n * a, this.morphTargetInfluences[i.lastFrame] = (1 - n) * a) : this.morphTargetInfluences[i.currentFrame] = a
}
}
},
define('_libs/three.min', function () {
}),
define('refraction/_libs/OBJLoader', [
], function () {
OBJLoader = function (e) {
this.manager = void 0 !== e ? e : THREE.DefaultLoadingManager
},
OBJLoader.prototype = {
constructor: OBJLoader,
load: function (e, t, r, i) {
var n = this,
o = new THREE.XHRLoader(n.manager);
o.setCrossOrigin(this.crossOrigin),
o.load(e, function (e) {
t(n.parse(e))
}, r, i)
},
parse: function (e) {
function t(e) {
var t = parseInt(e);
return 3 * (t >= 0 ? t - 1 : t + E.length / 3)
}
function r(e) {
var t = parseInt(e);
return 3 * (t >= 0 ? t - 1 : t + p.length / 3)
}
function i(e) {
var t = parseInt(e);
return 2 * (t >= 0 ? t - 1 : t + d.length / 2)
}
function n(e, t, r) {
c.vertices.push(E[e], E[e + 1], E[e + 2], E[t], E[t + 1], E[t + 2], E[r], E[r + 1], E[r + 2])
}
function o(e, t, r) {
c.normals.push(p[e], p[e + 1], p[e + 2], p[t], p[t + 1], p[t + 2], p[r], p[r + 1], p[r + 2])
}
function a(e, t, r) {
c.uvs.push(d[e], d[e + 1], d[t], d[t + 1], d[r], d[r + 1])
}
function s(e, s, h, c, u, l, E, p, d, f, m, T) {
var g,
v = t(e),
y = t(s),
R = t(h);
void 0 === c ? n(v, y, R) : (g = t(c), n(v, y, g), n(y, R, g)),
void 0 !== u && (v = i(u), y = i(l), R = i(E), void 0 === c ? a(v, y, R) : (g = i(p), a(v, y, g), a(y, R, g))),
void 0 !== d && (v = r(d), y = r(f), R = r(m), void 0 === c ? o(v, y, R) : (g = r(T), o(v, y, g), o(y, R, g)))
}
console.time('OBJLoader');
var h,
c,
u,
l = [
];
/^o /gm.test(e) === !1 && (c = {
vertices: [
],
normals: [
],
uvs: [
]
}, u = {
name: ''
}, h = {
name: '',
geometry: c,
material: u
}, l.push(h));
for (var E = [
], p = [
], d = [
], f = /v( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/, m = /vn( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/, T = /vt( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/, g = /f( +-?\d+)( +-?\d+)( +-?\d+)( +-?\d+)?/, v = /f( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))?/, y = /f( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))?/, R = /f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/, H = e.split('\n'), x = 0; x < H.length; x++) {
var b = H[x];
b = b.trim();
var _;
0 !== b.length && '#' !== b.charAt(0) && (null !== (_ = f.exec(b)) ? E.push(parseFloat(_[1]), parseFloat(_[2]), parseFloat(_[3])) : null !== (_ = m.exec(b)) ? p.push(parseFloat(_[1]), parseFloat(_[2]), parseFloat(_[3])) : null !== (_ = T.exec(b)) ? d.push(parseFloat(_[1]), parseFloat(_[2])) : null !== (_ = g.exec(b)) ? s(_[1], _[2], _[3], _[4]) : null !== (_ = v.exec(b)) ? s(_[2], _[5], _[8], _[11], _[3], _[6], _[9], _[12]) : null !== (_ = y.exec(b)) ? s(_[2], _[6], _[10], _[14], _[3], _[7], _[11], _[15], _[4], _[8], _[12], _[16]) : null !== (_ = R.exec(b)) ? s(_[2], _[5], _[8], _[11], void 0, void 0, void 0, void 0, _[3], _[6], _[9], _[12]) : /^o /.test(b) ? (c = {
vertices: [
],
normals: [
],
uvs: [
]
}, u = {
name: ''
}, h = {
name: b.substring(2).trim(),
geometry: c,
material: u
}, l.push(h)) : /^g /.test(b) || (/^usemtl /.test(b) ? u.name = b.substring(7).trim() : /^mtllib /.test(b) || /^s /.test(b)))
}
for (var w = new THREE.Object3D, x = 0, M = l.length; M > x; x++) {
h = l[x],
c = h.geometry;
var S = new THREE.BufferGeometry;
S.addAttribute('position', new THREE.BufferAttribute(new Float32Array(c.vertices), 3)),
c.normals.length > 0 && S.addAttribute('normal', new THREE.BufferAttribute(new Float32Array(c.normals), 3)),
c.uvs.length > 0 && S.addAttribute('uv', new THREE.BufferAttribute(new Float32Array(c.uvs), 2)),
u = new THREE.MeshLambertMaterial,
u.name = h.material.name;
var A = new THREE.Mesh(S, u);
A.name = h.name,
w.add(A)
}
return console.timeEnd('OBJLoader'),
w
}
}
}),
define('css', [
], function () {
if ('undefined' == typeof window) return {
load: function (e, t, r) {
r()
}
};
var e = document.getElementsByTagName('head') [0],
t = window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/) || 0,
r = !1,
i = !0;
t[1] || t[7] ? r = parseInt(t[1]) < 6 || parseInt(t[7]) <= 9 : t[2] || t[8] ? i = !1 : t[4] && (r = parseInt(t[4]) < 18);
var n,
o,
a,
s = {
},
h = function () {
n = document.createElement('style'),
e.appendChild(n),
o = n.styleSheet || n.sheet
},
c = 0,
u = [
],
l = function (e) {
c++,
32 == c && (h(), c = 0),
o.addImport(e),
n.onload = function () {
E()
}
},
E = function () {
a();
var e = u.shift();
return e ? (a = e[1], void l(e[0])) : void (a = null)
},
p = function (e, t) {
if (o && o.addImport || h(), o && o.addImport) a ? u.push([e,
t]) : (l(e), a = t);
else {
n.textContent = '@import "' + e + '";';
var r = setInterval(function () {
try {
n.sheet.cssRules,
clearInterval(r),
t()
} catch (e) {
}
}, 10)
}
},
d = function (t, r) {
var n = document.createElement('link');
if (n.type = 'text/css', n.rel = 'stylesheet', i) n.onload = function () {
n.onload = function () {
},
setTimeout(r, 7)
};
else var o = setInterval(function () {
for (var e = 0; e < document.styleSheets.length; e++) {
var t = document.styleSheets[e];
if (t.href == n.href) return clearInterval(o),
r()
}
}, 10);
n.href = t,
e.appendChild(n)
};
return s.normalize = function (e, t) {
return '.css' == e.substr(e.length - 4, 4) && (e = e.substr(0, e.length - 4)),
t(e)
},
s.load = function (e, t, i) {
(r ? p : d) (t.toUrl(e + '.css'), i)
},
s
}),
define('refraction/main', [
'text!refraction/template.html',
'_libs/three.min',
'refraction/_libs/OBJLoader',
'css!/_jsapps/backdrop/refraction/style'
], function (e) {
var t = Backbone.View.extend({
template: _.template(e),
deferredLoadEventName: 'refraction-load-complete',
defaults: {
image: '//payload.persona.co/assets/backdrop/venus.jpg',
reflection_type: 'reflection',
flip: !0,
refraction_ratio: 19,
mouse_interaction: !0,
mouse_speed: 63,
refract_interaction: !1,
refract_motion: 'speed',
geometry: 'shard',
zoom: 130,
rot_x: 145,
rot_y: 195,
rot_z: 115,
rot_speed_x: 3.5,
rot_speed_y: - 1.5,
rot_speed_z: 2,
color: 'rgba(255,255,255,1)',
rgb: 'rgb(255,255,255)',
color_r: '255',
color_g: '255',
color_b: '255',
alpha: '1',
overlay_type: 'multiply_color',
plugin_id: 20
},
image_load_queue: [
],
data: {
is_running: !1,
counter: 0,
dimensions: {
left: 0,
top: 0,
width: 800,
height: 600,
resolution: 1,
aspect: 1.33,
inverse_aspect: 0.75
},
image_dimensions: {
width: 800,
height: 600,
aspect: 1.33,
inverse_aspect: 0.75
},
mouse: {
prev: {
x: 0,
y: 0,
vector_length: 0
},
current: {
x: 0,
y: 0,
vector_length: 0
},
smoothed_vector_array: [
0,
0,
0,
0,
0
],
inited: !1
},
inited: !1,
init_start: !1,
image_loaded: !1,
object_loaded: !1
},
three_data: {
},
cube_data: {
},
makeMaterial: function () {
0 != this.data.inited && (this.model.get('flip') ? (this.cube_data.cube.material.materials[0].map.flipY = !1, this.cube_data.cube.material.materials[1].map.flipY = !1, this.cube_data.cube.material.materials[2].map.flipY = !1, this.cube_data.cube.material.materials[3].map.flipY = !1, this.cube_data.cube.material.materials[4].map.flipY = !1, 'refraction' == this.model.get('reflection_type') ? this.cube_data.plane.material.map.flipY = !1 : this.cube_data.plane.material.map.flipY = !0) : (this.cube_data.cube.material.materials[0].map.flipY = !0, this.cube_data.cube.material.materials[1].map.flipY = !0, this.cube_data.cube.material.materials[2].map.flipY = !0, this.cube_data.cube.material.materials[3].map.flipY = !0, this.cube_data.cube.material.materials[4].map.flipY = !0, 'refraction' == this.model.get('reflection_type') ? this.cube_data.plane.material.map.flipY = !0 : this.cube_data.plane.material.map.flipY = !1), this.cube_data.cube.material.materials[0].map.needsUpdate = !0, this.cube_data.cube.material.materials[1].map.needsUpdate = !0, this.cube_data.cube.material.materials[2].map.needsUpdate = !0, this.cube_data.cube.material.materials[3].map.needsUpdate = !0, this.cube_data.cube.material.materials[4].map.needsUpdate = !0, this.cube_data.plane.material.map.needsUpdate = !0, 'reflection' == this.model.get('reflection_type') ? (this.cube_data.cube_camera.renderTarget.mapping = THREE.CubeReflectionMapping, this.cube_data.cube.rotation.x = 0, this.cube_data.cube.rotation.y = Math.PI, this.cube_data.cube.rotation.z = 0, this.cube_data.plane.rotation.x = 0, this.cube_data.plane.rotation.y = Math.PI, this.cube_data.plane.rotation.z = 0, this.cube_data.plane.position.z = 0.5) : (this.cube_data.cube_camera.renderTarget.mapping = THREE.CubeRefractionMapping, this.cube_data.cube_camera.renderTarget.texture.repeat.y = 1, this.cube_data.cube.rotation.x = 0, this.cube_data.cube.rotation.z = 0, this.cube_data.cube.rotation.y = 0, this.cube_data.plane.rotation.x = 0, this.cube_data.plane.rotation.y = 0, this.cube_data.plane.position.z = - 0.5), this.data.cubemap_needs_update = !0, this.three_data.render_object.material.envMap = this.cube_data.cube_camera.renderTarget, this.three_data.render_object.material.needsUpdate = !0)
},
setUpScene: function () {
this.updateWindow(!0),
this.three_data.max_refraction_ratio = 1 - this.model.get('refraction_ratio') / 100,
this.three_data.renderer.domElement.id = 'three_canvas',
this.three_data.renderer.setPixelRatio(window.devicePixelRatio),
this.updateWindow(!0),
this.three_data.renderer.sortObjects = !1,
this.el.appendChild(this.three_data.renderer.domElement);
var e = [
new THREE.MeshBasicMaterial({
map: this.cube_data.cube_texture,
side: THREE.BackSide
}),
new THREE.MeshBasicMaterial({
map: this.cube_data.cube_texture,
side: THREE.BackSide
}),
new THREE.MeshBasicMaterial({
map: this.cube_data.cube_texture,
side: THREE.BackSide
}),
new THREE.MeshBasicMaterial({
map: this.cube_data.cube_texture,
side: THREE.BackSide
}),
new THREE.MeshBasicMaterial({
map: this.cube_data.cube_texture,
side: THREE.BackSide
}),
new THREE.MeshBasicMaterial({
})
];
this.cube_data.cube = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshFaceMaterial(e)),
this.cube_data.plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1, 1, 1), new THREE.MeshBasicMaterial({
map: this.cube_data.cube_texture,
side: THREE.FrontSide
})),
this.cube_data.cube.position.z = 0,
this.cube_data.scene.add(this.cube_data.cube),
this.cube_data.plane.position.z = - 0.5,
this.cube_data.scene.add(this.cube_data.plane),
this.cube_data.cube_camera.renderTarget.texture.minFilter = THREE.LinearFilter,
this.cube_data.cube_camera.renderTarget.texture.magFilter = THREE.LinearFilter,
this.cube_data.scene.add(this.cube_data.cube_camera),
this.three_data.camera.position.z = 0.2,
this.data.inited = !0,
this.makeMaterial(),
this.three_data.parent_object.position.z = 0,
this.three_data.parent_object.add(this.three_data.render_object),
this.three_data.scene.add(this.three_data.parent_object),
this.cube_data.cube_camera.updateCubeMap(this.three_data.renderer, this.cube_data.scene),
this.updateWindow(!0),
this.draw(),
Cargo.Event.trigger(this.deferredLoadEventName)
},
getOverlayType: function () {
var e = this.model.get('overlay_type'),
t = THREE.MixOperation;
return 'normal_color' == e ? t = THREE.MixOperation : 'multiply_color' == e ? t = THREE.MultiplyOperation : 'screen_color' == e && (t = THREE.AddOperation),
t
},
loadObj: function () {
function e(e) {
e.traverse(function (e) {
void 0 !== e.geometry && (r.data.object_loaded = !0, r.three_data.render_object && r.three_data.parent_object.remove(r.three_data.render_object), r.three_data.render_object = new THREE.Mesh(e.geometry, new THREE.MeshPhongMaterial({
color: new THREE.Color(16777215),
emissive: new THREE.Color(r.model.get('rgb')),
combine: r.getOverlayType(),
side: THREE.FrontSide,
refractionRatio: r.three_data.max_refraction_ratio,
envMap: r.cube_data.cube_camera.renderTarget
})), r.three_data.render_object.scale.x = 50, r.three_data.render_object.scale.y = 50, r.three_data.render_object.scale.z = 50, r.three_data.parent_object.add(r.three_data.render_object), 1 == r.data.image_loaded && 0 == r.data.init_start && (r.data.init_start = !0, r.setUpScene()))
}),
r.Resume()
}
var t,
r = this,
i = '//payload.persona.co/assets/backdrop/refraction/',
n = '//payload.persona.co/assets/backdrop/refraction/';
/.js/.test(this.model.get('geometry')) ? (t = n + this.model.get('geometry'), this.three_data.obj_loader.load(t, e)) : (t = i + this.model.get('geometry') + '.obj', this.three_data.obj_loader.load(t, e))
},
loadImage: function () {
Cargo.Event.trigger('show_loading_anim');
var e = this,
t = Backdrop.Collection.Images.GetImageUrlOrDefaultFromName(this.model.get('image'), this.defaults.image),
r = Backdrop.Collection.Images.getCleanImageUrl(t),
i = new Image;
i.crossOrigin = '';
var n,
o,
a;
this.data.image_loaded = !1,
this.model.get('image_width') && this.model.get('image_height') ? this.image_load_queue.push({
url: t,
width: parseInt(this.model.get('image_width')),
height: parseInt(this.model.get('image_height'))
}) : this.image_load_queue.push({
url: t,
width: null,
height: null
}),
i.onload = function () {
var r,
s,
h = e.image_load_queue.pop();
return e.model.get('image') != h.url && e.defaults.image != h.url ? void e.loadImage() : void (h.url == t && (h.width && h.height ? e.data.image_dimensions = {
width: h.width,
height: h.height,
aspect: h.width / h.height,
inverse_aspect: h.height / h.width
}
: e.data.image_dimensions = {
width: i.width,
height: i.height,
aspect: i.width / i.height,
inverse_aspect: i.height / i.width
}, e.isPowerOfTwo(i.width) && e.isPowerOfTwo(i.height) ? a = i : (n = document.createElement('canvas'), o = n.getContext('2d'), r = n.width = e.nextHighestPowerOfTwo(e.data.image_dimensions.width), s = n.height = e.nextHighestPowerOfTwo(e.data.image_dimensions.height), o.drawImage(i, 0, 0, i.width, i.height, 0, 0, n.width, n.height), a = n), e.cube_data.cube_texture.image = a, e.cube_data.cube_texture.needsUpdate = !0, e.updateWindow(!0), e.data.image_loaded = !0, 1 == e.data.object_loaded && 0 == e.data.init_start ? (e.data.init_start = !0, e.setUpScene(), e.Resume()) : e.data.object_loaded && (e.makeMaterial(), e.Resume())))
},
i.src = r
},
isPowerOfTwo: function (e) {
return 0 == (e & e - 1)
},
nextHighestPowerOfTwo: function (e) {
--e;
for (var t = 1; 32 > t; t <<= 1) e |= e >> t;
return Math.min(e + 1, 1024)
},
updateWindow: function (e) {
var t,
r,
i,
n,
o,
a = document.getElementById('backdrop');
if (null !== a && (t = a.offsetWidth + 1, r = a.offsetHeight + 1, i = a.offsetLeft, n = a.offsetTop, o = window.devicePixelRatio, this.data.dimensions.width != t || this.data.dimensions.height != r || 1 == e || this.data.dimensions.resolution != o)) {
this.data.dimensions = {
left: i,
top: n,
width: t,
resolution: o,
height: r,
aspect: t / r,
inverse_aspect: r / t
},
this.three_data.renderer.setPixelRatio(o),
this.three_data.renderer.setSize(t, r);
var s = this.data.dimensions.aspect / this.data.image_dimensions.aspect,
h = (this.model.get('zoom') - 100) / 400,
c = 0.09 * (4 * - Math.pow(h + - 0.5, 2) + 1) + 0.91;
this.cube_data.cube && (this.data.image_dimensions.aspect > 1 ? this.data.image_dimensions.aspect > this.data.dimensions.aspect ? (this.cube_data.cube.scale.x = this.data.image_dimensions.aspect, this.cube_data.cube.scale.y = 1, this.cube_data.cube.scale.z = 1, this.cube_data.plane.scale.x = this.data.image_dimensions.aspect, this.cube_data.plane.scale.y = 1) : (this.cube_data.cube.scale.x = this.data.image_dimensions.aspect * s, this.cube_data.cube.scale.y = s, this.cube_data.cube.scale.z = 1, this.cube_data.plane.scale.x = this.data.image_dimensions.aspect * s, this.cube_data.plane.scale.y = s) : this.data.image_dimensions.aspect > this.data.dimensions.aspect ? (this.cube_data.cube.scale.x = 1, this.cube_data.cube.scale.y = this.data.image_dimensions.inverse_aspect, this.cube_data.cube.scale.z = 1, this.cube_data.plane.scale.x = 1, this.cube_data.plane.scale.y = this.data.image_dimensions.inverse_aspect) : (this.cube_data.cube.scale.x = this.data.image_dimensions.aspect * s, this.cube_data.cube.scale.y = s, this.cube_data.cube.scale.z = 1, this.cube_data.plane.scale.x = this.data.image_dimensions.aspect * s, this.cube_data.plane.scale.y = s), this.cube_data.cube.scale.x *= (1 - h) * c + (1 - c), this.cube_data.cube.scale.y *= (1 - h) * c + (1 - c), this.cube_data.plane.scale.x *= (1 - h) * c + (1 - c), this.cube_data.plane.scale.y *= (1 - h) * c + (1 - c), this.data.cubemap_needs_update = !0),
this.data.dimensions.aspect > 1 ? this.three_data.camera.aspect = this.data.dimensions.aspect : this.three_data.camera.aspect = this.data.dimensions.aspect,
this.three_data.camera.fov = 90 - 80 * h,
this.three_data.camera.updateProjectionMatrix()
}
},
Pause: function () {
Cargo.Event.trigger('show_loading_anim'),
window.cancelAnimationFrame(this.drawFrameID),
this.data.is_running = !1
},
Resume: function () {
Cargo.Event.trigger('hide_loading_anim'),
!this.data.is_running && this.data.inited && this.draw()
},
drawFrameID: null,
draw: function () {
this.data.is_running = !0;
var e = this,
t = 0,
r = 0.1 * this.model.get('mouse_speed');
this.drawFrameID = window.requestAnimationFrame(function () {
e.draw()
}),
this.updateWindow(),
this.data.counter++,
this.data.counter > - 1 && (t = e.data.counter),
this.updateMouseMovement(),
this.three_data.camera.position.x = this.data.mouse.prev.x * r * 0.3,
this.three_data.camera.position.y = - this.data.mouse.prev.y * r * 0.3,
this.three_data.parent_object.rotation.x = this.data.mouse.prev.y * - 0.05 * r,
this.three_data.parent_object.rotation.y = this.data.mouse.prev.x * - 0.05 * r,
this.three_data.render_object.rotation.x = 0.000289 * this.model.get('rot_speed_x') * t + 0.01745 * this.model.get('rot_x'),
this.three_data.render_object.rotation.y = 0.000289 * this.model.get('rot_speed_y') * t + 0.01745 * this.model.get('rot_y'),
this.three_data.render_object.rotation.z = 0.000289 * this.model.get('rot_speed_z') * t + 0.01745 * this.model.get('rot_z'),
'refraction' == this.model.get('reflection_type') && (this.model.get('refract_interaction') && this.model.get('mouse_interaction') ? this.three_data.render_object.material.refractionRatio = 1 - (1 - this.three_data.max_refraction_ratio) * e.data.mouse.smoothed_vector : this.three_data.render_object.material.refractionRatio = 1 - (1 - this.three_data.max_refraction_ratio)),
1 == this.data.cubemap_needs_update && (this.cube_data.cube_camera.updateCubeMap(this.three_data.renderer, this.cube_data.scene), this.data.cubemap_needs_update = !1),
this.three_data.renderer.render(this.three_data.scene, this.three_data.camera)
},
updateMouseInput: function (e) {
var t = this.model.get('refract_motion'),
r = this.model.get('reflection_type'),
i = 0,
n = 0;
'speed' == t && 'refraction' == r && (i = this.data.mouse.prev.x, n = this.data.mouse.prev.y);
var o,
a;
1 == this.data.is_mobile ? (o = e.touches[0].clientX, a = e.touches[0].clientY) : (o = e.clientX, a = e.clientY),
o = o / (this.data.dimensions.left + this.data.dimensions.width) * 2 - 1,
a = a / (this.data.dimensions.top + this.data.dimensions.height) * 2 - 1,
vector_length = Math.sqrt(Math.pow(o - i, 2) + Math.pow(a - n, 2)),
this.data.mouse.current.x = o,
this.data.mouse.current.y = a,
'gather' == t ? this.data.mouse.current.vector_length = Math.max(Math.min(2 * Math.sqrt(vector_length) - 1, 1), 0) : 'disperse' == t ? this.data.mouse.current.vector_length = 1 - Math.max(Math.min(2 * Math.sqrt(vector_length) - 1, 1), 0) : 'speed' == t && 1.2 * vector_length > this.data.mouse.prev.vector_length && (this.data.mouse.prev.vector_length = Math.min(1.2 * vector_length, 1))
},
updateMouseMovement: function () {
if (0 == this.model.get('mouse_interaction')) return void (this.data.mouse = {
prev: {
x: 0,
y: 0,
vector_length: 0
},
current: {
x: 0,
y: 0,
vector_length: 0
},
smoothed_vector: 0,
smoothed_vector_array: [
0,
0,
0,
0,
0
],
inited: !1
});
var e = 0;
if (0 == this.data.mouse.inited) this.data.mouse.prev = this.data.mouse.current,
this.data.mouse.inited = !0;
else {
var t = {
x: 0.9 * this.data.mouse.prev.x + 0.1 * this.data.mouse.current.x,
y: 0.9 * this.data.mouse.prev.y + 0.1 * this.data.mouse.current.y
};
if ('speed' == this.model.get('refract_motion')) {
this.data.mouse.smoothed_vector_array.unshift(this.data.mouse.prev.vector_length);
for (var r = 0; r < this.data.mouse.smoothed_vector_array.length; r++) e += this.data.mouse.smoothed_vector_array[r];
this.data.mouse.smoothed_vector_array.length > 5 && (this.data.mouse.smoothed_vector_array = this.data.mouse.smoothed_vector_array.splice(0, 5)),
this.data.mouse.smoothed_vector = e / 5,
t.vector_length = 0.95 * this.data.mouse.prev.vector_length
} else t.vector_length = 0.05 * this.data.mouse.current.vector_length + 0.95 * this.data.mouse.prev.vector_length,
this.data.mouse.smoothed_vector = t.vector_length;
this.data.mouse.prev = t
}
},
makeCallBack: function () {
this.mouseCallback = this.updateMouseInput.bind(this)
},
Init: function () {
Cargo.Event.trigger('show_loading_anim');
this.three_data = {
renderer: window.devicePixelRatio > 1 ? new THREE.WebGLRenderer : new THREE.WebGLRenderer({
antialias: !0
}),
scene: new THREE.Scene,
parent_object: new THREE.Group,
camera: new THREE.PerspectiveCamera(90, window.innerWidth / window.innerHeight, 0.01, 1000),
manager: new THREE.LoadingManager,
max_refraction_ratio: 0.5,
obj_loader: null,
image_loader: null,
render_object: null
};
var e = this.three_data.renderer.context.getParameter(this.three_data.renderer.context.MAX_CUBE_MAP_TEXTURE_SIZE);
e = 1024 > e ? 512 : 2048 > e ? 1024 : 2048,
this.cube_data = {
scene: new THREE.Scene,
camera: new THREE.PerspectiveCamera(90, 1, 0.1, 1000),
cube_texture: new THREE.Texture,
cube_camera: new THREE.CubeCamera(0.1, 1000, e),
cube: null,
plane: null
},
this.data.inited = !1,
this.data.init_start = !1,
this.data.image_loaded = !1,
this.data.object_loaded = !1,
Cargo.Helper.isMobile() ? (this.data.is_mobile = !0, window.addEventListener('touchmove', this.mouseCallback)) : window.addEventListener('mousemove', this.mouseCallback),
this.three_data.obj_loader = new OBJLoader(this.three_data.manager),
this.three_data.image_loader = new THREE.ImageLoader(this.three_data.manager),
this.three_data.image_loader.crossOrigin = '',
this.loadImage(),
this.loadObj()
},
Update: function (e, t) {
(t != this.model.get(e) || 'geometry' == e) && (this.model.set(e, t), ('rot_speed_x' == e || 'rot_speed_y' == e || 'rot_speed_z' == e) && (this.data.counter = - 6), 'image' == e && (Cargo.Event.trigger('show_loading_anim'), this.loadImage()), 'zoom' == e && this.updateWindow(!0), 'geometry' == e && this.loadObj(), 'reflection_type' == e && (this.makeMaterial(), this.updateWindow(!0)), 'flip' == e && (this.makeMaterial(), this.updateWindow(!0)), 'refraction_ratio' == e && this.three_data.render_object && (this.three_data.max_refraction_ratio = 1 - t / 100), 'rgb' == e && this.three_data.render_object && (this.three_data.render_object.material.emissive = new THREE.Color(t)), 'overlay_type' == e && this.three_data.render_object && (this.three_data.render_object.material.combine = this.getOverlayType(), this.three_data.render_object.material.needsUpdate = !0))
},
initialize: function () {
_.defaults(this.model.attributes, this.defaults),
this.listenTo(this.model, 'reset', this.Init),
this.makeCallBack()
},
render: function () {
var e = this.template({
settings: this.model.toJSON()
});
return this.$el.html(e),
this
},
destroy: function () {
this.image_load_queue = [
],
window.cancelAnimationFrame(this.drawFrameID),
this.data.inited = !1,
this.data.init_start = !1,
this.data.image_loaded = !1,
this.data.object_loaded = !1,
window.removeEventListener('mousemove', this.mouseCallback, !1),
window.removeEventListener('touchmove', this.mouseCallback, !1),
this.three_data.scene = null,
this.cube_data.scene = null,
this.data = null,
this.three_data = null,
this.cube_data = null
}
});
return t
}),
Backdrop.Data.require_loaded = !0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment