//============================================================================= // LN_FilmicFilter_Mod.js //============================================================================= /*:ja * @target MZ * @plugindesc LN_FilmicFilter_Mod v1.0.2 (MIT License) * @author LRIKI * @author ぺぱぺろん mod. * * @help グラフィックスをより豊かに見せるための撮影効果を付加します。 * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * 本プラグインのオリジナルはLRIKI様です。 * ぺぱぺろんがぼかし強度と戦闘シーンのON/OFFを追加しています。 * 面倒なので私の方でメンテすることは無いと思います。 * MITではありますがオリジナルの意志を尊重して難読化維持しています。 * 最新版等はオリジナルをご参照ください。 * また、本プラグインもMITライセンスとします。 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * 使い方は次のページを参照してください。 * https://github.com/lriki/LN_FilmicFilter/blob/main/README.md * * 変更履歴は次のページを参照してください。 * https://github.com/lriki/LN_FilmicFilter/releases * * 既知の不具合や要望は次のページを参照してください。 * https://github.com/lriki/LN_FilmicFilter/issues * * @command SetFilmicFilter * @text SetFilmicFilter * @desc フィルタを適用します。 * * @arg filterId * @type number * @min -1 * @default 0 * @text フィルタID * @desc 適用するフィルタファイルの番号です。 (例: 2-夕焼け.json の場合は 2 を指定する) * * @arg duration * @type number * @default 30 * @text 時間 * @desc 変化にかける時間です。フレーム単位で指定します。 * * @arg wait * @type boolean * @default true * @text 完了までウェイト * @desc 変化が完了するまでイベントを待機します。 * * @param BlurIntensityX * @text ぼかし強度X軸 * @desc X軸のぼかし強度(Blur)を設定します。 0~8 * @default 8 * @min 0 * @max 8 * @type number * * @param BlurIntensityY * @text ぼかし強度Y軸 * @desc Y軸のぼかし強度(Blur)を設定します。 0~8 * @default 8 * @min 0 * @max 8 * @type number * * @param BlurOnBattle * @text 戦闘シーンをぼかす * @desc 戦闘シーンでぼかしのON/OFFを設定します。 * @default false * @type boolean */ /*: * @target MZ * @plugindesc LN_FilmicFilter_Mod v1.0.2 (MIT License) * @author LRIKI * @author pepaperon_p mod. * * @help Adds shooting effects to make the graphics look richer. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The original of this plug-in is LRIKI. * pepaperon_p adds blur strength and ON / OFF of battle scenes. * I don't think I will maintain it because it is troublesome. * Although it is MIT, it is obfuscated while respecting the original intention. * Please refer to the original for the latest version. * This plug-in is also MIT licensed. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * @param BlurIntensityX * @text Blur intensity X-axis * @desc Sets the Blur intensity for the X-axis. 0~8 * @default 8 * @min 0 * @max 8 * @type number * * @param BlurIntensityY * @text Blur intensity Y-axis * @desc Sets the Blur intensity for the Y-axis. 0~8 * @default 8 * @min 0 * @max 8 * @type number * * @param BlurOnBattle * @text Blur the battle scene * @desc Set the blur ON / OFF in the battle scene. * @default false * @type boolean */ (() => { "use strict"; const script = document.currentScript; const param = PluginManagerEx.createParameter(script); var n = { 376: (e, t, n) => { function o(e, t) { var n = e.__state.conversionName.toString(), o = Math.round(e.r), r = Math.round(e.g), i = Math.round(e.b), a = e.a, s = Math.round(e.h), l = e.s.toFixed(1), u = e.v.toFixed(1); if (t || "THREE_CHAR_HEX" === n || "SIX_CHAR_HEX" === n) { for (var d = e.hex.toString(16); d.length < 6;) d = "0" + d; return "#" + d } return "CSS_RGB" === n ? "rgb(" + o + "," + r + "," + i + ")" : "CSS_RGBA" === n ? "rgba(" + o + "," + r + "," + i + "," + a + ")" : "HEX" === n ? "0x" + e.hex.toString(16) : "RGB_ARRAY" === n ? "[" + o + "," + r + "," + i + "]" : "RGBA_ARRAY" === n ? "[" + o + "," + r + "," + i + "," + a + "]" : "RGB_OBJ" === n ? "{r:" + o + ",g:" + r + ",b:" + i + "}" : "RGBA_OBJ" === n ? "{r:" + o + ",g:" + r + ",b:" + i + ",a:" + a + "}" : "HSV_OBJ" === n ? "{h:" + s + ",s:" + l + ",v:" + u + "}" : "HSVA_OBJ" === n ? "{h:" + s + ",s:" + l + ",v:" + u + ",a:" + a + "}" : "unknown format" } n.r(t), n.d(t, { color: () => be, controllers: () => ve, dom: () => ye, gui: () => xe, GUI: () => we, default: () => Ce }); var r, a = Array.prototype.forEach, i = Array.prototype.slice, p = { BREAK: {}, extend: function (n) { return this.each(i.call(arguments, 1), function (t) { (this.isObject(t) ? Object.keys(t) : []).forEach(function (e) { this.isUndefined(t[e]) || (n[e] = t[e]) }.bind(this)) }, this), n }, defaults: function (n) { return this.each(i.call(arguments, 1), function (t) { (this.isObject(t) ? Object.keys(t) : []).forEach(function (e) { this.isUndefined(n[e]) && (n[e] = t[e]) }.bind(this)) }, this), n }, compose: function () { var n = i.call(arguments); return function () { for (var e = i.call(arguments), t = n.length - 1; 0 <= t; t--) e = [n[t].apply(this, e)]; return e[0] } }, each: function (e, t, n) { if (e) if (a && e.forEach && e.forEach === a) e.forEach(t, n); else if (e.length === e.length + 0) { for (var o = void 0, o = 0, r = e.length; o < r; o++) if (o in e && t.call(n, e[o], o) === this.BREAK) return } else for (var i in e) if (t.call(n, e[i], i) === this.BREAK) return }, defer: function (e) { setTimeout(e, 0) }, debounce: function (o, r, i) { var a = void 0; return function () { var e = this, t = arguments; var n = i || !a; clearTimeout(a), a = setTimeout(function () { a = null, i || o.apply(e, t) }, r), n && o.apply(e, t) } }, toArray: function (e) { return e.toArray ? e.toArray() : i.call(e) }, isUndefined: function (e) { return void 0 === e }, isNull: function (e) { return null === e }, isNaN: (r = function (e) { return isNaN(e) }, s.toString = function () { return r.toString() }, s), isArray: Array.isArray || function (e) { return e.constructor === Array }, isObject: function (e) { return e === Object(e) }, isNumber: function (e) { return e === e + 0 }, isString: function (e) { return e === e + "" }, isBoolean: function (e) { return !1 === e || !0 === e }, isFunction: function (e) { return e instanceof Function } }; function s(e) { return r.apply(this, arguments) } var l, u = [{ litmus: p.isString, conversions: { THREE_CHAR_HEX: { read: function (e) { e = e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i); return null !== e && { space: "HEX", hex: parseInt("0x" + e[1].toString() + e[1].toString() + e[2].toString() + e[2].toString() + e[3].toString() + e[3].toString(), 0) } }, write: o }, SIX_CHAR_HEX: { read: function (e) { e = e.match(/^#([A-F0-9]{6})$/i); return null !== e && {space: "HEX", hex: parseInt("0x" + e[1].toString(), 0)} }, write: o }, CSS_RGB: { read: function (e) { e = e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/); return null !== e && { space: "RGB", r: parseFloat(e[1]), g: parseFloat(e[2]), b: parseFloat(e[3]) } }, write: o }, CSS_RGBA: { read: function (e) { e = e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/); return null !== e && { space: "RGB", r: parseFloat(e[1]), g: parseFloat(e[2]), b: parseFloat(e[3]), a: parseFloat(e[4]) } }, write: o } } }, { litmus: p.isNumber, conversions: { HEX: { read: function (e) { return {space: "HEX", hex: e, conversionName: "HEX"} }, write: function (e) { return e.hex } } } }, { litmus: p.isArray, conversions: { RGB_ARRAY: { read: function (e) { return 3 === e.length && {space: "RGB", r: e[0], g: e[1], b: e[2]} }, write: function (e) { return [e.r, e.g, e.b] } }, RGBA_ARRAY: { read: function (e) { return 4 === e.length && {space: "RGB", r: e[0], g: e[1], b: e[2], a: e[3]} }, write: function (e) { return [e.r, e.g, e.b, e.a] } } } }, { litmus: p.isObject, conversions: { RGBA_OBJ: { read: function (e) { return !!(p.isNumber(e.r) && p.isNumber(e.g) && p.isNumber(e.b) && p.isNumber(e.a)) && { space: "RGB", r: e.r, g: e.g, b: e.b, a: e.a } }, write: function (e) { return {r: e.r, g: e.g, b: e.b, a: e.a} } }, RGB_OBJ: { read: function (e) { return !!(p.isNumber(e.r) && p.isNumber(e.g) && p.isNumber(e.b)) && { space: "RGB", r: e.r, g: e.g, b: e.b } }, write: function (e) { return {r: e.r, g: e.g, b: e.b} } }, HSVA_OBJ: { read: function (e) { return !!(p.isNumber(e.h) && p.isNumber(e.s) && p.isNumber(e.v) && p.isNumber(e.a)) && { space: "HSV", h: e.h, s: e.s, v: e.v, a: e.a } }, write: function (e) { return {h: e.h, s: e.s, v: e.v, a: e.a} } }, HSV_OBJ: { read: function (e) { return !!(p.isNumber(e.h) && p.isNumber(e.s) && p.isNumber(e.v)) && { space: "HSV", h: e.h, s: e.s, v: e.v } }, write: function (e) { return {h: e.h, s: e.s, v: e.v} } } } }], d = void 0, c = void 0, h = function () { c = !1; var n = 1 < arguments.length ? p.toArray(arguments) : arguments[0]; return p.each(u, function (e) { if (e.litmus(n)) return p.each(e.conversions, function (e, t) { if (d = e.read(n), !1 === c && !1 !== d) return (c = d).conversionName = t, d.conversion = e, p.BREAK }), p.BREAK }), c }, _ = { hsv_to_rgb: function (e, t, n) { var o = Math.floor(e / 60) % 6, r = e / 60 - Math.floor(e / 60), i = n * (1 - t), e = n * (1 - r * t), t = n * (1 - (1 - r) * t), o = [[n, t, i], [e, n, i], [i, n, t], [i, e, n], [t, i, n], [n, i, e]][o]; return {r: 255 * o[0], g: 255 * o[1], b: 255 * o[2]} }, rgb_to_hsv: function (e, t, n) { var o = Math.min(e, t, n), r = Math.max(e, t, n), i = r - o, o = void 0; return 0 === r ? { h: NaN, s: 0, v: 0 } : (o = e === r ? (t - n) / i : t === r ? 2 + (n - e) / i : 4 + (e - t) / i, (o /= 6) < 0 && (o += 1), { h: 360 * o, s: i / r, v: r / 255 }) }, rgb_to_hex: function (e, t, n) { e = this.hex_with_component(0, 2, e), e = this.hex_with_component(e, 1, t); return e = this.hex_with_component(e, 0, n) }, component_from_hex: function (e, t) { return e >> 8 * t & 255 }, hex_with_component: function (e, t, n) { return n << (l = 8 * t) | e & ~(255 << l) } }, m = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, f = function (e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, g = function (e, t, n) { return t && b(e.prototype, t), n && b(e, n), e }; function b(e, t) { for (var n = 0; n < t.length; n++) { var o = t[n]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o) } } function v(e, t, n) { null === e && (e = Function.prototype); var o = Object.getOwnPropertyDescriptor(e, t); if (void 0 !== o) { if ("value" in o) return o.value; o = o.get; return void 0 !== o ? o.call(n) : void 0 } if (null !== (e = Object.getPrototypeOf(e))) return v(e, t, n) } var n = function (e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }, y = function (e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t }, x = (g(w, [{ key: "toString", value: function () { return o(this) } }, { key: "toHexString", value: function () { return o(this, !0) } }, { key: "toOriginal", value: function () { return this.__state.conversion.write(this) } }]), w); function w() { if (f(this, w), this.__state = h.apply(this, arguments), !1 === this.__state) throw new Error("Failed to interpret color arguments"); this.__state.a = this.__state.a || 1 } function C(e, t, n) { Object.defineProperty(e, t, { get: function () { return "RGB" === this.__state.space || x.recalculateRGB(this, t, n), this.__state[t] }, set: function (e) { "RGB" !== this.__state.space && (x.recalculateRGB(this, t, n), this.__state.space = "RGB"), this.__state[t] = e } }) } function S(e, t) { Object.defineProperty(e, t, { get: function () { return "HSV" === this.__state.space || x.recalculateHSV(this), this.__state[t] }, set: function (e) { "HSV" !== this.__state.space && (x.recalculateHSV(this), this.__state.space = "HSV"), this.__state[t] = e } }) } x.recalculateRGB = function (e, t, n) { if ("HEX" === e.__state.space) e.__state[t] = _.component_from_hex(e.__state.hex, n); else { if ("HSV" !== e.__state.space) throw new Error("Corrupted color state"); p.extend(e.__state, _.hsv_to_rgb(e.__state.h, e.__state.s, e.__state.v)) } }, x.recalculateHSV = function (e) { var t = _.rgb_to_hsv(e.r, e.g, e.b); p.extend(e.__state, { s: t.s, v: t.v }), p.isNaN(t.h) ? p.isUndefined(e.__state.h) && (e.__state.h = 0) : e.__state.h = t.h }, x.COMPONENTS = ["r", "g", "b", "h", "s", "v", "hex", "a"], C(x.prototype, "r", 2), C(x.prototype, "g", 1), C(x.prototype, "b", 0), S(x.prototype, "h"), S(x.prototype, "s"), S(x.prototype, "v"), Object.defineProperty(x.prototype, "a", { get: function () { return this.__state.a }, set: function (e) { this.__state.a = e } }), Object.defineProperty(x.prototype, "hex", { get: function () { return "HEX" !== this.__state.space && (this.__state.hex = _.rgb_to_hex(this.r, this.g, this.b), this.__state.space = "HEX"), this.__state.hex }, set: function (e) { this.__state.space = "HEX", this.__state.hex = e } }); var F = (g(E, [{ key: "onChange", value: function (e) { return this.__onChange = e, this } }, { key: "onFinishChange", value: function (e) { return this.__onFinishChange = e, this } }, { key: "setValue", value: function (e) { return this.object[this.property] = e, this.__onChange && this.__onChange.call(this, e), this.updateDisplay(), this } }, { key: "getValue", value: function () { return this.object[this.property] } }, { key: "updateDisplay", value: function () { return this } }, { key: "isModified", value: function () { return this.initialValue !== this.getValue() } }]), E); function E(e, t) { f(this, E), this.initialValue = e[t], this.domElement = document.createElement("div"), this.object = e, this.property = t, this.__onChange = void 0, this.__onFinishChange = void 0 } var A = {}; p.each({ HTMLEvents: ["change"], MouseEvents: ["click", "mousemove", "mousedown", "mouseup", "mouseover"], KeyboardEvents: ["keydown"] }, function (e, t) { p.each(e, function (e) { A[e] = t }) }); var T = /(\d+(\.\d+)?)px/; function P(e) { if ("0" === e || p.isUndefined(e)) return 0; e = e.match(T); return p.isNull(e) ? 0 : parseFloat(e[1]) } var k = { makeSelectable: function (e, t) { void 0 !== e && void 0 !== e.style && (e.onselectstart = t ? function () { return !1 } : function () { }, e.style.MozUserSelect = t ? "auto" : "none", e.style.KhtmlUserSelect = t ? "auto" : "none", e.unselectable = t ? "on" : "off") }, makeFullscreen: function (e, t, n) { p.isUndefined(t) && (t = !0), p.isUndefined(n) && (n = !0), e.style.position = "absolute", t && (e.style.left = 0, e.style.right = 0), n && (e.style.top = 0, e.style.bottom = 0) }, fakeEvent: function (e, t, n, o) { var r = n || {}, n = A[t]; if (!n) throw new Error("Event type " + t + " not supported."); var i = document.createEvent(n); switch (n) { case "MouseEvents": var a = r.x || r.clientX || 0, s = r.y || r.clientY || 0; i.initMouseEvent(t, r.bubbles || !1, r.cancelable || !0, window, r.clickCount || 1, 0, 0, a, s, !1, !1, !1, !1, 0, null); break; case "KeyboardEvents": s = i.initKeyboardEvent || i.initKeyEvent; p.defaults(r, { cancelable: !0, ctrlKey: !1, altKey: !1, shiftKey: !1, metaKey: !1, keyCode: void 0, charCode: void 0 }), s(t, r.bubbles || !1, r.cancelable, window, r.ctrlKey, r.altKey, r.shiftKey, r.metaKey, r.keyCode, r.charCode); break; default: i.initEvent(t, r.bubbles || !1, r.cancelable || !0) } p.defaults(i, o), e.dispatchEvent(i) }, bind: function (e, t, n, o) { return e.addEventListener ? e.addEventListener(t, n, o || !1) : e.attachEvent && e.attachEvent("on" + t, n), k }, unbind: function (e, t, n, o) { return e.removeEventListener ? e.removeEventListener(t, n, o || !1) : e.detachEvent && e.detachEvent("on" + t, n), k }, addClass: function (e, t) { var n; return void 0 === e.className ? e.className = t : e.className === t || -1 === (n = e.className.split(/ +/)).indexOf(t) && (n.push(t), e.className = n.join(" ").replace(/^\s+/, "").replace(/\s+$/, "")), k }, removeClass: function (e, t) { var n; return t ? e.className === t ? e.removeAttribute("class") : -1 !== (t = (n = e.className.split(/ +/)).indexOf(t)) && (n.splice(t, 1), e.className = n.join(" ")) : e.className = void 0, k }, hasClass: function (e, t) { return new RegExp("(?:^|\\s+)" + t + "(?:\\s+|$)").test(e.className) || !1 }, getWidth: function (e) { e = getComputedStyle(e); return P(e["border-left-width"]) + P(e["border-right-width"]) + P(e["padding-left"]) + P(e["padding-right"]) + P(e.width) }, getHeight: function (e) { e = getComputedStyle(e); return P(e["border-top-width"]) + P(e["border-bottom-width"]) + P(e["padding-top"]) + P(e["padding-bottom"]) + P(e.height) }, getOffset: function (e) { var t = e, n = {left: 0, top: 0}; if (t.offsetParent) for (; n.left += t.offsetLeft, n.top += t.offsetTop, t = t.offsetParent;) ; return n }, isActive: function (e) { return e === document.activeElement && (e.type || e.href) } }, B = (n(O, F), g(O, [{ key: "setValue", value: function (e) { e = v(O.prototype.__proto__ || Object.getPrototypeOf(O.prototype), "setValue", this).call(this, e); return this.__onFinishChange && this.__onFinishChange.call(this, this.getValue()), this.__prev = this.getValue(), e } }, { key: "updateDisplay", value: function () { return !0 === this.getValue() ? (this.__checkbox.setAttribute("checked", "checked"), this.__checkbox.checked = !0, this.__prev = !0) : (this.__checkbox.checked = !1, this.__prev = !1), v(O.prototype.__proto__ || Object.getPrototypeOf(O.prototype), "updateDisplay", this).call(this) } }]), O); function O(e, t) { f(this, O); var t = y(this, (O.__proto__ || Object.getPrototypeOf(O)).call(this, e, t)), n = t; return t.__prev = t.getValue(), t.__checkbox = document.createElement("input"), t.__checkbox.setAttribute("type", "checkbox"), k.bind(t.__checkbox, "change", function () { n.setValue(!n.__prev) }, !1), t.domElement.appendChild(t.__checkbox), t.updateDisplay(), t } var D = (n(L, F), g(L, [{ key: "setValue", value: function (e) { e = v(L.prototype.__proto__ || Object.getPrototypeOf(L.prototype), "setValue", this).call(this, e); return this.__onFinishChange && this.__onFinishChange.call(this, this.getValue()), e } }, { key: "updateDisplay", value: function () { return k.isActive(this.__select) ? this : (this.__select.value = this.getValue(), v(L.prototype.__proto__ || Object.getPrototypeOf(L.prototype), "updateDisplay", this).call(this)) } }]), L); function L(e, t, n) { f(this, L); var o, t = y(this, (L.__proto__ || Object.getPrototypeOf(L)).call(this, e, t)), n = n, r = t; return t.__select = document.createElement("select"), p.isArray(n) && (o = {}, p.each(n, function (e) { o[e] = e }), n = o), p.each(n, function (e, t) { var n = document.createElement("option"); n.innerHTML = t, n.setAttribute("value", e), r.__select.appendChild(n) }), t.updateDisplay(), k.bind(t.__select, "change", function () { var e = this.options[this.selectedIndex].value; r.setValue(e) }), t.domElement.appendChild(t.__select), t } var R = (n(M, F), g(M, [{ key: "updateDisplay", value: function () { return k.isActive(this.__input) || (this.__input.value = this.getValue()), v(M.prototype.__proto__ || Object.getPrototypeOf(M.prototype), "updateDisplay", this).call(this) } }]), M); function M(e, t) { f(this, M); var t = y(this, (M.__proto__ || Object.getPrototypeOf(M)).call(this, e, t)), n = t; function o() { n.setValue(n.__input.value) } return t.__input = document.createElement("input"), t.__input.setAttribute("type", "text"), k.bind(t.__input, "keyup", o), k.bind(t.__input, "change", o), k.bind(t.__input, "blur", function () { n.__onFinishChange && n.__onFinishChange.call(n, n.getValue()) }), k.bind(t.__input, "keydown", function (e) { 13 === e.keyCode && this.blur() }), t.updateDisplay(), t.domElement.appendChild(t.__input), t } function I(e) { e = e.toString(); return -1 < e.indexOf(".") ? e.length - e.indexOf(".") - 1 : 0 } n(N, F), g(N, [{ key: "setValue", value: function (e) { return void 0 !== this.__min && e < this.__min ? e = this.__min : void 0 !== this.__max && e > this.__max && (e = this.__max), void 0 !== this.__step && e % this.__step != 0 && (e = Math.round(e / this.__step) * this.__step), v(N.prototype.__proto__ || Object.getPrototypeOf(N.prototype), "setValue", this).call(this, e) } }, { key: "min", value: function (e) { return this.__min = e, this } }, { key: "max", value: function (e) { return this.__max = e, this } }, { key: "step", value: function (e) { return this.__step = e, this.__impliedStep = e, this.__precision = I(e), this } }]), t = N; function N(e, t, n) { f(this, N); t = y(this, (N.__proto__ || Object.getPrototypeOf(N)).call(this, e, t)), n = n || {}; return t.__min = n.min, t.__max = n.max, t.__step = n.step, p.isUndefined(t.__step) ? 0 === t.initialValue ? t.__impliedStep = 1 : t.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(t.initialValue)) / Math.LN10)) / 10 : t.__impliedStep = t.__step, t.__precision = I(t.__impliedStep), t } var j = (n(H, t), g(H, [{ key: "updateDisplay", value: function () { var e, t; return this.__input.value = this.__truncationSuspended ? this.getValue() : (e = this.getValue(), t = this.__precision, t = Math.pow(10, t), Math.round(e * t) / t), v(H.prototype.__proto__ || Object.getPrototypeOf(H.prototype), "updateDisplay", this).call(this) } }]), H); function H(e, t, n) { f(this, H); n = y(this, (H.__proto__ || Object.getPrototypeOf(H)).call(this, e, t, n)); n.__truncationSuspended = !1; var o = n, r = void 0; function i() { o.__onFinishChange && o.__onFinishChange.call(o, o.getValue()) } function a(e) { var t = r - e.clientY; o.setValue(o.getValue() + t * o.__impliedStep), r = e.clientY } function s() { k.unbind(window, "mousemove", a), k.unbind(window, "mouseup", s), i() } return n.__input = document.createElement("input"), n.__input.setAttribute("type", "text"), k.bind(n.__input, "change", function () { var e = parseFloat(o.__input.value); p.isNaN(e) || o.setValue(e) }), k.bind(n.__input, "blur", function () { i() }), k.bind(n.__input, "mousedown", function (e) { k.bind(window, "mousemove", a), k.bind(window, "mouseup", s), r = e.clientY }), k.bind(n.__input, "keydown", function (e) { 13 === e.keyCode && (o.__truncationSuspended = !0, this.blur(), o.__truncationSuspended = !1, i()) }), n.updateDisplay(), n.domElement.appendChild(n.__input), n } function G(e, t, n, o, r) { return o + (e - t) / (n - t) * (r - o) } var V = (n(z, t), g(z, [{ key: "updateDisplay", value: function () { var e = (this.getValue() - this.__min) / (this.__max - this.__min); return this.__foreground.style.width = 100 * e + "%", v(z.prototype.__proto__ || Object.getPrototypeOf(z.prototype), "updateDisplay", this).call(this) } }]), z); function z(e, t, n, o, r) { f(this, z); var r = y(this, (z.__proto__ || Object.getPrototypeOf(z)).call(this, e, t, {min: n, max: o, step: r})), i = r; function a(e) { e.preventDefault(); var t = i.__background.getBoundingClientRect(); return i.setValue(G(e.clientX, t.left, t.right, i.__min, i.__max)), !1 } function s() { k.unbind(window, "mousemove", a), k.unbind(window, "mouseup", s), i.__onFinishChange && i.__onFinishChange.call(i, i.getValue()) } function l(e) { var t = e.touches[0].clientX, e = i.__background.getBoundingClientRect(); i.setValue(G(t, e.left, e.right, i.__min, i.__max)) } function u() { k.unbind(window, "touchmove", l), k.unbind(window, "touchend", u), i.__onFinishChange && i.__onFinishChange.call(i, i.getValue()) } return r.__background = document.createElement("div"), r.__foreground = document.createElement("div"), k.bind(r.__background, "mousedown", function (e) { document.activeElement.blur(), k.bind(window, "mousemove", a), k.bind(window, "mouseup", s), a(e) }), k.bind(r.__background, "touchstart", function (e) { 1 === e.touches.length && (k.bind(window, "touchmove", l), k.bind(window, "touchend", u), l(e)) }), k.addClass(r.__background, "slider"), k.addClass(r.__foreground, "slider-fg"), r.updateDisplay(), r.__background.appendChild(r.__foreground), r.domElement.appendChild(r.__background), r } var U = (n(X, F), g(X, [{ key: "fire", value: function () { this.__onChange && this.__onChange.call(this), this.getValue().call(this.object), this.__onFinishChange && this.__onFinishChange.call(this, this.getValue()) } }]), X); function X(e, t, n) { f(this, X); var t = y(this, (X.__proto__ || Object.getPrototypeOf(X)).call(this, e, t)), o = t; return t.__button = document.createElement("div"), t.__button.innerHTML = void 0 === n ? "Fire" : n, k.bind(t.__button, "click", function (e) { return e.preventDefault(), o.fire(), !1 }), k.addClass(t.__button, "button"), t.domElement.appendChild(t.__button), t } var W = (n(Y, F), g(Y, [{ key: "updateDisplay", value: function () { var t, n = h(this.getValue()); !1 !== n && (t = !1, p.each(x.COMPONENTS, function (e) { if (!p.isUndefined(n[e]) && !p.isUndefined(this.__color.__state[e]) && n[e] !== this.__color.__state[e]) return t = !0, {} }, this), t && p.extend(this.__color.__state, n)), p.extend(this.__temp.__state, this.__color.__state), this.__temp.a = 1; var e = this.__color.v < .5 || .5 < this.__color.s ? 255 : 0, o = 255 - e; p.extend(this.__field_knob.style, { marginLeft: 100 * this.__color.s - 7 + "px", marginTop: 100 * (1 - this.__color.v) - 7 + "px", backgroundColor: this.__temp.toHexString(), border: this.__field_knob_border + "rgb(" + e + "," + e + "," + e + ")" }), this.__hue_knob.style.marginTop = 100 * (1 - this.__color.h / 360) + "px", this.__temp.s = 1, this.__temp.v = 1, J(this.__saturation_field, "left", "#fff", this.__temp.toHexString()), this.__input.value = this.__color.toString(), p.extend(this.__input.style, { backgroundColor: this.__color.toHexString(), color: "rgb(" + e + "," + e + "," + e + ")", textShadow: this.__input_textShadow + "rgba(" + o + "," + o + "," + o + ",.7)" }) } }]), Y); function Y(e, t) { f(this, Y); var n = y(this, (Y.__proto__ || Object.getPrototypeOf(Y)).call(this, e, t)); n.__color = new x(n.getValue()), n.__temp = new x(0); var o = n; n.domElement = document.createElement("div"), k.makeSelectable(n.domElement, !1), n.__selector = document.createElement("div"), n.__selector.className = "selector", n.__saturation_field = document.createElement("div"), n.__saturation_field.className = "saturation-field", n.__field_knob = document.createElement("div"), n.__field_knob.className = "field-knob", n.__field_knob_border = "2px solid ", n.__hue_knob = document.createElement("div"), n.__hue_knob.className = "hue-knob", n.__hue_field = document.createElement("div"), n.__hue_field.className = "hue-field", n.__input = document.createElement("input"), n.__input.type = "text", n.__input_textShadow = "0 1px 1px ", k.bind(n.__input, "keydown", function (e) { 13 === e.keyCode && l.call(this) }), k.bind(n.__input, "blur", l), k.bind(n.__selector, "mousedown", function () { k.addClass(this, "drag").bind(window, "mouseup", function () { k.removeClass(o.__selector, "drag") }) }), k.bind(n.__selector, "touchstart", function () { k.addClass(this, "drag").bind(window, "touchend", function () { k.removeClass(o.__selector, "drag") }) }); e = document.createElement("div"); function r(e) { d(e), k.bind(window, "mousemove", d), k.bind(window, "touchmove", d), k.bind(window, "mouseup", a), k.bind(window, "touchend", a) } function i(e) { c(e), k.bind(window, "mousemove", c), k.bind(window, "touchmove", c), k.bind(window, "mouseup", s), k.bind(window, "touchend", s) } function a() { k.unbind(window, "mousemove", d), k.unbind(window, "touchmove", d), k.unbind(window, "mouseup", a), k.unbind(window, "touchend", a), u() } function s() { k.unbind(window, "mousemove", c), k.unbind(window, "touchmove", c), k.unbind(window, "mouseup", s), k.unbind(window, "touchend", s), u() } function l() { var e = h(this.value); !1 !== e ? (o.__color.__state = e, o.setValue(o.__color.toOriginal())) : this.value = o.__color.toString() } function u() { o.__onFinishChange && o.__onFinishChange.call(o, o.__color.toOriginal()) } function d(e) { -1 === e.type.indexOf("touch") && e.preventDefault(); var t = o.__saturation_field.getBoundingClientRect(), n = e.touches && e.touches[0] || e, e = n.clientX, n = n.clientY, e = (e - t.left) / (t.right - t.left), t = 1 - (n - t.top) / (t.bottom - t.top); return 1 < t ? t = 1 : t < 0 && (t = 0), 1 < e ? e = 1 : e < 0 && (e = 0), o.__color.v = t, o.__color.s = e, o.setValue(o.__color.toOriginal()), !1 } function c(e) { -1 === e.type.indexOf("touch") && e.preventDefault(); var t = o.__hue_field.getBoundingClientRect(), t = 1 - ((e.touches && e.touches[0] || e).clientY - t.top) / (t.bottom - t.top); return 1 < t ? t = 1 : t < 0 && (t = 0), o.__color.h = 360 * t, o.setValue(o.__color.toOriginal()), !1 } return p.extend(n.__selector.style, { width: "122px", height: "102px", padding: "3px", backgroundColor: "#222", boxShadow: "0px 1px 3px rgba(0,0,0,0.3)" }), p.extend(n.__field_knob.style, { position: "absolute", width: "12px", height: "12px", border: n.__field_knob_border + (n.__color.v < .5 ? "#fff" : "#000"), boxShadow: "0px 1px 3px rgba(0,0,0,0.5)", borderRadius: "12px", zIndex: 1 }), p.extend(n.__hue_knob.style, { position: "absolute", width: "15px", height: "2px", borderRight: "4px solid #fff", zIndex: 1 }), p.extend(n.__saturation_field.style, { width: "100px", height: "100px", border: "1px solid #555", marginRight: "3px", display: "inline-block", cursor: "pointer" }), p.extend(e.style, { width: "100%", height: "100%", background: "none" }), J(e, "top", "rgba(0,0,0,0)", "#000"), p.extend(n.__hue_field.style, { width: "15px", height: "100px", border: "1px solid #555", cursor: "ns-resize", position: "absolute", top: "3px", right: "3px" }), (t = n.__hue_field).style.background = "", t.style.cssText += "background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);", t.style.cssText += "background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", t.style.cssText += "background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", t.style.cssText += "background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", t.style.cssText += "background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);", p.extend(n.__input.style, { outline: "none", textAlign: "center", color: "#fff", border: 0, fontWeight: "bold", textShadow: n.__input_textShadow + "rgba(0,0,0,0.7)" }), k.bind(n.__saturation_field, "mousedown", r), k.bind(n.__saturation_field, "touchstart", r), k.bind(n.__field_knob, "mousedown", r), k.bind(n.__field_knob, "touchstart", r), k.bind(n.__hue_field, "mousedown", i), k.bind(n.__hue_field, "touchstart", i), n.__saturation_field.appendChild(e), n.__selector.appendChild(n.__field_knob), n.__selector.appendChild(n.__saturation_field), n.__selector.appendChild(n.__hue_field), n.__hue_field.appendChild(n.__hue_knob), n.domElement.appendChild(n.__input), n.domElement.appendChild(n.__selector), n.updateDisplay(), n } var K = ["-moz-", "-o-", "-webkit-", "-ms-", ""]; function J(t, n, o, r) { t.style.background = "", p.each(K, function (e) { t.style.cssText += "background: " + e + "linear-gradient(" + n + ", " + o + " 0%, " + r + " 100%); " }) } var n = function (e, t) { var n = t || document, t = document.createElement("style"); t.type = "text/css", t.innerHTML = e; n = n.getElementsByTagName("head")[0]; try { n.appendChild(t) } catch (e) { } }, $ = function (e, t) { var n = e[t]; return p.isArray(arguments[2]) || p.isObject(arguments[2]) ? new D(e, t, arguments[2]) : p.isNumber(n) ? p.isNumber(arguments[2]) && p.isNumber(arguments[3]) ? p.isNumber(arguments[4]) ? new V(e, t, arguments[2], arguments[3], arguments[4]) : new V(e, t, arguments[2], arguments[3]) : p.isNumber(arguments[4]) ? new j(e, t, { min: arguments[2], max: arguments[3], step: arguments[4] }) : new j(e, t, { min: arguments[2], max: arguments[3] }) : p.isString(n) ? new R(e, t) : p.isFunction(n) ? new U(e, t, "") : p.isBoolean(n) ? new B(e, t) : null }; var Q = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (e) { setTimeout(e, 1e3 / 60) }, q = (g(Z, [{ key: "show", value: function () { var e = this; this.backgroundElement.style.display = "block", this.domElement.style.display = "block", this.domElement.style.opacity = 0, this.domElement.style.webkitTransform = "scale(1.1)", this.layout(), p.defer(function () { e.backgroundElement.style.opacity = 1, e.domElement.style.opacity = 1, e.domElement.style.webkitTransform = "scale(1)" }) } }, { key: "hide", value: function () { function e() { t.domElement.style.display = "none", t.backgroundElement.style.display = "none", k.unbind(t.domElement, "webkitTransitionEnd", e), k.unbind(t.domElement, "transitionend", e), k.unbind(t.domElement, "oTransitionEnd", e) } var t = this; k.bind(this.domElement, "webkitTransitionEnd", e), k.bind(this.domElement, "transitionend", e), k.bind(this.domElement, "oTransitionEnd", e), this.backgroundElement.style.opacity = 0, this.domElement.style.opacity = 0, this.domElement.style.webkitTransform = "scale(1.1)" } }, { key: "layout", value: function () { this.domElement.style.left = window.innerWidth / 2 - k.getWidth(this.domElement) / 2 + "px", this.domElement.style.top = window.innerHeight / 2 - k.getHeight(this.domElement) / 2 + "px" } }]), Z); function Z() { f(this, Z), this.backgroundElement = document.createElement("div"), p.extend(this.backgroundElement.style, { backgroundColor: "rgba(0,0,0,0.8)", top: 0, left: 0, display: "none", zIndex: "1000", opacity: 0, WebkitTransition: "opacity 0.2s linear", transition: "opacity 0.2s linear" }), k.makeFullscreen(this.backgroundElement), this.backgroundElement.style.position = "fixed", this.domElement = document.createElement("div"), p.extend(this.domElement.style, { position: "fixed", display: "none", zIndex: "1001", opacity: 0, WebkitTransition: "-webkit-transform 0.2s ease-out, opacity 0.2s linear", transition: "transform 0.2s ease-out, opacity 0.2s linear" }), document.body.appendChild(this.backgroundElement), document.body.appendChild(this.domElement); var e = this; k.bind(this.backgroundElement, "click", function () { e.hide() }) } n(function (e) { if (e && "undefined" != typeof window) { var t = document.createElement("style"); return t.setAttribute("type", "text/css"), t.innerHTML = e, document.head.appendChild(t), e } }(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n")); var ee = "Default", te = function () { try { return !!window.localStorage } catch (e) { return !1 } }(), ne = void 0, oe = !0, re = void 0, ie = !1, ae = [], se = function t(e) { var n = this, o = e || {}; this.domElement = document.createElement("div"), this.__ul = document.createElement("ul"), this.domElement.appendChild(this.__ul), k.addClass(this.domElement, "dg"), this.__folders = {}, this.__controllers = [], this.__rememberedObjects = [], this.__rememberedObjectIndecesToControllers = [], this.__listening = [], o = p.defaults(o, { closeOnTop: !1, autoPlace: !0, width: t.DEFAULT_WIDTH }), o = p.defaults(o, { resizable: o.autoPlace, hideable: o.autoPlace }), p.isUndefined(o.load) ? o.load = {preset: ee} : o.preset && (o.load.preset = o.preset), p.isUndefined(o.parent) && o.hideable && ae.push(this), o.resizable = p.isUndefined(o.parent) && o.resizable, o.autoPlace && p.isUndefined(o.scrollable) && (o.scrollable = !0); var r, i, a, s, l = te && "true" === localStorage.getItem(_e(0, "isLocal")), u = void 0, d = void 0; function c(e) { return e.preventDefault(), i.width += a - e.clientX, i.onResize(), a = e.clientX, !1 } function h() { k.removeClass(i.__closeButton, se.CLASS_DRAG), k.unbind(window, "mousemove", c), k.unbind(window, "mouseup", h) } function _(e) { return e.preventDefault(), a = e.clientX, k.addClass(i.__closeButton, se.CLASS_DRAG), k.bind(window, "mousemove", c), k.bind(window, "mouseup", h), !1 } Object.defineProperties(this, { parent: { get: function () { return o.parent } }, scrollable: { get: function () { return o.scrollable } }, autoPlace: { get: function () { return o.autoPlace } }, closeOnTop: { get: function () { return o.closeOnTop } }, preset: { get: function () { return (n.parent ? n.getRoot() : o.load).preset }, set: function (e) { n.parent ? n.getRoot().preset = e : o.load.preset = e, function (e) { for (var t = 0; t < e.__preset_select.length; t++) e.__preset_select[t].value === e.preset && (e.__preset_select.selectedIndex = t) }(this), n.revert() } }, width: { get: function () { return o.width }, set: function (e) { o.width = e, fe(n, e) } }, name: { get: function () { return o.name }, set: function (e) { o.name = e, d && (d.innerHTML = o.name) } }, closed: { get: function () { return o.closed }, set: function (e) { o.closed = e, o.closed ? k.addClass(n.__ul, t.CLASS_CLOSED) : k.removeClass(n.__ul, t.CLASS_CLOSED), this.onResize(), n.__closeButton && (n.__closeButton.innerHTML = e ? t.TEXT_OPEN : t.TEXT_CLOSED) } }, load: { get: function () { return o.load } }, useLocalStorage: { get: function () { return l }, set: function (e) { te && ((l = e) ? k.bind(window, "unload", u) : k.unbind(window, "unload", u), localStorage.setItem(_e(0, "isLocal"), e)) } } }), p.isUndefined(o.parent) ? (this.closed = o.closed || !1, k.addClass(this.domElement, t.CLASS_MAIN), k.makeSelectable(this.domElement, !1), te && l && (n.useLocalStorage = !0, (r = localStorage.getItem(_e(0, "gui"))) && (o.load = JSON.parse(r))), this.__closeButton = document.createElement("div"), this.__closeButton.innerHTML = t.TEXT_CLOSED, k.addClass(this.__closeButton, t.CLASS_CLOSE_BUTTON), o.closeOnTop ? (k.addClass(this.__closeButton, t.CLASS_CLOSE_TOP), this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0])) : (k.addClass(this.__closeButton, t.CLASS_CLOSE_BOTTOM), this.domElement.appendChild(this.__closeButton)), k.bind(this.__closeButton, "click", function () { n.closed = !n.closed })) : (void 0 === o.closed && (o.closed = !0), r = document.createTextNode(o.name), k.addClass(r, "controller-name"), d = le(n, r), k.addClass(this.__ul, t.CLASS_CLOSED), k.addClass(d, "title"), k.bind(d, "click", function (e) { return e.preventDefault(), n.closed = !n.closed, !1 }), o.closed || (this.closed = !1)), o.autoPlace && (p.isUndefined(o.parent) && (oe && (re = document.createElement("div"), k.addClass(re, "dg"), k.addClass(re, t.CLASS_AUTO_PLACE_CONTAINER), document.body.appendChild(re), oe = !1), re.appendChild(this.domElement), k.addClass(this.domElement, t.CLASS_AUTO_PLACE)), this.parent || fe(n, o.width)), this.__resizeHandler = function () { n.onResizeDebounced() }, k.bind(window, "resize", this.__resizeHandler), k.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler), k.bind(this.__ul, "transitionend", this.__resizeHandler), k.bind(this.__ul, "oTransitionEnd", this.__resizeHandler), this.onResize(), o.resizable && (a = void 0, (i = this).__resize_handle = document.createElement("div"), p.extend(i.__resize_handle.style, { width: "6px", marginLeft: "-3px", height: "200px", cursor: "ew-resize", position: "absolute" }), k.bind(i.__resize_handle, "mousedown", _), k.bind(i.__closeButton, "mousedown", _), i.domElement.insertBefore(i.__resize_handle, i.domElement.firstElementChild)), u = function () { te && "true" === localStorage.getItem(_e(0, "isLocal")) && localStorage.setItem(_e(0, "gui"), JSON.stringify(n.getSaveObject())) }, this.saveToLocalStorageIfPossible = u, o.parent || ((s = n.getRoot()).width += 1, p.defer(function () { --s.width })) }; function le(e, t, n) { var o = document.createElement("li"); return t && o.appendChild(t), n ? e.__ul.insertBefore(o, n) : e.__ul.appendChild(o), e.onResize(), o } function ue(e) { k.unbind(window, "resize", e.__resizeHandler), e.saveToLocalStorageIfPossible && k.unbind(window, "unload", e.saveToLocalStorageIfPossible) } function de(e, t) { e = e.__preset_select[e.__preset_select.selectedIndex]; e.innerHTML = t ? e.value + "*" : e.value } function ce(e, t) { var n = e.getRoot(), o = n.__rememberedObjects.indexOf(t.object); if (-1 !== o) { var r = n.__rememberedObjectIndecesToControllers[o]; if (void 0 === r && (n.__rememberedObjectIndecesToControllers[o] = r = {}), r[t.property] = t, n.load && n.load.remembered) { r = n.load.remembered, n = void 0; if (r[e.preset]) n = r[e.preset]; else { if (!r[ee]) return; n = r[ee] } n[o] && void 0 !== n[o][t.property] && (o = n[o][t.property], t.initialValue = o, t.setValue(o)) } } } function he(e, t, n, o) { if (void 0 === t[n]) throw new Error('Object "' + t + '" has no property "' + n + '"'); var r = void 0; r = o.color ? new W(t, n) : (i = [t, n].concat(o.factoryArgs), $.apply(e, i)), o.before instanceof F && (o.before = o.before.__li), ce(e, r), k.addClass(r.domElement, "c"); n = document.createElement("span"); k.addClass(n, "property-name"), n.innerHTML = r.property; var i = document.createElement("div"); i.appendChild(n), i.appendChild(r.domElement); var a, s, l, u, o = le(e, i, o.before); return k.addClass(o, se.CLASS_CONTROLLER_ROW), r instanceof W ? k.addClass(o, "color") : k.addClass(o, m(r.getValue())), a = e, s = o, (l = r).__li = s, l.__gui = a, p.extend(l, { options: function (e) { if (1 < arguments.length) { var t = l.__li.nextElementSibling; return l.remove(), he(a, l.object, l.property, { before: t, factoryArgs: [p.toArray(arguments)] }) } if (p.isArray(e) || p.isObject(e)) { t = l.__li.nextElementSibling; return l.remove(), he(a, l.object, l.property, {before: t, factoryArgs: [e]}) } }, name: function (e) { return l.__li.firstElementChild.firstElementChild.innerHTML = e, l }, listen: function () { return l.__gui.listen(l), l }, remove: function () { return l.__gui.remove(l), l } }), l instanceof V ? (u = new j(l.object, l.property, { min: l.__min, max: l.__max, step: l.__step }), p.each(["updateDisplay", "onChange", "onFinishChange", "step", "min", "max"], function (e) { var t = l[e], n = u[e]; l[e] = u[e] = function () { var e = Array.prototype.slice.call(arguments); return n.apply(u, e), t.apply(l, e) } }), k.addClass(s, "has-slider"), l.domElement.insertBefore(u.domElement, l.domElement.firstElementChild)) : l instanceof j ? (o = function (e) { if (p.isNumber(l.__min) && p.isNumber(l.__max)) { var t = l.__li.firstElementChild.firstElementChild.innerHTML, n = -1 < l.__gui.__listening.indexOf(l); l.remove(); var o = he(a, l.object, l.property, { before: l.__li.nextElementSibling, factoryArgs: [l.__min, l.__max, l.__step] }); return o.name(t), n && o.listen(), o } return e }, l.min = p.compose(o, l.min), l.max = p.compose(o, l.max)) : l instanceof B ? (k.bind(s, "click", function () { k.fakeEvent(l.__checkbox, "click") }), k.bind(l.__checkbox, "click", function (e) { e.stopPropagation() })) : l instanceof U ? (k.bind(s, "click", function () { k.fakeEvent(l.__button, "click") }), k.bind(s, "mouseover", function () { k.addClass(l.__button, "hover") }), k.bind(s, "mouseout", function () { k.removeClass(l.__button, "hover") })) : l instanceof W && (k.addClass(s, "color"), l.updateDisplay = p.compose(function (e) { return s.style.borderLeftColor = l.__color.toString(), e }, l.updateDisplay), l.updateDisplay()), l.setValue = p.compose(function (e) { return a.getRoot().__preset_select && l.isModified() && de(a.getRoot(), !0), e }, l.setValue), e.__controllers.push(r), r } function _e(e, t) { return document.location.href + "." + t } function pe(e, t, n) { var o = document.createElement("option"); o.innerHTML = t, o.value = t, e.__preset_select.appendChild(o), n && (e.__preset_select.selectedIndex = e.__preset_select.length - 1) } function me(e, t) { t.style.display = e.useLocalStorage ? "block" : "none" } function fe(e, t) { e.domElement.style.width = t + "px", e.__save_row && e.autoPlace && (e.__save_row.style.width = t + "px"), e.__closeButton && (e.__closeButton.style.width = t + "px") } function ge(r, i) { var a = {}; return p.each(r.__rememberedObjects, function (e, t) { var n = {}, o = r.__rememberedObjectIndecesToControllers[t]; p.each(o, function (e, t) { n[t] = i ? e.initialValue : e.getValue() }), a[t] = n }), a } se.toggleHide = function () { ie = !ie, p.each(ae, function (e) { e.domElement.style.display = ie ? "none" : "" }) }, se.CLASS_AUTO_PLACE = "a", se.CLASS_AUTO_PLACE_CONTAINER = "ac", se.CLASS_MAIN = "main", se.CLASS_CONTROLLER_ROW = "cr", se.CLASS_TOO_TALL = "taller-than-window", se.CLASS_CLOSED = "closed", se.CLASS_CLOSE_BUTTON = "close-button", se.CLASS_CLOSE_TOP = "close-top", se.CLASS_CLOSE_BOTTOM = "close-bottom", se.CLASS_DRAG = "drag", se.DEFAULT_WIDTH = 245, se.TEXT_CLOSED = "Close Controls", se.TEXT_OPEN = "Open Controls", se._keydownHandler = function (e) { "text" === document.activeElement.type || 72 !== e.which && 72 !== e.keyCode || se.toggleHide() }, k.bind(window, "keydown", se._keydownHandler, !1), p.extend(se.prototype, { add: function (e, t) { return he(this, e, t, {factoryArgs: Array.prototype.slice.call(arguments, 2)}) }, addColor: function (e, t) { return he(this, e, t, {color: !0}) }, remove: function (e) { this.__ul.removeChild(e.__li), this.__controllers.splice(this.__controllers.indexOf(e), 1); var t = this; p.defer(function () { t.onResize() }) }, destroy: function () { if (this.parent) throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead."); this.autoPlace && re.removeChild(this.domElement); var t = this; p.each(this.__folders, function (e) { t.removeFolder(e) }), k.unbind(window, "keydown", se._keydownHandler, !1), ue(this) }, addFolder: function (e) { if (void 0 !== this.__folders[e]) throw new Error('You already have a folder in this GUI by the name "' + e + '"'); var t = {name: e, parent: this}; t.autoPlace = this.autoPlace, this.load && this.load.folders && this.load.folders[e] && (t.closed = this.load.folders[e].closed, t.load = this.load.folders[e]); t = new se(t); this.__folders[e] = t; e = le(this, t.domElement); return k.addClass(e, "folder"), t }, removeFolder: function (t) { this.__ul.removeChild(t.domElement.parentElement), delete this.__folders[t.name], this.load && this.load.folders && this.load.folders[t.name] && delete this.load.folders[t.name], ue(t); var e = this; p.each(t.__folders, function (e) { t.removeFolder(e) }), p.defer(function () { e.onResize() }) }, open: function () { this.closed = !1 }, close: function () { this.closed = !0 }, hide: function () { this.domElement.style.display = "none" }, show: function () { this.domElement.style.display = "" }, onResize: function () { var e, t, n = this.getRoot(); n.scrollable && (e = k.getOffset(n.__ul).top, t = 0, p.each(n.__ul.childNodes, function (e) { n.autoPlace && e === n.__save_row || (t += k.getHeight(e)) }), window.innerHeight - e - 20 < t ? (k.addClass(n.domElement, se.CLASS_TOO_TALL), n.__ul.style.height = window.innerHeight - e - 20 + "px") : (k.removeClass(n.domElement, se.CLASS_TOO_TALL), n.__ul.style.height = "auto")), n.__resize_handle && p.defer(function () { n.__resize_handle.style.height = n.__ul.offsetHeight + "px" }), n.__closeButton && (n.__closeButton.style.width = n.width + "px") }, onResizeDebounced: p.debounce(function () { this.onResize() }, 50), remember: function () { if (p.isUndefined(ne) && ((ne = new q).domElement.innerHTML = '
GUI\'s constructor:\n\n \n\n localStorage on exit.\n\n localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n