!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).rexperlinplugin = e() }(this, function () { "use strict"; function o(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } function r(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } function t(t, e, n) { return e && r(t.prototype, e), n && r(t, n), t } function i(t) { return (i = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) { return t.__proto__ || Object.getPrototypeOf(t) })(t) } function u(t, e) { return (u = Object.setPrototypeOf || function (t, e) { return t.__proto__ = e, t })(t, e) } function f(t, e) { return !e || "object" != typeof e && "function" != typeof e ? function (t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function a(r) { var o = function () { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Date.prototype.toString.call(Reflect.construct(Date, [], function () { })), !0 } catch (t) { return !1 } }(); return function () { var t, e = i(r); if (o) { var n = i(this).constructor; t = Reflect.construct(e, arguments, n) } else t = e.apply(this, arguments); return f(this, t) } } function g(t) { return t * t * t * (t * (6 * t - 15) + 10) } function m(t, e, n) { return (1 - n) * t + n * e } var e = function () { function r(t, e, n) { o(this, r), this.x = t, this.y = e, this.z = n } return t(r, [{ key: "dot2", value: function (t, e) { return this.x * t + this.y * e } }, { key: "dot3", value: function (t, e, n) { return this.x * t + this.y * e + this.z * n } }]), r }(), c = [new e(1, 1, 0), new e(-1, 1, 0), new e(1, -1, 0), new e(-1, -1, 0), new e(1, 0, 1), new e(-1, 0, 1), new e(1, 0, -1), new e(-1, 0, -1), new e(0, 1, 1), new e(0, -1, 1), new e(0, 1, -1), new e(0, -1, -1)], s = [151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180], M = .5 * (Math.sqrt(3) - 1), k = (3 - Math.sqrt(3)) / 6, B = 1 / 6, l = function () { function e(t) { o(this, e), void 0 === t && (t = 0), this.perm = new Array(512), this.gradP = new Array(512), this.setSeed(t) } return t(e, [{ key: "setSeed", value: function (t) { var e = this.perm, n = this.gradP; 0 < t && t < 1 && (t *= 65536), (t = Math.floor(t)) < 256 && (t |= t << 8); for (var r = 0; r < 256; r++) { var o; o = 1 & r ? s[r] ^ 255 & t : s[r] ^ t >> 8 & 255, e[r] = e[r + 256] = o, n[r] = n[r + 256] = c[o % 12] } } }, { key: "simplex2", value: function (t, e) { var n, r, o = this.perm, i = this.gradP, u = (t + e) * M, f = Math.floor(t + u), a = Math.floor(e + u), c = (f + a) * k, s = t - f + c, l = e - a + c; r = l < s ? (n = 1, 0) : (n = 0, 1); var h = s - n + k, d = l - r + k, p = s - 1 + 2 * k, y = l - 1 + 2 * k, v = i[(f &= 255) + o[a &= 255]], w = i[f + n + o[a + r]], b = i[f + 1 + o[a + 1]], g = .5 - s * s - l * l, m = .5 - h * h - d * d, P = .5 - p * p - y * y; return 70 * ((g < 0 ? 0 : (g *= g) * g * v.dot2(s, l)) + (m < 0 ? 0 : (m *= m) * m * w.dot2(h, d)) + (P < 0 ? 0 : (P *= P) * P * b.dot2(p, y))) } }, { key: "simplex3", value: function (t, e, n) { var r, o, i, u, f, a, c = this.perm, s = this.gradP, l = (t + e + n) * (1 / 3), h = Math.floor(t + l), d = Math.floor(e + l), p = Math.floor(n + l), y = (h + d + p) * B, v = t - h + y, w = e - d + y, b = n - p + y; a = w <= v ? b <= w ? (f = u = r = 1, i = o = 0) : u = b <= v ? (f = i = o = 0, r = 1) : (f = o = r = 0, i = 1) : w < b ? (u = o = r = 0, f = i = 1) : v < b ? (u = i = r = 0, f = o = 1) : (f = u = o = 1, i = r = 0); var g = v - r + B, m = w - o + B, P = b - i + B, M = v - u + 2 * B, k = w - f + 2 * B, x = b - a + 2 * B, O = v - 1 + .5, j = w - 1 + .5, _ = b - 1 + .5, R = s[(h &= 255) + c[(d &= 255) + c[p &= 255]]], S = s[h + r + c[d + o + c[p + i]]], T = s[h + u + c[d + f + c[p + a]]], E = s[h + 1 + c[d + 1 + c[p + 1]]], q = .6 - v * v - w * w - b * b, z = .6 - g * g - m * m - P * P, A = .6 - M * M - k * k - x * x, D = .6 - O * O - j * j - _ * _; return 32 * ((q < 0 ? 0 : (q *= q) * q * R.dot3(v, w, b)) + (z < 0 ? 0 : (z *= z) * z * S.dot3(g, m, P)) + (A < 0 ? 0 : (A *= A) * A * T.dot3(M, k, x)) + (D < 0 ? 0 : (D *= D) * D * E.dot3(O, j, _))) } }, { key: "perlin2", value: function (t, e) { var n = this.perm, r = this.gradP, o = Math.floor(t), i = Math.floor(e); t -= o, e -= i; var u = r[(o &= 255) + n[i &= 255]].dot2(t, e), f = r[o + n[i + 1]].dot2(t, e - 1), a = r[o + 1 + n[i]].dot2(t - 1, e), c = r[o + 1 + n[i + 1]].dot2(t - 1, e - 1), s = g(t); return m(m(u, a, s), m(f, c, s), g(e)) } }, { key: "perlin3", value: function (t, e, n) { var r = this.perm, o = this.gradP, i = Math.floor(t), u = Math.floor(e), f = Math.floor(n); t -= i, e -= u, n -= f; var a = o[(i &= 255) + r[(u &= 255) + r[f &= 255]]].dot3(t, e, n), c = o[i + r[u + r[f + 1]]].dot3(t, e, n - 1), s = o[i + r[u + 1 + r[f]]].dot3(t, e - 1, n), l = o[i + r[u + 1 + r[f + 1]]].dot3(t, e - 1, n - 1), h = o[i + 1 + r[u + r[f]]].dot3(t - 1, e, n), d = o[i + 1 + r[u + r[f + 1]]].dot3(t - 1, e, n - 1), p = o[i + 1 + r[u + 1 + r[f]]].dot3(t - 1, e - 1, n), y = o[i + 1 + r[u + 1 + r[f + 1]]].dot3(t - 1, e - 1, n - 1), v = g(t), w = g(e), b = g(n); return m(m(m(a, h, v), m(c, d, v), b), m(m(s, p, v), m(l, y, v), b), w) } }]), e }(); return function () { !function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && u(t, e) }(n, Phaser.Plugins.BasePlugin); var e = a(n); function n(t) { return o(this, n), e.call(this, t) } return t(n, [{ key: "start", value: function () { this.game.events.on("destroy", this.destroy, this) } }, { key: "add", value: function (t) { return new l(t) } }]), n }() });