diff --git a/cosmopolitan.nix b/cosmopolitan.nix new file mode 100644 index 0000000..237666c --- /dev/null +++ b/cosmopolitan.nix @@ -0,0 +1,93 @@ +{ lib +, stdenv +, fetchFromGitHub +, bintools-unwrapped +, callPackage +, coreutils +, substituteAll +, unzip +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "cosmopolitan"; + version = "2.2"; + + src = fetchFromGitHub { + owner = "jart"; + repo = "cosmopolitan"; + rev = finalAttrs.version; + hash = "sha256-DTL1dXH+LhaxWpiCrsNjV74Bw5+kPbhEAA2Z1NKiPDk="; + }; + + patches = [ + # make sure tests set PATH correctly + (substituteAll { + src = ./fix-paths.patch; + inherit coreutils; + }) + ]; + + nativeBuildInputs = [ + bintools-unwrapped + unzip + ]; + + strictDeps = true; + + outputs = [ "out" "dist" ]; + + # slashes are significant because upstream uses o/$(MODE)/foo.o + buildFlags = [ + "o/cosmopolitan.h" + "o//cosmopolitan.a" + "o//libc/crt/crt.o" + "o//ape/ape.o" + "o//ape/ape.lds" + "o//tool/net/redbean.com" + ]; + + checkTarget = "o//test"; + + enableParallelBuilding = true; + + doCheck = false; + dontConfigure = true; + dontFixup = true; + + preCheck = let + failingTests = [ + # some syscall tests fail because we're in a sandbox + "test/libc/calls/sched_setscheduler_test.c" + "test/libc/thread/pthread_create_test.c" + "test/libc/calls/getgroups_test.c" + # fails + "test/libc/stdio/posix_spawn_test.c" + ]; + in lib.concatStringsSep ";\n" (map (t: "rm -v ${t}") failingTests); + + installPhase = '' + runHook preInstall + + mkdir -p $out/{include,lib,bin} + install o/cosmopolitan.h $out/include + install o/cosmopolitan.a o/libc/crt/crt.o o/ape/ape.{o,lds} o/ape/ape-no-modify-self.o $out/lib + install o/tool/net/redbean.com $out/bin/xrsh.com + cp -RT . "$dist" + + runHook postInstall + ''; + + passthru = { + cosmocc = callPackage ./cosmocc.nix { + cosmopolitan = finalAttrs.finalPackage; + }; + }; + + meta = { + homepage = "https://xrsh.isvery.ninja/"; + description = "XR shell runs a linux ISO in WebXR"; + license = lib.licenses.isc; + maintainers = lib.teams.cosmopolitan.members; + platforms = lib.platforms.x86_64; + }; +}) diff --git a/make b/make index d611512..6426ca0 100755 --- a/make +++ b/make @@ -15,14 +15,18 @@ deps(){ # check dependencies } standalone(){ # build standalone xrsh.com binary - rm ${APP}.com || true - deps + FILE=${APP}.com + test -z "$1" && { + rm ${APP}.com || true + deps + } + test -n "$1" && FILE="$1" #cp index.html /tmp/index.html #sed -i 's|isoterminal=".*"|isoterminal="iso: ./../xrsh.iso"|g' index.html - zip -x "*.git*" -r ${APP}.com index.html xrsh.iso .args LICENSE src/index.{html,css} src/assets src/com/*.js src/com/isoterminal/{libv86.js,bios,v86.wasm,feat,core.js} + zip -x "*.git*" -r "$FILE" index.html xrsh.iso .args LICENSE src/index.{html,css} src/assets src/com/*.js src/com/isoterminal/{libv86.js,bios,v86.wasm,feat,core.js,PromiseWorker.js,ISOTerminal.js,localforage.js,VT100.js,assets,worker.js} #cp /tmp/index.html index.html - sha256sum ${APP}.com > ${APP}.txt - ls -lah ${APP}.com + sha256sum ${APP}.com > "$FILE".txt + ls -lah "$FILE" } dev(){ # start dev http server diff --git a/nix/xrsh.nix b/nix/xrsh.nix new file mode 100644 index 0000000..2e15556 --- /dev/null +++ b/nix/xrsh.nix @@ -0,0 +1,53 @@ +{ stdenv, fetchurl, fetchzip, lib, zip }: + +stdenv.mkDerivation rec { + pname = "xrsh"; + version = "0.0.13"; + + redbean = fetchurl { + url = "https://redbean.dev/redbean-2.2.com"; + hash = "sha256-24/HzFp3A7fMuDCjZutp5yj8eJL9PswJPAidg3qluRs="; + }; + + xrsh = fetchzip { + url = "https://codeberg.org/xrsh/xrsh/archive/24e117f5125e4b2ecd7432baf6fdd5f60e6b3a70.tar.gz"; + sha256 = "1x0h5krz90y8ngrzgbpjd6xdr171y54p3lqwyirq8j6ilzlq5d5i"; + }; + + xrshcom = fetchzip { + url = "https://codeberg.org/xrsh/xrsh-com/archive/c668a8ba8f65c3d36e3a4da5ea8b87af5eb6091c.tar.gz"; + sha256 = "0mpl7h4fxg5i4lxw5447pqr12rsffcf24xdrqwqzr1zzpkdkslks"; + }; + + buildInputs = [ zip ]; + + dontUnpack = true; + + dontBuild = true; + + dontFixup = true; # essential, otherwise cosmopolitcan libc exec-header gets corrupted + + installPhase = '' + install -D $redbean $out/bin/xrsh.com + chmod +x $out/bin/xrsh.com + + cd $xrsh + zip -x "*.git*" -r $out/bin/xrsh.com index.html src/index.{html,css} LICENSE src/assets + + # add components + mkdir /tmp/src + cp -r $xrshcom/* /tmp/src/. + cd /tmp + zip -x "*.git*" -r $out/bin/xrsh.com src/com/*.js src/com/isoterminal/{xrsh.iso,libv86.js,bios,v86.wasm} + ''; + + meta = with lib; { + description = "XR shell which runs a linux ISO in WebXR"; + license = "MPL"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + homepage = "https://xrsh.isvery.ninja"; + maintainers = with maintainers; [ coderofsalvation ]; + platforms = [ "i686-linux" "x86_64-linux" "x86_64-windows" "i686-windows" "x86_64-darwin" ]; + }; +} + diff --git a/nix/xrsh.nix.bak b/nix/xrsh.nix.bak new file mode 100644 index 0000000..6e9948b --- /dev/null +++ b/nix/xrsh.nix.bak @@ -0,0 +1,25 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "xrsh"; + version = "0.1"; + + src = fetchurl { + url = "https://codeberg.org/xrsh/xrsh/archive/24e117f5125e4b2ecd7432baf6fdd5f60e6b3a70.tar.gz"; + sha256 = "11v22pijnjm3mb3n8dki4m95rc73azschfwvh2c1pc3bxrfsk0k8"; + }; + + #cosmopolitan = pkgs.callPackage pkgs.cosmopolitan { }; + + ## Override derivation to modify buildFlags + #redbean = cosmopolitan.overrideDerivation (oldAttrs: { + # buildFlags = oldAttrs.buildFlags ++ ["--enable-feature-x"]; + #}); + + buildInputs = []; + + buildFlags = []; + + # Define phases if needed, e.g., build, install, etc. + # phases = [ "buildPhase" "installPhase" ]; +} diff --git a/result b/result new file mode 120000 index 0000000..e503011 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/17c38pj7561hc4s27410crcb2g5571vw-xrsh-0.2 \ No newline at end of file diff --git a/src/aframe b/src/aframe new file mode 120000 index 0000000..db9ef7a --- /dev/null +++ b/src/aframe @@ -0,0 +1 @@ +../../../aframe \ No newline at end of file diff --git a/src/dist/index.443d2602.js b/src/dist/index.443d2602.js new file mode 100644 index 0000000..7438e99 --- /dev/null +++ b/src/dist/index.443d2602.js @@ -0,0 +1,37894 @@ +!function(e1, t) { + "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.AFRAME = t() : e1.AFRAME = t(); +}(self, ()=>(()=>{ + var e1 = { + 651: ()=>{ + !function() { + "use strict"; + var e1 = function(e1, t) { + var n = function(e1) { + for(var t = 0, n = e1.length; t < n; t++)i(e1[t]); + }, i = function(e1) { + var t = e1.target, n = e1.attributeName, i = e1.oldValue; + t.attributeChangedCallback(n, i, t.getAttribute(n)); + }; + return function(r, s) { + var o = r.constructor.observedAttributes; + return o && e1(s).then(function() { + new t(n).observe(r, { + attributes: !0, + attributeOldValue: !0, + attributeFilter: o + }); + for(var e1 = 0, s = o.length; e1 < s; e1++)r.hasAttribute(o[e1]) && i({ + target: r, + attributeName: o[e1], + oldValue: null + }); + }), r; + }; + }; + function t(e1, t) { + (null == t || t > e1.length) && (t = e1.length); + for(var n = 0, i = new Array(t); n < t; n++)i[n] = e1[n]; + return i; + } + function n(e1, n) { + var i = "undefined" != typeof Symbol && e1[Symbol.iterator] || e1["@@iterator"]; + if (!i) { + if (Array.isArray(e1) || (i = function(e1, n) { + if (e1) { + if ("string" == typeof e1) return t(e1, n); + var i = Object.prototype.toString.call(e1).slice(8, -1); + return "Object" === i && e1.constructor && (i = e1.constructor.name), "Map" === i || "Set" === i ? Array.from(e1) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? t(e1, n) : void 0; + } + }(e1)) || n && e1 && "number" == typeof e1.length) { + i && (e1 = i); + var r = 0, s = function() {}; + return { + s, + n: function() { + return r >= e1.length ? { + done: !0 + } : { + done: !1, + value: e1[r++] + }; + }, + e: function(e1) { + throw e1; + }, + f: s + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var o, a = !0, l = !1; + return { + s: function() { + i = i.call(e1); + }, + n: function() { + var e1 = i.next(); + return a = e1.done, e1; + }, + e: function(e1) { + l = !0, o = e1; + }, + f: function() { + try { + a || null == i.return || i.return(); + } finally{ + if (l) throw o; + } + } + }; + } + var i = !0, r = !1, s = "querySelectorAll", o = "querySelectorAll", a = self, l = a.document, c = a.Element, h = a.MutationObserver, u = a.Set, d = a.WeakMap, p = function(e1) { + return o in e1; + }, A = [].filter, f = function(e1) { + var t = new d, a = function(n, i) { + var r; + if (i) for(var s, o = function(e1) { + return e1.matches || e1.webkitMatchesSelector || e1.msMatchesSelector; + }(n), a = 0, l = m.length; a < l; a++)o.call(n, s = m[a]) && (t.has(n) || t.set(n, new u), (r = t.get(n)).has(s) || (r.add(s), e1.handle(n, i, s))); + else t.has(n) && (r = t.get(n), t.delete(n), r.forEach(function(t) { + e1.handle(n, i, t); + })); + }, f = function(e1) { + for(var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n = 0, i = e1.length; n < i; n++)a(e1[n], t); + }, m = e1.query, g = e1.root || l, v = function(e1) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : document, o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : MutationObserver, a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : [ + "*" + ], l = function t(r, o, a, l, c, h) { + var u, d = n(r); + try { + for(d.s(); !(u = d.n()).done;){ + var p = u.value; + (h || s in p) && (c ? a.has(p) || (a.add(p), l.delete(p), e1(p, c)) : l.has(p) || (l.add(p), a.delete(p), e1(p, c)), h || t(p[s](o), o, a, l, c, i)); + } + } catch (e1) { + d.e(e1); + } finally{ + d.f(); + } + }, c = new o(function(e1) { + if (a.length) { + var t, s = a.join(","), o = new Set, c = new Set, h = n(e1); + try { + for(h.s(); !(t = h.n()).done;){ + var u = t.value, d = u.addedNodes, p = u.removedNodes; + l(p, s, o, c, r, r), l(d, s, o, c, i, r); + } + } catch (e1) { + h.e(e1); + } finally{ + h.f(); + } + } + }), h = c.observe; + return (c.observe = function(e1) { + return h.call(c, e1, { + subtree: i, + childList: i + }); + })(t), c; + }(a, g, h, m), y = c.prototype.attachShadow; + return y && (c.prototype.attachShadow = function(e1) { + var t = y.call(this, e1); + return v.observe(t), t; + }), m.length && f(g[o](m)), { + drop: function(e1) { + for(var n = 0, i = e1.length; n < i; n++)t.delete(e1[n]); + }, + flush: function() { + for(var e1 = v.takeRecords(), t = 0, n = e1.length; t < n; t++)f(A.call(e1[t].removedNodes, p), !1), f(A.call(e1[t].addedNodes, p), !0); + }, + observer: v, + parse: f + }; + }, m = self, g = m.document, v = m.Map, y = m.MutationObserver, E = m.Object, b = m.Set, x = m.WeakMap, C = m.Element, w = m.HTMLElement, _ = m.Node, M = m.Error, S = m.TypeError, I = m.Reflect, B = E.defineProperty, T = E.keys, R = E.getOwnPropertyNames, L = E.setPrototypeOf, D = !self.customElements, P = function(e1) { + for(var t = T(e1), n = [], i = t.length, r = 0; r < i; r++)n[r] = e1[t[r]], delete e1[t[r]]; + return function() { + for(var r = 0; r < i; r++)e1[t[r]] = n[r]; + }; + }; + if (D) { + var U = function() { + var e1 = this.constructor; + if (!F.has(e1)) throw new S("Illegal constructor"); + var t = F.get(e1); + if (H) return W(H, t); + var n = O.call(g, t); + return W(L(n, e1.prototype), t); + }, O = g.createElement, F = new v, N = new v, k = new v, Q = new v, G = [], z = f({ + query: G, + handle: function(e1, t, n) { + var i = k.get(n); + if (t && !i.isPrototypeOf(e1)) { + var r = P(e1); + H = L(e1, i); + try { + new i.constructor; + } finally{ + H = null, r(); + } + } + var s = "".concat(t ? "" : "dis", "connectedCallback"); + s in i && e1[s](); + } + }).parse, H = null, V = function(e1) { + if (!N.has(e1)) { + var t, n = new Promise(function(e1) { + t = e1; + }); + N.set(e1, { + $: n, + _: t + }); + } + return N.get(e1).$; + }, W = e1(V, y); + B(self, "customElements", { + configurable: !0, + value: { + define: function(e1, t) { + if (Q.has(e1)) throw new M('the name "'.concat(e1, '" has already been used with this registry')); + F.set(t, e1), k.set(e1, t.prototype), Q.set(e1, t), G.push(e1), V(e1).then(function() { + z(g.querySelectorAll(e1)); + }), N.get(e1)._(t); + }, + get: function(e1) { + return Q.get(e1); + }, + whenDefined: V + } + }), B(U.prototype = w.prototype, "constructor", { + value: U + }), B(self, "HTMLElement", { + configurable: !0, + value: U + }), B(g, "createElement", { + configurable: !0, + value: function(e1, t) { + var n = t && t.is, i = n ? Q.get(n) : Q.get(e1); + return i ? new i : O.call(g, e1); + } + }), "isConnected" in _.prototype || B(_.prototype, "isConnected", { + configurable: !0, + get: function() { + return !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED); + } + }); + } else if (D = !self.customElements.get("extends-li")) try { + var j = function e1() { + return self.Reflect.construct(HTMLLIElement, [], e1); + }; + j.prototype = HTMLLIElement.prototype; + var q = "extends-li"; + self.customElements.define("extends-li", j, { + extends: "li" + }), D = g.createElement("li", { + is: q + }).outerHTML.indexOf(q) < 0; + var X = self.customElements, Y = X.get, J = X.whenDefined; + B(self.customElements, "whenDefined", { + configurable: !0, + value: function(e1) { + var t = this; + return J.call(this, e1).then(function(n) { + return n || Y.call(t, e1); + }); + } + }); + } catch (e1) {} + if (D) { + var K = function(e1) { + var t = se.get(e1); + Ae(t.querySelectorAll(this), e1.isConnected); + }, Z = self.customElements, $ = g.createElement, ee = Z.define, te = Z.get, ne = Z.upgrade, ie = I || { + construct: function(e1) { + return e1.call(this); + } + }, re = ie.construct, se = new x, oe = new b, ae = new v, le = new v, ce = new v, he = new v, ue = [], de = [], pe = function(e1) { + return he.get(e1) || te.call(Z, e1); + }, Ae = f({ + query: de, + handle: function(e1, t, n) { + var i = ce.get(n); + if (t && !i.isPrototypeOf(e1)) { + var r = P(e1); + ye = L(e1, i); + try { + new i.constructor; + } finally{ + ye = null, r(); + } + } + var s = "".concat(t ? "" : "dis", "connectedCallback"); + s in i && e1[s](); + } + }).parse, fe = f({ + query: ue, + handle: function(e1, t) { + se.has(e1) && (t ? oe.add(e1) : oe.delete(e1), de.length && K.call(de, e1)); + } + }).parse, me = C.prototype.attachShadow; + me && (C.prototype.attachShadow = function(e1) { + var t = me.call(this, e1); + return se.set(this, t), t; + }); + var ge = function(e1) { + if (!le.has(e1)) { + var t, n = new Promise(function(e1) { + t = e1; + }); + le.set(e1, { + $: n, + _: t + }); + } + return le.get(e1).$; + }, ve = e1(ge, y), ye = null; + R(self).filter(function(e1) { + return /^HTML.*Element$/.test(e1); + }).forEach(function(e1) { + var t = self[e1]; + function n() { + var e1 = this.constructor; + if (!ae.has(e1)) throw new S("Illegal constructor"); + var n = ae.get(e1), i = n.is, r = n.tag; + if (i) { + if (ye) return ve(ye, i); + var s = $.call(g, r); + return s.setAttribute("is", i), ve(L(s, e1.prototype), i); + } + return re.call(this, t, [], e1); + } + B(n.prototype = t.prototype, "constructor", { + value: n + }), B(self, e1, { + value: n + }); + }), B(g, "createElement", { + configurable: !0, + value: function(e1, t) { + var n = t && t.is; + if (n) { + var i = he.get(n); + if (i && ae.get(i).tag === e1) return new i; + } + var r = $.call(g, e1); + return n && r.setAttribute("is", n), r; + } + }), B(Z, "get", { + configurable: !0, + value: pe + }), B(Z, "whenDefined", { + configurable: !0, + value: ge + }), B(Z, "upgrade", { + configurable: !0, + value: function(e1) { + var t = e1.getAttribute("is"); + if (t) { + var n = he.get(t); + if (n) return void ve(L(e1, n.prototype), t); + } + ne.call(Z, e1); + } + }), B(Z, "define", { + configurable: !0, + value: function(e1, t, n) { + if (pe(e1)) throw new M("'".concat(e1, "' has already been defined as a custom element")); + var i, r = n && n.extends; + ae.set(t, r ? { + is: e1, + tag: r + } : { + is: "", + tag: e1 + }), r ? (i = "".concat(r, '[is="').concat(e1, '"]'), ce.set(i, t.prototype), he.set(e1, t), de.push(i)) : (ee.apply(Z, arguments), ue.push(i = e1)), ge(e1).then(function() { + r ? (Ae(g.querySelectorAll(i)), oe.forEach(K, [ + i + ])) : fe(g.querySelectorAll(i)); + }), le.get(e1)._(t); + } + }); + } + }(); + }, + 6793: (e1)=>{ + var t = Object.prototype.toString; + e1.exports = function(e1) { + return e1.BYTES_PER_ELEMENT && "[object ArrayBuffer]" === t.call(e1.buffer) || Array.isArray(e1); + }; + }, + 3205: (e1)=>{ + e1.exports = function(e1, t) { + return "number" == typeof e1 ? e1 : "number" == typeof t ? t : 0; + }; + }, + 6717: (e1, t)=>{ + "use strict"; + t.byteLength = function(e1) { + var t = l(e1), n = t[0], i = t[1]; + return 3 * (n + i) / 4 - i; + }, t.toByteArray = function(e1) { + var t, n, s = l(e1), o = s[0], a = s[1], c = new r(function(e1, t, n) { + return 3 * (t + n) / 4 - n; + }(0, o, a)), h = 0, u = a > 0 ? o - 4 : o; + for(n = 0; n < u; n += 4)t = i[e1.charCodeAt(n)] << 18 | i[e1.charCodeAt(n + 1)] << 12 | i[e1.charCodeAt(n + 2)] << 6 | i[e1.charCodeAt(n + 3)], c[h++] = t >> 16 & 255, c[h++] = t >> 8 & 255, c[h++] = 255 & t; + return 2 === a && (t = i[e1.charCodeAt(n)] << 2 | i[e1.charCodeAt(n + 1)] >> 4, c[h++] = 255 & t), 1 === a && (t = i[e1.charCodeAt(n)] << 10 | i[e1.charCodeAt(n + 1)] << 4 | i[e1.charCodeAt(n + 2)] >> 2, c[h++] = t >> 8 & 255, c[h++] = 255 & t), c; + }, t.fromByteArray = function(e1) { + for(var t, i = e1.length, r = i % 3, s = [], o = 16383, a = 0, l = i - r; a < l; a += o)s.push(c(e1, a, a + o > l ? l : a + o)); + return 1 === r ? (t = e1[i - 1], s.push(n[t >> 2] + n[t << 4 & 63] + "==")) : 2 === r && (t = (e1[i - 2] << 8) + e1[i - 1], s.push(n[t >> 10] + n[t >> 4 & 63] + n[t << 2 & 63] + "=")), s.join(""); + }; + for(var n = [], i = [], r = "undefined" != typeof Uint8Array ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = 0, a = s.length; o < a; ++o)n[o] = s[o], i[s.charCodeAt(o)] = o; + function l(e1) { + var t = e1.length; + if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); + var n = e1.indexOf("="); + return -1 === n && (n = t), [ + n, + n === t ? 0 : 4 - n % 4 + ]; + } + function c(e1, t, i) { + for(var r, s, o = [], a = t; a < i; a += 3)r = (e1[a] << 16 & 16711680) + (e1[a + 1] << 8 & 65280) + (255 & e1[a + 2]), o.push(n[(s = r) >> 18 & 63] + n[s >> 12 & 63] + n[s >> 6 & 63] + n[63 & s]); + return o.join(""); + } + i["-".charCodeAt(0)] = 62, i["_".charCodeAt(0)] = 63; + }, + 5286: (e1, t, n)=>{ + var i = n(5851).lW; + e1.exports = function(e1, t) { + if (i.isBuffer(e1) && i.isBuffer(t)) { + if ("function" == typeof e1.equals) return e1.equals(t); + if (e1.length !== t.length) return !1; + for(var n = 0; n < e1.length; n++)if (e1[n] !== t[n]) return !1; + return !0; + } + }; + }, + 5851: (e1, t, n)=>{ + "use strict"; + const i = n(6717), r = n(9350), s = "function" == typeof Symbol && "function" == typeof Symbol.for ? Symbol.for("nodejs.util.inspect.custom") : null; + t.lW = l, t.h2 = 50; + const o = 2147483647; + function a(e1) { + if (e1 > o) throw new RangeError('The value "' + e1 + '" is invalid for option "size"'); + const t = new Uint8Array(e1); + return Object.setPrototypeOf(t, l.prototype), t; + } + function l(e1, t, n) { + if ("number" == typeof e1) { + if ("string" == typeof t) throw new TypeError('The "string" argument must be of type string. Received type number'); + return u(e1); + } + return c(e1, t, n); + } + function c(e1, t, n) { + if ("string" == typeof e1) return function(e1, t) { + if ("string" == typeof t && "" !== t || (t = "utf8"), !l.isEncoding(t)) throw new TypeError("Unknown encoding: " + t); + const n = 0 | f(e1, t); + let i = a(n); + const r = i.write(e1, t); + return r !== n && (i = i.slice(0, r)), i; + }(e1, t); + if (ArrayBuffer.isView(e1)) return function(e1) { + if (Y(e1, Uint8Array)) { + const t = new Uint8Array(e1); + return p(t.buffer, t.byteOffset, t.byteLength); + } + return d(e1); + }(e1); + if (null == e1) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e1); + if (Y(e1, ArrayBuffer) || e1 && Y(e1.buffer, ArrayBuffer)) return p(e1, t, n); + if ("undefined" != typeof SharedArrayBuffer && (Y(e1, SharedArrayBuffer) || e1 && Y(e1.buffer, SharedArrayBuffer))) return p(e1, t, n); + if ("number" == typeof e1) throw new TypeError('The "value" argument must not be of type number. Received type number'); + const i = e1.valueOf && e1.valueOf(); + if (null != i && i !== e1) return l.from(i, t, n); + const r = function(e1) { + if (l.isBuffer(e1)) { + const t = 0 | A(e1.length), n = a(t); + return 0 === n.length || e1.copy(n, 0, 0, t), n; + } + return void 0 !== e1.length ? "number" != typeof e1.length || J(e1.length) ? a(0) : d(e1) : "Buffer" === e1.type && Array.isArray(e1.data) ? d(e1.data) : void 0; + }(e1); + if (r) return r; + if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof e1[Symbol.toPrimitive]) return l.from(e1[Symbol.toPrimitive]("string"), t, n); + throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e1); + } + function h(e1) { + if ("number" != typeof e1) throw new TypeError('"size" argument must be of type number'); + if (e1 < 0) throw new RangeError('The value "' + e1 + '" is invalid for option "size"'); + } + function u(e1) { + return h(e1), a(e1 < 0 ? 0 : 0 | A(e1)); + } + function d(e1) { + const t = e1.length < 0 ? 0 : 0 | A(e1.length), n = a(t); + for(let i = 0; i < t; i += 1)n[i] = 255 & e1[i]; + return n; + } + function p(e1, t, n) { + if (t < 0 || e1.byteLength < t) throw new RangeError('"offset" is outside of buffer bounds'); + if (e1.byteLength < t + (n || 0)) throw new RangeError('"length" is outside of buffer bounds'); + let i; + return i = void 0 === t && void 0 === n ? new Uint8Array(e1) : void 0 === n ? new Uint8Array(e1, t) : new Uint8Array(e1, t, n), Object.setPrototypeOf(i, l.prototype), i; + } + function A(e1) { + if (e1 >= o) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + o.toString(16) + " bytes"); + return 0 | e1; + } + function f(e1, t) { + if (l.isBuffer(e1)) return e1.length; + if (ArrayBuffer.isView(e1) || Y(e1, ArrayBuffer)) return e1.byteLength; + if ("string" != typeof e1) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e1); + const n = e1.length, i = arguments.length > 2 && !0 === arguments[2]; + if (!i && 0 === n) return 0; + let r = !1; + for(;;)switch(t){ + case "ascii": + case "latin1": + case "binary": + return n; + case "utf8": + case "utf-8": + return j(e1).length; + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return 2 * n; + case "hex": + return n >>> 1; + case "base64": + return q(e1).length; + default: + if (r) return i ? -1 : j(e1).length; + t = ("" + t).toLowerCase(), r = !0; + } + } + function m(e1, t, n) { + let i = !1; + if ((void 0 === t || t < 0) && (t = 0), t > this.length) return ""; + if ((void 0 === n || n > this.length) && (n = this.length), n <= 0) return ""; + if ((n >>>= 0) <= (t >>>= 0)) return ""; + for(e1 || (e1 = "utf8");;)switch(e1){ + case "hex": + return T(this, t, n); + case "utf8": + case "utf-8": + return M(this, t, n); + case "ascii": + return I(this, t, n); + case "latin1": + case "binary": + return B(this, t, n); + case "base64": + return _(this, t, n); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return R(this, t, n); + default: + if (i) throw new TypeError("Unknown encoding: " + e1); + e1 = (e1 + "").toLowerCase(), i = !0; + } + } + function g(e1, t, n) { + const i = e1[t]; + e1[t] = e1[n], e1[n] = i; + } + function v(e1, t, n, i, r) { + if (0 === e1.length) return -1; + if ("string" == typeof n ? (i = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), J(n = +n) && (n = r ? 0 : e1.length - 1), n < 0 && (n = e1.length + n), n >= e1.length) { + if (r) return -1; + n = e1.length - 1; + } else if (n < 0) { + if (!r) return -1; + n = 0; + } + if ("string" == typeof t && (t = l.from(t, i)), l.isBuffer(t)) return 0 === t.length ? -1 : y(e1, t, n, i, r); + if ("number" == typeof t) return t &= 255, "function" == typeof Uint8Array.prototype.indexOf ? r ? Uint8Array.prototype.indexOf.call(e1, t, n) : Uint8Array.prototype.lastIndexOf.call(e1, t, n) : y(e1, [ + t + ], n, i, r); + throw new TypeError("val must be string, number or Buffer"); + } + function y(e1, t, n, i, r) { + let s, o = 1, a = e1.length, l = t.length; + if (void 0 !== i && ("ucs2" === (i = String(i).toLowerCase()) || "ucs-2" === i || "utf16le" === i || "utf-16le" === i)) { + if (e1.length < 2 || t.length < 2) return -1; + o = 2, a /= 2, l /= 2, n /= 2; + } + function c(e1, t) { + return 1 === o ? e1[t] : e1.readUInt16BE(t * o); + } + if (r) { + let i = -1; + for(s = n; s < a; s++)if (c(e1, s) === c(t, -1 === i ? 0 : s - i)) { + if (-1 === i && (i = s), s - i + 1 === l) return i * o; + } else -1 !== i && (s -= s - i), i = -1; + } else for(n + l > a && (n = a - l), s = n; s >= 0; s--){ + let n = !0; + for(let i = 0; i < l; i++)if (c(e1, s + i) !== c(t, i)) { + n = !1; + break; + } + if (n) return s; + } + return -1; + } + function E(e1, t, n, i) { + n = Number(n) || 0; + const r = e1.length - n; + i ? (i = Number(i)) > r && (i = r) : i = r; + const s = t.length; + let o; + for(i > s / 2 && (i = s / 2), o = 0; o < i; ++o){ + const i = parseInt(t.substr(2 * o, 2), 16); + if (J(i)) return o; + e1[n + o] = i; + } + return o; + } + function b(e1, t, n, i) { + return X(j(t, e1.length - n), e1, n, i); + } + function x(e1, t, n, i) { + return X(function(e1) { + const t = []; + for(let n = 0; n < e1.length; ++n)t.push(255 & e1.charCodeAt(n)); + return t; + }(t), e1, n, i); + } + function C(e1, t, n, i) { + return X(q(t), e1, n, i); + } + function w(e1, t, n, i) { + return X(function(e1, t) { + let n, i, r; + const s = []; + for(let o = 0; o < e1.length && !((t -= 2) < 0); ++o)n = e1.charCodeAt(o), i = n >> 8, r = n % 256, s.push(r), s.push(i); + return s; + }(t, e1.length - n), e1, n, i); + } + function _(e1, t, n) { + return 0 === t && n === e1.length ? i.fromByteArray(e1) : i.fromByteArray(e1.slice(t, n)); + } + function M(e1, t, n) { + n = Math.min(e1.length, n); + const i = []; + let r = t; + for(; r < n;){ + const t = e1[r]; + let s = null, o = t > 239 ? 4 : t > 223 ? 3 : t > 191 ? 2 : 1; + if (r + o <= n) { + let n, i, a, l; + switch(o){ + case 1: + t < 128 && (s = t); + break; + case 2: + n = e1[r + 1], 128 == (192 & n) && (l = (31 & t) << 6 | 63 & n, l > 127 && (s = l)); + break; + case 3: + n = e1[r + 1], i = e1[r + 2], 128 == (192 & n) && 128 == (192 & i) && (l = (15 & t) << 12 | (63 & n) << 6 | 63 & i, l > 2047 && (l < 55296 || l > 57343) && (s = l)); + break; + case 4: + n = e1[r + 1], i = e1[r + 2], a = e1[r + 3], 128 == (192 & n) && 128 == (192 & i) && 128 == (192 & a) && (l = (15 & t) << 18 | (63 & n) << 12 | (63 & i) << 6 | 63 & a, l > 65535 && l < 1114112 && (s = l)); + } + } + null === s ? (s = 65533, o = 1) : s > 65535 && (s -= 65536, i.push(s >>> 10 & 1023 | 55296), s = 56320 | 1023 & s), i.push(s), r += o; + } + return function(e1) { + const t = e1.length; + if (t <= S) return String.fromCharCode.apply(String, e1); + let n = "", i = 0; + for(; i < t;)n += String.fromCharCode.apply(String, e1.slice(i, i += S)); + return n; + }(i); + } + l.TYPED_ARRAY_SUPPORT = function() { + try { + const e1 = new Uint8Array(1), t = { + foo: function() { + return 42; + } + }; + return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(e1, t), 42 === e1.foo(); + } catch (e1) { + return !1; + } + }(), l.TYPED_ARRAY_SUPPORT || "undefined" == typeof console || "function" != typeof console.error || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."), Object.defineProperty(l.prototype, "parent", { + enumerable: !0, + get: function() { + if (l.isBuffer(this)) return this.buffer; + } + }), Object.defineProperty(l.prototype, "offset", { + enumerable: !0, + get: function() { + if (l.isBuffer(this)) return this.byteOffset; + } + }), l.poolSize = 8192, l.from = function(e1, t, n) { + return c(e1, t, n); + }, Object.setPrototypeOf(l.prototype, Uint8Array.prototype), Object.setPrototypeOf(l, Uint8Array), l.alloc = function(e1, t, n) { + return function(e1, t, n) { + return h(e1), e1 <= 0 ? a(e1) : void 0 !== t ? "string" == typeof n ? a(e1).fill(t, n) : a(e1).fill(t) : a(e1); + }(e1, t, n); + }, l.allocUnsafe = function(e1) { + return u(e1); + }, l.allocUnsafeSlow = function(e1) { + return u(e1); + }, l.isBuffer = function(e1) { + return null != e1 && !0 === e1._isBuffer && e1 !== l.prototype; + }, l.compare = function(e1, t) { + if (Y(e1, Uint8Array) && (e1 = l.from(e1, e1.offset, e1.byteLength)), Y(t, Uint8Array) && (t = l.from(t, t.offset, t.byteLength)), !l.isBuffer(e1) || !l.isBuffer(t)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); + if (e1 === t) return 0; + let n = e1.length, i = t.length; + for(let r = 0, s = Math.min(n, i); r < s; ++r)if (e1[r] !== t[r]) { + n = e1[r], i = t[r]; + break; + } + return n < i ? -1 : i < n ? 1 : 0; + }, l.isEncoding = function(e1) { + switch(String(e1).toLowerCase()){ + case "hex": + case "utf8": + case "utf-8": + case "ascii": + case "latin1": + case "binary": + case "base64": + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return !0; + default: + return !1; + } + }, l.concat = function(e1, t) { + if (!Array.isArray(e1)) throw new TypeError('"list" argument must be an Array of Buffers'); + if (0 === e1.length) return l.alloc(0); + let n; + if (void 0 === t) for(t = 0, n = 0; n < e1.length; ++n)t += e1[n].length; + const i = l.allocUnsafe(t); + let r = 0; + for(n = 0; n < e1.length; ++n){ + let t = e1[n]; + if (Y(t, Uint8Array)) r + t.length > i.length ? (l.isBuffer(t) || (t = l.from(t)), t.copy(i, r)) : Uint8Array.prototype.set.call(i, t, r); + else { + if (!l.isBuffer(t)) throw new TypeError('"list" argument must be an Array of Buffers'); + t.copy(i, r); + } + r += t.length; + } + return i; + }, l.byteLength = f, l.prototype._isBuffer = !0, l.prototype.swap16 = function() { + const e1 = this.length; + if (e1 % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); + for(let t = 0; t < e1; t += 2)g(this, t, t + 1); + return this; + }, l.prototype.swap32 = function() { + const e1 = this.length; + if (e1 % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); + for(let t = 0; t < e1; t += 4)g(this, t, t + 3), g(this, t + 1, t + 2); + return this; + }, l.prototype.swap64 = function() { + const e1 = this.length; + if (e1 % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); + for(let t = 0; t < e1; t += 8)g(this, t, t + 7), g(this, t + 1, t + 6), g(this, t + 2, t + 5), g(this, t + 3, t + 4); + return this; + }, l.prototype.toString = function() { + const e1 = this.length; + return 0 === e1 ? "" : 0 === arguments.length ? M(this, 0, e1) : m.apply(this, arguments); + }, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(e1) { + if (!l.isBuffer(e1)) throw new TypeError("Argument must be a Buffer"); + return this === e1 || 0 === l.compare(this, e1); + }, l.prototype.inspect = function() { + let e1 = ""; + const n = t.h2; + return e1 = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (e1 += " ... "), ""; + }, s && (l.prototype[s] = l.prototype.inspect), l.prototype.compare = function(e1, t, n, i, r) { + if (Y(e1, Uint8Array) && (e1 = l.from(e1, e1.offset, e1.byteLength)), !l.isBuffer(e1)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e1); + if (void 0 === t && (t = 0), void 0 === n && (n = e1 ? e1.length : 0), void 0 === i && (i = 0), void 0 === r && (r = this.length), t < 0 || n > e1.length || i < 0 || r > this.length) throw new RangeError("out of range index"); + if (i >= r && t >= n) return 0; + if (i >= r) return -1; + if (t >= n) return 1; + if (this === e1) return 0; + let s = (r >>>= 0) - (i >>>= 0), o = (n >>>= 0) - (t >>>= 0); + const a = Math.min(s, o), c = this.slice(i, r), h = e1.slice(t, n); + for(let e1 = 0; e1 < a; ++e1)if (c[e1] !== h[e1]) { + s = c[e1], o = h[e1]; + break; + } + return s < o ? -1 : o < s ? 1 : 0; + }, l.prototype.includes = function(e1, t, n) { + return -1 !== this.indexOf(e1, t, n); + }, l.prototype.indexOf = function(e1, t, n) { + return v(this, e1, t, n, !0); + }, l.prototype.lastIndexOf = function(e1, t, n) { + return v(this, e1, t, n, !1); + }, l.prototype.write = function(e1, t, n, i) { + if (void 0 === t) i = "utf8", n = this.length, t = 0; + else if (void 0 === n && "string" == typeof t) i = t, n = this.length, t = 0; + else { + if (!isFinite(t)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); + t >>>= 0, isFinite(n) ? (n >>>= 0, void 0 === i && (i = "utf8")) : (i = n, n = void 0); + } + const r = this.length - t; + if ((void 0 === n || n > r) && (n = r), e1.length > 0 && (n < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds"); + i || (i = "utf8"); + let s = !1; + for(;;)switch(i){ + case "hex": + return E(this, e1, t, n); + case "utf8": + case "utf-8": + return b(this, e1, t, n); + case "ascii": + case "latin1": + case "binary": + return x(this, e1, t, n); + case "base64": + return C(this, e1, t, n); + case "ucs2": + case "ucs-2": + case "utf16le": + case "utf-16le": + return w(this, e1, t, n); + default: + if (s) throw new TypeError("Unknown encoding: " + i); + i = ("" + i).toLowerCase(), s = !0; + } + }, l.prototype.toJSON = function() { + return { + type: "Buffer", + data: Array.prototype.slice.call(this._arr || this, 0) + }; + }; + const S = 4096; + function I(e1, t, n) { + let i = ""; + n = Math.min(e1.length, n); + for(let r = t; r < n; ++r)i += String.fromCharCode(127 & e1[r]); + return i; + } + function B(e1, t, n) { + let i = ""; + n = Math.min(e1.length, n); + for(let r = t; r < n; ++r)i += String.fromCharCode(e1[r]); + return i; + } + function T(e1, t, n) { + const i = e1.length; + (!t || t < 0) && (t = 0), (!n || n < 0 || n > i) && (n = i); + let r = ""; + for(let i = t; i < n; ++i)r += K[e1[i]]; + return r; + } + function R(e1, t, n) { + const i = e1.slice(t, n); + let r = ""; + for(let e1 = 0; e1 < i.length - 1; e1 += 2)r += String.fromCharCode(i[e1] + 256 * i[e1 + 1]); + return r; + } + function L(e1, t, n) { + if (e1 % 1 != 0 || e1 < 0) throw new RangeError("offset is not uint"); + if (e1 + t > n) throw new RangeError("Trying to access beyond buffer length"); + } + function D(e1, t, n, i, r, s) { + if (!l.isBuffer(e1)) throw new TypeError('"buffer" argument must be a Buffer instance'); + if (t > r || t < s) throw new RangeError('"value" argument is out of bounds'); + if (n + i > e1.length) throw new RangeError("Index out of range"); + } + function P(e1, t, n, i, r) { + z(t, i, r, e1, n, 7); + let s = Number(t & BigInt(4294967295)); + e1[n++] = s, s >>= 8, e1[n++] = s, s >>= 8, e1[n++] = s, s >>= 8, e1[n++] = s; + let o = Number(t >> BigInt(32) & BigInt(4294967295)); + return e1[n++] = o, o >>= 8, e1[n++] = o, o >>= 8, e1[n++] = o, o >>= 8, e1[n++] = o, n; + } + function U(e1, t, n, i, r) { + z(t, i, r, e1, n, 7); + let s = Number(t & BigInt(4294967295)); + e1[n + 7] = s, s >>= 8, e1[n + 6] = s, s >>= 8, e1[n + 5] = s, s >>= 8, e1[n + 4] = s; + let o = Number(t >> BigInt(32) & BigInt(4294967295)); + return e1[n + 3] = o, o >>= 8, e1[n + 2] = o, o >>= 8, e1[n + 1] = o, o >>= 8, e1[n] = o, n + 8; + } + function O(e1, t, n, i, r, s) { + if (n + i > e1.length) throw new RangeError("Index out of range"); + if (n < 0) throw new RangeError("Index out of range"); + } + function F(e1, t, n, i, s) { + return t = +t, n >>>= 0, s || O(e1, 0, n, 4), r.write(e1, t, n, i, 23, 4), n + 4; + } + function N(e1, t, n, i, s) { + return t = +t, n >>>= 0, s || O(e1, 0, n, 8), r.write(e1, t, n, i, 52, 8), n + 8; + } + l.prototype.slice = function(e1, t) { + const n = this.length; + (e1 = ~~e1) < 0 ? (e1 += n) < 0 && (e1 = 0) : e1 > n && (e1 = n), (t = void 0 === t ? n : ~~t) < 0 ? (t += n) < 0 && (t = 0) : t > n && (t = n), t < e1 && (t = e1); + const i = this.subarray(e1, t); + return Object.setPrototypeOf(i, l.prototype), i; + }, l.prototype.readUintLE = l.prototype.readUIntLE = function(e1, t, n) { + e1 >>>= 0, t >>>= 0, n || L(e1, t, this.length); + let i = this[e1], r = 1, s = 0; + for(; ++s < t && (r *= 256);)i += this[e1 + s] * r; + return i; + }, l.prototype.readUintBE = l.prototype.readUIntBE = function(e1, t, n) { + e1 >>>= 0, t >>>= 0, n || L(e1, t, this.length); + let i = this[e1 + --t], r = 1; + for(; t > 0 && (r *= 256);)i += this[e1 + --t] * r; + return i; + }, l.prototype.readUint8 = l.prototype.readUInt8 = function(e1, t) { + return e1 >>>= 0, t || L(e1, 1, this.length), this[e1]; + }, l.prototype.readUint16LE = l.prototype.readUInt16LE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 2, this.length), this[e1] | this[e1 + 1] << 8; + }, l.prototype.readUint16BE = l.prototype.readUInt16BE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 2, this.length), this[e1] << 8 | this[e1 + 1]; + }, l.prototype.readUint32LE = l.prototype.readUInt32LE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 4, this.length), (this[e1] | this[e1 + 1] << 8 | this[e1 + 2] << 16) + 16777216 * this[e1 + 3]; + }, l.prototype.readUint32BE = l.prototype.readUInt32BE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 4, this.length), 16777216 * this[e1] + (this[e1 + 1] << 16 | this[e1 + 2] << 8 | this[e1 + 3]); + }, l.prototype.readBigUInt64LE = Z(function(e1) { + H(e1 >>>= 0, "offset"); + const t = this[e1], n = this[e1 + 7]; + void 0 !== t && void 0 !== n || V(e1, this.length - 8); + const i = t + 256 * this[++e1] + 65536 * this[++e1] + this[++e1] * 2 ** 24, r = this[++e1] + 256 * this[++e1] + 65536 * this[++e1] + n * 2 ** 24; + return BigInt(i) + (BigInt(r) << BigInt(32)); + }), l.prototype.readBigUInt64BE = Z(function(e1) { + H(e1 >>>= 0, "offset"); + const t = this[e1], n = this[e1 + 7]; + void 0 !== t && void 0 !== n || V(e1, this.length - 8); + const i = t * 2 ** 24 + 65536 * this[++e1] + 256 * this[++e1] + this[++e1], r = this[++e1] * 2 ** 24 + 65536 * this[++e1] + 256 * this[++e1] + n; + return (BigInt(i) << BigInt(32)) + BigInt(r); + }), l.prototype.readIntLE = function(e1, t, n) { + e1 >>>= 0, t >>>= 0, n || L(e1, t, this.length); + let i = this[e1], r = 1, s = 0; + for(; ++s < t && (r *= 256);)i += this[e1 + s] * r; + return r *= 128, i >= r && (i -= Math.pow(2, 8 * t)), i; + }, l.prototype.readIntBE = function(e1, t, n) { + e1 >>>= 0, t >>>= 0, n || L(e1, t, this.length); + let i = t, r = 1, s = this[e1 + --i]; + for(; i > 0 && (r *= 256);)s += this[e1 + --i] * r; + return r *= 128, s >= r && (s -= Math.pow(2, 8 * t)), s; + }, l.prototype.readInt8 = function(e1, t) { + return e1 >>>= 0, t || L(e1, 1, this.length), 128 & this[e1] ? -1 * (255 - this[e1] + 1) : this[e1]; + }, l.prototype.readInt16LE = function(e1, t) { + e1 >>>= 0, t || L(e1, 2, this.length); + const n = this[e1] | this[e1 + 1] << 8; + return 32768 & n ? 4294901760 | n : n; + }, l.prototype.readInt16BE = function(e1, t) { + e1 >>>= 0, t || L(e1, 2, this.length); + const n = this[e1 + 1] | this[e1] << 8; + return 32768 & n ? 4294901760 | n : n; + }, l.prototype.readInt32LE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 4, this.length), this[e1] | this[e1 + 1] << 8 | this[e1 + 2] << 16 | this[e1 + 3] << 24; + }, l.prototype.readInt32BE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 4, this.length), this[e1] << 24 | this[e1 + 1] << 16 | this[e1 + 2] << 8 | this[e1 + 3]; + }, l.prototype.readBigInt64LE = Z(function(e1) { + H(e1 >>>= 0, "offset"); + const t = this[e1], n = this[e1 + 7]; + void 0 !== t && void 0 !== n || V(e1, this.length - 8); + const i = this[e1 + 4] + 256 * this[e1 + 5] + 65536 * this[e1 + 6] + (n << 24); + return (BigInt(i) << BigInt(32)) + BigInt(t + 256 * this[++e1] + 65536 * this[++e1] + this[++e1] * 2 ** 24); + }), l.prototype.readBigInt64BE = Z(function(e1) { + H(e1 >>>= 0, "offset"); + const t = this[e1], n = this[e1 + 7]; + void 0 !== t && void 0 !== n || V(e1, this.length - 8); + const i = (t << 24) + 65536 * this[++e1] + 256 * this[++e1] + this[++e1]; + return (BigInt(i) << BigInt(32)) + BigInt(this[++e1] * 2 ** 24 + 65536 * this[++e1] + 256 * this[++e1] + n); + }), l.prototype.readFloatLE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 4, this.length), r.read(this, e1, !0, 23, 4); + }, l.prototype.readFloatBE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 4, this.length), r.read(this, e1, !1, 23, 4); + }, l.prototype.readDoubleLE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 8, this.length), r.read(this, e1, !0, 52, 8); + }, l.prototype.readDoubleBE = function(e1, t) { + return e1 >>>= 0, t || L(e1, 8, this.length), r.read(this, e1, !1, 52, 8); + }, l.prototype.writeUintLE = l.prototype.writeUIntLE = function(e1, t, n, i) { + e1 = +e1, t >>>= 0, n >>>= 0, i || D(this, e1, t, n, Math.pow(2, 8 * n) - 1, 0); + let r = 1, s = 0; + for(this[t] = 255 & e1; ++s < n && (r *= 256);)this[t + s] = e1 / r & 255; + return t + n; + }, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(e1, t, n, i) { + e1 = +e1, t >>>= 0, n >>>= 0, i || D(this, e1, t, n, Math.pow(2, 8 * n) - 1, 0); + let r = n - 1, s = 1; + for(this[t + r] = 255 & e1; --r >= 0 && (s *= 256);)this[t + r] = e1 / s & 255; + return t + n; + }, l.prototype.writeUint8 = l.prototype.writeUInt8 = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 1, 255, 0), this[t] = 255 & e1, t + 1; + }, l.prototype.writeUint16LE = l.prototype.writeUInt16LE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 2, 65535, 0), this[t] = 255 & e1, this[t + 1] = e1 >>> 8, t + 2; + }, l.prototype.writeUint16BE = l.prototype.writeUInt16BE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 2, 65535, 0), this[t] = e1 >>> 8, this[t + 1] = 255 & e1, t + 2; + }, l.prototype.writeUint32LE = l.prototype.writeUInt32LE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 4, 4294967295, 0), this[t + 3] = e1 >>> 24, this[t + 2] = e1 >>> 16, this[t + 1] = e1 >>> 8, this[t] = 255 & e1, t + 4; + }, l.prototype.writeUint32BE = l.prototype.writeUInt32BE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 4, 4294967295, 0), this[t] = e1 >>> 24, this[t + 1] = e1 >>> 16, this[t + 2] = e1 >>> 8, this[t + 3] = 255 & e1, t + 4; + }, l.prototype.writeBigUInt64LE = Z(function(e1, t = 0) { + return P(this, e1, t, BigInt(0), BigInt("0xffffffffffffffff")); + }), l.prototype.writeBigUInt64BE = Z(function(e1, t = 0) { + return U(this, e1, t, BigInt(0), BigInt("0xffffffffffffffff")); + }), l.prototype.writeIntLE = function(e1, t, n, i) { + if (e1 = +e1, t >>>= 0, !i) { + const i = Math.pow(2, 8 * n - 1); + D(this, e1, t, n, i - 1, -i); + } + let r = 0, s = 1, o = 0; + for(this[t] = 255 & e1; ++r < n && (s *= 256);)e1 < 0 && 0 === o && 0 !== this[t + r - 1] && (o = 1), this[t + r] = (e1 / s >> 0) - o & 255; + return t + n; + }, l.prototype.writeIntBE = function(e1, t, n, i) { + if (e1 = +e1, t >>>= 0, !i) { + const i = Math.pow(2, 8 * n - 1); + D(this, e1, t, n, i - 1, -i); + } + let r = n - 1, s = 1, o = 0; + for(this[t + r] = 255 & e1; --r >= 0 && (s *= 256);)e1 < 0 && 0 === o && 0 !== this[t + r + 1] && (o = 1), this[t + r] = (e1 / s >> 0) - o & 255; + return t + n; + }, l.prototype.writeInt8 = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 1, 127, -128), e1 < 0 && (e1 = 255 + e1 + 1), this[t] = 255 & e1, t + 1; + }, l.prototype.writeInt16LE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 2, 32767, -32768), this[t] = 255 & e1, this[t + 1] = e1 >>> 8, t + 2; + }, l.prototype.writeInt16BE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 2, 32767, -32768), this[t] = e1 >>> 8, this[t + 1] = 255 & e1, t + 2; + }, l.prototype.writeInt32LE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 4, 2147483647, -2147483648), this[t] = 255 & e1, this[t + 1] = e1 >>> 8, this[t + 2] = e1 >>> 16, this[t + 3] = e1 >>> 24, t + 4; + }, l.prototype.writeInt32BE = function(e1, t, n) { + return e1 = +e1, t >>>= 0, n || D(this, e1, t, 4, 2147483647, -2147483648), e1 < 0 && (e1 = 4294967295 + e1 + 1), this[t] = e1 >>> 24, this[t + 1] = e1 >>> 16, this[t + 2] = e1 >>> 8, this[t + 3] = 255 & e1, t + 4; + }, l.prototype.writeBigInt64LE = Z(function(e1, t = 0) { + return P(this, e1, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); + }), l.prototype.writeBigInt64BE = Z(function(e1, t = 0) { + return U(this, e1, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); + }), l.prototype.writeFloatLE = function(e1, t, n) { + return F(this, e1, t, !0, n); + }, l.prototype.writeFloatBE = function(e1, t, n) { + return F(this, e1, t, !1, n); + }, l.prototype.writeDoubleLE = function(e1, t, n) { + return N(this, e1, t, !0, n); + }, l.prototype.writeDoubleBE = function(e1, t, n) { + return N(this, e1, t, !1, n); + }, l.prototype.copy = function(e1, t, n, i) { + if (!l.isBuffer(e1)) throw new TypeError("argument should be a Buffer"); + if (n || (n = 0), i || 0 === i || (i = this.length), t >= e1.length && (t = e1.length), t || (t = 0), i > 0 && i < n && (i = n), i === n) return 0; + if (0 === e1.length || 0 === this.length) return 0; + if (t < 0) throw new RangeError("targetStart out of bounds"); + if (n < 0 || n >= this.length) throw new RangeError("Index out of range"); + if (i < 0) throw new RangeError("sourceEnd out of bounds"); + i > this.length && (i = this.length), e1.length - t < i - n && (i = e1.length - t + n); + const r = i - n; + return this === e1 && "function" == typeof Uint8Array.prototype.copyWithin ? this.copyWithin(t, n, i) : Uint8Array.prototype.set.call(e1, this.subarray(n, i), t), r; + }, l.prototype.fill = function(e1, t, n, i) { + if ("string" == typeof e1) { + if ("string" == typeof t ? (i = t, t = 0, n = this.length) : "string" == typeof n && (i = n, n = this.length), void 0 !== i && "string" != typeof i) throw new TypeError("encoding must be a string"); + if ("string" == typeof i && !l.isEncoding(i)) throw new TypeError("Unknown encoding: " + i); + if (1 === e1.length) { + const t = e1.charCodeAt(0); + ("utf8" === i && t < 128 || "latin1" === i) && (e1 = t); + } + } else "number" == typeof e1 ? e1 &= 255 : "boolean" == typeof e1 && (e1 = Number(e1)); + if (t < 0 || this.length < t || this.length < n) throw new RangeError("Out of range index"); + if (n <= t) return this; + let r; + if (t >>>= 0, n = void 0 === n ? this.length : n >>> 0, e1 || (e1 = 0), "number" == typeof e1) for(r = t; r < n; ++r)this[r] = e1; + else { + const s = l.isBuffer(e1) ? e1 : l.from(e1, i), o = s.length; + if (0 === o) throw new TypeError('The value "' + e1 + '" is invalid for argument "value"'); + for(r = 0; r < n - t; ++r)this[r + t] = s[r % o]; + } + return this; + }; + const k = {}; + function Q(e1, t, n) { + k[e1] = class extends n { + constructor(){ + super(), Object.defineProperty(this, "message", { + value: t.apply(this, arguments), + writable: !0, + configurable: !0 + }), this.name = `${this.name} [${e1}]`, this.stack, delete this.name; + } + get code() { + return e1; + } + set code(e1) { + Object.defineProperty(this, "code", { + configurable: !0, + enumerable: !0, + value: e1, + writable: !0 + }); + } + toString() { + return `${this.name} [${e1}]: ${this.message}`; + } + }; + } + function G(e1) { + let t = "", n = e1.length; + const i = "-" === e1[0] ? 1 : 0; + for(; n >= i + 4; n -= 3)t = `_${e1.slice(n - 3, n)}${t}`; + return `${e1.slice(0, n)}${t}`; + } + function z(e1, t, n, i, r, s) { + if (e1 > n || e1 < t) { + const i = "bigint" == typeof t ? "n" : ""; + let r; + throw r = s > 3 ? 0 === t || t === BigInt(0) ? `>= 0${i} and < 2${i} ** ${8 * (s + 1)}${i}` : `>= -(2${i} ** ${8 * (s + 1) - 1}${i}) and < 2 ** ${8 * (s + 1) - 1}${i}` : `>= ${t}${i} and <= ${n}${i}`, new k.ERR_OUT_OF_RANGE("value", r, e1); + } + !function(e1, t, n) { + H(t, "offset"), void 0 !== e1[t] && void 0 !== e1[t + n] || V(t, e1.length - (n + 1)); + }(i, r, s); + } + function H(e1, t) { + if ("number" != typeof e1) throw new k.ERR_INVALID_ARG_TYPE(t, "number", e1); + } + function V(e1, t, n) { + if (Math.floor(e1) !== e1) throw H(e1, n), new k.ERR_OUT_OF_RANGE(n || "offset", "an integer", e1); + if (t < 0) throw new k.ERR_BUFFER_OUT_OF_BOUNDS; + throw new k.ERR_OUT_OF_RANGE(n || "offset", `>= ${n ? 1 : 0} and <= ${t}`, e1); + } + Q("ERR_BUFFER_OUT_OF_BOUNDS", function(e1) { + return e1 ? `${e1} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds"; + }, RangeError), Q("ERR_INVALID_ARG_TYPE", function(e1, t) { + return `The "${e1}" argument must be of type number. Received type ${typeof t}`; + }, TypeError), Q("ERR_OUT_OF_RANGE", function(e1, t, n) { + let i = `The value of "${e1}" is out of range.`, r = n; + return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? r = G(String(n)) : "bigint" == typeof n && (r = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (r = G(r)), r += "n"), i += ` It must be ${t}. Received ${r}`, i; + }, RangeError); + const W = /[^+/0-9A-Za-z-_]/g; + function j(e1, t) { + let n; + t = t || 1 / 0; + const i = e1.length; + let r = null; + const s = []; + for(let o = 0; o < i; ++o){ + if (n = e1.charCodeAt(o), n > 55295 && n < 57344) { + if (!r) { + if (n > 56319) { + (t -= 3) > -1 && s.push(239, 191, 189); + continue; + } + if (o + 1 === i) { + (t -= 3) > -1 && s.push(239, 191, 189); + continue; + } + r = n; + continue; + } + if (n < 56320) { + (t -= 3) > -1 && s.push(239, 191, 189), r = n; + continue; + } + n = 65536 + (r - 55296 << 10 | n - 56320); + } else r && (t -= 3) > -1 && s.push(239, 191, 189); + if (r = null, n < 128) { + if ((t -= 1) < 0) break; + s.push(n); + } else if (n < 2048) { + if ((t -= 2) < 0) break; + s.push(n >> 6 | 192, 63 & n | 128); + } else if (n < 65536) { + if ((t -= 3) < 0) break; + s.push(n >> 12 | 224, n >> 6 & 63 | 128, 63 & n | 128); + } else { + if (!(n < 1114112)) throw new Error("Invalid code point"); + if ((t -= 4) < 0) break; + s.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, 63 & n | 128); + } + } + return s; + } + function q(e1) { + return i.toByteArray(function(e1) { + if ((e1 = (e1 = e1.split("=")[0]).trim().replace(W, "")).length < 2) return ""; + for(; e1.length % 4 != 0;)e1 += "="; + return e1; + }(e1)); + } + function X(e1, t, n, i) { + let r; + for(r = 0; r < i && !(r + n >= t.length || r >= e1.length); ++r)t[r + n] = e1[r]; + return r; + } + function Y(e1, t) { + return e1 instanceof t || null != e1 && null != e1.constructor && null != e1.constructor.name && e1.constructor.name === t.name; + } + function J(e1) { + return e1 != e1; + } + const K = function() { + const e1 = "0123456789abcdef", t = new Array(256); + for(let n = 0; n < 16; ++n){ + const i = 16 * n; + for(let r = 0; r < 16; ++r)t[i + r] = e1[n] + e1[r]; + } + return t; + }(); + function Z(e1) { + return "undefined" == typeof BigInt ? $ : e1; + } + function $() { + throw new Error("BigInt not supported"); + } + }, + 7705: (e1)=>{ + "use strict"; + e1.exports = function(e1) { + var t = []; + return t.toString = function() { + return this.map(function(t) { + var n = "", i = void 0 !== t[5]; + return t[4] && (n += "@supports (".concat(t[4], ") {")), t[2] && (n += "@media ".concat(t[2], " {")), i && (n += "@layer".concat(t[5].length > 0 ? " ".concat(t[5]) : "", " {")), n += e1(t), i && (n += "}"), t[2] && (n += "}"), t[4] && (n += "}"), n; + }).join(""); + }, t.i = function(e1, n, i, r, s) { + "string" == typeof e1 && (e1 = [ + [ + null, + e1, + void 0 + ] + ]); + var o = {}; + if (i) for(var a = 0; a < this.length; a++){ + var l = this[a][0]; + null != l && (o[l] = !0); + } + for(var c = 0; c < e1.length; c++){ + var h = [].concat(e1[c]); + i && o[h[0]] || (void 0 !== s && (void 0 === h[5] || (h[1] = "@layer".concat(h[5].length > 0 ? " ".concat(h[5]) : "", " {").concat(h[1], "}")), h[5] = s), n && (h[2] ? (h[1] = "@media ".concat(h[2], " {").concat(h[1], "}"), h[2] = n) : h[2] = n), r && (h[4] ? (h[1] = "@supports (".concat(h[4], ") {").concat(h[1], "}"), h[4] = r) : h[4] = "".concat(r)), t.push(h)); + } + }, t; + }; + }, + 6742: (e1)=>{ + "use strict"; + e1.exports = function(e1, t) { + return t || (t = {}), e1 ? (e1 = String(e1.__esModule ? e1.default : e1), /^['"].*['"]$/.test(e1) && (e1 = e1.slice(1, -1)), t.hash && (e1 += t.hash), /["'() \t\n]|(%20)/.test(e1) || t.needQuotes ? '"'.concat(e1.replace(/"/g, '\\"').replace(/\n/g, "\\n"), '"') : e1) : e1; + }; + }, + 4216: (e1)=>{ + "use strict"; + e1.exports = function(e1) { + var t = e1[1], n = e1[3]; + if (!n) return t; + if ("function" == typeof btoa) { + var i = btoa(unescape(encodeURIComponent(JSON.stringify(n)))), r = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i), s = "/*# ".concat(r, " */"); + return [ + t + ].concat([ + s + ]).join("\n"); + } + return [ + t + ].join("\n"); + }; + }, + 7464: ()=>{ + !function() { + if ("undefined" != typeof window) try { + var e1 = new window.CustomEvent("test", { + cancelable: !0 + }); + if (e1.preventDefault(), !0 !== e1.defaultPrevented) throw new Error("Could not prevent default"); + } catch (e1) { + var t = function(e1, t) { + var n, i; + return (t = t || {}).bubbles = !!t.bubbles, t.cancelable = !!t.cancelable, (n = document.createEvent("CustomEvent")).initCustomEvent(e1, t.bubbles, t.cancelable, t.detail), i = n.preventDefault, n.preventDefault = function() { + i.call(this); + try { + Object.defineProperty(this, "defaultPrevented", { + get: function() { + return !0; + } + }); + } catch (e1) { + this.defaultPrevented = !0; + } + }, n; + }; + t.prototype = window.Event.prototype, window.CustomEvent = t; + } + }(); + }, + 695: (e1, t, n)=>{ + function i() { + var e1; + try { + e1 = t.storage.debug; + } catch (e1) {} + return e1; + } + (t = e1.exports = n(4569)).log = function() { + return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); + }, t.formatArgs = function() { + var e1 = arguments, t = this.useColors; + if (e1[0] = (t ? "%c" : "") + this.namespace + (t ? " %c" : " ") + e1[0] + (t ? "%c " : " "), !t) return e1; + var n = "color: " + this.color; + e1 = [ + e1[0], + n, + "color: inherit" + ].concat(Array.prototype.slice.call(e1, 1)); + var i = 0, r = 0; + return e1[0].replace(/%[a-z%]/g, function(e1) { + "%%" !== e1 && (i++, "%c" === e1 && (r = i)); + }), e1.splice(r, 0, n), e1; + }, t.save = function(e1) { + try { + null == e1 ? t.storage.removeItem("debug") : t.storage.debug = e1; + } catch (e1) {} + }, t.load = i, t.useColors = function() { + return "WebkitAppearance" in document.documentElement.style || window.console && (console.firebug || console.exception && console.table) || navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31; + }, t.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : function() { + try { + return window.localStorage; + } catch (e1) {} + }(), t.colors = [ + "lightseagreen", + "forestgreen", + "goldenrod", + "dodgerblue", + "darkorchid", + "crimson" + ], t.formatters.j = function(e1) { + return JSON.stringify(e1); + }, t.enable(i()); + }, + 4569: (e1, t)=>{ + (t = e1.exports = function(e1) { + function n() {} + function r() { + var e1 = r; + null == e1.useColors && (e1.useColors = t.useColors()), null == e1.color && e1.useColors && (e1.color = i()); + var n = Array.prototype.slice.call(arguments); + n[0] = t.coerce(n[0]), "string" != typeof n[0] && (n = [ + "%o" + ].concat(n)); + var s = 0; + n[0] = n[0].replace(/%([a-z%])/g, function(i, r) { + if ("%%" === i) return i; + s++; + var o = t.formatters[r]; + if ("function" == typeof o) { + var a = n[s]; + i = o.call(e1, a), n.splice(s, 1), s--; + } + return i; + }), "function" == typeof t.formatArgs && (n = t.formatArgs.apply(e1, n)); + var o = r.log || t.log || console.log.bind(console); + o.apply(e1, n); + } + n.enabled = !1, r.enabled = !0; + var s = t.enabled(e1) ? r : n; + return s.namespace = e1, s; + }).coerce = function(e1) { + return e1 instanceof Error ? e1.stack || e1.message : e1; + }, t.disable = function() { + t.enable(""); + }, t.enable = function(e1) { + t.save(e1); + for(var n = (e1 || "").split(/[\s,]+/), i = n.length, r = 0; r < i; r++)n[r] && ("-" === (e1 = n[r].replace(/\*/g, ".*?"))[0] ? t.skips.push(new RegExp("^" + e1.substr(1) + "$")) : t.names.push(new RegExp("^" + e1 + "$"))); + }, t.enabled = function(e1) { + var n, i; + for(n = 0, i = t.skips.length; n < i; n++)if (t.skips[n].test(e1)) return !1; + for(n = 0, i = t.names.length; n < i; n++)if (t.names[n].test(e1)) return !0; + return !1; + }, t.names = [], t.skips = [], t.formatters = {}; + var n = 0; + function i() { + return t.colors[n++ % t.colors.length]; + } + }, + 1900: (e1, t, n)=>{ + "use strict"; + var i = n(445), r = Object.prototype.hasOwnProperty, s = Object.prototype.propertyIsEnumerable; + function o(e1) { + if (null == e1) throw new TypeError("Sources cannot be null or undefined"); + return Object(e1); + } + function a(e1, t, n) { + var s = t[n]; + if (null != s) { + if (r.call(e1, n) && (void 0 === e1[n] || null === e1[n])) throw new TypeError("Cannot convert undefined or null to object (" + n + ")"); + r.call(e1, n) && i(s) ? e1[n] = l(Object(e1[n]), t[n]) : e1[n] = s; + } + } + function l(e1, t) { + if (e1 === t) return e1; + for(var n in t = Object(t))r.call(t, n) && a(e1, t, n); + if (Object.getOwnPropertySymbols) for(var i = Object.getOwnPropertySymbols(t), o = 0; o < i.length; o++)s.call(t, i[o]) && a(e1, t, i[o]); + return e1; + } + e1.exports = function(e1) { + e1 = o(e1); + for(var t = 1; t < arguments.length; t++)l(e1, arguments[t]); + return e1; + }; + }, + 4666: (e1)=>{ + e1.exports = function(e1) { + switch(e1){ + case "int8": + return Int8Array; + case "int16": + return Int16Array; + case "int32": + return Int32Array; + case "uint8": + return Uint8Array; + case "uint16": + return Uint16Array; + case "uint32": + return Uint32Array; + case "float32": + return Float32Array; + case "float64": + return Float64Array; + case "array": + return Array; + case "uint8_clamped": + return Uint8ClampedArray; + } + }; + }, + 1192: (e1, t, n)=>{ + var i; + i = "undefined" != typeof window ? window : void 0 !== n.g ? n.g : "undefined" != typeof self ? self : {}, e1.exports = i; + }, + 9350: (e1, t)=>{ + t.read = function(e1, t, n, i, r) { + var s, o, a = 8 * r - i - 1, l = (1 << a) - 1, c = l >> 1, h = -7, u = n ? r - 1 : 0, d = n ? -1 : 1, p = e1[t + u]; + for(u += d, s = p & (1 << -h) - 1, p >>= -h, h += a; h > 0; s = 256 * s + e1[t + u], u += d, h -= 8); + for(o = s & (1 << -h) - 1, s >>= -h, h += i; h > 0; o = 256 * o + e1[t + u], u += d, h -= 8); + if (0 === s) s = 1 - c; + else { + if (s === l) return o ? NaN : 1 / 0 * (p ? -1 : 1); + o += Math.pow(2, i), s -= c; + } + return (p ? -1 : 1) * o * Math.pow(2, s - i); + }, t.write = function(e1, t, n, i, r, s) { + var o, a, l, c = 8 * s - r - 1, h = (1 << c) - 1, u = h >> 1, d = 23 === r ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = i ? 0 : s - 1, A = i ? 1 : -1, f = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0; + for(t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, o = h) : (o = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -o)) < 1 && (o--, l *= 2), (t += o + u >= 1 ? d / l : d * Math.pow(2, 1 - u)) * l >= 2 && (o++, l /= 2), o + u >= h ? (a = 0, o = h) : o + u >= 1 ? (a = (t * l - 1) * Math.pow(2, r), o += u) : (a = t * Math.pow(2, u - 1) * Math.pow(2, r), o = 0)); r >= 8; e1[n + p] = 255 & a, p += A, a /= 256, r -= 8); + for(o = o << r | a, c += r; c > 0; e1[n + p] = 255 & o, p += A, o /= 256, c -= 8); + e1[n + p - A] |= 128 * f; + }; + }, + 1826: (e1)=>{ + function t(e1) { + return !!e1.constructor && "function" == typeof e1.constructor.isBuffer && e1.constructor.isBuffer(e1); + } + e1.exports = function(e1) { + return null != e1 && (t(e1) || function(e1) { + return "function" == typeof e1.readFloatLE && "function" == typeof e1.slice && t(e1.slice(0, 0)); + }(e1) || !!e1._isBuffer); + }; + }, + 6534: (e1)=>{ + e1.exports = function(e1) { + if (!e1) return !1; + var n = t.call(e1); + return "[object Function]" === n || "function" == typeof e1 && "[object RegExp]" !== n || "undefined" != typeof window && (e1 === window.setTimeout || e1 === window.alert || e1 === window.confirm || e1 === window.prompt); + }; + var t = Object.prototype.toString; + }, + 445: (e1)=>{ + "use strict"; + e1.exports = function(e1) { + var t = typeof e1; + return null !== e1 && ("object" === t || "function" === t); + }; + }, + 7510: (e1, t, n)=>{ + var i = n(9443), r = n(2786), s = n(3205), o = [ + "x", + "e", + "a", + "o", + "n", + "s", + "r", + "c", + "u", + "m", + "v", + "w", + "z" + ], a = [ + "m", + "w" + ], l = [ + "H", + "I", + "N", + "E", + "F", + "K", + "L", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z" + ], c = " ".charCodeAt(0), h = " ".charCodeAt(0); + function u(e1) { + this.glyphs = [], this._measure = this.computeMetrics.bind(this), this.update(e1); + } + function d(e1) { + return new Function([ + "return function " + e1 + "() {", + " return this._" + e1, + "}" + ].join("\n"))(); + } + function p(e1, t) { + if (!e1.chars || 0 === e1.chars.length) return null; + var n = f(e1.chars, t); + return n >= 0 ? e1.chars[n] : null; + } + function A(e1, t, n) { + if (!e1.kernings || 0 === e1.kernings.length) return 0; + for(var i = e1.kernings, r = 0; r < i.length; r++){ + var s = i[r]; + if (s.first === t && s.second === n) return s.amount; + } + return 0; + } + function f(e1, t, n) { + for(var i = n = n || 0; i < e1.length; i++)if (e1[i].id === t) return i; + return -1; + } + e1.exports = function(e1) { + return new u(e1); + }, u.prototype.update = function(e1) { + if (e1 = r({ + measure: this._measure + }, e1), this._opt = e1, this._opt.tabSize = s(this._opt.tabSize, 4), !e1.font) throw new Error("must provide a valid bitmap font"); + var t = this.glyphs, n = e1.text || "", a = e1.font; + this._setupSpaceGlyphs(a); + var c = i.lines(n, e1), h = e1.width || 0; + t.length = 0; + var u = c.reduce(function(e1, t) { + return Math.max(e1, t.width, h); + }, 0), d = 0, p = 0, m = s(e1.lineHeight, a.common.lineHeight), g = a.common.base, v = m - g, y = e1.letterSpacing || 0, E = m * c.length - v, b = function(e1) { + return "center" === e1 ? 1 : "right" === e1 ? 2 : 0; + }(this._opt.align); + p -= E, this._width = u, this._height = E, this._descender = m - g, this._baseline = g, this._xHeight = function(e1) { + for(var t = 0; t < o.length; t++){ + var n = o[t].charCodeAt(0), i = f(e1.chars, n); + if (i >= 0) return e1.chars[i].height; + } + return 0; + }(a), this._capHeight = function(e1) { + for(var t = 0; t < l.length; t++){ + var n = l[t].charCodeAt(0), i = f(e1.chars, n); + if (i >= 0) return e1.chars[i].height; + } + return 0; + }(a), this._lineHeight = m, this._ascender = m - v - this._xHeight; + var x = this; + c.forEach(function(e1, i) { + for(var r, s = e1.start, o = e1.end, l = e1.width, c = s; c < o; c++){ + var h = n.charCodeAt(c), f = x.getGlyph(a, h); + if (f) { + r && (d += A(a, r.id, f.id)); + var g = d; + 1 === b ? g += (u - l) / 2 : 2 === b && (g += u - l), t.push({ + position: [ + g, + p + ], + data: f, + index: c, + line: i + }), d += f.xadvance + y, r = f; + } + } + p += m, d = 0; + }), this._linesTotal = c.length; + }, u.prototype._setupSpaceGlyphs = function(e1) { + if (this._fallbackSpaceGlyph = null, this._fallbackTabGlyph = null, e1.chars && 0 !== e1.chars.length) { + var t = p(e1, h) || function(e1) { + for(var t = 0; t < a.length; t++){ + var n = a[t].charCodeAt(0), i = f(e1.chars, n); + if (i >= 0) return e1.chars[i]; + } + return 0; + }(e1) || e1.chars[0], n = this._opt.tabSize * t.xadvance; + this._fallbackSpaceGlyph = t, this._fallbackTabGlyph = r(t, { + x: 0, + y: 0, + xadvance: n, + id: c, + xoffset: 0, + yoffset: 0, + width: 0, + height: 0 + }); + } + }, u.prototype.getGlyph = function(e1, t) { + return p(e1, t) || (t === c ? this._fallbackTabGlyph : t === h ? this._fallbackSpaceGlyph : null); + }, u.prototype.computeMetrics = function(e1, t, n, i) { + var r, s = this._opt.letterSpacing || 0, o = this._opt.font, a = 0, l = 0, c = 0; + if (!o.chars || 0 === o.chars.length) return { + start: t, + end: t, + width: 0 + }; + n = Math.min(e1.length, n); + for(var h = t; h < n; h++){ + var u, d = e1.charCodeAt(h); + if (u = this.getGlyph(o, d)) { + u.xoffset; + var p = (a += r ? A(o, r.id, u.id) : 0) + u.xadvance + s, f = a + u.width; + if (f >= i || p >= i) break; + a = p, l = f, r = u; + } + c++; + } + return r && (l += r.xoffset), { + start: t, + end: t + c, + width: l + }; + }, [ + "width", + "height", + "descender", + "ascender", + "xHeight", + "baseline", + "capHeight", + "lineHeight" + ].forEach(function(e1) { + Object.defineProperty(u.prototype, e1, { + get: d(e1), + configurable: !0 + }); + }); + }, + 1880: (e1, t, n)=>{ + var i = n(5851).lW, r = n(7377), s = function() {}, o = n(5551), a = n(7096), l = n(1683), c = n(7804), h = n(2786), u = self.XMLHttpRequest && "withCredentials" in new XMLHttpRequest; + e1.exports = function(e1, t) { + t = "function" == typeof t ? t : s, "string" == typeof e1 ? e1 = { + uri: e1 + } : e1 || (e1 = {}), e1.binary && (e1 = function(e1) { + if (u) return h(e1, { + responseType: "arraybuffer" + }); + if (void 0 === self.XMLHttpRequest) throw new Error("your browser does not support XHR loading"); + var t = new self.XMLHttpRequest; + return t.overrideMimeType("text/plain; charset=x-user-defined"), h({ + xhr: t + }, e1); + }(e1)), r(e1, function(n, r, h) { + if (n) return t(n); + if (!/^2/.test(r.statusCode)) return t(new Error("http status code: " + r.statusCode)); + if (!h) return t(new Error("no body result")); + var u, d, p = !1; + if (u = h, "[object ArrayBuffer]" === Object.prototype.toString.call(u)) { + var A = new Uint8Array(h); + h = i.from(A, "binary"); + } + c(h) && (p = !0, "string" == typeof h && (h = i.from(h, "binary"))), p || (i.isBuffer(h) && (h = h.toString(e1.encoding)), h = h.trim()); + try { + var f = r.headers["content-type"]; + d = p ? l(h) : /json/.test(f) || "{" === h.charAt(0) ? JSON.parse(h) : /xml/.test(f) || "<" === h.charAt(0) ? a(h) : o(h); + } catch (e1) { + t(new Error("error parsing font " + e1.message)), t = s; + } + t(null, d); + }); + }; + }, + 7804: (e1, t, n)=>{ + var i = n(5851).lW, r = n(5286), s = i.from([ + 66, + 77, + 70, + 3 + ]); + e1.exports = function(e1) { + return "string" == typeof e1 ? "BMF" === e1.substring(0, 3) : e1.length > 4 && r(e1.slice(0, 4), s); + }; + }, + 7347: (e1)=>{ + "use strict"; + var t = Object.getOwnPropertySymbols, n = Object.prototype.hasOwnProperty, i = Object.prototype.propertyIsEnumerable; + function r(e1) { + if (null == e1) throw new TypeError("Object.assign cannot be called with null or undefined"); + return Object(e1); + } + e1.exports = function() { + try { + if (!Object.assign) return !1; + var e1 = new String("abc"); + if (e1[5] = "de", "5" === Object.getOwnPropertyNames(e1)[0]) return !1; + for(var t = {}, n = 0; n < 10; n++)t["_" + String.fromCharCode(n)] = n; + if ("0123456789" !== Object.getOwnPropertyNames(t).map(function(e1) { + return t[e1]; + }).join("")) return !1; + var i = {}; + return "abcdefghijklmnopqrst".split("").forEach(function(e1) { + i[e1] = e1; + }), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, i)).join(""); + } catch (e1) { + return !1; + } + }() ? Object.assign : function(e1, s) { + for(var o, a, l = r(e1), c = 1; c < arguments.length; c++){ + for(var h in o = Object(arguments[c]))n.call(o, h) && (l[h] = o[h]); + if (t) { + a = t(o); + for(var u = 0; u < a.length; u++)i.call(o, a[u]) && (l[a[u]] = o[a[u]]); + } + } + return l; + }; + }, + 5551: (e1)=>{ + function t(e1, t) { + if (!(e1 = e1.replace(/\t+/g, " ").trim())) return null; + var i = e1.indexOf(" "); + if (-1 === i) throw new Error("no named row at line " + t); + var r = e1.substring(0, i); + e1 = (e1 = (e1 = (e1 = e1.substring(i + 1)).replace(/letter=[\'\"]\S+[\'\"]/gi, "")).split("=")).map(function(e1) { + return e1.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g); + }); + for(var s = [], o = 0; o < e1.length; o++){ + var a = e1[o]; + 0 === o ? s.push({ + key: a[0], + data: "" + }) : o === e1.length - 1 ? s[s.length - 1].data = n(a[0]) : (s[s.length - 1].data = n(a[0]), s.push({ + key: a[1], + data: "" + })); + } + var l = { + key: r, + data: {} + }; + return s.forEach(function(e1) { + l.data[e1.key] = e1.data; + }), l; + } + function n(e1) { + return e1 && 0 !== e1.length ? 0 === e1.indexOf('"') || 0 === e1.indexOf("'") ? e1.substring(1, e1.length - 1) : -1 !== e1.indexOf(",") ? function(e1) { + return e1.split(",").map(function(e1) { + return parseInt(e1, 10); + }); + }(e1) : parseInt(e1, 10) : ""; + } + e1.exports = function(e1) { + if (!e1) throw new Error("no data provided"); + var n = { + pages: [], + chars: [], + kernings: [] + }, i = (e1 = e1.toString().trim()).split(/\r\n?|\n/g); + if (0 === i.length) throw new Error("no data in BMFont file"); + for(var r = 0; r < i.length; r++){ + var s = t(i[r], r); + if (s) { + if ("page" === s.key) { + if ("number" != typeof s.data.id) throw new Error("malformed file at line " + r + " -- needs page id=N"); + if ("string" != typeof s.data.file) throw new Error("malformed file at line " + r + ' -- needs page file="path"'); + n.pages[s.data.id] = s.data.file; + } else "chars" === s.key || "kernings" === s.key || ("char" === s.key ? n.chars.push(s.data) : "kerning" === s.key ? n.kernings.push(s.data) : n[s.key] = s.data); + } + } + return n; + }; + }, + 1683: (e1)=>{ + var t = [ + 66, + 77, + 70 + ]; + function n(e1, t, n) { + if (n > t.length - 1) return 0; + var r = t.readUInt8(n++), s = t.readInt32LE(n); + switch(n += 4, r){ + case 1: + e1.info = function(e1, t) { + var n = {}; + n.size = e1.readInt16LE(t); + var r = e1.readUInt8(t + 2); + return n.smooth = r >> 7 & 1, n.unicode = r >> 6 & 1, n.italic = r >> 5 & 1, n.bold = r >> 4 & 1, r >> 3 & 1 && (n.fixedHeight = 1), n.charset = e1.readUInt8(t + 3) || "", n.stretchH = e1.readUInt16LE(t + 4), n.aa = e1.readUInt8(t + 6), n.padding = [ + e1.readInt8(t + 7), + e1.readInt8(t + 8), + e1.readInt8(t + 9), + e1.readInt8(t + 10) + ], n.spacing = [ + e1.readInt8(t + 11), + e1.readInt8(t + 12) + ], n.outline = e1.readUInt8(t + 13), n.face = function(e1, t) { + return i(e1, t).toString("utf8"); + }(e1, t + 14), n; + }(t, n); + break; + case 2: + e1.common = function(e1, t) { + var n = {}; + return n.lineHeight = e1.readUInt16LE(t), n.base = e1.readUInt16LE(t + 2), n.scaleW = e1.readUInt16LE(t + 4), n.scaleH = e1.readUInt16LE(t + 6), n.pages = e1.readUInt16LE(t + 8), e1.readUInt8(t + 10), n.packed = 0, n.alphaChnl = e1.readUInt8(t + 11), n.redChnl = e1.readUInt8(t + 12), n.greenChnl = e1.readUInt8(t + 13), n.blueChnl = e1.readUInt8(t + 14), n; + }(t, n); + break; + case 3: + e1.pages = function(e1, t, n) { + for(var r = [], s = i(e1, t), o = s.length + 1, a = n / o, l = 0; l < a; l++)r[l] = e1.slice(t, t + s.length).toString("utf8"), t += o; + return r; + }(t, n, s); + break; + case 4: + e1.chars = function(e1, t, n) { + for(var i = [], r = n / 20, s = 0; s < r; s++){ + var o = {}, a = 20 * s; + o.id = e1.readUInt32LE(t + 0 + a), o.x = e1.readUInt16LE(t + 4 + a), o.y = e1.readUInt16LE(t + 6 + a), o.width = e1.readUInt16LE(t + 8 + a), o.height = e1.readUInt16LE(t + 10 + a), o.xoffset = e1.readInt16LE(t + 12 + a), o.yoffset = e1.readInt16LE(t + 14 + a), o.xadvance = e1.readInt16LE(t + 16 + a), o.page = e1.readUInt8(t + 18 + a), o.chnl = e1.readUInt8(t + 19 + a), i[s] = o; + } + return i; + }(t, n, s); + break; + case 5: + e1.kernings = function(e1, t, n) { + for(var i = [], r = n / 10, s = 0; s < r; s++){ + var o = {}, a = 10 * s; + o.first = e1.readUInt32LE(t + 0 + a), o.second = e1.readUInt32LE(t + 4 + a), o.amount = e1.readInt16LE(t + 8 + a), i[s] = o; + } + return i; + }(t, n, s); + } + return 5 + s; + } + function i(e1, t) { + for(var n = t; n < e1.length && 0 !== e1[n]; n++); + return e1.slice(t, n); + } + e1.exports = function(e1) { + if (e1.length < 6) throw new Error("invalid buffer length for BMFont"); + var i = t.every(function(t, n) { + return e1.readUInt8(n) === t; + }); + if (!i) throw new Error("BMFont missing BMF byte header"); + var r = 3; + if (e1.readUInt8(r++) > 3) throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)"); + for(var s = { + kernings: [], + chars: [] + }, o = 0; o < 5; o++)r += n(s, e1, r); + return s; + }; + }, + 7096: (e1, t, n)=>{ + var i = n(3102), r = n(6774), s = { + scaleh: "scaleH", + scalew: "scaleW", + stretchh: "stretchH", + lineheight: "lineHeight", + alphachnl: "alphaChnl", + redchnl: "redChnl", + greenchnl: "greenChnl", + bluechnl: "blueChnl" + }; + function o(e1) { + var t = function(e1) { + for(var t = [], n = 0; n < e1.attributes.length; n++)t.push(e1.attributes[n]); + return t; + }(e1); + return t.reduce(function(e1, t) { + var n; + return e1[n = t.nodeName, s[n.toLowerCase()] || n] = t.nodeValue, e1; + }, {}); + } + e1.exports = function(e1) { + e1 = e1.toString(); + var t = r(e1), n = { + pages: [], + chars: [], + kernings: [] + }; + [ + "info", + "common" + ].forEach(function(e1) { + var r = t.getElementsByTagName(e1)[0]; + r && (n[e1] = i(o(r))); + }); + var s = t.getElementsByTagName("pages")[0]; + if (!s) throw new Error("malformed file -- no element"); + for(var a = s.getElementsByTagName("page"), l = 0; l < a.length; l++){ + var c = a[l], h = parseInt(c.getAttribute("id"), 10), u = c.getAttribute("file"); + if (isNaN(h)) throw new Error('malformed file -- page "id" attribute is NaN'); + if (!u) throw new Error('malformed file -- needs page "file" attribute'); + n.pages[parseInt(h, 10)] = u; + } + return [ + "chars", + "kernings" + ].forEach(function(e1) { + var r = t.getElementsByTagName(e1)[0]; + if (r) for(var s = e1.substring(0, e1.length - 1), a = r.getElementsByTagName(s), l = 0; l < a.length; l++){ + var c = a[l]; + n[e1].push(i(o(c))); + } + }), n; + }; + }, + 3102: (e1)=>{ + var t = "chasrset"; + e1.exports = function(e1) { + for(var n in t in e1 && (e1.charset = e1[t], delete e1[t]), e1)"face" !== n && "charset" !== n && (e1[n] = "padding" === n || "spacing" === n ? e1[n].split(",").map(function(e1) { + return parseInt(e1, 10); + }) : parseInt(e1[n], 10)); + return e1; + }; + }, + 9069: (e1)=>{ + var t = function(e1) { + return e1.replace(/^\s+|\s+$/g, ""); + }; + e1.exports = function(e1) { + if (!e1) return {}; + for(var n, i = {}, r = t(e1).split("\n"), s = 0; s < r.length; s++){ + var o = r[s], a = o.indexOf(":"), l = t(o.slice(0, a)).toLowerCase(), c = t(o.slice(a + 1)); + void 0 === i[l] ? i[l] = c : (n = i[l], "[object Array]" === Object.prototype.toString.call(n) ? i[l].push(c) : i[l] = [ + i[l], + c + ]); + } + return i; + }; + }, + 9414: (e1, t, n)=>{ + var i = n.g.performance || {}, r = function() { + for(var e1 = [ + "now", + "webkitNow", + "msNow", + "mozNow", + "oNow" + ]; e1.length;){ + var t = e1.shift(); + if (t in i) return i[t].bind(i); + } + var n = Date.now || function() { + return (new Date).getTime(); + }, r = (i.timing || {}).navigationStart || n(); + return function() { + return n() - r; + }; + }(); + r.performanceNow = i.now, r.noConflict = function() { + i.now = r.performanceNow; + }, r.conflict = function() { + i.now = r; + }, r.conflict(), e1.exports = r; + }, + 2790: (e1)=>{ + var t, n, i = e1.exports = {}; + function r() { + throw new Error("setTimeout has not been defined"); + } + function s() { + throw new Error("clearTimeout has not been defined"); + } + function o(e1) { + if (t === setTimeout) return setTimeout(e1, 0); + if ((t === r || !t) && setTimeout) return t = setTimeout, setTimeout(e1, 0); + try { + return t(e1, 0); + } catch (n) { + try { + return t.call(null, e1, 0); + } catch (n) { + return t.call(this, e1, 0); + } + } + } + !function() { + try { + t = "function" == typeof setTimeout ? setTimeout : r; + } catch (e1) { + t = r; + } + try { + n = "function" == typeof clearTimeout ? clearTimeout : s; + } catch (e1) { + n = s; + } + }(); + var a, l = [], c = !1, h = -1; + function u() { + c && a && (c = !1, a.length ? l = a.concat(l) : h = -1, l.length && d()); + } + function d() { + if (!c) { + var e1 = o(u); + c = !0; + for(var t = l.length; t;){ + for(a = l, l = []; ++h < t;)a && a[h].run(); + h = -1, t = l.length; + } + a = null, c = !1, function(e1) { + if (n === clearTimeout) return clearTimeout(e1); + if ((n === s || !n) && clearTimeout) return n = clearTimeout, clearTimeout(e1); + try { + n(e1); + } catch (t) { + try { + return n.call(null, e1); + } catch (t) { + return n.call(this, e1); + } + } + }(e1); + } + } + function p(e1, t) { + this.fun = e1, this.array = t; + } + function A() {} + i.nextTick = function(e1) { + var t = new Array(arguments.length - 1); + if (arguments.length > 1) for(var n = 1; n < arguments.length; n++)t[n - 1] = arguments[n]; + l.push(new p(e1, t)), 1 !== l.length || c || o(d); + }, p.prototype.run = function() { + this.fun.apply(null, this.array); + }, i.title = "browser", i.browser = !0, i.env = {}, i.argv = [], i.version = "", i.versions = {}, i.on = A, i.addListener = A, i.once = A, i.off = A, i.removeListener = A, i.removeAllListeners = A, i.emit = A, i.prependListener = A, i.prependOnceListener = A, i.listeners = function(e1) { + return []; + }, i.binding = function(e1) { + throw new Error("process.binding is not supported"); + }, i.cwd = function() { + return "/"; + }, i.chdir = function(e1) { + throw new Error("process.chdir is not supported"); + }, i.umask = function() { + return 0; + }; + }, + 4177: function(e1) { + !function(t) { + var n = setTimeout, i = "function" == typeof setImmediate && setImmediate || function(e1) { + n(e1, 1); + }; + function r(e1, t) { + return function() { + e1.apply(t, arguments); + }; + } + var s = Array.isArray || function(e1) { + return "[object Array]" === Object.prototype.toString.call(e1); + }; + function o(e1) { + if ("object" != typeof this) throw new TypeError("Promises must be constructed via new"); + if ("function" != typeof e1) throw new TypeError("not a function"); + this._state = null, this._value = null, this._deferreds = [], d(e1, r(l, this), r(c, this)); + } + function a(e1) { + var t = this; + null !== this._state ? i(function() { + var n = t._state ? e1.onFulfilled : e1.onRejected; + if (null !== n) { + var i; + try { + i = n(t._value); + } catch (t) { + return void e1.reject(t); + } + e1.resolve(i); + } else (t._state ? e1.resolve : e1.reject)(t._value); + }) : this._deferreds.push(e1); + } + function l(e1) { + try { + if (e1 === this) throw new TypeError("A promise cannot be resolved with itself."); + if (e1 && ("object" == typeof e1 || "function" == typeof e1)) { + var t = e1.then; + if ("function" == typeof t) return void d(r(t, e1), r(l, this), r(c, this)); + } + this._state = !0, this._value = e1, h.call(this); + } catch (e1) { + c.call(this, e1); + } + } + function c(e1) { + this._state = !1, this._value = e1, h.call(this); + } + function h() { + for(var e1 = 0, t = this._deferreds.length; e1 < t; e1++)a.call(this, this._deferreds[e1]); + this._deferreds = null; + } + function u(e1, t, n, i) { + this.onFulfilled = "function" == typeof e1 ? e1 : null, this.onRejected = "function" == typeof t ? t : null, this.resolve = n, this.reject = i; + } + function d(e1, t, n) { + var i = !1; + try { + e1(function(e1) { + i || (i = !0, t(e1)); + }, function(e1) { + i || (i = !0, n(e1)); + }); + } catch (e1) { + if (i) return; + i = !0, n(e1); + } + } + o.prototype.catch = function(e1) { + return this.then(null, e1); + }, o.prototype.then = function(e1, t) { + var n = this; + return new o(function(i, r) { + a.call(n, new u(e1, t, i, r)); + }); + }, o.all = function() { + var e1 = Array.prototype.slice.call(1 === arguments.length && s(arguments[0]) ? arguments[0] : arguments); + return new o(function(t, n) { + if (0 === e1.length) return t([]); + var i = e1.length; + function r(s, o) { + try { + if (o && ("object" == typeof o || "function" == typeof o)) { + var a = o.then; + if ("function" == typeof a) return void a.call(o, function(e1) { + r(s, e1); + }, n); + } + e1[s] = o, 0 == --i && t(e1); + } catch (e1) { + n(e1); + } + } + for(var s = 0; s < e1.length; s++)r(s, e1[s]); + }); + }, o.resolve = function(e1) { + return e1 && "object" == typeof e1 && e1.constructor === o ? e1 : new o(function(t) { + t(e1); + }); + }, o.reject = function(e1) { + return new o(function(t, n) { + n(e1); + }); + }, o.race = function(e1) { + return new o(function(t, n) { + for(var i = 0, r = e1.length; i < r; i++)e1[i].then(t, n); + }); + }, o._setImmediateFn = function(e1) { + i = e1; + }, e1.exports ? e1.exports = o : t.Promise || (t.Promise = o); + }(this); + }, + 4502: (e1, t, n)=>{ + var i = n(4666), r = n(6793), s = n(1826), o = [ + 0, + 2, + 3 + ], a = [ + 2, + 1, + 3 + ]; + e1.exports = function(e1, t) { + e1 && (r(e1) || s(e1)) || (t = e1 || {}, e1 = null); + for(var n = "string" == typeof (t = "number" == typeof t ? { + count: t + } : t || {}).type ? t.type : "uint16", l = "number" == typeof t.count ? t.count : 1, c = t.start || 0, h = !1 !== t.clockwise ? o : a, u = h[0], d = h[1], p = h[2], A = 6 * l, f = e1 || new (i(n))(A), m = 0, g = 0; m < A; m += 6, g += 4){ + var v = m + c; + f[v + 0] = g + 0, f[v + 1] = g + 1, f[v + 2] = g + 2, f[v + 3] = g + u, f[v + 4] = g + d, f[v + 5] = g + p; + } + return f; + }; + }, + 2446: (e1, t, n)=>{ + "use strict"; + n.d(t, { + Z: ()=>ve + }); + var i = { + update: null, + begin: null, + loopBegin: null, + changeBegin: null, + change: null, + changeComplete: null, + loopComplete: null, + complete: null, + loop: 1, + direction: "normal", + autoplay: !0, + timelineOffset: 0 + }, r = { + duration: 1e3, + delay: 0, + endDelay: 0, + easing: "easeOutElastic(1, .5)", + round: 0 + }, s = [ + "translateX", + "translateY", + "translateZ", + "rotate", + "rotateX", + "rotateY", + "rotateZ", + "scale", + "scaleX", + "scaleY", + "scaleZ", + "skew", + "skewX", + "skewY", + "perspective" + ], o = { + CSS: {}, + springs: {} + }; + function a(e1, t, n) { + return Math.min(Math.max(e1, t), n); + } + function l(e1, t) { + return e1.indexOf(t) > -1; + } + function c(e1, t) { + return e1.apply(null, t); + } + var h = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i, u = /^rgb/, d = /^hsl/, p = { + arr: function(e1) { + return Array.isArray(e1); + }, + obj: function(e1) { + return l(Object.prototype.toString.call(e1), "Object"); + }, + pth: function(e1) { + return p.obj(e1) && e1.hasOwnProperty("totalLength"); + }, + svg: function(e1) { + return e1 instanceof SVGElement; + }, + inp: function(e1) { + return e1 instanceof HTMLInputElement; + }, + dom: function(e1) { + return e1.nodeType || p.svg(e1); + }, + str: function(e1) { + return "string" == typeof e1; + }, + fnc: function(e1) { + return "function" == typeof e1; + }, + und: function(e1) { + return void 0 === e1; + }, + hex: function(e1) { + return h.test(e1); + }, + rgb: function(e1) { + return u.test(e1); + }, + hsl: function(e1) { + return d.test(e1); + }, + col: function(e1) { + return p.hex(e1) || p.rgb(e1) || p.hsl(e1); + }, + key: function(e1) { + return !i.hasOwnProperty(e1) && !r.hasOwnProperty(e1) && "targets" !== e1 && "keyframes" !== e1; + } + }, A = /\(([^)]+)\)/; + function f(e1) { + var t = A.exec(e1); + return t ? t[1].split(",").map(function(e1) { + return parseFloat(e1); + }) : []; + } + function m(e1, t) { + var n = f(e1), i = a(p.und(n[0]) ? 1 : n[0], .1, 100), r = a(p.und(n[1]) ? 100 : n[1], .1, 100), s = a(p.und(n[2]) ? 10 : n[2], .1, 100), l = a(p.und(n[3]) ? 0 : n[3], .1, 100), c = Math.sqrt(r / i), h = s / (2 * Math.sqrt(r * i)), u = h < 1 ? c * Math.sqrt(1 - h * h) : 0, d = h < 1 ? (h * c - l) / u : -l + c; + function A(e1) { + var n = t ? t * e1 / 1e3 : e1; + return n = h < 1 ? Math.exp(-n * h * c) * (1 * Math.cos(u * n) + d * Math.sin(u * n)) : (1 + d * n) * Math.exp(-n * c), 0 === e1 || 1 === e1 ? e1 : 1 - n; + } + return t ? A : function() { + var t = o.springs[e1]; + if (t) return t; + for(var n = 1 / 6, i = 0, r = 0;;)if (1 === A(i += n)) { + if (++r >= 16) break; + } else r = 0; + var s = i * n * 1e3; + return o.springs[e1] = s, s; + }; + } + function g(e1, t) { + void 0 === e1 && (e1 = 1), void 0 === t && (t = .5); + var n = a(e1, 1, 10), i = a(t, .1, 2); + return function(e1) { + return 0 === e1 || 1 === e1 ? e1 : -n * Math.pow(2, 10 * (e1 - 1)) * Math.sin((e1 - 1 - i / (2 * Math.PI) * Math.asin(1 / n)) * (2 * Math.PI) / i); + }; + } + function v(e1) { + return void 0 === e1 && (e1 = 10), function(t) { + return Math.round(t * e1) * (1 / e1); + }; + } + var y = function() { + var e1 = .1; + function t(e1, t) { + return 1 - 3 * t + 3 * e1; + } + function n(e1, t) { + return 3 * t - 6 * e1; + } + function i(e1) { + return 3 * e1; + } + function r(e1, r, s) { + return ((t(r, s) * e1 + n(r, s)) * e1 + i(r)) * e1; + } + function s(e1, r, s) { + return 3 * t(r, s) * e1 * e1 + 2 * n(r, s) * e1 + i(r); + } + return function(t, n, i, o) { + if (0 <= t && t <= 1 && 0 <= i && i <= 1) { + var a = new Float32Array(11); + if (t !== n || i !== o) for(var l = 0; l < 11; ++l)a[l] = r(l * e1, t, i); + return function(l) { + return t === n && i === o || 0 === l || 1 === l ? l : r(function(n) { + for(var o = 0, l = 1; 10 !== l && a[l] <= n; ++l)o += e1; + --l; + var c = o + (n - a[l]) / (a[l + 1] - a[l]) * e1, h = s(c, t, i); + return h >= .001 ? function(e1, t, n, i) { + for(var o = 0; o < 4; ++o){ + var a = s(t, n, i); + if (0 === a) return t; + t -= (r(t, n, i) - e1) / a; + } + return t; + }(n, c, t, i) : 0 === h ? c : function(e1, t, n, i, s) { + var o, a, l = 0; + do (o = r(a = t + (n - t) / 2, i, s) - e1) > 0 ? n = a : t = a; + while (Math.abs(o) > 1e-7 && ++l < 10); + return a; + }(n, o, o + e1, t, i); + }(l), n, o); + }; + } + }; + }(), E = function() { + var e1 = [ + "Quad", + "Cubic", + "Quart", + "Quint", + "Sine", + "Expo", + "Circ", + "Back", + "Elastic" + ], t = { + In: [ + [ + .55, + .085, + .68, + .53 + ], + [ + .55, + .055, + .675, + .19 + ], + [ + .895, + .03, + .685, + .22 + ], + [ + .755, + .05, + .855, + .06 + ], + [ + .47, + 0, + .745, + .715 + ], + [ + .95, + .05, + .795, + .035 + ], + [ + .6, + .04, + .98, + .335 + ], + [ + .6, + -0.28, + .735, + .045 + ], + g + ], + Out: [ + [ + .25, + .46, + .45, + .94 + ], + [ + .215, + .61, + .355, + 1 + ], + [ + .165, + .84, + .44, + 1 + ], + [ + .23, + 1, + .32, + 1 + ], + [ + .39, + .575, + .565, + 1 + ], + [ + .19, + 1, + .22, + 1 + ], + [ + .075, + .82, + .165, + 1 + ], + [ + .175, + .885, + .32, + 1.275 + ], + function(e1, t) { + return function(n) { + return 1 - g(e1, t)(1 - n); + }; + } + ], + InOut: [ + [ + .455, + .03, + .515, + .955 + ], + [ + .645, + .045, + .355, + 1 + ], + [ + .77, + 0, + .175, + 1 + ], + [ + .86, + 0, + .07, + 1 + ], + [ + .445, + .05, + .55, + .95 + ], + [ + 1, + 0, + 0, + 1 + ], + [ + .785, + .135, + .15, + .86 + ], + [ + .68, + -0.55, + .265, + 1.55 + ], + function(e1, t) { + return function(n) { + return n < .5 ? g(e1, t)(2 * n) / 2 : 1 - g(e1, t)(-2 * n + 2) / 2; + }; + } + ] + }, n = { + linear: [ + .25, + .25, + .75, + .75 + ] + }; + for(var i in t)for(var r = 0, s = t[i].length; r < s; r++)n["ease" + i + e1[r]] = t[i][r]; + return n; + }(); + function b(e1, t) { + if (p.fnc(e1)) return e1; + var n = e1.split("(")[0], i = E[n], r = f(e1); + switch(n){ + case "spring": + return m(e1, t); + case "cubicBezier": + return c(y, r); + case "steps": + return c(v, r); + default: + return p.fnc(i) ? c(i, r) : c(y, i); + } + } + function x(e1) { + try { + return document.querySelectorAll(e1); + } catch (e1) { + return; + } + } + var C = []; + function w(e1, t) { + for(var n = C, i = e1.length, r = arguments.length >= 2 ? arguments[1] : void 0, s = 0; s < i; s++)if (s in e1) { + var o = e1[s]; + t.call(r, o, s, e1) && n.push(o); + } + return (C = e1).length = 0, n; + } + function _(e1, t) { + t || (t = []); + for(var n = 0, i = e1.length; n < i; n++){ + var r = e1[n]; + Array.isArray(r) ? _(r, t) : t.push(r); + } + return t; + } + function M(e1) { + return p.arr(e1) ? e1 : (p.str(e1) && (e1 = x(e1) || e1), e1 instanceof NodeList || e1 instanceof HTMLCollection ? [].slice.call(e1) : [ + e1 + ]); + } + function S(e1, t) { + return e1.some(function(e1) { + return e1 === t; + }); + } + function I(e1) { + var t = {}; + for(var n in e1)t[n] = e1[n]; + return t; + } + function B(e1, t) { + var n = I(e1); + for(var i in e1)n[i] = t.hasOwnProperty(i) ? t[i] : e1[i]; + return n; + } + function T(e1, t) { + var n = I(e1); + for(var i in t)n[i] = p.und(e1[i]) ? t[i] : e1[i]; + return n; + } + var R = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g, L = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, D = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, P = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g, U = /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g; + var O = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/; + function F(e1) { + var t = O.exec(e1); + if (t) return t[2]; + } + function N(e1, t) { + return p.fnc(e1) ? e1(t.target, t.id, t.total) : e1; + } + function k(e1, t) { + return e1.getAttribute(t); + } + function Q(e1, t, n) { + if (S([ + n, + "deg", + "rad", + "turn" + ], F(t))) return t; + var i = o.CSS[t + n]; + if (!p.und(i)) return i; + var r = document.createElement(e1.tagName), s = e1.parentNode && e1.parentNode !== document ? e1.parentNode : document.body; + s.appendChild(r), r.style.position = "absolute", r.style.width = 100 + n; + var a = 100 / r.offsetWidth; + s.removeChild(r); + var l = a * parseFloat(t); + return o.CSS[t + n] = l, l; + } + function G(e1, t, n) { + if (t in e1.style) { + var i = t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), r = e1.style[t] || getComputedStyle(e1).getPropertyValue(i) || "0"; + return n ? Q(e1, r, n) : r; + } + } + function z(e1, t) { + return p.dom(e1) && !p.inp(e1) && (k(e1, t) || p.svg(e1) && e1[t]) ? "attribute" : p.dom(e1) && S(s, t) ? "transform" : p.dom(e1) && "transform" !== t && G(e1, t) ? "css" : null != e1[t] ? "object" : void 0; + } + var H = /(\w+)\(([^)]*)\)/g; + function V(e1) { + if (p.dom(e1)) { + for(var t, n = e1.style.transform || "", i = new Map; t = H.exec(n);)i.set(t[1], t[2]); + return i; + } + } + function W(e1, t, n, i) { + switch(z(e1, t)){ + case "transform": + return function(e1, t, n, i) { + var r = l(t, "scale") ? 1 : 0 + function(e1) { + return l(e1, "translate") || "perspective" === e1 ? "px" : l(e1, "rotate") || l(e1, "skew") ? "deg" : void 0; + }(t), s = V(e1).get(t) || r; + return n && (n.transforms.list.set(t, s), n.transforms.last = t), i ? Q(e1, s, i) : s; + }(e1, t, i, n); + case "css": + return G(e1, t, n); + case "attribute": + return k(e1, t); + default: + return e1[t] || 0; + } + } + var j = /^(\*=|\+=|-=)/; + function q(e1, t) { + var n = j.exec(e1); + if (!n) return e1; + var i = F(e1) || 0, r = parseFloat(t), s = parseFloat(e1.replace(n[0], "")); + switch(n[0][0]){ + case "+": + return r + s + i; + case "-": + return r - s + i; + case "*": + return r * s + i; + } + } + var X = /\s/g; + function Y(e1, t) { + if (p.col(e1)) return function(e1) { + var t, n; + return p.rgb(e1) ? (t = e1, (n = R.exec(t)) ? "rgba(" + n[1] + ",1)" : t) : p.hex(e1) ? function(e1) { + var t = e1.replace(L, function(e1, t, n, i) { + return t + t + n + n + i + i; + }), n = D.exec(t); + return "rgba(" + parseInt(n[1], 16) + "," + parseInt(n[2], 16) + "," + parseInt(n[3], 16) + ",1)"; + }(e1) : p.hsl(e1) ? function(e1) { + var t, n, i, r = P.exec(e1) || U.exec(e1), s = parseInt(r[1], 10) / 360, o = parseInt(r[2], 10) / 100, a = parseInt(r[3], 10) / 100, l = r[4] || 1; + function c(e1, t, n) { + return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e1 + 6 * (t - e1) * n : n < .5 ? t : n < 2 / 3 ? e1 + (t - e1) * (2 / 3 - n) * 6 : e1; + } + if (0 == o) t = n = i = a; + else { + var h = a < .5 ? a * (1 + o) : a + o - a * o, u = 2 * a - h; + t = c(u, h, s + 1 / 3), n = c(u, h, s), i = c(u, h, s - 1 / 3); + } + return "rgba(" + 255 * t + "," + 255 * n + "," + 255 * i + "," + l + ")"; + }(e1) : void 0; + }(e1); + var n = F(e1), i = n ? e1.substr(0, e1.length - n.length) : e1; + return t && !X.test(e1) ? i + t : i; + } + function J(e1, t) { + return Math.sqrt(Math.pow(t.x - e1.x, 2) + Math.pow(t.y - e1.y, 2)); + } + function K(e1) { + for(var t, n = e1.points, i = 0, r = 0; r < n.numberOfItems; r++){ + var s = n.getItem(r); + r > 0 && (i += J(t, s)), t = s; + } + return i; + } + function Z(e1) { + if (e1.getTotalLength) return e1.getTotalLength(); + switch(e1.tagName.toLowerCase()){ + case "circle": + return function(e1) { + return 2 * Math.PI * k(e1, "r"); + }(e1); + case "rect": + return function(e1) { + return 2 * k(e1, "width") + 2 * k(e1, "height"); + }(e1); + case "line": + return function(e1) { + return J({ + x: k(e1, "x1"), + y: k(e1, "y1") + }, { + x: k(e1, "x2"), + y: k(e1, "y2") + }); + }(e1); + case "polyline": + return K(e1); + case "polygon": + return function(e1) { + var t = e1.points; + return K(e1) + J(t.getItem(t.numberOfItems - 1), t.getItem(0)); + }(e1); + } + } + function $(e1, t) { + var n = t || {}, i = n.el || function(e1) { + for(var t = e1.parentNode; p.svg(t) && (t = t.parentNode, p.svg(t.parentNode));); + return t; + }(e1), r = i.getBoundingClientRect(), s = k(i, "viewBox"), o = r.width, a = r.height, l = n.viewBox || (s ? s.split(" ") : [ + 0, + 0, + o, + a + ]); + return { + el: i, + viewBox: l, + x: l[0] / 1, + y: l[1] / 1, + w: o / l[2], + h: a / l[3] + }; + } + function ee(e1, t) { + function n(n) { + void 0 === n && (n = 0); + var i = t + n >= 1 ? t + n : 0; + return e1.el.getPointAtLength(i); + } + var i = $(e1.el, e1.svg), r = n(), s = n(-1), o = n(1); + switch(e1.property){ + case "x": + return (r.x - i.x) * i.w; + case "y": + return (r.y - i.y) * i.h; + case "angle": + return 180 * Math.atan2(o.y - s.y, o.x - s.x) / Math.PI; + } + } + var te = /-?\d*\.?\d+/g; + function ne(e1, t) { + var n = Y(p.pth(e1) ? e1.totalLength : e1, t) + ""; + return { + original: n, + numbers: n.match(te) ? n.match(te).map(Number) : [ + 0 + ], + strings: p.str(e1) || t ? n.split(te) : [] + }; + } + function ie(e1) { + return w(e1 ? _(p.arr(e1) ? e1.map(M) : M(e1)) : [], function(e1, t, n) { + return n.indexOf(e1) === t; + }); + } + function re(e1) { + var t = ie(e1); + return t.map(function(e1, n) { + return { + target: e1, + id: n, + total: t.length, + transforms: { + list: V(e1) + } + }; + }); + } + var se = /^spring/; + function oe(e1, t) { + var n = I(t); + if (se.test(n.easing) && (n.duration = m(n.easing)), p.arr(e1)) { + var i = e1.length; + 2 !== i || p.obj(e1[0]) ? p.fnc(t.duration) || (n.duration = t.duration / i) : e1 = { + value: e1 + }; + } + var r = p.arr(e1) ? e1 : [ + e1 + ]; + return r.map(function(e1, n) { + var i = p.obj(e1) && !p.pth(e1) ? e1 : { + value: e1 + }; + return p.und(i.delay) && (i.delay = n ? 0 : t.delay), p.und(i.endDelay) && (i.endDelay = n === r.length - 1 ? t.endDelay : 0), i; + }).map(function(e1) { + return T(e1, n); + }); + } + var ae = { + css: function(e1, t, n) { + return e1.style[t] = n; + }, + attribute: function(e1, t, n) { + return e1.setAttribute(t, n); + }, + object: function(e1, t, n) { + return e1[t] = n; + }, + transform: function(e1, t, n, i, r) { + if (i.list.set(t, n), t === i.last || r) { + var s = ""; + i.list.forEach(function(e1, t) { + s += t + "(" + e1 + ") "; + }), e1.style.transform = s; + } + } + }; + function le(e1, t) { + for(var n = re(e1), i = 0, r = n.length; i < r; i++){ + var s = n[i]; + for(var o in t){ + var a = N(t[o], s), l = s.target, c = F(a), h = W(l, o, c, s), u = q(Y(a, c || F(h)), h), d = z(l, o); + ae[d](l, o, u, s.transforms, !0); + } + } + } + function ce(e1, t) { + return w(_(e1.map(function(e1) { + return t.map(function(t) { + return function(e1, t) { + var n = z(e1.target, t.name); + if (n) { + var i = function(e1, t) { + var n; + return e1.tweens.map(function(i) { + var r = function(e1, t) { + var n = {}; + for(var i in e1){ + var r = N(e1[i], t); + p.arr(r) && 1 === (r = r.map(function(e1) { + return N(e1, t); + })).length && (r = r[0]), n[i] = r; + } + return n.duration = parseFloat(n.duration), n.delay = parseFloat(n.delay), n; + }(i, t), s = r.value, o = p.arr(s) ? s[1] : s, a = F(o), l = W(t.target, e1.name, a, t), c = n ? n.to.original : l, h = p.arr(s) ? s[0] : c, u = F(h) || F(l), d = a || u; + return p.und(o) && (o = c), r.from = ne(h, d), r.to = ne(q(o, h), d), r.start = n ? n.end : 0, r.end = r.start + r.delay + r.duration + r.endDelay, r.easing = b(r.easing, r.duration), r.isPath = p.pth(s), r.isColor = p.col(r.from.original), r.isColor && (r.round = 1), n = r, r; + }); + }(t, e1), r = i[i.length - 1]; + return { + type: n, + property: t.name, + animatable: e1, + tweens: i, + duration: r.end, + delay: i[0].delay, + endDelay: r.endDelay + }; + } + }(e1, t); + }); + })), function(e1) { + return !p.und(e1); + }); + } + function he(e1, t) { + var n = e1.length, i = function(e1) { + return e1.timelineOffset ? e1.timelineOffset : 0; + }, r = {}; + return r.duration = n ? Math.max.apply(Math, e1.map(function(e1) { + return i(e1) + e1.duration; + })) : t.duration, r.delay = n ? Math.min.apply(Math, e1.map(function(e1) { + return i(e1) + e1.delay; + })) : t.delay, r.endDelay = n ? r.duration - Math.max.apply(Math, e1.map(function(e1) { + return i(e1) + e1.duration - e1.endDelay; + })) : t.endDelay, r; + } + var ue, de = 0, pe = [], Ae = [], fe = function() { + function e1() { + ue = requestAnimationFrame(t); + } + function t(t) { + var n = pe.length; + if (n) { + for(var i = 0; i < n;){ + var r = pe[i]; + if (r.paused) { + var s = pe.indexOf(r); + s > -1 && (pe.splice(s, 1), n = pe.length); + } else r.tick(t); + i++; + } + e1(); + } else ue = cancelAnimationFrame(ue); + } + return e1; + }(); + function me(e1) { + void 0 === e1 && (e1 = {}); + var t, n = 0, s = 0, o = 0, l = 0, c = null; + function h() { + return window.Promise && new Promise(function(e1) { + return c = e1; + }); + } + var u = h(), d = function(e1) { + var t = B(i, e1), n = B(r, e1), s = function(e1, t) { + var n = [], i = t.keyframes; + for(var r in i && (t = T(function(e1) { + for(var t = w(_(e1.map(function(e1) { + return Object.keys(e1); + })), function(e1) { + return p.key(e1); + }).reduce(function(e1, t) { + return e1.indexOf(t) < 0 && e1.push(t), e1; + }, []), n = {}, i = function(i) { + var r = t[i]; + n[r] = e1.map(function(e1) { + var t = {}; + for(var n in e1)p.key(n) ? n == r && (t.value = e1[n]) : t[n] = e1[n]; + return t; + }); + }, r = 0; r < t.length; r++)i(r); + return n; + }(i), t)), t)p.key(r) && n.push({ + name: r, + tweens: oe(t[r], e1) + }); + return n; + }(n, e1), o = re(e1.targets), a = ce(o, s), l = he(a, n), c = de; + return de++, T(t, { + id: c, + children: [], + animatables: o, + animations: a, + duration: l.duration, + delay: l.delay, + endDelay: l.endDelay + }); + }(e1); + function A() { + d.reversed = !d.reversed; + for(var e1 = 0, n = t.length; e1 < n; e1++)t[e1].reversed = d.reversed; + } + function f(e1) { + return d.reversed ? d.duration - e1 : e1; + } + function m() { + n = 0, s = f(d.currentTime) * (1 / me.speed); + } + function g(e1, t) { + t && t.seek(e1 - t.timelineOffset); + } + function v(e1) { + for(var t = 0, n = d.animations, i = n.length; t < i;){ + var r = n[t], s = r.animatable, o = r.tweens, l = o.length - 1, c = o[l]; + l && (c = w(o, function(t) { + return e1 < t.end; + })[0] || c); + for(var h = a(e1 - c.start - c.delay, 0, c.duration) / c.duration, u = isNaN(h) ? 1 : c.easing(h), p = c.to.strings, A = c.round, f = [], m = c.to.numbers.length, g = void 0, v = 0; v < m; v++){ + var y = void 0, E = c.to.numbers[v], b = c.from.numbers[v] || 0; + y = c.isPath ? ee(c.value, u * E) : b + u * (E - b), A && (c.isColor && v > 2 || (y = Math.round(y * A) / A)), f.push(y); + } + var x = p.length; + if (x) { + g = p[0]; + for(var C = 0; C < x; C++){ + p[C]; + var _ = p[C + 1], M = f[C]; + isNaN(M) || (g += _ ? M + _ : M + " "); + } + } else g = f[0]; + ae[r.type](s.target, r.property, g, s.transforms), r.currentValue = g, t++; + } + } + function y(e1) { + d[e1] && !d.passThrough && d[e1](d); + } + function E(e1) { + var i = d.duration, r = d.delay, p = i - d.endDelay, m = f(e1); + d.progress = a(m / i * 100, 0, 100), d.reversePlayback = m < d.currentTime, t && function(e1) { + if (d.reversePlayback) for(var n = l; n--;)g(e1, t[n]); + else for(var i = 0; i < l; i++)g(e1, t[i]); + }(m), !d.began && d.currentTime > 0 && (d.began = !0, y("begin"), y("loopBegin")), m <= r && 0 !== d.currentTime && v(0), (m >= p && d.currentTime !== i || !i) && v(i), m > r && m < p ? (d.changeBegan || (d.changeBegan = !0, d.changeCompleted = !1, y("changeBegin")), y("change"), v(m)) : d.changeBegan && (d.changeCompleted = !0, d.changeBegan = !1, y("changeComplete")), d.currentTime = a(m, 0, i), d.began && y("update"), e1 >= i && (s = 0, d.remaining && !0 !== d.remaining && d.remaining--, d.remaining ? (n = o, y("loopComplete"), y("loopBegin"), "alternate" === d.direction && A()) : (d.paused = !0, d.completed || (d.completed = !0, y("loopComplete"), y("complete"), "Promise" in window && (c(), u = h())))); + } + return d.reset = function() { + var e1 = d.direction; + d.passThrough = !1, d.currentTime = 0, d.progress = 0, d.paused = !0, d.began = !1, d.changeBegan = !1, d.completed = !1, d.changeCompleted = !1, d.reversePlayback = !1, d.reversed = "reverse" === e1, d.remaining = d.loop, t = d.children; + for(var n = l = t.length; n--;)d.children[n].reset(); + (d.reversed && !0 !== d.loop || "alternate" === e1 && 1 === d.loop) && d.remaining++, v(0); + }, d.set = function(e1, t) { + return le(e1, t), d; + }, d.tick = function(e1) { + o = e1, n || (n = o), E((o + (s - n)) * me.speed); + }, d.seek = function(e1) { + E(f(e1)); + }, d.pause = function() { + d.paused = !0, m(); + }, d.play = function() { + d.paused && (d.paused = !1, pe.push(d), m(), ue || fe()); + }, d.reverse = function() { + A(), m(); + }, d.restart = function() { + d.reset(), d.play(); + }, d.finished = u, d.reset(), d.autoplay && d.play(), d; + } + function ge(e1, t) { + for(var n = t.length; n--;)S(e1, t[n].animatable.target) && t.splice(n, 1); + } + document.addEventListener("visibilitychange", function() { + if (document.hidden) { + for(var e1 = 0, t = pe.length; e1 < t; e1++)activeInstance[e1].pause(); + Ae = pe.slice(0), pe = []; + } else for(var n = 0, i = Ae.length; n < i; n++)Ae[n].play(); + }), me.version = "3.0.0", me.speed = 1, me.running = pe, me.remove = function(e1) { + for(var t = ie(e1), n = pe.length; n--;){ + var i = pe[n], r = i.animations, s = i.children; + ge(t, r); + for(var o = s.length; o--;){ + var a = s[o], l = a.animations; + ge(t, l), l.length || a.children.length || s.splice(o, 1); + } + r.length || s.length || i.pause(); + } + }, me.get = W, me.set = le, me.convertPx = Q, me.path = function(e1, t) { + var n = p.str(e1) ? x(e1)[0] : e1, i = t || 100; + return function(e1) { + return { + property: e1, + el: n, + svg: $(n), + totalLength: Z(n) * (i / 100) + }; + }; + }, me.setDashoffset = function(e1) { + var t = Z(e1); + return e1.setAttribute("stroke-dasharray", t), t; + }, me.stagger = function(e1, t) { + void 0 === t && (t = {}); + var n = t.direction || "normal", i = t.easing ? b(t.easing) : null, r = t.grid, s = t.axis, o = t.from || 0, a = "first" === o, l = "center" === o, c = "last" === o, h = p.arr(e1), u = h ? parseFloat(e1[0]) : parseFloat(e1), d = h ? parseFloat(e1[1]) : 0, A = F(h ? e1[1] : e1) || 0, f = t.start || 0 + (h ? u : 0), m = [], g = 0; + return function(e1, t, p) { + if (a && (o = 0), l && (o = (p - 1) / 2), c && (o = p - 1), !m.length) { + for(var v = 0; v < p; v++){ + if (r) { + var y = l ? (r[0] - 1) / 2 : o % r[0], E = l ? (r[1] - 1) / 2 : Math.floor(o / r[0]), b = y - v % r[0], x = E - Math.floor(v / r[0]), C = Math.sqrt(b * b + x * x); + "x" === s && (C = -b), "y" === s && (C = -x), m.push(C); + } else m.push(Math.abs(o - v)); + g = Math.max.apply(Math, m); + } + i && (m = m.map(function(e1) { + return i(e1 / g) * g; + })), "reverse" === n && (m = m.map(function(e1) { + return s ? e1 < 0 ? -1 * e1 : -e1 : Math.abs(g - e1); + })); + } + return f + (h ? (d - u) / g : u) * (Math.round(100 * m[t]) / 100) + A; + }; + }, me.timeline = function(e1) { + void 0 === e1 && (e1 = {}); + var t = me(e1); + return t.duration = 0, t.add = function(n, i) { + var s = pe.indexOf(t), o = t.children; + function a(e1) { + e1.passThrough = !0; + } + s > -1 && pe.splice(s, 1); + for(var l = 0; l < o.length; l++)a(o[l]); + var c = T(n, B(r, e1)); + c.targets = c.targets || e1.targets; + var h = t.duration; + c.autoplay = !1, c.direction = t.direction, c.timelineOffset = p.und(i) ? h : q(i, h), a(t), t.seek(c.timelineOffset); + var u = me(c); + a(u), o.push(u); + var d = he(o, e1); + return t.delay = d.delay, t.endDelay = d.endDelay, t.duration = d.duration, t.seek(0), t.reset(), t.autoplay && t.play(), t; + }, t; + }, me.easing = b, me.penner = E, me.random = function(e1, t) { + return Math.floor(Math.random() * (t - e1 + 1)) + e1; + }; + const ve = me; + }, + 6559: (e1, t, n)=>{ + var i = n(7510), r = n(4502), s = n(83), o = n(2259); + e1.exports = function(e1) { + return new a(e1); + }; + class a extends THREE.BufferGeometry { + constructor(e1){ + super(), "string" == typeof e1 && (e1 = { + text: e1 + }), this._opt = Object.assign({}, e1), e1 && this.update(e1); + } + update(e1) { + if ("string" == typeof e1 && (e1 = { + text: e1 + }), !(e1 = Object.assign({}, this._opt, e1)).font) throw new TypeError("must specify a { font } in options"); + this.layout = i(e1); + var t = !1 !== e1.flipY, n = e1.font, o = n.common.scaleW, a = n.common.scaleH, l = this.layout.glyphs.filter(function(e1) { + var t = e1.data; + return t.width * t.height > 0; + }); + this.visibleGlyphs = l; + var c = s.positions(l), h = s.uvs(l, o, a, t), u = r([], { + clockwise: !0, + type: "uint16", + count: l.length + }); + if (this.setIndex(u), this.setAttribute("position", new THREE.BufferAttribute(c, 2)), this.setAttribute("uv", new THREE.BufferAttribute(h, 2)), !e1.multipage && "page" in this.attributes) this.removeAttribute("page"); + else if (e1.multipage) { + var d = s.pages(l); + this.setAttribute("page", new THREE.BufferAttribute(d, 1)); + } + null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(); + } + computeBoundingSphere() { + null === this.boundingSphere && (this.boundingSphere = new THREE.Sphere); + var e1 = this.attributes.position.array, t = this.attributes.position.itemSize; + if (!e1 || !t || e1.length < 2) return this.boundingSphere.radius = 0, void this.boundingSphere.center.set(0, 0, 0); + o.computeSphere(e1, this.boundingSphere), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.'); + } + computeBoundingBox() { + null === this.boundingBox && (this.boundingBox = new THREE.Box3); + var e1 = this.boundingBox, t = this.attributes.position.array, n = this.attributes.position.itemSize; + !t || !n || t.length < 2 ? e1.makeEmpty() : o.computeBox(t, e1); + } + } + }, + 2259: (e1)=>{ + var t = { + min: [ + 0, + 0 + ], + max: [ + 0, + 0 + ] + }; + function n(e1) { + var n = e1.length / 2; + t.min[0] = e1[0], t.min[1] = e1[1], t.max[0] = e1[0], t.max[1] = e1[1]; + for(var i = 0; i < n; i++){ + var r = e1[2 * i + 0], s = e1[2 * i + 1]; + t.min[0] = Math.min(r, t.min[0]), t.min[1] = Math.min(s, t.min[1]), t.max[0] = Math.max(r, t.max[0]), t.max[1] = Math.max(s, t.max[1]); + } + } + e1.exports.computeBox = function(e1, i) { + n(e1), i.min.set(t.min[0], t.min[1], 0), i.max.set(t.max[0], t.max[1], 0); + }, e1.exports.computeSphere = function(e1, i) { + n(e1); + var r = t.min[0], s = t.min[1], o = t.max[0] - r, a = t.max[1] - s, l = Math.sqrt(o * o + a * a); + i.center.set(r + o / 2, s + a / 2, 0), i.radius = l / 2; + }; + }, + 83: (e1)=>{ + e1.exports.pages = function(e1) { + var t = new Float32Array(4 * e1.length * 1), n = 0; + return e1.forEach(function(e1) { + var i = e1.data.page || 0; + t[n++] = i, t[n++] = i, t[n++] = i, t[n++] = i; + }), t; + }, e1.exports.uvs = function(e1, t, n, i) { + var r = new Float32Array(4 * e1.length * 2), s = 0; + return e1.forEach(function(e1) { + var o = e1.data, a = o.x + o.width, l = o.y + o.height, c = o.x / t, h = o.y / n, u = a / t, d = l / n; + i && (h = (n - o.y) / n, d = (n - l) / n), r[s++] = c, r[s++] = h, r[s++] = c, r[s++] = d, r[s++] = u, r[s++] = d, r[s++] = u, r[s++] = h; + }), r; + }, e1.exports.positions = function(e1) { + var t = new Float32Array(4 * e1.length * 2), n = 0; + return e1.forEach(function(e1) { + var i = e1.data, r = e1.position[0] + i.xoffset, s = e1.position[1] + i.yoffset, o = i.width, a = i.height; + t[n++] = r, t[n++] = s, t[n++] = r, t[n++] = s + a, t[n++] = r + o, t[n++] = s + a, t[n++] = r + o, t[n++] = s; + }), t; + }; + }, + 5542: function(e1, t, n) { + e1.exports = function() { + "use strict"; + var e1 = "undefined" != typeof window ? window : void 0 !== n.g ? n.g : "undefined" != typeof self ? self : {}; + var t, i = function() { + return /Android/i.test(navigator.userAgent) || /iPhone|iPad|iPod/i.test(navigator.userAgent); + }, r = function(e1, t) { + for(var n = 0, i = e1.length; n < i; n++)t[n] = e1[n]; + }, s = function(e1, t) { + for(var n in t)t.hasOwnProperty(n) && (e1[n] = t[n]); + return e1; + }, o = function(e1, t) { + return e1(t = { + exports: {} + }, t.exports), t.exports; + }(function(t, n) { + t.exports = function() { + var t, n, i, r = function(e1, t) { + if (!(e1 instanceof t)) throw new TypeError("Cannot call a class as a function"); + }, s = function() { + function e1(e1, t) { + for(var n = 0; n < t.length; n++){ + var i = t[n]; + i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e1, i.key, i); + } + } + return function(t, n, i) { + return n && e1(t.prototype, n), i && e1(t, i), t; + }; + }(), o = function() { + function e1(e1, t) { + var n = [], i = !0, r = !1, s = void 0; + try { + for(var o, a = e1[Symbol.iterator](); !(i = (o = a.next()).done) && (n.push(o.value), !t || n.length !== t); i = !0); + } catch (e1) { + r = !0, s = e1; + } finally{ + try { + !i && a.return && a.return(); + } finally{ + if (r) throw s; + } + } + return n; + } + return function(t, n) { + if (Array.isArray(t)) return t; + if (Symbol.iterator in Object(t)) return e1(t, n); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + }(), a = .001, l = 1, c = function(e1, t) { + return "data:" + e1 + "," + encodeURIComponent(t); + }, h = function(e1, t, n) { + return e1 + (t - e1) * n; + }, u = function() { + var e1 = /iPad|iPhone|iPod/.test(navigator.platform); + return function() { + return e1; + }; + }(), d = function() { + var e1 = -1 !== navigator.userAgent.indexOf("Version") && -1 !== navigator.userAgent.indexOf("Android") && -1 !== navigator.userAgent.indexOf("Chrome"); + return function() { + return e1; + }; + }(), p = function() { + var e1 = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function() { + return e1; + }; + }(), A = function() { + var e1 = -1 !== navigator.userAgent.indexOf("Firefox") && -1 !== navigator.userAgent.indexOf("Android"); + return function() { + return e1; + }; + }(), f = (t = navigator.userAgent.match(/.*Chrome\/([0-9]+)/), n = t ? parseInt(t[1], 10) : null, function() { + return n; + }), m = function() { + var e1 = !1; + return e1 = u() && p() && -1 !== navigator.userAgent.indexOf("13_4"), function() { + return e1; + }; + }(), g = function() { + var e1 = !1; + if (65 === f()) { + var t = navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/); + if (t) { + var n = t[1].split("."), i = o(n, 4), r = (i[0], i[1], i[2]), s = i[3]; + e1 = 3325 === parseInt(r, 10) && parseInt(s, 10) < 148; + } + } + return function() { + return e1; + }; + }(), v = function() { + var e1 = -1 !== navigator.userAgent.indexOf("R7 Build"); + return function() { + return e1; + }; + }(), y = function() { + var e1 = 90 == window.orientation || -90 == window.orientation; + return v() ? !e1 : e1; + }, E = function(e1) { + return !(isNaN(e1) || e1 <= a || e1 > l); + }, b = function() { + return Math.max(window.screen.width, window.screen.height) * window.devicePixelRatio; + }, x = function() { + return Math.min(window.screen.width, window.screen.height) * window.devicePixelRatio; + }, C = function(e1) { + if (d()) return !1; + if (e1.requestFullscreen) e1.requestFullscreen(); + else if (e1.webkitRequestFullscreen) e1.webkitRequestFullscreen(); + else if (e1.mozRequestFullScreen) e1.mozRequestFullScreen(); + else { + if (!e1.msRequestFullscreen) return !1; + e1.msRequestFullscreen(); + } + return !0; + }, w = function() { + if (document.exitFullscreen) document.exitFullscreen(); + else if (document.webkitExitFullscreen) document.webkitExitFullscreen(); + else if (document.mozCancelFullScreen) document.mozCancelFullScreen(); + else { + if (!document.msExitFullscreen) return !1; + document.msExitFullscreen(); + } + return !0; + }, _ = function() { + return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; + }, M = function(e1, t, n, i) { + var r = e1.createShader(e1.VERTEX_SHADER); + e1.shaderSource(r, t), e1.compileShader(r); + var s = e1.createShader(e1.FRAGMENT_SHADER); + e1.shaderSource(s, n), e1.compileShader(s); + var o = e1.createProgram(); + for(var a in e1.attachShader(o, r), e1.attachShader(o, s), i)e1.bindAttribLocation(o, i[a], a); + return e1.linkProgram(o), e1.deleteShader(r), e1.deleteShader(s), o; + }, S = function(e1, t) { + for(var n = {}, i = e1.getProgramParameter(t, e1.ACTIVE_UNIFORMS), r = "", s = 0; s < i; s++)n[r = e1.getActiveUniform(t, s).name.replace("[0]", "")] = e1.getUniformLocation(t, r); + return n; + }, I = function(e1, t, n, i, r, s, o) { + var a = 1 / (t - n), l = 1 / (i - r), c = 1 / (s - o); + return e1[0] = -2 * a, e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[5] = -2 * l, e1[6] = 0, e1[7] = 0, e1[8] = 0, e1[9] = 0, e1[10] = 2 * c, e1[11] = 0, e1[12] = (t + n) * a, e1[13] = (r + i) * l, e1[14] = (o + s) * c, e1[15] = 1, e1; + }, B = function() { + var e1, t = !1; + return e1 = navigator.userAgent || navigator.vendor || window.opera, (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|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|xda|xiino/i.test(e1) || /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(e1.substr(0, 4))) && (t = !0), t; + }, T = function(e1, t) { + for(var n in t)t.hasOwnProperty(n) && (e1[n] = t[n]); + return e1; + }, R = function(e1) { + if (u()) { + var t = e1.style.width, n = e1.style.height; + e1.style.width = parseInt(t) + 1 + "px", e1.style.height = parseInt(n) + "px", setTimeout(function() { + e1.style.width = t, e1.style.height = n; + }, 100); + } + window.canvas = e1; + }, L = function() { + var e1 = Math.PI / 180, t = .25 * Math.PI; + function n(n, i, r, s) { + var o = Math.tan(i ? i.upDegrees * e1 : t), a = Math.tan(i ? i.downDegrees * e1 : t), l = Math.tan(i ? i.leftDegrees * e1 : t), c = Math.tan(i ? i.rightDegrees * e1 : t), h = 2 / (l + c), u = 2 / (o + a); + return n[0] = h, n[1] = 0, n[2] = 0, n[3] = 0, n[4] = 0, n[5] = u, n[6] = 0, n[7] = 0, n[8] = -(l - c) * h * .5, n[9] = (o - a) * u * .5, n[10] = s / (r - s), n[11] = -1, n[12] = 0, n[13] = 0, n[14] = s * r / (r - s), n[15] = 0, n; + } + function i(e1, t, n) { + var i = t[0], r = t[1], s = t[2], o = t[3], a = i + i, l = r + r, c = s + s, h = i * a, u = i * l, d = i * c, p = r * l, A = r * c, f = s * c, m = o * a, g = o * l, v = o * c; + return e1[0] = 1 - (p + f), e1[1] = u + v, e1[2] = d - g, e1[3] = 0, e1[4] = u - v, e1[5] = 1 - (h + f), e1[6] = A + m, e1[7] = 0, e1[8] = d + g, e1[9] = A - m, e1[10] = 1 - (h + p), e1[11] = 0, e1[12] = n[0], e1[13] = n[1], e1[14] = n[2], e1[15] = 1, e1; + } + function r(e1, t, n) { + var i, r, s, o, a, l, c, h, u, d, p, A, f = n[0], m = n[1], g = n[2]; + return t === e1 ? (e1[12] = t[0] * f + t[4] * m + t[8] * g + t[12], e1[13] = t[1] * f + t[5] * m + t[9] * g + t[13], e1[14] = t[2] * f + t[6] * m + t[10] * g + t[14], e1[15] = t[3] * f + t[7] * m + t[11] * g + t[15]) : (i = t[0], r = t[1], s = t[2], o = t[3], a = t[4], l = t[5], c = t[6], h = t[7], u = t[8], d = t[9], p = t[10], A = t[11], e1[0] = i, e1[1] = r, e1[2] = s, e1[3] = o, e1[4] = a, e1[5] = l, e1[6] = c, e1[7] = h, e1[8] = u, e1[9] = d, e1[10] = p, e1[11] = A, e1[12] = i * f + a * m + u * g + t[12], e1[13] = r * f + l * m + d * g + t[13], e1[14] = s * f + c * m + p * g + t[14], e1[15] = o * f + h * m + A * g + t[15]), e1; + } + function s(e1, t) { + var n = t[0], i = t[1], r = t[2], s = t[3], o = t[4], a = t[5], l = t[6], c = t[7], h = t[8], u = t[9], d = t[10], p = t[11], A = t[12], f = t[13], m = t[14], g = t[15], v = n * a - i * o, y = n * l - r * o, E = n * c - s * o, b = i * l - r * a, x = i * c - s * a, C = r * c - s * l, w = h * f - u * A, _ = h * m - d * A, M = h * g - p * A, S = u * m - d * f, I = u * g - p * f, B = d * g - p * m, T = v * B - y * I + E * S + b * M - x * _ + C * w; + return T ? (T = 1 / T, e1[0] = (a * B - l * I + c * S) * T, e1[1] = (r * I - i * B - s * S) * T, e1[2] = (f * C - m * x + g * b) * T, e1[3] = (d * x - u * C - p * b) * T, e1[4] = (l * M - o * B - c * _) * T, e1[5] = (n * B - r * M + s * _) * T, e1[6] = (m * E - A * C - g * y) * T, e1[7] = (h * C - d * E + p * y) * T, e1[8] = (o * I - a * M + c * w) * T, e1[9] = (i * M - n * I - s * w) * T, e1[10] = (A * x - f * E + g * v) * T, e1[11] = (u * E - h * x - p * v) * T, e1[12] = (a * _ - o * S - l * w) * T, e1[13] = (n * S - i * _ + r * w) * T, e1[14] = (f * y - A * b - m * v) * T, e1[15] = (h * b - u * y + d * v) * T, e1) : null; + } + var o = new Float32Array([ + 0, + 0, + 0, + 1 + ]), a = new Float32Array([ + 0, + 0, + 0 + ]); + function l(e1, t, l, c, h, u) { + n(e1, c || null, u.depthNear, u.depthFar), i(t, l.orientation || o, l.position || a), h && r(t, t, h), s(t, t); + } + return function(e1, t, n) { + return !(!e1 || !t || (e1.pose = t, e1.timestamp = t.timestamp, l(e1.leftProjectionMatrix, e1.leftViewMatrix, t, n._getFieldOfView("left"), n._getEyeOffset("left"), n), l(e1.rightProjectionMatrix, e1.rightViewMatrix, t, n._getFieldOfView("right"), n._getEyeOffset("right"), n), 0)); + }; + }(), D = function() { + var e1 = window.self !== window.top, t = P(document.referrer), n = P(window.location.href); + return e1 && t !== n; + }, P = function(e1) { + var t, n = e1.indexOf("://"); + t = -1 !== n ? n + 3 : 0; + var i = e1.indexOf("/", t); + return -1 === i && (i = e1.length), e1.substring(0, i); + }, U = function(e1) { + return e1.w > 1 ? (console.warn("getQuaternionAngle: w > 1"), 0) : 2 * Math.acos(e1.w); + }, O = (i = {}, function(e1, t) { + void 0 === i[e1] && (console.warn("webvr-polyfill: " + t), i[e1] = !0); + }), F = function(e1, t) { + O(e1, e1 + " has been deprecated. This may not work on native WebVR displays. " + (t ? "Please use " + t + " instead." : "")); + }; + function N(e1, t, n) { + if (t) { + for(var i = [], r = null, s = 0; s < t.length; ++s)switch(o = t[s]){ + case e1.TEXTURE_BINDING_2D: + case e1.TEXTURE_BINDING_CUBE_MAP: + if ((l = t[++s]) < e1.TEXTURE0 || l > e1.TEXTURE31) { + console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"), i.push(null, null); + break; + } + r || (r = e1.getParameter(e1.ACTIVE_TEXTURE)), e1.activeTexture(l), i.push(e1.getParameter(o), null); + break; + case e1.ACTIVE_TEXTURE: + r = e1.getParameter(e1.ACTIVE_TEXTURE), i.push(null); + break; + default: + i.push(e1.getParameter(o)); + } + for(n(e1), s = 0; s < t.length; ++s){ + var o = t[s], a = i[s]; + switch(o){ + case e1.ACTIVE_TEXTURE: + break; + case e1.ARRAY_BUFFER_BINDING: + e1.bindBuffer(e1.ARRAY_BUFFER, a); + break; + case e1.COLOR_CLEAR_VALUE: + e1.clearColor(a[0], a[1], a[2], a[3]); + break; + case e1.COLOR_WRITEMASK: + e1.colorMask(a[0], a[1], a[2], a[3]); + break; + case e1.CURRENT_PROGRAM: + e1.useProgram(a); + break; + case e1.ELEMENT_ARRAY_BUFFER_BINDING: + e1.bindBuffer(e1.ELEMENT_ARRAY_BUFFER, a); + break; + case e1.FRAMEBUFFER_BINDING: + e1.bindFramebuffer(e1.FRAMEBUFFER, a); + break; + case e1.RENDERBUFFER_BINDING: + e1.bindRenderbuffer(e1.RENDERBUFFER, a); + break; + case e1.TEXTURE_BINDING_2D: + if ((l = t[++s]) < e1.TEXTURE0 || l > e1.TEXTURE31) break; + e1.activeTexture(l), e1.bindTexture(e1.TEXTURE_2D, a); + break; + case e1.TEXTURE_BINDING_CUBE_MAP: + var l; + if ((l = t[++s]) < e1.TEXTURE0 || l > e1.TEXTURE31) break; + e1.activeTexture(l), e1.bindTexture(e1.TEXTURE_CUBE_MAP, a); + break; + case e1.VIEWPORT: + e1.viewport(a[0], a[1], a[2], a[3]); + break; + case e1.BLEND: + case e1.CULL_FACE: + case e1.DEPTH_TEST: + case e1.SCISSOR_TEST: + case e1.STENCIL_TEST: + a ? e1.enable(o) : e1.disable(o); + break; + default: + console.log("No GL restore behavior for 0x" + o.toString(16)); + } + r && e1.activeTexture(r); + } + } else n(e1); + } + var k = N, Q = [ + "attribute vec2 position;", + "attribute vec3 texCoord;", + "varying vec2 vTexCoord;", + "uniform vec4 viewportOffsetScale[2];", + "void main() {", + " vec4 viewport = viewportOffsetScale[int(texCoord.z)];", + " vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;", + " gl_Position = vec4( position, 1.0, 1.0 );", + "}" + ].join("\n"), G = [ + "precision mediump float;", + "uniform sampler2D diffuse;", + "varying vec2 vTexCoord;", + "void main() {", + " gl_FragColor = texture2D(diffuse, vTexCoord);", + "}" + ].join("\n"); + function z(e1, t, n, i) { + this.gl = e1, this.cardboardUI = t, this.bufferScale = n, this.dirtySubmitFrameBindings = i, this.ctxAttribs = e1.getContextAttributes(), this.instanceExt = e1.getExtension("ANGLE_instanced_arrays"), this.meshWidth = 20, this.meshHeight = 20, this.bufferWidth = e1.drawingBufferWidth, this.bufferHeight = e1.drawingBufferHeight, this.realBindFramebuffer = e1.bindFramebuffer, this.realEnable = e1.enable, this.realDisable = e1.disable, this.realColorMask = e1.colorMask, this.realClearColor = e1.clearColor, this.realViewport = e1.viewport, u() || (this.realCanvasWidth = Object.getOwnPropertyDescriptor(e1.canvas.__proto__, "width"), this.realCanvasHeight = Object.getOwnPropertyDescriptor(e1.canvas.__proto__, "height")), this.isPatched = !1, this.lastBoundFramebuffer = null, this.cullFace = !1, this.depthTest = !1, this.blend = !1, this.scissorTest = !1, this.stencilTest = !1, this.viewport = [ + 0, + 0, + 0, + 0 + ], this.colorMask = [ + !0, + !0, + !0, + !0 + ], this.clearColor = [ + 0, + 0, + 0, + 0 + ], this.attribs = { + position: 0, + texCoord: 1 + }, this.program = M(e1, Q, G, this.attribs), this.uniforms = S(e1, this.program), this.viewportOffsetScale = new Float32Array(8), this.setTextureBounds(), this.vertexBuffer = e1.createBuffer(), this.indexBuffer = e1.createBuffer(), this.indexCount = 0, this.renderTarget = e1.createTexture(), this.framebuffer = e1.createFramebuffer(), this.depthStencilBuffer = null, this.depthBuffer = null, this.stencilBuffer = null, this.ctxAttribs.depth && this.ctxAttribs.stencil ? this.depthStencilBuffer = e1.createRenderbuffer() : this.ctxAttribs.depth ? this.depthBuffer = e1.createRenderbuffer() : this.ctxAttribs.stencil && (this.stencilBuffer = e1.createRenderbuffer()), this.patch(), this.onResize(); + } + z.prototype.destroy = function() { + var e1 = this.gl; + this.unpatch(), e1.deleteProgram(this.program), e1.deleteBuffer(this.vertexBuffer), e1.deleteBuffer(this.indexBuffer), e1.deleteTexture(this.renderTarget), e1.deleteFramebuffer(this.framebuffer), this.depthStencilBuffer && e1.deleteRenderbuffer(this.depthStencilBuffer), this.depthBuffer && e1.deleteRenderbuffer(this.depthBuffer), this.stencilBuffer && e1.deleteRenderbuffer(this.stencilBuffer), this.cardboardUI && this.cardboardUI.destroy(); + }, z.prototype.onResize = function() { + var e1 = this.gl, t = this, n = [ + e1.RENDERBUFFER_BINDING, + e1.TEXTURE_BINDING_2D, + e1.TEXTURE0 + ]; + k(e1, n, function(e1) { + t.realBindFramebuffer.call(e1, e1.FRAMEBUFFER, null), t.scissorTest && t.realDisable.call(e1, e1.SCISSOR_TEST), t.realColorMask.call(e1, !0, !0, !0, !0), t.realViewport.call(e1, 0, 0, e1.drawingBufferWidth, e1.drawingBufferHeight), t.realClearColor.call(e1, 0, 0, 0, 1), e1.clear(e1.COLOR_BUFFER_BIT), t.realBindFramebuffer.call(e1, e1.FRAMEBUFFER, t.framebuffer), e1.bindTexture(e1.TEXTURE_2D, t.renderTarget), e1.texImage2D(e1.TEXTURE_2D, 0, t.ctxAttribs.alpha ? e1.RGBA : e1.RGB, t.bufferWidth, t.bufferHeight, 0, t.ctxAttribs.alpha ? e1.RGBA : e1.RGB, e1.UNSIGNED_BYTE, null), e1.texParameteri(e1.TEXTURE_2D, e1.TEXTURE_MAG_FILTER, e1.LINEAR), e1.texParameteri(e1.TEXTURE_2D, e1.TEXTURE_MIN_FILTER, e1.LINEAR), e1.texParameteri(e1.TEXTURE_2D, e1.TEXTURE_WRAP_S, e1.CLAMP_TO_EDGE), e1.texParameteri(e1.TEXTURE_2D, e1.TEXTURE_WRAP_T, e1.CLAMP_TO_EDGE), e1.framebufferTexture2D(e1.FRAMEBUFFER, e1.COLOR_ATTACHMENT0, e1.TEXTURE_2D, t.renderTarget, 0), t.ctxAttribs.depth && t.ctxAttribs.stencil ? (e1.bindRenderbuffer(e1.RENDERBUFFER, t.depthStencilBuffer), e1.renderbufferStorage(e1.RENDERBUFFER, e1.DEPTH_STENCIL, t.bufferWidth, t.bufferHeight), e1.framebufferRenderbuffer(e1.FRAMEBUFFER, e1.DEPTH_STENCIL_ATTACHMENT, e1.RENDERBUFFER, t.depthStencilBuffer)) : t.ctxAttribs.depth ? (e1.bindRenderbuffer(e1.RENDERBUFFER, t.depthBuffer), e1.renderbufferStorage(e1.RENDERBUFFER, e1.DEPTH_COMPONENT16, t.bufferWidth, t.bufferHeight), e1.framebufferRenderbuffer(e1.FRAMEBUFFER, e1.DEPTH_ATTACHMENT, e1.RENDERBUFFER, t.depthBuffer)) : t.ctxAttribs.stencil && (e1.bindRenderbuffer(e1.RENDERBUFFER, t.stencilBuffer), e1.renderbufferStorage(e1.RENDERBUFFER, e1.STENCIL_INDEX8, t.bufferWidth, t.bufferHeight), e1.framebufferRenderbuffer(e1.FRAMEBUFFER, e1.STENCIL_ATTACHMENT, e1.RENDERBUFFER, t.stencilBuffer)), !e1.checkFramebufferStatus(e1.FRAMEBUFFER) === e1.FRAMEBUFFER_COMPLETE && console.error("Framebuffer incomplete!"), t.realBindFramebuffer.call(e1, e1.FRAMEBUFFER, t.lastBoundFramebuffer), t.scissorTest && t.realEnable.call(e1, e1.SCISSOR_TEST), t.realColorMask.apply(e1, t.colorMask), t.realViewport.apply(e1, t.viewport), t.realClearColor.apply(e1, t.clearColor); + }), this.cardboardUI && this.cardboardUI.onResize(); + }, z.prototype.patch = function() { + if (!this.isPatched) { + var e1 = this, t = this.gl.canvas, n = this.gl; + u() || (t.width = b() * this.bufferScale, t.height = x() * this.bufferScale, Object.defineProperty(t, "width", { + configurable: !0, + enumerable: !0, + get: function() { + return e1.bufferWidth; + }, + set: function(n) { + e1.bufferWidth = n, e1.realCanvasWidth.set.call(t, n), e1.onResize(); + } + }), Object.defineProperty(t, "height", { + configurable: !0, + enumerable: !0, + get: function() { + return e1.bufferHeight; + }, + set: function(n) { + e1.bufferHeight = n, e1.realCanvasHeight.set.call(t, n), e1.onResize(); + } + })), this.lastBoundFramebuffer = n.getParameter(n.FRAMEBUFFER_BINDING), null == this.lastBoundFramebuffer && (this.lastBoundFramebuffer = this.framebuffer, this.gl.bindFramebuffer(n.FRAMEBUFFER, this.framebuffer)), this.gl.bindFramebuffer = function(t, i) { + e1.lastBoundFramebuffer = i || e1.framebuffer, e1.realBindFramebuffer.call(n, t, e1.lastBoundFramebuffer); + }, this.cullFace = n.getParameter(n.CULL_FACE), this.depthTest = n.getParameter(n.DEPTH_TEST), this.blend = n.getParameter(n.BLEND), this.scissorTest = n.getParameter(n.SCISSOR_TEST), this.stencilTest = n.getParameter(n.STENCIL_TEST), n.enable = function(t) { + switch(t){ + case n.CULL_FACE: + e1.cullFace = !0; + break; + case n.DEPTH_TEST: + e1.depthTest = !0; + break; + case n.BLEND: + e1.blend = !0; + break; + case n.SCISSOR_TEST: + e1.scissorTest = !0; + break; + case n.STENCIL_TEST: + e1.stencilTest = !0; + } + e1.realEnable.call(n, t); + }, n.disable = function(t) { + switch(t){ + case n.CULL_FACE: + e1.cullFace = !1; + break; + case n.DEPTH_TEST: + e1.depthTest = !1; + break; + case n.BLEND: + e1.blend = !1; + break; + case n.SCISSOR_TEST: + e1.scissorTest = !1; + break; + case n.STENCIL_TEST: + e1.stencilTest = !1; + } + e1.realDisable.call(n, t); + }, this.colorMask = n.getParameter(n.COLOR_WRITEMASK), n.colorMask = function(t, i, r, s) { + e1.colorMask[0] = t, e1.colorMask[1] = i, e1.colorMask[2] = r, e1.colorMask[3] = s, e1.realColorMask.call(n, t, i, r, s); + }, this.clearColor = n.getParameter(n.COLOR_CLEAR_VALUE), n.clearColor = function(t, i, r, s) { + e1.clearColor[0] = t, e1.clearColor[1] = i, e1.clearColor[2] = r, e1.clearColor[3] = s, e1.realClearColor.call(n, t, i, r, s); + }, this.viewport = n.getParameter(n.VIEWPORT), n.viewport = function(t, i, r, s) { + e1.viewport[0] = t, e1.viewport[1] = i, e1.viewport[2] = r, e1.viewport[3] = s, e1.realViewport.call(n, t, i, r, s); + }, this.isPatched = !0, R(t); + } + }, z.prototype.unpatch = function() { + if (this.isPatched) { + var e1 = this.gl, t = this.gl.canvas; + u() || (Object.defineProperty(t, "width", this.realCanvasWidth), Object.defineProperty(t, "height", this.realCanvasHeight)), t.width = this.bufferWidth, t.height = this.bufferHeight, e1.bindFramebuffer = this.realBindFramebuffer, e1.enable = this.realEnable, e1.disable = this.realDisable, e1.colorMask = this.realColorMask, e1.clearColor = this.realClearColor, e1.viewport = this.realViewport, this.lastBoundFramebuffer == this.framebuffer && e1.bindFramebuffer(e1.FRAMEBUFFER, null), this.isPatched = !1, setTimeout(function() { + R(t); + }, 1); + } + }, z.prototype.setTextureBounds = function(e1, t) { + e1 || (e1 = [ + 0, + 0, + .5, + 1 + ]), t || (t = [ + .5, + 0, + .5, + 1 + ]), this.viewportOffsetScale[0] = e1[0], this.viewportOffsetScale[1] = e1[1], this.viewportOffsetScale[2] = e1[2], this.viewportOffsetScale[3] = e1[3], this.viewportOffsetScale[4] = t[0], this.viewportOffsetScale[5] = t[1], this.viewportOffsetScale[6] = t[2], this.viewportOffsetScale[7] = t[3]; + }, z.prototype.submitFrame = function() { + var e1 = this.gl, t = this, n = []; + if (this.dirtySubmitFrameBindings || n.push(e1.CURRENT_PROGRAM, e1.ARRAY_BUFFER_BINDING, e1.ELEMENT_ARRAY_BUFFER_BINDING, e1.TEXTURE_BINDING_2D, e1.TEXTURE0), k(e1, n, function(e1) { + t.realBindFramebuffer.call(e1, e1.FRAMEBUFFER, null); + var n = 0, i = 0; + t.instanceExt && (n = e1.getVertexAttrib(t.attribs.position, t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE), i = e1.getVertexAttrib(t.attribs.texCoord, t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)), t.cullFace && t.realDisable.call(e1, e1.CULL_FACE), t.depthTest && t.realDisable.call(e1, e1.DEPTH_TEST), t.blend && t.realDisable.call(e1, e1.BLEND), t.scissorTest && t.realDisable.call(e1, e1.SCISSOR_TEST), t.stencilTest && t.realDisable.call(e1, e1.STENCIL_TEST), t.realColorMask.call(e1, !0, !0, !0, !0), t.realViewport.call(e1, 0, 0, e1.drawingBufferWidth, e1.drawingBufferHeight), (t.ctxAttribs.alpha || u()) && (t.realClearColor.call(e1, 0, 0, 0, 1), e1.clear(e1.COLOR_BUFFER_BIT)), e1.useProgram(t.program), e1.bindBuffer(e1.ELEMENT_ARRAY_BUFFER, t.indexBuffer), e1.bindBuffer(e1.ARRAY_BUFFER, t.vertexBuffer), e1.enableVertexAttribArray(t.attribs.position), e1.enableVertexAttribArray(t.attribs.texCoord), e1.vertexAttribPointer(t.attribs.position, 2, e1.FLOAT, !1, 20, 0), e1.vertexAttribPointer(t.attribs.texCoord, 3, e1.FLOAT, !1, 20, 8), t.instanceExt && (0 != n && t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position, 0), 0 != i && t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord, 0)), e1.activeTexture(e1.TEXTURE0), e1.uniform1i(t.uniforms.diffuse, 0), e1.bindTexture(e1.TEXTURE_2D, t.renderTarget), e1.uniform4fv(t.uniforms.viewportOffsetScale, t.viewportOffsetScale), e1.drawElements(e1.TRIANGLES, t.indexCount, e1.UNSIGNED_SHORT, 0), t.cardboardUI && t.cardboardUI.renderNoState(), t.realBindFramebuffer.call(t.gl, e1.FRAMEBUFFER, t.framebuffer), t.ctxAttribs.preserveDrawingBuffer || (t.realClearColor.call(e1, 0, 0, 0, 0), e1.clear(e1.COLOR_BUFFER_BIT)), t.dirtySubmitFrameBindings || t.realBindFramebuffer.call(e1, e1.FRAMEBUFFER, t.lastBoundFramebuffer), t.cullFace && t.realEnable.call(e1, e1.CULL_FACE), t.depthTest && t.realEnable.call(e1, e1.DEPTH_TEST), t.blend && t.realEnable.call(e1, e1.BLEND), t.scissorTest && t.realEnable.call(e1, e1.SCISSOR_TEST), t.stencilTest && t.realEnable.call(e1, e1.STENCIL_TEST), t.realColorMask.apply(e1, t.colorMask), t.realViewport.apply(e1, t.viewport), !t.ctxAttribs.alpha && t.ctxAttribs.preserveDrawingBuffer || t.realClearColor.apply(e1, t.clearColor), t.instanceExt && (0 != n && t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position, n), 0 != i && t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord, i)); + }), u()) { + var i = e1.canvas; + i.width == t.bufferWidth && i.height == t.bufferHeight || (t.bufferWidth = i.width, t.bufferHeight = i.height, t.onResize()); + } + }, z.prototype.updateDeviceInfo = function(e1) { + var t = this.gl, n = this, i = [ + t.ARRAY_BUFFER_BINDING, + t.ELEMENT_ARRAY_BUFFER_BINDING + ]; + k(t, i, function(t) { + var i = n.computeMeshVertices_(n.meshWidth, n.meshHeight, e1); + if (t.bindBuffer(t.ARRAY_BUFFER, n.vertexBuffer), t.bufferData(t.ARRAY_BUFFER, i, t.STATIC_DRAW), !n.indexCount) { + var r = n.computeMeshIndices_(n.meshWidth, n.meshHeight); + t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, n.indexBuffer), t.bufferData(t.ELEMENT_ARRAY_BUFFER, r, t.STATIC_DRAW), n.indexCount = r.length; + } + }); + }, z.prototype.computeMeshVertices_ = function(e1, t, n) { + for(var i = new Float32Array(2 * e1 * t * 5), r = n.getLeftEyeVisibleTanAngles(), s = n.getLeftEyeNoLensTanAngles(), o = n.getLeftEyeVisibleScreenRect(s), a = 0, l = 0; l < 2; l++){ + for(var c = 0; c < t; c++)for(var u = 0; u < e1; u++, a++){ + var d = u / (e1 - 1), p = c / (t - 1), A = d, f = p, m = h(r[0], r[2], d), g = h(r[3], r[1], p), v = Math.sqrt(m * m + g * g), y = n.distortion.distortInverse(v), E = g * y / v; + d = (m * y / v - s[0]) / (s[2] - s[0]), p = (E - s[3]) / (s[1] - s[3]), d = 2 * (o.x + d * o.width - .5), p = 2 * (o.y + p * o.height - .5), i[5 * a + 0] = d, i[5 * a + 1] = p, i[5 * a + 2] = A, i[5 * a + 3] = f, i[5 * a + 4] = l; + } + var b = r[2] - r[0]; + r[0] = -(b + r[0]), r[2] = b - r[2], b = s[2] - s[0], s[0] = -(b + s[0]), s[2] = b - s[2], o.x = 1 - (o.x + o.width); + } + return i; + }, z.prototype.computeMeshIndices_ = function(e1, t) { + for(var n = new Uint16Array(2 * (e1 - 1) * (t - 1) * 6), i = e1 / 2, r = t / 2, s = 0, o = 0, a = 0; a < 2; a++)for(var l = 0; l < t; l++)for(var c = 0; c < e1; c++, s++)0 != c && 0 != l && (c <= i == l <= r ? (n[o++] = s, n[o++] = s - e1 - 1, n[o++] = s - e1, n[o++] = s - e1 - 1, n[o++] = s, n[o++] = s - 1) : (n[o++] = s - 1, n[o++] = s - e1, n[o++] = s, n[o++] = s - e1, n[o++] = s - 1, n[o++] = s - e1 - 1)); + return n; + }, z.prototype.getOwnPropertyDescriptor_ = function(e1, t) { + var n = Object.getOwnPropertyDescriptor(e1, t); + return void 0 !== n.get && void 0 !== n.set || (n.configurable = !0, n.enumerable = !0, n.get = function() { + return this.getAttribute(t); + }, n.set = function(e1) { + this.setAttribute(t, e1); + }), n; + }; + var H = [ + "attribute vec2 position;", + "uniform mat4 projectionMat;", + "void main() {", + " gl_Position = projectionMat * vec4( position, -1.0, 1.0 );", + "}" + ].join("\n"), V = [ + "precision mediump float;", + "uniform vec4 color;", + "void main() {", + " gl_FragColor = color;", + "}" + ].join("\n"), W = Math.PI / 180, j = 60, q = 12, X = 20, Y = 1, J = .75, K = .3125, Z = 4, $ = 28, ee = 1.5; + function te(e1) { + this.gl = e1, this.attribs = { + position: 0 + }, this.program = M(e1, H, V, this.attribs), this.uniforms = S(e1, this.program), this.vertexBuffer = e1.createBuffer(), this.gearOffset = 0, this.gearVertexCount = 0, this.arrowOffset = 0, this.arrowVertexCount = 0, this.projMat = new Float32Array(16), this.listener = null, this.onResize(); + } + function ne(e1) { + this.coefficients = e1; + } + te.prototype.destroy = function() { + var e1 = this.gl; + this.listener && e1.canvas.removeEventListener("click", this.listener, !1), e1.deleteProgram(this.program), e1.deleteBuffer(this.vertexBuffer); + }, te.prototype.listen = function(e1, t) { + var n = this.gl.canvas; + this.listener = function(i) { + var r = n.clientWidth / 2, s = $ * ee; + i.clientX > r - s && i.clientX < r + s && i.clientY > n.clientHeight - s ? e1(i) : i.clientX < s && i.clientY < s && t(i); + }, n.addEventListener("click", this.listener, !1); + }, te.prototype.onResize = function() { + var e1 = this.gl, t = this, n = [ + e1.ARRAY_BUFFER_BINDING + ]; + k(e1, n, function(e1) { + var n = [], i = e1.drawingBufferWidth / 2, r = Math.max(screen.width, screen.height) * window.devicePixelRatio, s = e1.drawingBufferWidth / r * window.devicePixelRatio, o = Z * s / 2, a = $ * ee * s, l = $ * s / 2, c = ($ * ee - $) * s; + function h(e1, t) { + var r = (90 - e1) * W, s = Math.cos(r), o = Math.sin(r); + n.push(K * s * l + i, K * o * l + l), n.push(t * s * l + i, t * o * l + l); + } + n.push(i - o, a), n.push(i - o, e1.drawingBufferHeight), n.push(i + o, a), n.push(i + o, e1.drawingBufferHeight), t.gearOffset = n.length / 2; + for(var u = 0; u <= 6; u++){ + var d = u * j; + h(d, Y), h(d + q, Y), h(d + X, J), h(d + (j - X), J), h(d + (j - q), Y); + } + function p(t, i) { + n.push(c + t, e1.drawingBufferHeight - c - i); + } + t.gearVertexCount = n.length / 2 - t.gearOffset, t.arrowOffset = n.length / 2; + var A = o / Math.sin(45 * W); + p(0, l), p(l, 0), p(l + A, A), p(A, l + A), p(A, l - A), p(0, l), p(l, 2 * l), p(l + A, 2 * l - A), p(A, l - A), p(0, l), p(A, l - o), p($ * s, l - o), p(A, l + o), p($ * s, l + o), t.arrowVertexCount = n.length / 2 - t.arrowOffset, e1.bindBuffer(e1.ARRAY_BUFFER, t.vertexBuffer), e1.bufferData(e1.ARRAY_BUFFER, new Float32Array(n), e1.STATIC_DRAW); + }); + }, te.prototype.render = function() { + var e1 = this.gl, t = this, n = [ + e1.CULL_FACE, + e1.DEPTH_TEST, + e1.BLEND, + e1.SCISSOR_TEST, + e1.STENCIL_TEST, + e1.COLOR_WRITEMASK, + e1.VIEWPORT, + e1.CURRENT_PROGRAM, + e1.ARRAY_BUFFER_BINDING + ]; + k(e1, n, function(e1) { + e1.disable(e1.CULL_FACE), e1.disable(e1.DEPTH_TEST), e1.disable(e1.BLEND), e1.disable(e1.SCISSOR_TEST), e1.disable(e1.STENCIL_TEST), e1.colorMask(!0, !0, !0, !0), e1.viewport(0, 0, e1.drawingBufferWidth, e1.drawingBufferHeight), t.renderNoState(); + }); + }, te.prototype.renderNoState = function() { + var e1 = this.gl; + e1.useProgram(this.program), e1.bindBuffer(e1.ARRAY_BUFFER, this.vertexBuffer), e1.enableVertexAttribArray(this.attribs.position), e1.vertexAttribPointer(this.attribs.position, 2, e1.FLOAT, !1, 8, 0), e1.uniform4f(this.uniforms.color, 1, 1, 1, 1), I(this.projMat, 0, e1.drawingBufferWidth, 0, e1.drawingBufferHeight, .1, 1024), e1.uniformMatrix4fv(this.uniforms.projectionMat, !1, this.projMat), e1.drawArrays(e1.TRIANGLE_STRIP, 0, 4), e1.drawArrays(e1.TRIANGLE_STRIP, this.gearOffset, this.gearVertexCount), e1.drawArrays(e1.TRIANGLE_STRIP, this.arrowOffset, this.arrowVertexCount); + }, ne.prototype.distortInverse = function(e1) { + for(var t = 0, n = 1, i = e1 - this.distort(t); Math.abs(n - t) > 1e-4;){ + var r = e1 - this.distort(n), s = n - r * ((n - t) / (r - i)); + t = n, n = s, i = r; + } + return n; + }, ne.prototype.distort = function(e1) { + for(var t = e1 * e1, n = 0, i = 0; i < this.coefficients.length; i++)n = t * (n + this.coefficients[i]); + return (n + 1) * e1; + }; + var ie = Math.PI / 180, re = 180 / Math.PI, se = function(e1, t, n) { + this.x = e1 || 0, this.y = t || 0, this.z = n || 0; + }; + se.prototype = { + constructor: se, + set: function(e1, t, n) { + return this.x = e1, this.y = t, this.z = n, this; + }, + copy: function(e1) { + return this.x = e1.x, this.y = e1.y, this.z = e1.z, this; + }, + length: function() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + }, + normalize: function() { + var e1 = this.length(); + if (0 !== e1) { + var t = 1 / e1; + this.multiplyScalar(t); + } else this.x = 0, this.y = 0, this.z = 0; + return this; + }, + multiplyScalar: function(e1) { + this.x *= e1, this.y *= e1, this.z *= e1; + }, + applyQuaternion: function(e1) { + var t = this.x, n = this.y, i = this.z, r = e1.x, s = e1.y, o = e1.z, a = e1.w, l = a * t + s * i - o * n, c = a * n + o * t - r * i, h = a * i + r * n - s * t, u = -r * t - s * n - o * i; + return this.x = l * a + u * -r + c * -o - h * -s, this.y = c * a + u * -s + h * -r - l * -o, this.z = h * a + u * -o + l * -s - c * -r, this; + }, + dot: function(e1) { + return this.x * e1.x + this.y * e1.y + this.z * e1.z; + }, + crossVectors: function(e1, t) { + var n = e1.x, i = e1.y, r = e1.z, s = t.x, o = t.y, a = t.z; + return this.x = i * a - r * o, this.y = r * s - n * a, this.z = n * o - i * s, this; + } + }; + var oe, ae, le, ce = function(e1, t, n, i) { + this.x = e1 || 0, this.y = t || 0, this.z = n || 0, this.w = void 0 !== i ? i : 1; + }; + function he(e1) { + this.width = e1.width || b(), this.height = e1.height || x(), this.widthMeters = e1.widthMeters, this.heightMeters = e1.heightMeters, this.bevelMeters = e1.bevelMeters; + } + ce.prototype = { + constructor: ce, + set: function(e1, t, n, i) { + return this.x = e1, this.y = t, this.z = n, this.w = i, this; + }, + copy: function(e1) { + return this.x = e1.x, this.y = e1.y, this.z = e1.z, this.w = e1.w, this; + }, + setFromEulerXYZ: function(e1, t, n) { + var i = Math.cos(e1 / 2), r = Math.cos(t / 2), s = Math.cos(n / 2), o = Math.sin(e1 / 2), a = Math.sin(t / 2), l = Math.sin(n / 2); + return this.x = o * r * s + i * a * l, this.y = i * a * s - o * r * l, this.z = i * r * l + o * a * s, this.w = i * r * s - o * a * l, this; + }, + setFromEulerYXZ: function(e1, t, n) { + var i = Math.cos(e1 / 2), r = Math.cos(t / 2), s = Math.cos(n / 2), o = Math.sin(e1 / 2), a = Math.sin(t / 2), l = Math.sin(n / 2); + return this.x = o * r * s + i * a * l, this.y = i * a * s - o * r * l, this.z = i * r * l - o * a * s, this.w = i * r * s + o * a * l, this; + }, + setFromAxisAngle: function(e1, t) { + var n = t / 2, i = Math.sin(n); + return this.x = e1.x * i, this.y = e1.y * i, this.z = e1.z * i, this.w = Math.cos(n), this; + }, + multiply: function(e1) { + return this.multiplyQuaternions(this, e1); + }, + multiplyQuaternions: function(e1, t) { + var n = e1.x, i = e1.y, r = e1.z, s = e1.w, o = t.x, a = t.y, l = t.z, c = t.w; + return this.x = n * c + s * o + i * l - r * a, this.y = i * c + s * a + r * o - n * l, this.z = r * c + s * l + n * a - i * o, this.w = s * c - n * o - i * a - r * l, this; + }, + inverse: function() { + return this.x *= -1, this.y *= -1, this.z *= -1, this.normalize(), this; + }, + normalize: function() { + var e1 = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + return 0 === e1 ? (this.x = 0, this.y = 0, this.z = 0, this.w = 1) : (e1 = 1 / e1, this.x = this.x * e1, this.y = this.y * e1, this.z = this.z * e1, this.w = this.w * e1), this; + }, + slerp: function(e1, t) { + if (0 === t) return this; + if (1 === t) return this.copy(e1); + var n = this.x, i = this.y, r = this.z, s = this.w, o = s * e1.w + n * e1.x + i * e1.y + r * e1.z; + if (o < 0 ? (this.w = -e1.w, this.x = -e1.x, this.y = -e1.y, this.z = -e1.z, o = -o) : this.copy(e1), o >= 1) return this.w = s, this.x = n, this.y = i, this.z = r, this; + var a = Math.acos(o), l = Math.sqrt(1 - o * o); + if (Math.abs(l) < .001) return this.w = .5 * (s + this.w), this.x = .5 * (n + this.x), this.y = .5 * (i + this.y), this.z = .5 * (r + this.z), this; + var c = Math.sin((1 - t) * a) / l, h = Math.sin(t * a) / l; + return this.w = s * c + this.w * h, this.x = n * c + this.x * h, this.y = i * c + this.y * h, this.z = r * c + this.z * h, this; + }, + setFromUnitVectors: (le = 1e-6, function(e1, t) { + return void 0 === oe && (oe = new se), (ae = e1.dot(t) + 1) < le ? (ae = 0, Math.abs(e1.x) > Math.abs(e1.z) ? oe.set(-e1.y, e1.x, 0) : oe.set(0, -e1.z, e1.y)) : oe.crossVectors(e1, t), this.x = oe.x, this.y = oe.y, this.z = oe.z, this.w = ae, this.normalize(), this; + }) + }; + var ue = new he({ + widthMeters: .11, + heightMeters: .062, + bevelMeters: .004 + }), de = new he({ + widthMeters: .1038, + heightMeters: .0584, + bevelMeters: .004 + }), pe = { + CardboardV1: new fe({ + id: "CardboardV1", + label: "Cardboard I/O 2014", + fov: 40, + interLensDistance: .06, + baselineLensDistance: .035, + screenLensDistance: .042, + distortionCoefficients: [ + .441, + .156 + ], + inverseCoefficients: [ + -0.4410035, + .42756155, + -0.4804439, + .5460139, + -0.58821183, + .5733938, + -0.48303202, + .33299083, + -0.17573841, + .0651772, + -0.01488963, + .001559834 + ] + }), + CardboardV2: new fe({ + id: "CardboardV2", + label: "Cardboard I/O 2015", + fov: 60, + interLensDistance: .064, + baselineLensDistance: .035, + screenLensDistance: .039, + distortionCoefficients: [ + .34, + .55 + ], + inverseCoefficients: [ + -0.33836704, + -0.18162185, + .862655, + -1.2462051, + 1.0560602, + -0.58208317, + .21609078, + -0.05444823, + .009177956, + -0.0009904169, + 6183535e-11, + -0.0000016981803 + ] + }) + }; + function Ae(e1, t) { + this.viewer = pe.CardboardV2, this.updateDeviceParams(e1), this.distortion = new ne(this.viewer.distortionCoefficients); + for(var n = 0; n < t.length; n++){ + var i = t[n]; + pe[i.id] = new fe(i); + } + } + function fe(e1) { + this.id = e1.id, this.label = e1.label, this.fov = e1.fov, this.interLensDistance = e1.interLensDistance, this.baselineLensDistance = e1.baselineLensDistance, this.screenLensDistance = e1.screenLensDistance, this.distortionCoefficients = e1.distortionCoefficients, this.inverseCoefficients = e1.inverseCoefficients; + } + Ae.prototype.updateDeviceParams = function(e1) { + this.device = this.determineDevice_(e1) || this.device; + }, Ae.prototype.getDevice = function() { + return this.device; + }, Ae.prototype.setViewer = function(e1) { + this.viewer = e1, this.distortion = new ne(this.viewer.distortionCoefficients); + }, Ae.prototype.determineDevice_ = function(e1) { + if (!e1) return u() ? (console.warn("Using fallback iOS device measurements."), de) : (console.warn("Using fallback Android device measurements."), ue); + var t = .0254, n = t / e1.xdpi, i = t / e1.ydpi; + return new he({ + widthMeters: n * b(), + heightMeters: i * x(), + bevelMeters: .001 * e1.bevelMm + }); + }, Ae.prototype.getDistortedFieldOfViewLeftEye = function() { + var e1 = this.viewer, t = this.device, n = this.distortion, i = e1.screenLensDistance, r = (t.widthMeters - e1.interLensDistance) / 2, s = e1.interLensDistance / 2, o = e1.baselineLensDistance - t.bevelMeters, a = t.heightMeters - o, l = re * Math.atan(n.distort(r / i)), c = re * Math.atan(n.distort(s / i)), h = re * Math.atan(n.distort(o / i)), u = re * Math.atan(n.distort(a / i)); + return { + leftDegrees: Math.min(l, e1.fov), + rightDegrees: Math.min(c, e1.fov), + downDegrees: Math.min(h, e1.fov), + upDegrees: Math.min(u, e1.fov) + }; + }, Ae.prototype.getLeftEyeVisibleTanAngles = function() { + var e1 = this.viewer, t = this.device, n = this.distortion, i = Math.tan(-ie * e1.fov), r = Math.tan(ie * e1.fov), s = Math.tan(ie * e1.fov), o = Math.tan(-ie * e1.fov), a = t.widthMeters / 4, l = t.heightMeters / 2, c = e1.baselineLensDistance - t.bevelMeters - l, h = e1.interLensDistance / 2 - a, u = -c, d = e1.screenLensDistance, p = n.distort((h - a) / d), A = n.distort((u + l) / d), f = n.distort((h + a) / d), m = n.distort((u - l) / d), g = new Float32Array(4); + return g[0] = Math.max(i, p), g[1] = Math.min(r, A), g[2] = Math.min(s, f), g[3] = Math.max(o, m), g; + }, Ae.prototype.getLeftEyeNoLensTanAngles = function() { + var e1 = this.viewer, t = this.device, n = this.distortion, i = new Float32Array(4), r = n.distortInverse(Math.tan(-ie * e1.fov)), s = n.distortInverse(Math.tan(ie * e1.fov)), o = n.distortInverse(Math.tan(ie * e1.fov)), a = n.distortInverse(Math.tan(-ie * e1.fov)), l = t.widthMeters / 4, c = t.heightMeters / 2, h = e1.baselineLensDistance - t.bevelMeters - c, u = e1.interLensDistance / 2 - l, d = -h, p = e1.screenLensDistance, A = (u - l) / p, f = (d + c) / p, m = (u + l) / p, g = (d - c) / p; + return i[0] = Math.max(r, A), i[1] = Math.min(s, f), i[2] = Math.min(o, m), i[3] = Math.max(a, g), i; + }, Ae.prototype.getLeftEyeVisibleScreenRect = function(e1) { + var t = this.viewer, n = this.device, i = t.screenLensDistance, r = (n.widthMeters - t.interLensDistance) / 2, s = t.baselineLensDistance - n.bevelMeters, o = (e1[0] * i + r) / n.widthMeters, a = (e1[1] * i + s) / n.heightMeters, l = (e1[2] * i + r) / n.widthMeters, c = (e1[3] * i + s) / n.heightMeters; + return { + x: o, + y: c, + width: l - o, + height: a - c + }; + }, Ae.prototype.getFieldOfViewLeftEye = function(e1) { + return e1 ? this.getUndistortedFieldOfViewLeftEye() : this.getDistortedFieldOfViewLeftEye(); + }, Ae.prototype.getFieldOfViewRightEye = function(e1) { + var t = this.getFieldOfViewLeftEye(e1); + return { + leftDegrees: t.rightDegrees, + rightDegrees: t.leftDegrees, + upDegrees: t.upDegrees, + downDegrees: t.downDegrees + }; + }, Ae.prototype.getUndistortedFieldOfViewLeftEye = function() { + var e1 = this.getUndistortedParams_(); + return { + leftDegrees: re * Math.atan(e1.outerDist), + rightDegrees: re * Math.atan(e1.innerDist), + downDegrees: re * Math.atan(e1.bottomDist), + upDegrees: re * Math.atan(e1.topDist) + }; + }, Ae.prototype.getUndistortedViewportLeftEye = function() { + var e1 = this.getUndistortedParams_(), t = this.viewer, n = this.device, i = t.screenLensDistance, r = n.widthMeters / i, s = n.heightMeters / i, o = n.width / r, a = n.height / s, l = Math.round((e1.eyePosX - e1.outerDist) * o), c = Math.round((e1.eyePosY - e1.bottomDist) * a); + return { + x: l, + y: c, + width: Math.round((e1.eyePosX + e1.innerDist) * o) - l, + height: Math.round((e1.eyePosY + e1.topDist) * a) - c + }; + }, Ae.prototype.getUndistortedParams_ = function() { + var e1 = this.viewer, t = this.device, n = this.distortion, i = e1.screenLensDistance, r = e1.interLensDistance / 2 / i, s = t.widthMeters / i, o = t.heightMeters / i, a = s / 2 - r, l = (e1.baselineLensDistance - t.bevelMeters) / i, c = e1.fov, h = n.distortInverse(Math.tan(ie * c)), u = Math.min(a, h), d = Math.min(r, h), p = Math.min(l, h); + return { + outerDist: u, + innerDist: d, + topDist: Math.min(o - l, h), + bottomDist: p, + eyePosX: a, + eyePosY: l + }; + }, Ae.Viewers = pe; + var me = { + format: 1, + last_updated: "2019-11-09T17:36:14Z", + devices: [ + { + type: "android", + rules: [ + { + mdmh: "asus/*/Nexus 7/*" + }, + { + ua: "Nexus 7" + } + ], + dpi: [ + 320.8, + 323 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "asus/*/ASUS_X00PD/*" + }, + { + ua: "ASUS_X00PD" + } + ], + dpi: 245, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "asus/*/ASUS_X008D/*" + }, + { + ua: "ASUS_X008D" + } + ], + dpi: 282, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "asus/*/ASUS_Z00AD/*" + }, + { + ua: "ASUS_Z00AD" + } + ], + dpi: [ + 403, + 404.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Google/*/Pixel 2 XL/*" + }, + { + ua: "Pixel 2 XL" + } + ], + dpi: 537.9, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Google/*/Pixel 3 XL/*" + }, + { + ua: "Pixel 3 XL" + } + ], + dpi: [ + 558.5, + 553.8 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Google/*/Pixel XL/*" + }, + { + ua: "Pixel XL" + } + ], + dpi: [ + 537.9, + 533 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Google/*/Pixel 3/*" + }, + { + ua: "Pixel 3" + } + ], + dpi: 442.4, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Google/*/Pixel 2/*" + }, + { + ua: "Pixel 2" + } + ], + dpi: 441, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "Google/*/Pixel/*" + }, + { + ua: "Pixel" + } + ], + dpi: [ + 432.6, + 436.7 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "HTC/*/HTC6435LVW/*" + }, + { + ua: "HTC6435LVW" + } + ], + dpi: [ + 449.7, + 443.3 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "HTC/*/HTC One XL/*" + }, + { + ua: "HTC One XL" + } + ], + dpi: [ + 315.3, + 314.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "htc/*/Nexus 9/*" + }, + { + ua: "Nexus 9" + } + ], + dpi: 289, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "HTC/*/HTC One M9/*" + }, + { + ua: "HTC One M9" + } + ], + dpi: [ + 442.5, + 443.3 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "HTC/*/HTC One_M8/*" + }, + { + ua: "HTC One_M8" + } + ], + dpi: [ + 449.7, + 447.4 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "HTC/*/HTC One/*" + }, + { + ua: "HTC One" + } + ], + dpi: 472.8, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Huawei/*/Nexus 6P/*" + }, + { + ua: "Nexus 6P" + } + ], + dpi: [ + 515.1, + 518 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Huawei/*/BLN-L24/*" + }, + { + ua: "HONORBLN-L24" + } + ], + dpi: 480, + bw: 4, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "Huawei/*/BKL-L09/*" + }, + { + ua: "BKL-L09" + } + ], + dpi: 403, + bw: 3.47, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "LENOVO/*/Lenovo PB2-690Y/*" + }, + { + ua: "Lenovo PB2-690Y" + } + ], + dpi: [ + 457.2, + 454.713 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/Nexus 5X/*" + }, + { + ua: "Nexus 5X" + } + ], + dpi: [ + 422, + 419.9 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/LGMS345/*" + }, + { + ua: "LGMS345" + } + ], + dpi: [ + 221.7, + 219.1 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/LG-D800/*" + }, + { + ua: "LG-D800" + } + ], + dpi: [ + 422, + 424.1 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/LG-D850/*" + }, + { + ua: "LG-D850" + } + ], + dpi: [ + 537.9, + 541.9 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/VS985 4G/*" + }, + { + ua: "VS985 4G" + } + ], + dpi: [ + 537.9, + 535.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/Nexus 5/*" + }, + { + ua: "Nexus 5 B" + } + ], + dpi: [ + 442.4, + 444.8 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/Nexus 4/*" + }, + { + ua: "Nexus 4" + } + ], + dpi: [ + 319.8, + 318.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/LG-P769/*" + }, + { + ua: "LG-P769" + } + ], + dpi: [ + 240.6, + 247.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/LGMS323/*" + }, + { + ua: "LGMS323" + } + ], + dpi: [ + 206.6, + 204.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "LGE/*/LGLS996/*" + }, + { + ua: "LGLS996" + } + ], + dpi: [ + 403.4, + 401.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Micromax/*/4560MMX/*" + }, + { + ua: "4560MMX" + } + ], + dpi: [ + 240, + 219.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Micromax/*/A250/*" + }, + { + ua: "Micromax A250" + } + ], + dpi: [ + 480, + 446.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Micromax/*/Micromax AQ4501/*" + }, + { + ua: "Micromax AQ4501" + } + ], + dpi: 240, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/G5/*" + }, + { + ua: "Moto G (5) Plus" + } + ], + dpi: [ + 403.4, + 403 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/DROID RAZR/*" + }, + { + ua: "DROID RAZR" + } + ], + dpi: [ + 368.1, + 256.7 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT830C/*" + }, + { + ua: "XT830C" + } + ], + dpi: [ + 254, + 255.9 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1021/*" + }, + { + ua: "XT1021" + } + ], + dpi: [ + 254, + 256.7 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1023/*" + }, + { + ua: "XT1023" + } + ], + dpi: [ + 254, + 256.7 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1028/*" + }, + { + ua: "XT1028" + } + ], + dpi: [ + 326.6, + 327.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1034/*" + }, + { + ua: "XT1034" + } + ], + dpi: [ + 326.6, + 328.4 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1053/*" + }, + { + ua: "XT1053" + } + ], + dpi: [ + 315.3, + 316.1 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1562/*" + }, + { + ua: "XT1562" + } + ], + dpi: [ + 403.4, + 402.7 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/Nexus 6/*" + }, + { + ua: "Nexus 6 B" + } + ], + dpi: [ + 494.3, + 489.7 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1063/*" + }, + { + ua: "XT1063" + } + ], + dpi: [ + 295, + 296.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1064/*" + }, + { + ua: "XT1064" + } + ], + dpi: [ + 295, + 295.6 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1092/*" + }, + { + ua: "XT1092" + } + ], + dpi: [ + 422, + 424.1 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/XT1095/*" + }, + { + ua: "XT1095" + } + ], + dpi: [ + 422, + 423.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "motorola/*/G4/*" + }, + { + ua: "Moto G (4)" + } + ], + dpi: 401, + bw: 4, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/A0001/*" + }, + { + ua: "A0001" + } + ], + dpi: [ + 403.4, + 401 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONE E1001/*" + }, + { + ua: "ONE E1001" + } + ], + dpi: [ + 442.4, + 441.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONE E1003/*" + }, + { + ua: "ONE E1003" + } + ], + dpi: [ + 442.4, + 441.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONE E1005/*" + }, + { + ua: "ONE E1005" + } + ], + dpi: [ + 442.4, + 441.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONE A2001/*" + }, + { + ua: "ONE A2001" + } + ], + dpi: [ + 391.9, + 405.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONE A2003/*" + }, + { + ua: "ONE A2003" + } + ], + dpi: [ + 391.9, + 405.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONE A2005/*" + }, + { + ua: "ONE A2005" + } + ], + dpi: [ + 391.9, + 405.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A3000/*" + }, + { + ua: "ONEPLUS A3000" + } + ], + dpi: 401, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A3003/*" + }, + { + ua: "ONEPLUS A3003" + } + ], + dpi: 401, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A3010/*" + }, + { + ua: "ONEPLUS A3010" + } + ], + dpi: 401, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A5000/*" + }, + { + ua: "ONEPLUS A5000 " + } + ], + dpi: [ + 403.411, + 399.737 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONE A5010/*" + }, + { + ua: "ONEPLUS A5010" + } + ], + dpi: [ + 403, + 400 + ], + bw: 2, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A6000/*" + }, + { + ua: "ONEPLUS A6000" + } + ], + dpi: 401, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A6003/*" + }, + { + ua: "ONEPLUS A6003" + } + ], + dpi: 401, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A6010/*" + }, + { + ua: "ONEPLUS A6010" + } + ], + dpi: 401, + bw: 2, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "OnePlus/*/ONEPLUS A6013/*" + }, + { + ua: "ONEPLUS A6013" + } + ], + dpi: 401, + bw: 2, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "OPPO/*/X909/*" + }, + { + ua: "X909" + } + ], + dpi: [ + 442.4, + 444.1 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-I9082/*" + }, + { + ua: "GT-I9082" + } + ], + dpi: [ + 184.7, + 185.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G360P/*" + }, + { + ua: "SM-G360P" + } + ], + dpi: [ + 196.7, + 205.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/Nexus S/*" + }, + { + ua: "Nexus S" + } + ], + dpi: [ + 234.5, + 229.8 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-I9300/*" + }, + { + ua: "GT-I9300" + } + ], + dpi: [ + 304.8, + 303.9 + ], + bw: 5, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-T230NU/*" + }, + { + ua: "SM-T230NU" + } + ], + dpi: 216, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SGH-T399/*" + }, + { + ua: "SGH-T399" + } + ], + dpi: [ + 217.7, + 231.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SGH-M919/*" + }, + { + ua: "SGH-M919" + } + ], + dpi: [ + 440.8, + 437.7 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-N9005/*" + }, + { + ua: "SM-N9005" + } + ], + dpi: [ + 386.4, + 387 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SAMSUNG-SM-N900A/*" + }, + { + ua: "SAMSUNG-SM-N900A" + } + ], + dpi: [ + 386.4, + 387.7 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-I9500/*" + }, + { + ua: "GT-I9500" + } + ], + dpi: [ + 442.5, + 443.3 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-I9505/*" + }, + { + ua: "GT-I9505" + } + ], + dpi: 439.4, + bw: 4, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G900F/*" + }, + { + ua: "SM-G900F" + } + ], + dpi: [ + 415.6, + 431.6 + ], + bw: 5, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G900M/*" + }, + { + ua: "SM-G900M" + } + ], + dpi: [ + 415.6, + 431.6 + ], + bw: 5, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G800F/*" + }, + { + ua: "SM-G800F" + } + ], + dpi: 326.8, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G906S/*" + }, + { + ua: "SM-G906S" + } + ], + dpi: [ + 562.7, + 572.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-I9300/*" + }, + { + ua: "GT-I9300" + } + ], + dpi: [ + 306.7, + 304.8 + ], + bw: 5, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-T535/*" + }, + { + ua: "SM-T535" + } + ], + dpi: [ + 142.6, + 136.4 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-N920C/*" + }, + { + ua: "SM-N920C" + } + ], + dpi: [ + 515.1, + 518.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-N920P/*" + }, + { + ua: "SM-N920P" + } + ], + dpi: [ + 386.3655, + 390.144 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-N920W8/*" + }, + { + ua: "SM-N920W8" + } + ], + dpi: [ + 515.1, + 518.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-I9300I/*" + }, + { + ua: "GT-I9300I" + } + ], + dpi: [ + 304.8, + 305.8 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-I9195/*" + }, + { + ua: "GT-I9195" + } + ], + dpi: [ + 249.4, + 256.7 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SPH-L520/*" + }, + { + ua: "SPH-L520" + } + ], + dpi: [ + 249.4, + 255.9 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SAMSUNG-SGH-I717/*" + }, + { + ua: "SAMSUNG-SGH-I717" + } + ], + dpi: 285.8, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SPH-D710/*" + }, + { + ua: "SPH-D710" + } + ], + dpi: [ + 217.7, + 204.2 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/GT-N7100/*" + }, + { + ua: "GT-N7100" + } + ], + dpi: 265.1, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SCH-I605/*" + }, + { + ua: "SCH-I605" + } + ], + dpi: 265.1, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/Galaxy Nexus/*" + }, + { + ua: "Galaxy Nexus" + } + ], + dpi: [ + 315.3, + 314.2 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-N910H/*" + }, + { + ua: "SM-N910H" + } + ], + dpi: [ + 515.1, + 518 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-N910C/*" + }, + { + ua: "SM-N910C" + } + ], + dpi: [ + 515.2, + 520.2 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G130M/*" + }, + { + ua: "SM-G130M" + } + ], + dpi: [ + 165.9, + 164.8 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G928I/*" + }, + { + ua: "SM-G928I" + } + ], + dpi: [ + 515.1, + 518.4 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G920F/*" + }, + { + ua: "SM-G920F" + } + ], + dpi: 580.6, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G920P/*" + }, + { + ua: "SM-G920P" + } + ], + dpi: [ + 522.5, + 577 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G925F/*" + }, + { + ua: "SM-G925F" + } + ], + dpi: 580.6, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G925V/*" + }, + { + ua: "SM-G925V" + } + ], + dpi: [ + 522.5, + 576.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G930F/*" + }, + { + ua: "SM-G930F" + } + ], + dpi: 576.6, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G935F/*" + }, + { + ua: "SM-G935F" + } + ], + dpi: 533, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G950F/*" + }, + { + ua: "SM-G950F" + } + ], + dpi: [ + 562.707, + 565.293 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G955U/*" + }, + { + ua: "SM-G955U" + } + ], + dpi: [ + 522.514, + 525.762 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G955F/*" + }, + { + ua: "SM-G955F" + } + ], + dpi: [ + 522.514, + 525.762 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G960F/*" + }, + { + ua: "SM-G960F" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G9600/*" + }, + { + ua: "SM-G9600" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G960T/*" + }, + { + ua: "SM-G960T" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G960N/*" + }, + { + ua: "SM-G960N" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G960U/*" + }, + { + ua: "SM-G960U" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G9608/*" + }, + { + ua: "SM-G9608" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G960FD/*" + }, + { + ua: "SM-G960FD" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G960W/*" + }, + { + ua: "SM-G960W" + } + ], + dpi: [ + 569.575, + 571.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G965F/*" + }, + { + ua: "SM-G965F" + } + ], + dpi: 529, + bw: 2, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Sony/*/C6903/*" + }, + { + ua: "C6903" + } + ], + dpi: [ + 442.5, + 443.3 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "Sony/*/D6653/*" + }, + { + ua: "D6653" + } + ], + dpi: [ + 428.6, + 427.6 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Sony/*/E6653/*" + }, + { + ua: "E6653" + } + ], + dpi: [ + 428.6, + 425.7 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Sony/*/E6853/*" + }, + { + ua: "E6853" + } + ], + dpi: [ + 403.4, + 401.9 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Sony/*/SGP321/*" + }, + { + ua: "SGP321" + } + ], + dpi: [ + 224.7, + 224.1 + ], + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "TCT/*/ALCATEL ONE TOUCH Fierce/*" + }, + { + ua: "ALCATEL ONE TOUCH Fierce" + } + ], + dpi: [ + 240, + 247.5 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "THL/*/thl 5000/*" + }, + { + ua: "thl 5000" + } + ], + dpi: [ + 480, + 443.3 + ], + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Fly/*/IQ4412/*" + }, + { + ua: "IQ4412" + } + ], + dpi: 307.9, + bw: 3, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "ZTE/*/ZTE Blade L2/*" + }, + { + ua: "ZTE Blade L2" + } + ], + dpi: 240, + bw: 3, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "BENEVE/*/VR518/*" + }, + { + ua: "VR518" + } + ], + dpi: 480, + bw: 3, + ac: 500 + }, + { + type: "ios", + rules: [ + { + res: [ + 640, + 960 + ] + } + ], + dpi: [ + 325.1, + 328.4 + ], + bw: 4, + ac: 1e3 + }, + { + type: "ios", + rules: [ + { + res: [ + 640, + 1136 + ] + } + ], + dpi: [ + 317.1, + 320.2 + ], + bw: 3, + ac: 1e3 + }, + { + type: "ios", + rules: [ + { + res: [ + 750, + 1334 + ] + } + ], + dpi: 326.4, + bw: 4, + ac: 1e3 + }, + { + type: "ios", + rules: [ + { + res: [ + 1242, + 2208 + ] + } + ], + dpi: [ + 453.6, + 458.4 + ], + bw: 4, + ac: 1e3 + }, + { + type: "ios", + rules: [ + { + res: [ + 1125, + 2001 + ] + } + ], + dpi: [ + 410.9, + 415.4 + ], + bw: 4, + ac: 1e3 + }, + { + type: "ios", + rules: [ + { + res: [ + 1125, + 2436 + ] + } + ], + dpi: 458, + bw: 4, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "Huawei/*/EML-L29/*" + }, + { + ua: "EML-L29" + } + ], + dpi: 428, + bw: 3.45, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "Nokia/*/Nokia 7.1/*" + }, + { + ua: "Nokia 7.1" + } + ], + dpi: [ + 432, + 431.9 + ], + bw: 3, + ac: 500 + }, + { + type: "ios", + rules: [ + { + res: [ + 1242, + 2688 + ] + } + ], + dpi: 458, + bw: 4, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G570M/*" + }, + { + ua: "SM-G570M" + } + ], + dpi: 320, + bw: 3.684, + ac: 1e3 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G970F/*" + }, + { + ua: "SM-G970F" + } + ], + dpi: 438, + bw: 2.281, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G973F/*" + }, + { + ua: "SM-G973F" + } + ], + dpi: 550, + bw: 2.002, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G975F/*" + }, + { + ua: "SM-G975F" + } + ], + dpi: 522, + bw: 2.054, + ac: 500 + }, + { + type: "android", + rules: [ + { + mdmh: "samsung/*/SM-G977F/*" + }, + { + ua: "SM-G977F" + } + ], + dpi: 505, + bw: 2.334, + ac: 500 + }, + { + type: "ios", + rules: [ + { + res: [ + 828, + 1792 + ] + } + ], + dpi: 326, + bw: 5, + ac: 500 + } + ] + }; + function ge(e1, t) { + if (this.dpdb = me, this.recalculateDeviceParams_(), e1) { + this.onDeviceParamsUpdated = t; + var n = new XMLHttpRequest, i = this; + n.open("GET", e1, !0), n.addEventListener("load", function() { + i.loading = !1, n.status >= 200 && n.status <= 299 ? (i.dpdb = JSON.parse(n.response), i.recalculateDeviceParams_()) : console.error("Error loading online DPDB!"); + }), n.send(); + } + } + function ve(e1) { + this.xdpi = e1.xdpi, this.ydpi = e1.ydpi, this.bevelMm = e1.bevelMm; + } + function ye(e1, t) { + this.set(e1, t); + } + function Ee(e1, t) { + this.kFilter = e1, this.isDebug = t, this.currentAccelMeasurement = new ye, this.currentGyroMeasurement = new ye, this.previousGyroMeasurement = new ye, u() ? this.filterQ = new ce(-1, 0, 0, 1) : this.filterQ = new ce(1, 0, 0, 1), this.previousFilterQ = new ce, this.previousFilterQ.copy(this.filterQ), this.accelQ = new ce, this.isOrientationInitialized = !1, this.estimatedGravity = new se, this.measuredGravity = new se, this.gyroIntegralQ = new ce; + } + function be(e1, t) { + this.predictionTimeS = e1, this.isDebug = t, this.previousQ = new ce, this.previousTimestampS = null, this.deltaQ = new ce, this.outQ = new ce; + } + function xe(e1, t, n, i) { + this.yawOnly = n, this.accelerometer = new se, this.gyroscope = new se, this.filter = new Ee(e1, i), this.posePredictor = new be(t, i), this.isFirefoxAndroid = A(), this.isIOS = u(); + var r = f(); + this.isDeviceMotionInRadians = !this.isIOS && r && r < 66, this.isWithoutDeviceMotion = g() || m(), this.filterToWorldQ = new ce, u() ? this.filterToWorldQ.setFromAxisAngle(new se(1, 0, 0), Math.PI / 2) : this.filterToWorldQ.setFromAxisAngle(new se(1, 0, 0), -Math.PI / 2), this.inverseWorldToScreenQ = new ce, this.worldToScreenQ = new ce, this.originalPoseAdjustQ = new ce, this.originalPoseAdjustQ.setFromAxisAngle(new se(0, 0, 1), -window.orientation * Math.PI / 180), this.setScreenTransform_(), y() && this.filterToWorldQ.multiply(this.inverseWorldToScreenQ), this.resetQ = new ce, this.orientationOut_ = new Float32Array(4), this.start(); + } + ge.prototype.getDeviceParams = function() { + return this.deviceParams; + }, ge.prototype.recalculateDeviceParams_ = function() { + var e1 = this.calcDeviceParams_(); + e1 ? (this.deviceParams = e1, this.onDeviceParamsUpdated && this.onDeviceParamsUpdated(this.deviceParams)) : console.error("Failed to recalculate device parameters."); + }, ge.prototype.calcDeviceParams_ = function() { + var e1 = this.dpdb; + if (!e1) return console.error("DPDB not available."), null; + if (1 != e1.format) return console.error("DPDB has unexpected format version."), null; + if (!e1.devices || !e1.devices.length) return console.error("DPDB does not have a devices section."), null; + var t = navigator.userAgent || navigator.vendor || window.opera, n = b(), i = x(); + if (!e1.devices) return console.error("DPDB has no devices section."), null; + for(var r = 0; r < e1.devices.length; r++){ + var s = e1.devices[r]; + if (s.rules) { + if ("ios" == s.type || "android" == s.type) { + if (u() == ("ios" == s.type)) { + for(var o = !1, a = 0; a < s.rules.length; a++){ + var l = s.rules[a]; + if (this.ruleMatches_(l, t, n, i)) { + o = !0; + break; + } + } + if (o) return new ve({ + xdpi: s.dpi[0] || s.dpi, + ydpi: s.dpi[1] || s.dpi, + bevelMm: s.bw + }); + } + } else console.warn("Device[" + r + "] has invalid type."); + } else console.warn("Device[" + r + "] has no rules section."); + } + return console.warn("No DPDB device match."), null; + }, ge.prototype.ruleMatches_ = function(e1, t, n, i) { + if (!e1.ua && !e1.res) return !1; + if (e1.ua && "SM" === e1.ua.substring(0, 2) && (e1.ua = e1.ua.substring(0, 7)), e1.ua && t.indexOf(e1.ua) < 0) return !1; + if (e1.res) { + if (!e1.res[0] || !e1.res[1]) return !1; + var r = e1.res[0], s = e1.res[1]; + if (Math.min(n, i) != Math.min(r, s) || Math.max(n, i) != Math.max(r, s)) return !1; + } + return !0; + }, ye.prototype.set = function(e1, t) { + this.sample = e1, this.timestampS = t; + }, ye.prototype.copy = function(e1) { + this.set(e1.sample, e1.timestampS); + }, Ee.prototype.addAccelMeasurement = function(e1, t) { + this.currentAccelMeasurement.set(e1, t); + }, Ee.prototype.addGyroMeasurement = function(e1, t) { + this.currentGyroMeasurement.set(e1, t); + var n = t - this.previousGyroMeasurement.timestampS; + E(n) && this.run_(), this.previousGyroMeasurement.copy(this.currentGyroMeasurement); + }, Ee.prototype.run_ = function() { + if (!this.isOrientationInitialized) return this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample), this.previousFilterQ.copy(this.accelQ), void (this.isOrientationInitialized = !0); + var e1 = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS, t = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, e1); + this.gyroIntegralQ.multiply(t), this.filterQ.copy(this.previousFilterQ), this.filterQ.multiply(t); + var n = new ce; + n.copy(this.filterQ), n.inverse(), this.estimatedGravity.set(0, 0, -1), this.estimatedGravity.applyQuaternion(n), this.estimatedGravity.normalize(), this.measuredGravity.copy(this.currentAccelMeasurement.sample), this.measuredGravity.normalize(); + var i = new ce; + i.setFromUnitVectors(this.estimatedGravity, this.measuredGravity), i.inverse(), this.isDebug && console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)", re * U(i), this.estimatedGravity.x.toFixed(1), this.estimatedGravity.y.toFixed(1), this.estimatedGravity.z.toFixed(1), this.measuredGravity.x.toFixed(1), this.measuredGravity.y.toFixed(1), this.measuredGravity.z.toFixed(1)); + var r = new ce; + r.copy(this.filterQ), r.multiply(i), this.filterQ.slerp(r, 1 - this.kFilter), this.previousFilterQ.copy(this.filterQ); + }, Ee.prototype.getOrientation = function() { + return this.filterQ; + }, Ee.prototype.accelToQuaternion_ = function(e1) { + var t = new se; + t.copy(e1), t.normalize(); + var n = new ce; + return n.setFromUnitVectors(new se(0, 0, -1), t), n.inverse(), n; + }, Ee.prototype.gyroToQuaternionDelta_ = function(e1, t) { + var n = new ce, i = new se; + return i.copy(e1), i.normalize(), n.setFromAxisAngle(i, e1.length() * t), n; + }, be.prototype.getPrediction = function(e1, t, n) { + if (!this.previousTimestampS) return this.previousQ.copy(e1), this.previousTimestampS = n, e1; + var i = new se; + i.copy(t), i.normalize(); + var r = t.length(); + if (r < 20 * ie) return this.isDebug && console.log("Moving slowly, at %s deg/s: no prediction", (re * r).toFixed(1)), this.outQ.copy(e1), this.previousQ.copy(e1), this.outQ; + var s = r * this.predictionTimeS; + return this.deltaQ.setFromAxisAngle(i, s), this.outQ.copy(this.previousQ), this.outQ.multiply(this.deltaQ), this.previousQ.copy(e1), this.previousTimestampS = n, this.outQ; + }, xe.prototype.getPosition = function() { + return null; + }, xe.prototype.getOrientation = function() { + var e1 = void 0; + if (this.isWithoutDeviceMotion && this._deviceOrientationQ) return this.deviceOrientationFixQ = this.deviceOrientationFixQ || (n = (new ce).setFromAxisAngle(new se(0, 0, -1), 0), i = new ce, -90 === window.orientation ? i.setFromAxisAngle(new se(0, 1, 0), Math.PI / -2) : i.setFromAxisAngle(new se(0, 1, 0), Math.PI / 2), n.multiply(i)), this.deviceOrientationFilterToWorldQ = this.deviceOrientationFilterToWorldQ || ((t = new ce).setFromAxisAngle(new se(1, 0, 0), -Math.PI / 2), t), e1 = this._deviceOrientationQ, (r = new ce).copy(e1), r.multiply(this.deviceOrientationFilterToWorldQ), r.multiply(this.resetQ), r.multiply(this.worldToScreenQ), r.multiplyQuaternions(this.deviceOrientationFixQ, r), this.yawOnly && (r.x = 0, r.z = 0, r.normalize()), this.orientationOut_[0] = r.x, this.orientationOut_[1] = r.y, this.orientationOut_[2] = r.z, this.orientationOut_[3] = r.w, this.orientationOut_; + var t, n, i, r, s = this.filter.getOrientation(); + return e1 = this.posePredictor.getPrediction(s, this.gyroscope, this.previousTimestampS), (r = new ce).copy(this.filterToWorldQ), r.multiply(this.resetQ), r.multiply(e1), r.multiply(this.worldToScreenQ), this.yawOnly && (r.x = 0, r.z = 0, r.normalize()), this.orientationOut_[0] = r.x, this.orientationOut_[1] = r.y, this.orientationOut_[2] = r.z, this.orientationOut_[3] = r.w, this.orientationOut_; + }, xe.prototype.resetPose = function() { + this.resetQ.copy(this.filter.getOrientation()), this.resetQ.x = 0, this.resetQ.y = 0, this.resetQ.z *= -1, this.resetQ.normalize(), y() && this.resetQ.multiply(this.inverseWorldToScreenQ), this.resetQ.multiply(this.originalPoseAdjustQ); + }, xe.prototype.onDeviceOrientation_ = function(e1) { + this._deviceOrientationQ = this._deviceOrientationQ || new ce; + var t = e1.alpha, n = e1.beta, i = e1.gamma; + t = (t || 0) * Math.PI / 180, n = (n || 0) * Math.PI / 180, i = (i || 0) * Math.PI / 180, this._deviceOrientationQ.setFromEulerYXZ(n, t, -i); + }, xe.prototype.onDeviceMotion_ = function(e1) { + this.updateDeviceMotion_(e1); + }, xe.prototype.updateDeviceMotion_ = function(e1) { + var t = e1.accelerationIncludingGravity, n = e1.rotationRate, i = e1.timeStamp / 1e3, r = i - this.previousTimestampS; + return r < 0 ? (O("fusion-pose-sensor:invalid:non-monotonic", "Invalid timestamps detected: non-monotonic timestamp from devicemotion"), void (this.previousTimestampS = i)) : r <= a || r > l ? (O("fusion-pose-sensor:invalid:outside-threshold", "Invalid timestamps detected: Timestamp from devicemotion outside expected range."), void (this.previousTimestampS = i)) : (this.accelerometer.set(-t.x, -t.y, -t.z), n && (v() ? this.gyroscope.set(-n.beta, n.alpha, n.gamma) : this.gyroscope.set(n.alpha, n.beta, n.gamma), this.isDeviceMotionInRadians || this.gyroscope.multiplyScalar(Math.PI / 180), this.filter.addGyroMeasurement(this.gyroscope, i)), this.filter.addAccelMeasurement(this.accelerometer, i), void (this.previousTimestampS = i)); + }, xe.prototype.onOrientationChange_ = function(e1) { + this.setScreenTransform_(); + }, xe.prototype.onMessage_ = function(e1) { + var t = e1.data; + t && t.type && "devicemotion" === t.type.toLowerCase() && this.updateDeviceMotion_(t.deviceMotionEvent); + }, xe.prototype.setScreenTransform_ = function() { + switch(this.worldToScreenQ.set(0, 0, 0, 1), window.orientation){ + case 0: + break; + case 90: + this.worldToScreenQ.setFromAxisAngle(new se(0, 0, 1), -Math.PI / 2); + break; + case -90: + this.worldToScreenQ.setFromAxisAngle(new se(0, 0, 1), Math.PI / 2); + } + this.inverseWorldToScreenQ.copy(this.worldToScreenQ), this.inverseWorldToScreenQ.inverse(); + }, xe.prototype.start = function() { + this.onDeviceMotionCallback_ = this.onDeviceMotion_.bind(this), this.onOrientationChangeCallback_ = this.onOrientationChange_.bind(this), this.onMessageCallback_ = this.onMessage_.bind(this), this.onDeviceOrientationCallback_ = this.onDeviceOrientation_.bind(this), u() && D() && window.addEventListener("message", this.onMessageCallback_), window.addEventListener("orientationchange", this.onOrientationChangeCallback_), this.isWithoutDeviceMotion ? window.addEventListener("deviceorientation", this.onDeviceOrientationCallback_) : window.addEventListener("devicemotion", this.onDeviceMotionCallback_); + }, xe.prototype.stop = function() { + window.removeEventListener("devicemotion", this.onDeviceMotionCallback_), window.removeEventListener("deviceorientation", this.onDeviceOrientationCallback_), window.removeEventListener("orientationchange", this.onOrientationChangeCallback_), window.removeEventListener("message", this.onMessageCallback_); + }; + var Ce = 60, we = new se(1, 0, 0), _e = new se(0, 0, 1), Me = new ce; + Me.setFromAxisAngle(we, -Math.PI / 2), Me.multiply((new ce).setFromAxisAngle(_e, Math.PI / 2)); + var Se = function() { + function e1(t) { + r(this, e1), this.config = t, this.sensor = null, this.fusionSensor = null, this._out = new Float32Array(4), this.api = null, this.errors = [], this._sensorQ = new ce, this._outQ = new ce, this._onSensorRead = this._onSensorRead.bind(this), this._onSensorError = this._onSensorError.bind(this), this.init(); + } + return s(e1, [ + { + key: "init", + value: function() { + var e1 = null; + try { + (e1 = new RelativeOrientationSensor({ + frequency: Ce, + referenceFrame: "screen" + })).addEventListener("error", this._onSensorError); + } catch (e1) { + this.errors.push(e1), "SecurityError" === e1.name ? (console.error("Cannot construct sensors due to the Feature Policy"), console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'), this.useDeviceMotion()) : "ReferenceError" === e1.name ? this.useDeviceMotion() : console.error(e1); + } + e1 && (this.api = "sensor", this.sensor = e1, this.sensor.addEventListener("reading", this._onSensorRead), this.sensor.start()); + } + }, + { + key: "useDeviceMotion", + value: function() { + this.api = "devicemotion", this.fusionSensor = new xe(this.config.K_FILTER, this.config.PREDICTION_TIME_S, this.config.YAW_ONLY, this.config.DEBUG), this.sensor && (this.sensor.removeEventListener("reading", this._onSensorRead), this.sensor.removeEventListener("error", this._onSensorError), this.sensor = null); + } + }, + { + key: "getOrientation", + value: function() { + if (this.fusionSensor) return this.fusionSensor.getOrientation(); + if (!this.sensor || !this.sensor.quaternion) return this._out[0] = this._out[1] = this._out[2] = 0, this._out[3] = 1, this._out; + var e1 = this.sensor.quaternion; + this._sensorQ.set(e1[0], e1[1], e1[2], e1[3]); + var t = this._outQ; + return t.copy(Me), t.multiply(this._sensorQ), this.config.YAW_ONLY && (t.x = t.z = 0, t.normalize()), this._out[0] = t.x, this._out[1] = t.y, this._out[2] = t.z, this._out[3] = t.w, this._out; + } + }, + { + key: "_onSensorError", + value: function(e1) { + this.errors.push(e1.error), "NotAllowedError" === e1.error.name ? console.error("Permission to access sensor was denied") : "NotReadableError" === e1.error.name ? console.error("Sensor could not be read") : console.error(e1.error), this.useDeviceMotion(); + } + }, + { + key: "_onSensorRead", + value: function() {} + } + ]), e1; + }(), Ie = ""; + function Be() { + this.loadIcon_(); + var e1 = document.createElement("div"); + (s = e1.style).position = "fixed", s.top = 0, s.right = 0, s.bottom = 0, s.left = 0, s.backgroundColor = "gray", s.fontFamily = "sans-serif", s.zIndex = 1e6; + var t = document.createElement("img"); + t.src = this.icon, (s = t.style).marginLeft = "25%", s.marginTop = "25%", s.width = "50%", e1.appendChild(t); + var n = document.createElement("div"); + (s = n.style).textAlign = "center", s.fontSize = "16px", s.lineHeight = "24px", s.margin = "24px 25%", s.width = "50%", n.innerHTML = "Place your phone into your Cardboard viewer.", e1.appendChild(n); + var i = document.createElement("div"); + (s = i.style).backgroundColor = "#CFD8DC", s.position = "fixed", s.bottom = 0, s.width = "100%", s.height = "48px", s.padding = "14px 24px", s.boxSizing = "border-box", s.color = "#656A6B", e1.appendChild(i); + var r = document.createElement("div"); + r.style.float = "left", r.innerHTML = "No Cardboard viewer?"; + var s, o = document.createElement("a"); + o.href = "https://www.google.com/get/cardboard/get-cardboard/", o.innerHTML = "get one", o.target = "_blank", (s = o.style).float = "right", s.fontWeight = 600, s.textTransform = "uppercase", s.borderLeft = "1px solid gray", s.paddingLeft = "24px", s.textDecoration = "none", s.color = "#656A6B", i.appendChild(r), i.appendChild(o), this.overlay = e1, this.text = n, this.hide(); + } + Be.prototype.show = function(e1) { + e1 || this.overlay.parentElement ? e1 && (this.overlay.parentElement && this.overlay.parentElement != e1 && this.overlay.parentElement.removeChild(this.overlay), e1.appendChild(this.overlay)) : document.body.appendChild(this.overlay), this.overlay.style.display = "block"; + var t = this.overlay.querySelector("img").style; + y() ? (t.width = "20%", t.marginLeft = "40%", t.marginTop = "3%") : (t.width = "50%", t.marginLeft = "25%", t.marginTop = "25%"); + }, Be.prototype.hide = function() { + this.overlay.style.display = "none"; + }, Be.prototype.showTemporarily = function(e1, t) { + this.show(t), this.timer = setTimeout(this.hide.bind(this), e1); + }, Be.prototype.disableShowTemporarily = function() { + clearTimeout(this.timer); + }, Be.prototype.update = function() { + this.disableShowTemporarily(), !y() && B() ? this.show() : this.hide(); + }, Be.prototype.loadIcon_ = function() { + this.icon = c("image/svg+xml", Ie); + }; + var Te = "CardboardV1", Re = "WEBVR_CARDBOARD_VIEWER", Le = "webvr-polyfill-viewer-selector"; + function De(e1) { + try { + this.selectedKey = localStorage.getItem(Re); + } catch (e1) { + console.error("Failed to load viewer profile: %s", e1); + } + this.selectedKey || (this.selectedKey = e1 || Te), this.dialog = this.createDialog_(Ae.Viewers), this.root = null, this.onChangeCallbacks_ = []; + } + function Pe(e1) { + return e1 && e1.__esModule && Object.prototype.hasOwnProperty.call(e1, "default") ? e1.default : e1; + } + function Ue(e1, t) { + return e1(t = { + exports: {} + }, t.exports), t.exports; + } + De.prototype.show = function(e1) { + this.root = e1, e1.appendChild(this.dialog), this.dialog.querySelector("#" + this.selectedKey).checked = !0, this.dialog.style.display = "block"; + }, De.prototype.hide = function() { + this.root && this.root.contains(this.dialog) && this.root.removeChild(this.dialog), this.dialog.style.display = "none"; + }, De.prototype.getCurrentViewer = function() { + return Ae.Viewers[this.selectedKey]; + }, De.prototype.getSelectedKey_ = function() { + var e1 = this.dialog.querySelector("input[name=field]:checked"); + return e1 ? e1.id : null; + }, De.prototype.onChange = function(e1) { + this.onChangeCallbacks_.push(e1); + }, De.prototype.fireOnChange_ = function(e1) { + for(var t = 0; t < this.onChangeCallbacks_.length; t++)this.onChangeCallbacks_[t](e1); + }, De.prototype.onSave_ = function() { + if (this.selectedKey = this.getSelectedKey_(), this.selectedKey && Ae.Viewers[this.selectedKey]) { + this.fireOnChange_(Ae.Viewers[this.selectedKey]); + try { + localStorage.setItem(Re, this.selectedKey); + } catch (e1) { + console.error("Failed to save viewer profile: %s", e1); + } + this.hide(); + } else console.error("ViewerSelector.onSave_: this should never happen!"); + }, De.prototype.createDialog_ = function(e1) { + var t = document.createElement("div"); + t.classList.add(Le), t.style.display = "none"; + var n = document.createElement("div"); + (s = n.style).position = "fixed", s.left = 0, s.top = 0, s.width = "100%", s.height = "100%", s.background = "rgba(0, 0, 0, 0.3)", n.addEventListener("click", this.hide.bind(this)); + var i = 280, r = document.createElement("div"), s = r.style; + for(var o in s.boxSizing = "border-box", s.position = "fixed", s.top = "24px", s.left = "50%", s.marginLeft = -i / 2 + "px", s.width = i + "px", s.padding = "24px", s.overflow = "hidden", s.background = "#fafafa", s.fontFamily = "'Roboto', sans-serif", s.boxShadow = "0px 5px 20px #666", r.appendChild(this.createH1_("Select your viewer")), e1)r.appendChild(this.createChoice_(o, e1[o].label)); + return r.appendChild(this.createButton_("Save", this.onSave_.bind(this))), t.appendChild(n), t.appendChild(r), t; + }, De.prototype.createH1_ = function(e1) { + var t = document.createElement("h1"), n = t.style; + return n.color = "black", n.fontSize = "20px", n.fontWeight = "bold", n.marginTop = 0, n.marginBottom = "24px", t.innerHTML = e1, t; + }, De.prototype.createChoice_ = function(e1, t) { + var n = document.createElement("div"); + n.style.marginTop = "8px", n.style.color = "black"; + var i = document.createElement("input"); + i.style.fontSize = "30px", i.setAttribute("id", e1), i.setAttribute("type", "radio"), i.setAttribute("value", e1), i.setAttribute("name", "field"); + var r = document.createElement("label"); + return r.style.marginLeft = "4px", r.setAttribute("for", e1), r.innerHTML = t, n.appendChild(i), n.appendChild(r), n; + }, De.prototype.createButton_ = function(e1, t) { + var n = document.createElement("button"); + n.innerHTML = e1; + var i = n.style; + return i.float = "right", i.textTransform = "uppercase", i.color = "#1094f7", i.fontSize = "14px", i.letterSpacing = 0, i.border = 0, i.background = "none", i.marginTop = "16px", n.addEventListener("click", t), n; + }, "undefined" != typeof window ? window : void 0 !== e1 || "undefined" != typeof self && self; + var Oe = Ue(function(e1, t) { + !function(t, n) { + e1.exports = n(); + }(0, function() { + return function(e1) { + var t = {}; + function n(i) { + if (t[i]) return t[i].exports; + var r = t[i] = { + i, + l: !1, + exports: {} + }; + return e1[i].call(r.exports, r, r.exports, n), r.l = !0, r.exports; + } + return n.m = e1, n.c = t, n.d = function(e1, t, i) { + n.o(e1, t) || Object.defineProperty(e1, t, { + configurable: !1, + enumerable: !0, + get: i + }); + }, n.n = function(e1) { + var t = e1 && e1.__esModule ? function() { + return e1.default; + } : function() { + return e1; + }; + return n.d(t, "a", t), t; + }, n.o = function(e1, t) { + return Object.prototype.hasOwnProperty.call(e1, t); + }, n.p = "", n(n.s = 0); + }([ + function(e1, t, n) { + var i = function() { + function e1(e1, t) { + for(var n = 0; n < t.length; n++){ + var i = t[n]; + i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e1, i.key, i); + } + } + return function(t, n, i) { + return n && e1(t.prototype, n), i && e1(t, i), t; + }; + }(); + function r(e1, t) { + if (!(e1 instanceof t)) throw new TypeError("Cannot call a class as a function"); + } + var s = n(1), o = "undefined" != typeof navigator && parseFloat(("" + (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [ + 0, + "" + ])[1]).replace("undefined", "3_2").replace("_", ".").replace("_", "")) < 10 && !window.MSStream, a = function() { + function e1() { + r(this, e1), o ? this.noSleepTimer = null : (this.noSleepVideo = document.createElement("video"), this.noSleepVideo.setAttribute("playsinline", ""), this.noSleepVideo.setAttribute("src", s), this.noSleepVideo.addEventListener("timeupdate", (function(e1) { + this.noSleepVideo.currentTime > .5 && (this.noSleepVideo.currentTime = Math.random()); + }).bind(this))); + } + return i(e1, [ + { + key: "enable", + value: function() { + o ? (this.disable(), this.noSleepTimer = window.setInterval(function() { + window.location.href = "/", window.setTimeout(window.stop, 0); + }, 15e3)) : this.noSleepVideo.play(); + } + }, + { + key: "disable", + value: function() { + o ? this.noSleepTimer && (window.clearInterval(this.noSleepTimer), this.noSleepTimer = null) : this.noSleepVideo.pause(); + } + } + ]), e1; + }(); + e1.exports = a; + }, + function(e1, t, n) { + e1.exports = "data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="; + } + ]); + }); + }), Fe = Pe(Oe), Ne = 1e3, ke = [ + 0, + 0, + .5, + 1 + ], Qe = [ + .5, + 0, + .5, + 1 + ], Ge = window.requestAnimationFrame, ze = window.cancelAnimationFrame; + function He() { + this.leftProjectionMatrix = new Float32Array(16), this.leftViewMatrix = new Float32Array(16), this.rightProjectionMatrix = new Float32Array(16), this.rightViewMatrix = new Float32Array(16), this.pose = null; + } + function Ve(e1) { + Object.defineProperties(this, { + hasPosition: { + writable: !1, + enumerable: !0, + value: e1.hasPosition + }, + hasExternalDisplay: { + writable: !1, + enumerable: !0, + value: e1.hasExternalDisplay + }, + canPresent: { + writable: !1, + enumerable: !0, + value: e1.canPresent + }, + maxLayers: { + writable: !1, + enumerable: !0, + value: e1.maxLayers + }, + hasOrientation: { + enumerable: !0, + get: function() { + return F("VRDisplayCapabilities.prototype.hasOrientation", "VRDisplay.prototype.getFrameData"), e1.hasOrientation; + } + } + }); + } + function We(e1) { + var t = !("wakelock" in (e1 = e1 || {})) || e1.wakelock; + this.isPolyfilled = !0, this.displayId = Ne++, this.displayName = "", this.depthNear = .01, this.depthFar = 1e4, this.isPresenting = !1, Object.defineProperty(this, "isConnected", { + get: function() { + return F("VRDisplay.prototype.isConnected", "VRDisplayCapabilities.prototype.hasExternalDisplay"), !1; + } + }), this.capabilities = new Ve({ + hasPosition: !1, + hasOrientation: !1, + hasExternalDisplay: !1, + canPresent: !1, + maxLayers: 1 + }), this.stageParameters = null, this.waitingForPresent_ = !1, this.layer_ = null, this.originalParent_ = null, this.fullscreenElement_ = null, this.fullscreenWrapper_ = null, this.fullscreenElementCachedStyle_ = null, this.fullscreenEventTarget_ = null, this.fullscreenChangeHandler_ = null, this.fullscreenErrorHandler_ = null, t && B() && (this.wakelock_ = new Fe); + } + We.prototype.getFrameData = function(e1) { + return L(e1, this._getPose(), this); + }, We.prototype.getPose = function() { + return F("VRDisplay.prototype.getPose", "VRDisplay.prototype.getFrameData"), this._getPose(); + }, We.prototype.resetPose = function() { + return F("VRDisplay.prototype.resetPose"), this._resetPose(); + }, We.prototype.getImmediatePose = function() { + return F("VRDisplay.prototype.getImmediatePose", "VRDisplay.prototype.getFrameData"), this._getPose(); + }, We.prototype.requestAnimationFrame = function(e1) { + return Ge(e1); + }, We.prototype.cancelAnimationFrame = function(e1) { + return ze(e1); + }, We.prototype.wrapForFullscreen = function(e1) { + if (u()) return e1; + if (!this.fullscreenWrapper_) { + this.fullscreenWrapper_ = document.createElement("div"); + var t = [ + "height: " + Math.min(screen.height, screen.width) + "px !important", + "top: 0 !important", + "left: 0 !important", + "right: 0 !important", + "border: 0", + "margin: 0", + "padding: 0", + "z-index: 999999 !important", + "position: fixed" + ]; + this.fullscreenWrapper_.setAttribute("style", t.join("; ") + ";"), this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper"); + } + if (this.fullscreenElement_ == e1) return this.fullscreenWrapper_; + if (this.fullscreenElement_ && (this.originalParent_ ? this.originalParent_.appendChild(this.fullscreenElement_) : this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)), this.fullscreenElement_ = e1, this.originalParent_ = e1.parentElement, this.originalParent_ || document.body.appendChild(e1), !this.fullscreenWrapper_.parentElement) { + var n = this.fullscreenElement_.parentElement; + n.insertBefore(this.fullscreenWrapper_, this.fullscreenElement_), n.removeChild(this.fullscreenElement_); + } + this.fullscreenWrapper_.insertBefore(this.fullscreenElement_, this.fullscreenWrapper_.firstChild), this.fullscreenElementCachedStyle_ = this.fullscreenElement_.getAttribute("style"); + var i = this; + function r() { + if (i.fullscreenElement_) { + var e1 = [ + "position: absolute", + "top: 0", + "left: 0", + "width: " + Math.max(screen.width, screen.height) + "px", + "height: " + Math.min(screen.height, screen.width) + "px", + "border: 0", + "margin: 0", + "padding: 0" + ]; + i.fullscreenElement_.setAttribute("style", e1.join("; ") + ";"); + } + } + return r(), this.fullscreenWrapper_; + }, We.prototype.removeFullscreenWrapper = function() { + if (this.fullscreenElement_) { + var e1 = this.fullscreenElement_; + this.fullscreenElementCachedStyle_ ? e1.setAttribute("style", this.fullscreenElementCachedStyle_) : e1.removeAttribute("style"), this.fullscreenElement_ = null, this.fullscreenElementCachedStyle_ = null; + var t = this.fullscreenWrapper_.parentElement; + return this.fullscreenWrapper_.removeChild(e1), this.originalParent_ === t ? t.insertBefore(e1, this.fullscreenWrapper_) : this.originalParent_ && this.originalParent_.appendChild(e1), t.removeChild(this.fullscreenWrapper_), e1; + } + }, We.prototype.requestPresent = function(e1) { + var t = this.isPresenting, n = this; + return e1 instanceof Array || (F("VRDisplay.prototype.requestPresent with non-array argument", "an array of VRLayers as the first argument"), e1 = [ + e1 + ]), new Promise(function(i, r) { + if (n.capabilities.canPresent) { + if (0 == e1.length || e1.length > n.capabilities.maxLayers) r(new Error("Invalid number of layers.")); + else { + var s = e1[0]; + if (s.source) { + var o = s.leftBounds || ke, a = s.rightBounds || Qe; + if (t) { + var l = n.layer_; + l.source !== s.source && (l.source = s.source); + for(var c = 0; c < 4; c++)l.leftBounds[c] = o[c], l.rightBounds[c] = a[c]; + return n.wrapForFullscreen(n.layer_.source), n.updatePresent_(), void i(); + } + if (n.layer_ = { + predistorted: s.predistorted, + source: s.source, + leftBounds: o.slice(0), + rightBounds: a.slice(0) + }, n.waitingForPresent_ = !1, n.layer_ && n.layer_.source) { + var h = n.wrapForFullscreen(n.layer_.source), p = function() { + var e1 = _(); + n.isPresenting = h === e1, n.isPresenting ? (screen.orientation && screen.orientation.lock && screen.orientation.lock("landscape-primary").catch(function(e1) { + console.error("screen.orientation.lock() failed due to", e1.message); + }), n.waitingForPresent_ = !1, n.beginPresent_(), i()) : (screen.orientation && screen.orientation.unlock && screen.orientation.unlock(), n.removeFullscreenWrapper(), n.disableWakeLock(), n.endPresent_(), n.removeFullscreenListeners_()), n.fireVRDisplayPresentChange_(); + }, A = function() { + n.waitingForPresent_ && (n.removeFullscreenWrapper(), n.removeFullscreenListeners_(), n.disableWakeLock(), n.waitingForPresent_ = !1, n.isPresenting = !1, r(new Error("Unable to present."))); + }; + n.addFullscreenListeners_(h, p, A), C(h) ? (n.enableWakeLock(), n.waitingForPresent_ = !0) : (u() || d()) && (n.enableWakeLock(), n.isPresenting = !0, n.beginPresent_(), n.fireVRDisplayPresentChange_(), i()); + } + n.waitingForPresent_ || u() || (w(), r(new Error("Unable to present."))); + } else i(); + } + } else r(new Error("VRDisplay is not capable of presenting.")); + }); + }, We.prototype.exitPresent = function() { + var e1 = this.isPresenting, t = this; + return this.isPresenting = !1, this.layer_ = null, this.disableWakeLock(), new Promise(function(n, i) { + e1 ? (!w() && u() && (t.endPresent_(), t.fireVRDisplayPresentChange_()), d() && (t.removeFullscreenWrapper(), t.removeFullscreenListeners_(), t.endPresent_(), t.fireVRDisplayPresentChange_()), n()) : i(new Error("Was not presenting to VRDisplay.")); + }); + }, We.prototype.getLayers = function() { + return this.layer_ ? [ + this.layer_ + ] : []; + }, We.prototype.fireVRDisplayPresentChange_ = function() { + var e1 = new CustomEvent("vrdisplaypresentchange", { + detail: { + display: this + } + }); + window.dispatchEvent(e1); + }, We.prototype.fireVRDisplayConnect_ = function() { + var e1 = new CustomEvent("vrdisplayconnect", { + detail: { + display: this + } + }); + window.dispatchEvent(e1); + }, We.prototype.addFullscreenListeners_ = function(e1, t, n) { + this.removeFullscreenListeners_(), this.fullscreenEventTarget_ = e1, this.fullscreenChangeHandler_ = t, this.fullscreenErrorHandler_ = n, t && (document.fullscreenEnabled ? e1.addEventListener("fullscreenchange", t, !1) : document.webkitFullscreenEnabled ? e1.addEventListener("webkitfullscreenchange", t, !1) : document.mozFullScreenEnabled ? document.addEventListener("mozfullscreenchange", t, !1) : document.msFullscreenEnabled && e1.addEventListener("msfullscreenchange", t, !1)), n && (document.fullscreenEnabled ? e1.addEventListener("fullscreenerror", n, !1) : document.webkitFullscreenEnabled ? e1.addEventListener("webkitfullscreenerror", n, !1) : document.mozFullScreenEnabled ? document.addEventListener("mozfullscreenerror", n, !1) : document.msFullscreenEnabled && e1.addEventListener("msfullscreenerror", n, !1)); + }, We.prototype.removeFullscreenListeners_ = function() { + if (this.fullscreenEventTarget_) { + var e1 = this.fullscreenEventTarget_; + if (this.fullscreenChangeHandler_) { + var t = this.fullscreenChangeHandler_; + e1.removeEventListener("fullscreenchange", t, !1), e1.removeEventListener("webkitfullscreenchange", t, !1), document.removeEventListener("mozfullscreenchange", t, !1), e1.removeEventListener("msfullscreenchange", t, !1); + } + if (this.fullscreenErrorHandler_) { + var n = this.fullscreenErrorHandler_; + e1.removeEventListener("fullscreenerror", n, !1), e1.removeEventListener("webkitfullscreenerror", n, !1), document.removeEventListener("mozfullscreenerror", n, !1), e1.removeEventListener("msfullscreenerror", n, !1); + } + this.fullscreenEventTarget_ = null, this.fullscreenChangeHandler_ = null, this.fullscreenErrorHandler_ = null; + } + }, We.prototype.enableWakeLock = function() { + this.wakelock_ && this.wakelock_.enable(); + }, We.prototype.disableWakeLock = function() { + this.wakelock_ && this.wakelock_.disable(); + }, We.prototype.beginPresent_ = function() {}, We.prototype.endPresent_ = function() {}, We.prototype.submitFrame = function(e1) {}, We.prototype.getEyeParameters = function(e1) { + return null; + }; + var je = { + ADDITIONAL_VIEWERS: [], + DEFAULT_VIEWER: "", + MOBILE_WAKE_LOCK: !0, + DEBUG: !1, + DPDB_URL: "https://dpdb.webvr.rocks/dpdb.json", + K_FILTER: .98, + PREDICTION_TIME_S: .04, + CARDBOARD_UI_DISABLED: !1, + ROTATE_INSTRUCTIONS_DISABLED: !1, + YAW_ONLY: !1, + BUFFER_SCALE: .5, + DIRTY_SUBMIT_FRAME_BINDINGS: !1 + }, qe = { + LEFT: "left", + RIGHT: "right" + }; + function Xe(e1) { + var t = T({}, je); + e1 = T(t, e1 || {}), We.call(this, { + wakelock: e1.MOBILE_WAKE_LOCK + }), this.config = e1, this.displayName = "Cardboard VRDisplay", this.capabilities = new Ve({ + hasPosition: !1, + hasOrientation: !0, + hasExternalDisplay: !1, + canPresent: !0, + maxLayers: 1 + }), this.stageParameters = null, this.bufferScale_ = this.config.BUFFER_SCALE, this.poseSensor_ = new Se(this.config), this.distorter_ = null, this.cardboardUI_ = null, this.dpdb_ = new ge(this.config.DPDB_URL, this.onDeviceParamsUpdated_.bind(this)), this.deviceInfo_ = new Ae(this.dpdb_.getDeviceParams(), e1.ADDITIONAL_VIEWERS), this.viewerSelector_ = new De(e1.DEFAULT_VIEWER), this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)), this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()), this.config.ROTATE_INSTRUCTIONS_DISABLED || (this.rotateInstructions_ = new Be), u() && window.addEventListener("resize", this.onResize_.bind(this)); + } + return Xe.prototype = Object.create(We.prototype), Xe.prototype._getPose = function() { + return { + position: null, + orientation: this.poseSensor_.getOrientation(), + linearVelocity: null, + linearAcceleration: null, + angularVelocity: null, + angularAcceleration: null + }; + }, Xe.prototype._resetPose = function() { + this.poseSensor_.resetPose && this.poseSensor_.resetPose(); + }, Xe.prototype._getFieldOfView = function(e1) { + var t; + if (e1 == qe.LEFT) t = this.deviceInfo_.getFieldOfViewLeftEye(); + else { + if (e1 != qe.RIGHT) return console.error("Invalid eye provided: %s", e1), null; + t = this.deviceInfo_.getFieldOfViewRightEye(); + } + return t; + }, Xe.prototype._getEyeOffset = function(e1) { + var t; + if (e1 == qe.LEFT) t = [ + .5 * -this.deviceInfo_.viewer.interLensDistance, + 0, + 0 + ]; + else { + if (e1 != qe.RIGHT) return console.error("Invalid eye provided: %s", e1), null; + t = [ + .5 * this.deviceInfo_.viewer.interLensDistance, + 0, + 0 + ]; + } + return t; + }, Xe.prototype.getEyeParameters = function(e1) { + var t = this._getEyeOffset(e1), n = this._getFieldOfView(e1), i = { + offset: t, + renderWidth: .5 * this.deviceInfo_.device.width * this.bufferScale_, + renderHeight: this.deviceInfo_.device.height * this.bufferScale_ + }; + return Object.defineProperty(i, "fieldOfView", { + enumerable: !0, + get: function() { + return F("VRFieldOfView", "VRFrameData's projection matrices"), n; + } + }), i; + }, Xe.prototype.onDeviceParamsUpdated_ = function(e1) { + this.config.DEBUG && console.log("DPDB reported that device params were updated."), this.deviceInfo_.updateDeviceParams(e1), this.distorter_ && this.distorter_.updateDeviceInfo(this.deviceInfo_); + }, Xe.prototype.updateBounds_ = function() { + this.layer_ && this.distorter_ && (this.layer_.leftBounds || this.layer_.rightBounds) && this.distorter_.setTextureBounds(this.layer_.leftBounds, this.layer_.rightBounds); + }, Xe.prototype.beginPresent_ = function() { + var e1 = this.layer_.source.getContext("webgl"); + e1 || (e1 = this.layer_.source.getContext("experimental-webgl")), e1 || (e1 = this.layer_.source.getContext("webgl2")), e1 && (this.layer_.predistorted ? this.config.CARDBOARD_UI_DISABLED || (e1.canvas.width = b() * this.bufferScale_, e1.canvas.height = x() * this.bufferScale_, this.cardboardUI_ = new te(e1)) : (this.config.CARDBOARD_UI_DISABLED || (this.cardboardUI_ = new te(e1)), this.distorter_ = new z(e1, this.cardboardUI_, this.config.BUFFER_SCALE, this.config.DIRTY_SUBMIT_FRAME_BINDINGS), this.distorter_.updateDeviceInfo(this.deviceInfo_)), this.cardboardUI_ && this.cardboardUI_.listen((function(e1) { + this.viewerSelector_.show(this.layer_.source.parentElement), e1.stopPropagation(), e1.preventDefault(); + }).bind(this), (function(e1) { + this.exitPresent(), e1.stopPropagation(), e1.preventDefault(); + }).bind(this)), this.rotateInstructions_ && (y() && B() ? this.rotateInstructions_.showTemporarily(3e3, this.layer_.source.parentElement) : this.rotateInstructions_.update()), this.orientationHandler = this.onOrientationChange_.bind(this), window.addEventListener("orientationchange", this.orientationHandler), this.vrdisplaypresentchangeHandler = this.updateBounds_.bind(this), window.addEventListener("vrdisplaypresentchange", this.vrdisplaypresentchangeHandler), this.fireVRDisplayDeviceParamsChange_()); + }, Xe.prototype.endPresent_ = function() { + this.distorter_ && (this.distorter_.destroy(), this.distorter_ = null), this.cardboardUI_ && (this.cardboardUI_.destroy(), this.cardboardUI_ = null), this.rotateInstructions_ && this.rotateInstructions_.hide(), this.viewerSelector_.hide(), window.removeEventListener("orientationchange", this.orientationHandler), window.removeEventListener("vrdisplaypresentchange", this.vrdisplaypresentchangeHandler); + }, Xe.prototype.updatePresent_ = function() { + this.endPresent_(), this.beginPresent_(); + }, Xe.prototype.submitFrame = function(e1) { + if (this.distorter_) this.updateBounds_(), this.distorter_.submitFrame(); + else if (this.cardboardUI_ && this.layer_) { + var t = this.layer_.source.getContext("webgl"); + t || (t = this.layer_.source.getContext("experimental-webgl")), t || (t = this.layer_.source.getContext("webgl2")); + var n = t.canvas; + n.width == this.lastWidth && n.height == this.lastHeight || this.cardboardUI_.onResize(), this.lastWidth = n.width, this.lastHeight = n.height, this.cardboardUI_.render(); + } + }, Xe.prototype.onOrientationChange_ = function(e1) { + this.viewerSelector_.hide(), this.rotateInstructions_ && this.rotateInstructions_.update(), this.onResize_(); + }, Xe.prototype.onResize_ = function(e1) { + if (this.layer_) { + var t = this.layer_.source.getContext("webgl"); + t || (t = this.layer_.source.getContext("experimental-webgl")), t || (t = this.layer_.source.getContext("webgl2")); + var n = [ + "position: absolute", + "top: 0", + "left: 0", + "width: 100vw", + "height: 100vh", + "border: 0", + "margin: 0", + "padding: 0px", + "box-sizing: content-box" + ]; + t.canvas.setAttribute("style", n.join("; ") + ";"), R(t.canvas); + } + }, Xe.prototype.onViewerChanged_ = function(e1) { + this.deviceInfo_.setViewer(e1), this.distorter_ && this.distorter_.updateDeviceInfo(this.deviceInfo_), this.fireVRDisplayDeviceParamsChange_(); + }, Xe.prototype.fireVRDisplayDeviceParamsChange_ = function() { + var e1 = new CustomEvent("vrdisplaydeviceparamschange", { + detail: { + vrdisplay: this, + deviceInfo: this.deviceInfo_ + } + }); + window.dispatchEvent(e1); + }, Xe.VRFrameData = He, Xe.VRDisplay = We, Xe; + }(); + }), a = (t = o) && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t, l = { + ADDITIONAL_VIEWERS: [], + DEFAULT_VIEWER: "", + PROVIDE_MOBILE_VRDISPLAY: !0, + MOBILE_WAKE_LOCK: !0, + DEBUG: !1, + DPDB_URL: "https://dpdb.webvr.rocks/dpdb.json", + K_FILTER: .98, + PREDICTION_TIME_S: .04, + CARDBOARD_UI_DISABLED: !1, + ROTATE_INSTRUCTIONS_DISABLED: !1, + YAW_ONLY: !1, + BUFFER_SCALE: .5, + DIRTY_SUBMIT_FRAME_BINDINGS: !1 + }; + function c(e1) { + this.config = s(s({}, l), e1), this.polyfillDisplays = [], this.enabled = !1, this.hasNative = "getVRDisplays" in navigator, this.native = {}, this.native.getVRDisplays = navigator.getVRDisplays, this.native.VRFrameData = window.VRFrameData, this.native.VRDisplay = window.VRDisplay, (!this.hasNative || this.config.PROVIDE_MOBILE_VRDISPLAY && i()) && (this.enable(), this.getVRDisplays().then(function(e1) { + e1 && e1[0] && e1[0].fireVRDisplayConnect_ && e1[0].fireVRDisplayConnect_(); + })); + } + c.prototype.getPolyfillDisplays = function() { + if (this._polyfillDisplaysPopulated) return this.polyfillDisplays; + if (i()) { + var e1 = new a({ + ADDITIONAL_VIEWERS: this.config.ADDITIONAL_VIEWERS, + DEFAULT_VIEWER: this.config.DEFAULT_VIEWER, + MOBILE_WAKE_LOCK: this.config.MOBILE_WAKE_LOCK, + DEBUG: this.config.DEBUG, + DPDB_URL: this.config.DPDB_URL, + CARDBOARD_UI_DISABLED: this.config.CARDBOARD_UI_DISABLED, + K_FILTER: this.config.K_FILTER, + PREDICTION_TIME_S: this.config.PREDICTION_TIME_S, + ROTATE_INSTRUCTIONS_DISABLED: this.config.ROTATE_INSTRUCTIONS_DISABLED, + YAW_ONLY: this.config.YAW_ONLY, + BUFFER_SCALE: this.config.BUFFER_SCALE, + DIRTY_SUBMIT_FRAME_BINDINGS: this.config.DIRTY_SUBMIT_FRAME_BINDINGS + }); + this.polyfillDisplays.push(e1); + } + return this._polyfillDisplaysPopulated = !0, this.polyfillDisplays; + }, c.prototype.enable = function() { + if (this.enabled = !0, this.hasNative && this.native.VRFrameData) { + var e1 = this.native.VRFrameData, t = new this.native.VRFrameData, n = this.native.VRDisplay.prototype.getFrameData; + window.VRDisplay.prototype.getFrameData = function(i) { + i instanceof e1 ? n.call(this, i) : (n.call(this, t), i.pose = t.pose, r(t.leftProjectionMatrix, i.leftProjectionMatrix), r(t.rightProjectionMatrix, i.rightProjectionMatrix), r(t.leftViewMatrix, i.leftViewMatrix), r(t.rightViewMatrix, i.rightViewMatrix)); + }; + } + navigator.getVRDisplays = this.getVRDisplays.bind(this), window.VRDisplay = a.VRDisplay, window.VRFrameData = a.VRFrameData; + }, c.prototype.getVRDisplays = function() { + var e1 = this; + return this.config, this.hasNative ? this.native.getVRDisplays.call(navigator).then(function(t) { + return t.length > 0 ? t : e1.getPolyfillDisplays(); + }) : Promise.resolve(this.getPolyfillDisplays()); + }, c.version = "0.10.12", c.VRFrameData = a.VRFrameData, c.VRDisplay = a.VRDisplay; + var h = Object.freeze({ + default: c + }), u = h && c || h; + return void 0 !== e1 && e1.window && (e1.document || (e1.document = e1.window.document), e1.navigator || (e1.navigator = e1.window.navigator)), u; + }(); + }, + 9443: (e1)=>{ + var t = /\n/, n = "\n", i = /\s/; + function r(e1, t, n, i) { + var r = e1.indexOf(t, n); + return -1 === r || r > i ? i : r; + } + function s(e1) { + return i.test(e1); + } + function o(e1, t, n, i) { + return { + start: t, + end: t + Math.min(i, n - t) + }; + } + e1.exports = function(t, n) { + return e1.exports.lines(t, n).map(function(e1) { + return t.substring(e1.start, e1.end); + }).join("\n"); + }, e1.exports.lines = function(e1, i) { + if (0 === (i = i || {}).width && "nowrap" !== i.mode) return []; + e1 = e1 || ""; + var a = "number" == typeof i.width ? i.width : Number.MAX_VALUE, l = Math.max(0, i.start || 0), c = "number" == typeof i.end ? i.end : e1.length, h = i.mode, u = i.measure || o; + return "pre" === h ? function(e1, n, i, r, s) { + for(var o = [], a = i, l = i; l < r && l < n.length; l++){ + var c = n.charAt(l), h = t.test(c); + if (h || l === r - 1) { + var u = e1(n, a, h ? l : l + 1, s); + o.push(u), a = l + 1; + } + } + return o; + }(u, e1, l, c, a) : function(e1, t, i, o, a, l) { + var c = [], h = a; + for("nowrap" === l && (h = Number.MAX_VALUE); i < o && i < t.length;){ + for(var u = r(t, n, i, o); i < u && s(t.charAt(i));)i++; + var d = e1(t, i, u, h), p = i + (d.end - d.start), A = p + n.length; + if (p < u) { + for(; p > i && !s(t.charAt(p));)p--; + if (p === i) A > i + n.length && A--, p = A; + else for(A = p; p > i && s(t.charAt(p - n.length));)p--; + } + if (p >= i) { + var f = e1(t, i, p, h); + c.push(f); + } + i = A; + } + return c; + }(u, e1, l, c, a, h); + }; + }, + 7377: (e1, t, n)=>{ + "use strict"; + var i = n(1192), r = n(6534), s = n(9069), o = n(2786); + function a(e1, t, n) { + var i = e1; + return r(t) ? (n = t, "string" == typeof e1 && (i = { + uri: e1 + })) : i = o(t, { + uri: e1 + }), i.callback = n, i; + } + function l(e1, t, n) { + return c(t = a(e1, t, n)); + } + function c(e1) { + if (void 0 === e1.callback) throw new Error("callback argument missing"); + var t = !1, n = function(n, i, r) { + t || (t = !0, e1.callback(n, i, r)); + }; + function i() { + var e1 = void 0; + if (e1 = h.response ? h.response : h.responseText || function(e1) { + try { + if ("document" === e1.responseType) return e1.responseXML; + var t = e1.responseXML && "parsererror" === e1.responseXML.documentElement.nodeName; + if ("" === e1.responseType && !t) return e1.responseXML; + } catch (e1) {} + return null; + }(h), g) try { + e1 = JSON.parse(e1); + } catch (e1) {} + return e1; + } + function r(e1) { + return clearTimeout(u), e1 instanceof Error || (e1 = new Error("" + (e1 || "Unknown XMLHttpRequest Error"))), e1.statusCode = 0, n(e1, v); + } + function o() { + if (!c) { + var t; + clearTimeout(u), t = e1.useXDR && void 0 === h.status ? 200 : 1223 === h.status ? 204 : h.status; + var r = v, o = null; + return 0 !== t ? (r = { + body: i(), + statusCode: t, + method: p, + headers: {}, + url: d, + rawRequest: h + }, h.getAllResponseHeaders && (r.headers = s(h.getAllResponseHeaders()))) : o = new Error("Internal XMLHttpRequest Error"), n(o, r, r.body); + } + } + var a, c, h = e1.xhr || null; + h || (h = e1.cors || e1.useXDR ? new l.XDomainRequest : new l.XMLHttpRequest); + var u, d = h.url = e1.uri || e1.url, p = h.method = e1.method || "GET", A = e1.body || e1.data, f = h.headers = e1.headers || {}, m = !!e1.sync, g = !1, v = { + body: void 0, + headers: {}, + statusCode: 0, + method: p, + url: d, + rawRequest: h + }; + if ("json" in e1 && !1 !== e1.json && (g = !0, f.accept || f.Accept || (f.Accept = "application/json"), "GET" !== p && "HEAD" !== p && (f["content-type"] || f["Content-Type"] || (f["Content-Type"] = "application/json"), A = JSON.stringify(!0 === e1.json ? A : e1.json))), h.onreadystatechange = function() { + 4 === h.readyState && setTimeout(o, 0); + }, h.onload = o, h.onerror = r, h.onprogress = function() {}, h.onabort = function() { + c = !0; + }, h.ontimeout = r, h.open(p, d, !m, e1.username, e1.password), m || (h.withCredentials = !!e1.withCredentials), !m && e1.timeout > 0 && (u = setTimeout(function() { + if (!c) { + c = !0, h.abort("timeout"); + var e1 = new Error("XMLHttpRequest timeout"); + e1.code = "ETIMEDOUT", r(e1); + } + }, e1.timeout)), h.setRequestHeader) for(a in f)f.hasOwnProperty(a) && h.setRequestHeader(a, f[a]); + else if (e1.headers && !function(e1) { + for(var t in e1)if (e1.hasOwnProperty(t)) return !1; + return !0; + }(e1.headers)) throw new Error("Headers cannot be set on an XDomainRequest object"); + return "responseType" in e1 && (h.responseType = e1.responseType), "beforeSend" in e1 && "function" == typeof e1.beforeSend && e1.beforeSend(h), h.send(A || null), h; + } + e1.exports = l, e1.exports.default = l, l.XMLHttpRequest = i.XMLHttpRequest || function() {}, l.XDomainRequest = "withCredentials" in new l.XMLHttpRequest ? l.XMLHttpRequest : i.XDomainRequest, function(e1, t) { + for(var n = 0; n < e1.length; n++)t(e1[n]); + }([ + "get", + "put", + "post", + "patch", + "head", + "delete" + ], function(e1) { + l["delete" === e1 ? "del" : e1] = function(t, n, i) { + return (n = a(t, n, i)).method = e1.toUpperCase(), c(n); + }; + }); + }, + 6774: (e1)=>{ + e1.exports = void 0 !== self.DOMParser ? function(e1) { + return (new self.DOMParser).parseFromString(e1, "application/xml"); + } : void 0 !== self.ActiveXObject && new self.ActiveXObject("Microsoft.XMLDOM") ? function(e1) { + var t = new self.ActiveXObject("Microsoft.XMLDOM"); + return t.async = "false", t.loadXML(e1), t; + } : function(e1) { + var t = document.createElement("div"); + return t.innerHTML = e1, t; + }; + }, + 2786: (e1)=>{ + e1.exports = function() { + for(var e1 = {}, n = 0; n < arguments.length; n++){ + var i = arguments[n]; + for(var r in i)t.call(i, r) && (e1[r] = i[r]); + } + return e1; + }; + var t = Object.prototype.hasOwnProperty; + }, + 9715: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(8903).debug("components:anchored:warn"); + e1.exports.Component = i("anchored", { + schema: { + persistent: { + default: !1 + } + }, + init: function() { + var e1 = this.el.sceneEl.getAttribute("webxr"), t = e1.optionalFeatures; + -1 === t.indexOf("anchors") && (t.push("anchors"), this.el.sceneEl.setAttribute("webxr", e1)), this.auxQuaternion = new THREE.Quaternion, this.onEnterVR = this.onEnterVR.bind(this), this.el.sceneEl.addEventListener("enter-vr", this.onEnterVR); + }, + onEnterVR: function() { + this.anchor = void 0, this.requestPersistentAnchorPending = this.data.persistent, this.requestAnchorPending = !this.data.persistent; + }, + tick: function() { + var e1, t, n, i = this.el.sceneEl, r = i.renderer.xr, s = this.el.object3D; + (i.is("ar-mode") || i.is("vr-mode")) && (!this.anchor && this.requestPersistentAnchorPending && this.restorePersistentAnchor(), !this.anchor && this.requestAnchorPending && this.createAnchor(), this.anchor && (e1 = i.frame, t = r.getReferenceSpace(), n = e1.getPose(this.anchor.anchorSpace, t), s.matrix.elements = n.transform.matrix, s.matrix.decompose(s.position, s.rotation, s.scale))); + }, + createAnchor: async function(e1, t) { + var n, i, s, o, a = this.el.sceneEl, l = a.renderer.xr, c = this.el.object3D; + e1 = e1 || c.position, t = t || this.auxQuaternion.setFromEuler(c.rotation), function(e1) { + var t = e1.renderer.xr.getSession(); + return t && t.restorePersistentAnchor; + }(a) ? (this.anchor && this.deleteAnchor(), n = a.frame, i = l.getReferenceSpace(), s = new XRRigidTransform({ + x: e1.x, + y: e1.y, + z: e1.z + }, { + x: t.x, + y: t.y, + z: t.z, + w: t.w + }), this.requestAnchorPending = !1, o = await n.createAnchor(s, i), this.data.persistent && (this.el.id ? (this.persistentHandle = await o.requestPersistentHandle(), localStorage.setItem(this.el.id, this.persistentHandle)) : r("The anchor won't be persisted because the entity has no assigned id.")), a.object3D.attach(this.el.object3D), this.anchor = o) : r("This browser doesn't support the WebXR anchors module"); + }, + restorePersistentAnchor: async function() { + var e1, t = this.el.sceneEl.renderer.xr.getSession(), n = t.persistentAnchors; + if (this.requestPersistentAnchorPending = !1, !this.el.id) return r("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."), void (this.requestAnchorPending = !0); + if (n) { + e1 = localStorage.getItem(this.el.id); + for(var i = 0; i < n.length; ++i)if (e1 === n[i]) { + this.anchor = await t.restorePersistentAnchor(n[i]), this.anchor && (this.persistentHandle = n[i]); + break; + } + this.anchor || (this.requestAnchorPending = !0); + } else this.requestPersistentAnchorPending = !0; + }, + deleteAnchor: function() { + var e1, t = this.anchor; + t && (e1 = this.el.sceneEl.renderer.xr.getSession(), t.delete(), this.el.sceneEl.object3D.add(this.el.object3D), this.persistentHandle && e1.deletePersistentAnchor(this.persistentHandle), this.anchor = void 0); + } + }); + }, + 4649: (e1, t, n)=>{ + var i = n(2446).Z, r = n(3515).components, s = n(3515).registerComponent, o = n(2666), a = n(8903), l = new o.Color, c = new o.Color, h = a.entity.getComponentProperty, u = a.entity.setComponentProperty, d = {}, p = "color", A = "rotation", f = "scale", m = "components"; + function g(e1) { + e1.x = o.MathUtils.degToRad(e1.x), e1.y = o.MathUtils.degToRad(e1.y), e1.z = o.MathUtils.degToRad(e1.z); + } + function v(e1, t, n) { + var i; + for(i = 0; i < t.length; i++)e1.addEventListener(t[i], n); + } + function y(e1, t, n) { + var i; + for(i = 0; i < t.length; i++)e1.removeEventListener(t[i], n); + } + function E(e1, t) { + var n, i, r; + for(i = x(t), r = e1, n = 0; n < i.length; n++)r = r[i[n]]; + if (void 0 === r) throw console.log(e1), new Error("[animation] property (" + t + ") could not be found"); + return r; + } + function b(e1, t, n, i) { + var r, s, a, l; + for(t.startsWith("object3D.rotation") && (n = o.MathUtils.degToRad(n)), s = x(t), l = e1, r = 0; r < s.length - 1; r++)l = l[s[r]]; + a = s[s.length - 1], i !== p ? l[a] = n : "r" in l[a] ? (l[a].r = n.r, l[a].g = n.g, l[a].b = n.b) : (l[a].x = n.r, l[a].y = n.g, l[a].z = n.b); + } + function x(e1) { + return e1 in d || (d[e1] = e1.split(".")), d[e1]; + } + function C(e1) { + return e1.isRawProperty || e1.property.startsWith(m) || e1.property.startsWith("object3D"); + } + e1.exports.Component = s("animation", { + schema: { + autoplay: { + default: !0 + }, + delay: { + default: 0 + }, + dir: { + default: "" + }, + dur: { + default: 1e3 + }, + easing: { + default: "easeInQuad" + }, + elasticity: { + default: 400 + }, + enabled: { + default: !0 + }, + from: { + default: "" + }, + loop: { + default: 0, + parse: function(e1) { + return !0 === e1 || "true" === e1 || !1 !== e1 && "false" !== e1 && parseInt(e1, 10); + } + }, + property: { + default: "" + }, + startEvents: { + type: "array" + }, + pauseEvents: { + type: "array" + }, + resumeEvents: { + type: "array" + }, + round: { + default: !1 + }, + to: { + default: "" + }, + type: { + default: "" + }, + isRawProperty: { + default: !1 + } + }, + multiple: !0, + init: function() { + var e1 = this; + this.eventDetail = { + name: this.attrName + }, this.time = 0, this.animation = null, this.animationIsPlaying = !1, this.onStartEvent = this.onStartEvent.bind(this), this.beginAnimation = this.beginAnimation.bind(this), this.pauseAnimation = this.pauseAnimation.bind(this), this.resumeAnimation = this.resumeAnimation.bind(this), this.fromColor = {}, this.toColor = {}, this.targets = {}, this.targetsArray = [], this.updateConfigForDefault = this.updateConfigForDefault.bind(this), this.updateConfigForRawColor = this.updateConfigForRawColor.bind(this), this.config = { + complete: function() { + e1.animationIsPlaying = !1, e1.el.emit("animationcomplete", e1.eventDetail, !1), e1.id && e1.el.emit("animationcomplete__" + e1.id, e1.eventDetail, !1); + } + }; + }, + update: function(e1) { + var t = this.config, n = this.data; + this.animationIsPlaying = !1, this.data.enabled && n.property && (t.autoplay = !1, t.direction = n.dir, t.duration = n.dur, t.easing = n.easing, t.elasticity = n.elasticity, t.loop = n.loop, t.round = n.round, this.createAndStartAnimation()); + }, + tick: function(e1, t) { + this.animationIsPlaying && (this.time += t, this.animation.tick(this.time)); + }, + remove: function() { + this.pauseAnimation(), this.removeEventListeners(); + }, + pause: function() { + this.paused = !0, this.pausedWasPlaying = this.animationIsPlaying, this.pauseAnimation(), this.removeEventListeners(); + }, + play: function() { + this.paused && (this.paused = !1, this.addEventListeners(), this.pausedWasPlaying && (this.resumeAnimation(), this.pausedWasPlaying = !1)); + }, + createAndStartAnimation: function() { + var e1 = this.data; + this.updateConfig(), this.animationIsPlaying = !1, this.animation = i(this.config), this.animation.began = !0, this.removeEventListeners(), this.addEventListeners(), !e1.autoplay || e1.startEvents && e1.startEvents.length || (e1.delay ? setTimeout(this.beginAnimation, e1.delay) : this.beginAnimation()); + }, + beginAnimation: function() { + this.updateConfig(), this.animation.began = !0, this.time = 0, this.animationIsPlaying = !0, this.stopRelatedAnimations(), this.el.emit("animationbegin", this.eventDetail, !1); + }, + pauseAnimation: function() { + this.animationIsPlaying = !1; + }, + resumeAnimation: function() { + this.animationIsPlaying = !0; + }, + onStartEvent: function() { + this.data.enabled && (this.updateConfig(), this.animation && this.animation.pause(), this.animation = i(this.config), this.data.delay ? setTimeout(this.beginAnimation, this.data.delay) : this.beginAnimation()); + }, + updateConfigForRawColor: function() { + var e1, t, n, i = this.config, r = this.data, s = this.el; + if (!this.waitComponentInitRawProperty(this.updateConfigForRawColor)) { + for(t in e1 = "" === r.from ? E(s, r.property) : r.from, n = r.to, this.setColorConfig(e1, n), e1 = this.fromColor, n = this.toColor, this.targetsArray.length = 0, this.targetsArray.push(e1), i.targets = this.targetsArray, n)i[t] = n[t]; + var o; + i.update = (o = {}, function(e1) { + var t; + (t = e1.animatables[0].target).r === o.r && t.g === o.g && t.b === o.b || b(s, r.property, t, r.type); + }); + } + }, + updateConfigForDefault: function() { + var e1, t, n, i, r = this.config, s = this.data, o = this.el; + this.waitComponentInitRawProperty(this.updateConfigForDefault) || (e1 = "" === s.from ? C(s) ? E(o, s.property) : h(o, s.property) : s.from, n = s.to, isNaN(e1 || n) ? (e1 = e1 ? e1.toString() : e1, n = n ? n.toString() : n) : (e1 = parseFloat(e1), n = parseFloat(n)), (t = "true" === s.to || "false" === s.to || !0 === s.to || !1 === s.to) && (e1 = "true" === s.from || !0 === s.from ? 1 : 0, n = "true" === s.to || !0 === s.to ? 1 : 0), this.targets.aframeProperty = e1, r.targets = this.targets, r.aframeProperty = n, r.update = function(e1) { + var n; + (n = e1.animatables[0].target.aframeProperty) !== i && (i = n, t && (n = n >= 1), C(s) ? b(o, s.property, n, s.type) : u(o, s.property, n)); + }); + }, + updateConfigForVector: function() { + var e1, t, n, i, r = this.config, s = this.data, o = this.el; + for(e1 in t = "" !== s.from ? a.coordinates.parse(s.from) : h(o, s.property), n = a.coordinates.parse(s.to), s.property === A && (g(t), g(n)), this.targetsArray.length = 0, this.targetsArray.push(t), r.targets = this.targetsArray, n)r[e1] = n[e1]; + "position" !== s.property && s.property !== A && s.property !== f ? r.update = function() { + var e1 = {}; + return function(t) { + var n = t.animatables[0].target; + n.x === e1.x && n.y === e1.y && n.z === e1.z || (e1.x = n.x, e1.y = n.y, e1.z = n.z, u(o, s.property, n)); + }; + }() : r.update = (i = {}, function(e1) { + var t = e1.animatables[0].target; + s.property === f && (t.x = Math.max(1e-4, t.x), t.y = Math.max(1e-4, t.y), t.z = Math.max(1e-4, t.z)), t.x === i.x && t.y === i.y && t.z === i.z || (i.x = t.x, i.y = t.y, i.z = t.z, o.object3D[s.property].set(t.x, t.y, t.z)); + }); + }, + updateConfig: function() { + var e1, t, n, i, s, o, a; + t = this.el, n = this.data.property, s = (o = n.split("."))[0], a = o[1], e1 = (i = t.components[s] || r[s]) ? a && !i.schema[a] ? null : a ? i.schema[a].type : i.schema.type : null, C(this.data) && this.data.type === p ? this.updateConfigForRawColor() : "vec2" === e1 || "vec3" === e1 || "vec4" === e1 ? this.updateConfigForVector() : this.updateConfigForDefault(); + }, + waitComponentInitRawProperty: function(e1) { + var t, n = this.data, r = this.el, s = this; + return "" === n.from && !!n.property.startsWith(m) && (t = x(n.property)[1], !r.components[t] && (r.addEventListener("componentinitialized", function n(o) { + o.detail.name === t && (e1(), s.animation = i(s.config), r.removeEventListener("componentinitialized", n)); + }), !0)); + }, + stopRelatedAnimations: function() { + var e1, t; + for(t in this.el.components)e1 = this.el.components[t], t !== this.attrName && "animation" === e1.name && e1.animationIsPlaying && e1.data.property === this.data.property && (e1.animationIsPlaying = !1); + }, + addEventListeners: function() { + var e1 = this.data, t = this.el; + v(t, e1.startEvents, this.onStartEvent), v(t, e1.pauseEvents, this.pauseAnimation), v(t, e1.resumeEvents, this.resumeAnimation); + }, + removeEventListeners: function() { + var e1 = this.data, t = this.el; + y(t, e1.startEvents, this.onStartEvent), y(t, e1.pauseEvents, this.pauseAnimation), y(t, e1.resumeEvents, this.resumeAnimation); + }, + setColorConfig: function(e1, t) { + l.set(e1), c.set(t), e1 = this.fromColor, t = this.toColor, e1.r = l.r, e1.g = l.g, e1.b = l.b, t.r = c.r, t.g = c.g, t.b = c.b; + } + }); + }, + 9541: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(2666); + e1.exports.Component = i("camera", { + schema: { + active: { + default: !0 + }, + far: { + default: 1e4 + }, + fov: { + default: 80, + min: 0 + }, + near: { + default: .005, + min: 0 + }, + spectator: { + default: !1 + }, + zoom: { + default: 1, + min: 0 + } + }, + init: function() { + var e1, t = this.el; + e1 = this.camera = new r.PerspectiveCamera, t.setObject3D("camera", e1); + }, + update: function(e1) { + var t = this.data, n = this.camera; + n.aspect = t.aspect || window.innerWidth / window.innerHeight, n.far = t.far, n.fov = t.fov, n.near = t.near, n.zoom = t.zoom, n.updateProjectionMatrix(), this.updateActiveCamera(e1), this.updateSpectatorCamera(e1); + }, + updateActiveCamera: function(e1) { + var t = this.data, n = this.el, i = this.system; + e1 && e1.active === t.active || t.spectator || (t.active && i.activeCameraEl !== n ? i.setActiveCamera(n) : t.active || i.activeCameraEl !== n || i.disableActiveCamera()); + }, + updateSpectatorCamera: function(e1) { + var t = this.data, n = this.el, i = this.system; + e1 && e1.spectator === t.spectator || (t.spectator && i.spectatorCameraEl !== n ? i.setSpectatorCamera(n) : t.spectator || i.spectatorCameraEl !== n || i.disableSpectatorCamera()); + }, + remove: function() { + this.el.removeObject3D("camera"); + } + }); + }, + 57: (e1, t, n)=>{ + var i, r, s, o, a = n(3515).registerComponent, l = n(8903), c = l.bind, h = "click", u = "mouseup", d = "cursor-fusing", p = "cursor-hovering", A = "cursor-hovered", f = { + DOWN: [ + "mousedown", + "touchstart" + ], + UP: [ + "mouseup", + "touchend" + ] + }, m = { + DOWN: [ + "selectstart" + ], + UP: [ + "selectend" + ] + }, g = "a-mouse-cursor-hover"; + e1.exports.Component = a("cursor", { + dependencies: [ + "raycaster" + ], + schema: { + downEvents: { + default: [] + }, + fuse: { + default: l.device.isMobile() + }, + fuseTimeout: { + default: 1500, + min: 0 + }, + mouseCursorStylesEnabled: { + default: !0 + }, + upEvents: { + default: [] + }, + rayOrigin: { + default: "entity", + oneOf: [ + "mouse", + "entity", + "xrselect" + ] + } + }, + multiple: !0, + init: function() { + var e1 = this; + this.fuseTimeout = void 0, this.cursorDownEl = null, this.intersectedEl = null, this.canvasBounds = document.body.getBoundingClientRect(), this.isCursorDown = !1, this.activeXRInput = null, this.updateCanvasBounds = l.debounce(function() { + e1.canvasBounds = e1.el.sceneEl.canvas.getBoundingClientRect(); + }, 500), this.eventDetail = {}, this.intersectedEventDetail = { + cursorEl: this.el + }, this.onCursorDown = c(this.onCursorDown, this), this.onCursorUp = c(this.onCursorUp, this), this.onIntersection = c(this.onIntersection, this), this.onIntersectionCleared = c(this.onIntersectionCleared, this), this.onMouseMove = c(this.onMouseMove, this), this.onEnterVR = c(this.onEnterVR, this); + }, + update: function(e1) { + this.data.rayOrigin !== e1.rayOrigin && this.updateMouseEventListeners(); + }, + tick: function() { + var e1 = this.el.sceneEl.frame, t = this.activeXRInput; + "xrselect" === this.data.rayOrigin && e1 && t && this.onMouseMove({ + frame: e1, + inputSource: t, + type: "fakeselectevent" + }); + }, + play: function() { + this.addEventListeners(); + }, + pause: function() { + this.removeEventListeners(); + }, + remove: function() { + var e1 = this.el; + e1.removeState(p), e1.removeState(d), clearTimeout(this.fuseTimeout), this.intersectedEl && this.intersectedEl.removeState(A), this.removeEventListeners(); + }, + addEventListeners: function() { + var e1, t = this.data, n = this.el, i = this; + function r() { + e1 = n.sceneEl.canvas, t.downEvents.length || t.upEvents.length || (f.DOWN.forEach(function(t) { + e1.addEventListener(t, i.onCursorDown); + }), f.UP.forEach(function(t) { + e1.addEventListener(t, i.onCursorUp); + })); + } + (e1 = n.sceneEl.canvas) ? r() : n.sceneEl.addEventListener("render-target-loaded", r), t.downEvents.forEach(function(e1) { + n.addEventListener(e1, i.onCursorDown); + }), t.upEvents.forEach(function(e1) { + n.addEventListener(e1, i.onCursorUp); + }), n.addEventListener("raycaster-intersection", this.onIntersection), n.addEventListener("raycaster-closest-entity-changed", this.onIntersection), n.addEventListener("raycaster-intersection-cleared", this.onIntersectionCleared), n.sceneEl.addEventListener("rendererresize", this.updateCanvasBounds), n.sceneEl.addEventListener("enter-vr", this.onEnterVR), window.addEventListener("resize", this.updateCanvasBounds), window.addEventListener("scroll", this.updateCanvasBounds), this.updateMouseEventListeners(); + }, + removeEventListeners: function() { + var e1, t = this.data, n = this.el, i = this; + !(e1 = n.sceneEl.canvas) || t.downEvents.length || t.upEvents.length || (f.DOWN.forEach(function(t) { + e1.removeEventListener(t, i.onCursorDown); + }), f.UP.forEach(function(t) { + e1.removeEventListener(t, i.onCursorUp); + })), t.downEvents.forEach(function(e1) { + n.removeEventListener(e1, i.onCursorDown); + }), t.upEvents.forEach(function(e1) { + n.removeEventListener(e1, i.onCursorUp); + }), n.removeEventListener("raycaster-intersection", this.onIntersection), n.removeEventListener("raycaster-intersection-cleared", this.onIntersectionCleared), e1.removeEventListener("mousemove", this.onMouseMove), e1.removeEventListener("touchstart", this.onMouseMove), e1.removeEventListener("touchmove", this.onMouseMove), n.sceneEl.removeEventListener("rendererresize", this.updateCanvasBounds), n.sceneEl.removeEventListener("enter-vr", this.onEnterVR), window.removeEventListener("resize", this.updateCanvasBounds), window.removeEventListener("scroll", this.updateCanvasBounds); + }, + updateMouseEventListeners: function() { + var e1, t = this.el; + (e1 = t.sceneEl.canvas).removeEventListener("mousemove", this.onMouseMove), e1.removeEventListener("touchmove", this.onMouseMove), t.setAttribute("raycaster", "useWorldCoordinates", !1), "mouse" === this.data.rayOrigin && (e1.addEventListener("mousemove", this.onMouseMove, !1), e1.addEventListener("touchmove", this.onMouseMove, !1), t.setAttribute("raycaster", "useWorldCoordinates", !0), this.updateCanvasBounds()); + }, + onMouseMove: (i = new THREE.Vector3, r = new THREE.Vector2, s = new THREE.Vector3, o = { + origin: s, + direction: i + }, function(e1) { + var t, n, a, l, c, h, u, d = this.canvasBounds, p = this.el.sceneEl.camera; + p.parent.updateMatrixWorld(), t = (n = "touchmove" === e1.type || "touchstart" === e1.type ? e1.touches.item(0) : e1).clientX - d.left, a = n.clientY - d.top, r.x = t / d.width * 2 - 1, r.y = -a / d.height * 2 + 1, "xrselect" !== this.data.rayOrigin || "selectstart" !== e1.type && "fakeselectevent" !== e1.type ? "fakeselectout" === e1.type ? (i.set(0, 1, 0), s.set(0, 9999, 0)) : p && p.isPerspectiveCamera ? (s.setFromMatrixPosition(p.matrixWorld), i.set(r.x, r.y, .5).unproject(p).sub(s).normalize()) : p && p.isOrthographicCamera ? (s.set(r.x, r.y, (p.near + p.far) / (p.near - p.far)).unproject(p), i.set(0, 0, -1).transformDirection(p.matrixWorld)) : console.error("AFRAME.Raycaster: Unsupported camera type: " + p.type) : (l = e1.frame, c = e1.inputSource, h = this.el.renderer.xr.getReferenceSpace(), u = l.getPose(c.targetRaySpace, h).transform, i.set(0, 0, -1), i.applyQuaternion(u.orientation), s.copy(u.position)), this.el.setAttribute("raycaster", o), "touchmove" === e1.type && e1.preventDefault(); + }), + onCursorDown: function(e1) { + this.isCursorDown = !0, "mouse" === this.data.rayOrigin && "touchstart" === e1.type && (this.onMouseMove(e1), this.el.components.raycaster.checkIntersections(), e1.preventDefault()), "xrselect" === this.data.rayOrigin && "selectstart" === e1.type && (this.activeXRInput = e1.inputSource, this.onMouseMove(e1), this.el.components.raycaster.checkIntersections(), this.el.components.raycaster.intersectedEls.length && void 0 !== this.el.sceneEl.components["ar-hit-test"] && this.el.sceneEl.getAttribute("ar-hit-test").enabled && (this.el.sceneEl.setAttribute("ar-hit-test", "enabled", !1), this.reenableARHitTest = !0)), this.twoWayEmit("mousedown", e1), this.cursorDownEl = this.intersectedEl; + }, + onCursorUp: function(e1) { + if (this.isCursorDown) { + this.isCursorDown = !1; + var t = this.data; + this.twoWayEmit(u, e1), !0 === this.reenableARHitTest && (this.el.sceneEl.setAttribute("ar-hit-test", "enabled", !0), this.reenableARHitTest = void 0), this.cursorDownEl && this.cursorDownEl !== this.intersectedEl && (this.intersectedEventDetail.intersection = null, this.cursorDownEl.emit(u, this.intersectedEventDetail)), t.fuse && "mouse" !== t.rayOrigin && "xrselect" !== t.rayOrigin || !this.intersectedEl || this.cursorDownEl !== this.intersectedEl || this.twoWayEmit(h, e1), "xrselect" === t.rayOrigin && this.activeXRInput === e1.inputSource && this.onMouseMove({ + type: "fakeselectout" + }), this.activeXRInput = null, this.cursorDownEl = null, "touchend" === e1.type && e1.preventDefault(); + } + }, + onIntersection: function(e1) { + var t, n, i, r, s = this.el; + n = e1.detail.els[0] === s ? 1 : 0, r = e1.detail.intersections[n], (i = e1.detail.els[n]) && this.intersectedEl !== i && (this.intersectedEl && (t = this.el.components.raycaster.getIntersection(this.intersectedEl)) && t.distance <= r.distance || (this.clearCurrentIntersection(!0), this.setIntersection(i, r))); + }, + onIntersectionCleared: function(e1) { + -1 !== e1.detail.clearedEls.indexOf(this.intersectedEl) && this.clearCurrentIntersection(); + }, + onEnterVR: function() { + this.clearCurrentIntersection(!0); + var e1 = this.el.sceneEl.xrSession, t = this; + e1 && "mouse" !== this.data.rayOrigin && (m.DOWN.forEach(function(n) { + e1.addEventListener(n, t.onCursorDown); + }), m.UP.forEach(function(n) { + e1.addEventListener(n, t.onCursorUp); + })); + }, + setIntersection: function(e1, t) { + var n = this.el, i = this.data, r = this; + this.intersectedEl !== e1 && (this.intersectedEl = e1, n.addState(p), e1.addState(A), this.twoWayEmit("mouseenter"), this.data.mouseCursorStylesEnabled && "mouse" === this.data.rayOrigin && this.el.sceneEl.canvas.classList.add(g), 0 !== i.fuseTimeout && i.fuse && "xrselect" !== i.rayOrigin && "mouse" !== i.rayOrigin && (n.addState(d), this.twoWayEmit("fusing"), this.fuseTimeout = setTimeout(function() { + n.removeState(d), r.twoWayEmit(h); + }, i.fuseTimeout))); + }, + clearCurrentIntersection: function(e1) { + var t, n, i = this.el; + this.intersectedEl && (this.intersectedEl.removeState(A), i.removeState(p), i.removeState(d), this.twoWayEmit("mouseleave"), this.data.mouseCursorStylesEnabled && "mouse" === this.data.rayOrigin && this.el.sceneEl.canvas.classList.remove(g), this.intersectedEl = null, clearTimeout(this.fuseTimeout), !0 !== e1 && 0 !== (n = this.el.components.raycaster.intersections).length && (t = n[n[0].object.el === i ? 1 : 0]) && this.setIntersection(t.object.el, t)); + }, + twoWayEmit: function(e1, t) { + var n, i = this.el, r = this.intersectedEl; + function s(e1, n) { + t instanceof MouseEvent ? e1.mouseEvent = t : "undefined" != typeof TouchEvent && t instanceof TouchEvent && (e1.touchEvent = t); + } + n = this.el.components.raycaster.getIntersection(r), this.eventDetail.intersectedEl = r, this.eventDetail.intersection = n, s(this.eventDetail), i.emit(e1, this.eventDetail), r && (this.intersectedEventDetail.intersection = n, s(this.intersectedEventDetail), r.emit(e1, this.intersectedEventDetail)); + } + }); + }, + 9577: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(7629), s = n(6600), o = s.checkControllerPresentAndSetup, a = s.emitIfAxesChanged, l = s.onButtonEvent, c = "generic"; + e1.exports.Component = i("generic-tracked-controller-controls", { + schema: { + hand: { + default: "" + }, + defaultModel: { + default: !0 + }, + defaultModelColor: { + default: "gray" + }, + orientationOffset: { + type: "vec3" + }, + disabled: { + default: !1 + } + }, + mapping: { + axes: { + touchpad: [ + 0, + 1 + ], + thumbstick: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "squeeze", + "touchpad", + "thumbstick" + ] + }, + bindMethods: function() { + this.onControllersUpdate = r(this.onControllersUpdate, this), this.checkIfControllerPresent = r(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = r(this.removeControllersUpdateListener, this), this.onAxisMoved = r(this.onAxisMoved, this); + }, + init: function() { + var e1 = this; + this.onButtonChanged = r(this.onButtonChanged, this), this.onButtonDown = function(t) { + l(t.detail.id, "down", e1); + }, this.onButtonUp = function(t) { + l(t.detail.id, "up", e1); + }, this.onButtonTouchStart = function(t) { + l(t.detail.id, "touchstart", e1); + }, this.onButtonTouchEnd = function(t) { + l(t.detail.id, "touchend", e1); + }, this.controllerPresent = !1, this.wasControllerConnected = !1, this.lastControllerCheck = 0, this.bindMethods(), this.el.addEventListener("controllerconnected", function(t) { + t.detail.name !== e1.name && (e1.wasControllerConnected = !0, e1.removeEventListeners(), e1.removeControllersUpdateListener()); + }); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + var e1 = this.data, t = e1.hand ? e1.hand : void 0; + o(this, c, { + hand: t, + iterateControllerProfiles: !0 + }); + }, + play: function() { + this.wasControllerConnected || (this.checkIfControllerPresent(), this.addControllersUpdateListener()); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + this.el.components["tracked-controls"] ? this.removeEventListeners() : (e1.setAttribute("tracked-controls", { + hand: t.hand, + idPrefix: c, + orientationOffset: t.orientationOffset, + iterateControllerProfiles: !0 + }), this.data.defaultModel && this.initDefaultModel()); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.wasControllerConnected && this.checkIfControllerPresent(); + }, + onButtonChanged: function(e1) { + var t = this.mapping.buttons[e1.detail.id]; + t && this.el.emit(t + "changed", e1.detail.state); + }, + onAxisMoved: function(e1) { + a(this, this.mapping.axes, e1); + }, + initDefaultModel: function() { + var e1 = this.modelEl = document.createElement("a-entity"); + e1.setAttribute("geometry", { + primitive: "sphere", + radius: .03 + }), e1.setAttribute("material", { + color: this.data.color + }), this.el.appendChild(e1), this.el.emit("controllermodelready", { + name: "generic-tracked-controller-controls", + model: this.modelEl, + rayOrigin: { + origin: { + x: 0, + y: 0, + z: -0.01 + }, + direction: { + x: 0, + y: 0, + z: -1 + } + } + }); + } + }); + }, + 2503: (e1, t, n)=>{ + var i = n(4863).xZ, r = n(4863).ib, s = n(3515).registerComponent, o = n(2666), a = new o.BufferGeometry; + e1.exports.Component = s("geometry", { + schema: { + buffer: { + default: !0 + }, + primitive: { + default: "box", + oneOf: r, + schemaChange: !0 + }, + skipCache: { + default: !1 + } + }, + init: function() { + this.geometry = null; + }, + update: function(e1) { + var t, n = this.data, i = this.el, r = this.system; + this.geometry && (r.unuseGeometry(e1), this.geometry = null), this.geometry = r.getOrCreateGeometry(n), (t = i.getObject3D("mesh")) ? t.geometry = this.geometry : ((t = new o.Mesh).geometry = this.geometry, this.el.getAttribute("material") || (t.material = new o.MeshStandardMaterial({ + color: 16777215 * Math.random(), + metalness: 0, + roughness: .5 + })), i.setObject3D("mesh", t)); + }, + remove: function() { + this.system.unuseGeometry(this.data), this.el.getObject3D("mesh").geometry = a, this.geometry = null; + }, + updateSchema: function(e1) { + var t = this.oldData && this.oldData.primitive, n = e1.primitive, r = i[n] && i[n].schema; + if (!r) throw new Error("Unknown geometry schema `" + n + "`"); + t && t === n || this.extendSchema(r); + } + }); + }, + 3647: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(2666), s = n(8903).debug("components:gltf-model:warn"); + e1.exports.Component = i("gltf-model", { + schema: { + type: "model" + }, + init: function() { + var e1 = this, t = this.system.getDRACOLoader(), n = this.system.getMeshoptDecoder(), i = this.system.getKTX2Loader(); + this.model = null, this.loader = new r.GLTFLoader, t && this.loader.setDRACOLoader(t), this.ready = n ? n.then(function(t) { + e1.loader.setMeshoptDecoder(t); + }) : Promise.resolve(), i && this.loader.setKTX2Loader(i); + }, + update: function() { + var e1 = this, t = this.el, n = this.data; + n && (this.remove(), this.ready.then(function() { + e1.loader.load(n, function(n) { + e1.model = n.scene || n.scenes[0], e1.model.animations = n.animations, t.setObject3D("mesh", e1.model), t.emit("model-loaded", { + format: "gltf", + model: e1.model + }); + }, void 0, function(e1) { + var i = e1 && e1.message ? e1.message : "Failed to load glTF model"; + s(i), t.emit("model-error", { + format: "gltf", + src: n + }); + }); + })); + }, + remove: function() { + this.model && this.el.removeObject3D("mesh"); + } + }); + }, + 3924: (e1, t, n)=>{ + (0, n(3515).registerComponent)("grabbable", { + init: function() { + this.el.setAttribute("obb-collider", "centerModel: true"); + } + }); + }, + 2346: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(8309).AFRAME_CDN_ROOT, s = { + toonLeft: r + "controllers/hands/leftHand.glb", + toonRight: r + "controllers/hands/rightHand.glb", + lowPolyLeft: r + "controllers/hands/leftHandLow.glb", + lowPolyRight: r + "controllers/hands/rightHandLow.glb", + highPolyLeft: r + "controllers/hands/leftHandHigh.glb", + highPolyRight: r + "controllers/hands/rightHandHigh.glb" + }, o = "Point", a = "Fist", l = "Thumb Up", c = {}; + function h(e1, t) { + var n; + if (e1) return "grip" === (n = c[e1]) ? n + (t ? "close" : "open") : "point" === n ? n + (t ? "up" : "down") : "pointing" === n || "pistol" === n ? n + (t ? "start" : "end") : void 0; + } + c[a] = "grip", c[l] = "pistol", c[o] = "pointing", e1.exports.Component = i("hand-controls", { + schema: { + color: { + default: "white", + type: "color" + }, + hand: { + default: "left" + }, + handModelStyle: { + default: "lowPoly", + oneOf: [ + "lowPoly", + "highPoly", + "toon" + ] + } + }, + init: function() { + var e1 = this, t = this.el; + this.pressedButtons = {}, this.touchedButtons = {}, this.loader = new THREE.GLTFLoader, this.loader.setCrossOrigin("anonymous"), this.onGripDown = function() { + e1.handleButton("grip", "down"); + }, this.onGripUp = function() { + e1.handleButton("grip", "up"); + }, this.onTrackpadDown = function() { + e1.handleButton("trackpad", "down"); + }, this.onTrackpadUp = function() { + e1.handleButton("trackpad", "up"); + }, this.onTrackpadTouchStart = function() { + e1.handleButton("trackpad", "touchstart"); + }, this.onTrackpadTouchEnd = function() { + e1.handleButton("trackpad", "touchend"); + }, this.onTriggerDown = function() { + e1.handleButton("trigger", "down"); + }, this.onTriggerUp = function() { + e1.handleButton("trigger", "up"); + }, this.onTriggerTouchStart = function() { + e1.handleButton("trigger", "touchstart"); + }, this.onTriggerTouchEnd = function() { + e1.handleButton("trigger", "touchend"); + }, this.onGripTouchStart = function() { + e1.handleButton("grip", "touchstart"); + }, this.onGripTouchEnd = function() { + e1.handleButton("grip", "touchend"); + }, this.onThumbstickDown = function() { + e1.handleButton("thumbstick", "down"); + }, this.onThumbstickUp = function() { + e1.handleButton("thumbstick", "up"); + }, this.onAorXTouchStart = function() { + e1.handleButton("AorX", "touchstart"); + }, this.onAorXTouchEnd = function() { + e1.handleButton("AorX", "touchend"); + }, this.onBorYTouchStart = function() { + e1.handleButton("BorY", "touchstart"); + }, this.onBorYTouchEnd = function() { + e1.handleButton("BorY", "touchend"); + }, this.onSurfaceTouchStart = function() { + e1.handleButton("surface", "touchstart"); + }, this.onSurfaceTouchEnd = function() { + e1.handleButton("surface", "touchend"); + }, this.onControllerConnected = this.onControllerConnected.bind(this), this.onControllerDisconnected = this.onControllerDisconnected.bind(this), t.addEventListener("controllerconnected", this.onControllerConnected), t.addEventListener("controllerdisconnected", this.onControllerDisconnected), t.object3D.visible = !1; + }, + play: function() { + this.addEventListeners(); + }, + pause: function() { + this.removeEventListeners(); + }, + tick: function(e1, t) { + var n = this.el.getObject3D("mesh"); + n && n.mixer && n.mixer.update(t / 1e3); + }, + onControllerConnected: function() { + this.el.object3D.visible = !0; + }, + onControllerDisconnected: function() { + this.el.object3D.visible = !1; + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("gripdown", this.onGripDown), e1.addEventListener("gripup", this.onGripUp), e1.addEventListener("trackpaddown", this.onTrackpadDown), e1.addEventListener("trackpadup", this.onTrackpadUp), e1.addEventListener("trackpadtouchstart", this.onTrackpadTouchStart), e1.addEventListener("trackpadtouchend", this.onTrackpadTouchEnd), e1.addEventListener("triggerdown", this.onTriggerDown), e1.addEventListener("triggerup", this.onTriggerUp), e1.addEventListener("triggertouchstart", this.onTriggerTouchStart), e1.addEventListener("triggertouchend", this.onTriggerTouchEnd), e1.addEventListener("griptouchstart", this.onGripTouchStart), e1.addEventListener("griptouchend", this.onGripTouchEnd), e1.addEventListener("thumbstickdown", this.onThumbstickDown), e1.addEventListener("thumbstickup", this.onThumbstickUp), e1.addEventListener("abuttontouchstart", this.onAorXTouchStart), e1.addEventListener("abuttontouchend", this.onAorXTouchEnd), e1.addEventListener("bbuttontouchstart", this.onBorYTouchStart), e1.addEventListener("bbuttontouchend", this.onBorYTouchEnd), e1.addEventListener("xbuttontouchstart", this.onAorXTouchStart), e1.addEventListener("xbuttontouchend", this.onAorXTouchEnd), e1.addEventListener("ybuttontouchstart", this.onBorYTouchStart), e1.addEventListener("ybuttontouchend", this.onBorYTouchEnd), e1.addEventListener("surfacetouchstart", this.onSurfaceTouchStart), e1.addEventListener("surfacetouchend", this.onSurfaceTouchEnd); + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("gripdown", this.onGripDown), e1.removeEventListener("gripup", this.onGripUp), e1.removeEventListener("trackpaddown", this.onTrackpadDown), e1.removeEventListener("trackpadup", this.onTrackpadUp), e1.removeEventListener("trackpadtouchstart", this.onTrackpadTouchStart), e1.removeEventListener("trackpadtouchend", this.onTrackpadTouchEnd), e1.removeEventListener("triggerdown", this.onTriggerDown), e1.removeEventListener("triggerup", this.onTriggerUp), e1.removeEventListener("triggertouchstart", this.onTriggerTouchStart), e1.removeEventListener("triggertouchend", this.onTriggerTouchEnd), e1.removeEventListener("griptouchstart", this.onGripTouchStart), e1.removeEventListener("griptouchend", this.onGripTouchEnd), e1.removeEventListener("thumbstickdown", this.onThumbstickDown), e1.removeEventListener("thumbstickup", this.onThumbstickUp), e1.removeEventListener("abuttontouchstart", this.onAorXTouchStart), e1.removeEventListener("abuttontouchend", this.onAorXTouchEnd), e1.removeEventListener("bbuttontouchstart", this.onBorYTouchStart), e1.removeEventListener("bbuttontouchend", this.onBorYTouchEnd), e1.removeEventListener("xbuttontouchstart", this.onAorXTouchStart), e1.removeEventListener("xbuttontouchend", this.onAorXTouchEnd), e1.removeEventListener("ybuttontouchstart", this.onBorYTouchStart), e1.removeEventListener("ybuttontouchend", this.onBorYTouchEnd), e1.removeEventListener("surfacetouchstart", this.onSurfaceTouchStart), e1.removeEventListener("surfacetouchend", this.onSurfaceTouchEnd); + }, + update: function(e1) { + var t, n = this.el, i = this.data.hand, r = this.data.handModelStyle, o = this.data.color, a = this; + if (t = { + hand: i, + model: !1 + }, i !== e1) { + var l = s[r + i.charAt(0).toUpperCase() + i.slice(1)]; + this.loader.load(l, function(e1) { + var r = e1.scene.children[0], s = "left" === i ? Math.PI / 2 : -Math.PI / 2, l = n.sceneEl.hasWebXR ? -Math.PI / 2 : 0; + r.mixer = new THREE.AnimationMixer(r), a.clips = e1.animations, n.setObject3D("mesh", r), r.traverse(function(e1) { + e1.isMesh && (e1.material.color = new THREE.Color(o)); + }), r.position.set(0, 0, 0), r.rotation.set(l, 0, s), n.setAttribute("magicleap-controls", t), n.setAttribute("vive-controls", t), n.setAttribute("oculus-touch-controls", t), n.setAttribute("pico-controls", t), n.setAttribute("windows-motion-controls", t), n.setAttribute("hp-mixed-reality-controls", t); + }); + } + }, + remove: function() { + this.el.removeObject3D("mesh"); + }, + handleButton: function(e1, t) { + var n, i = "down" === t, r = "touchstart" === t; + if (0 === t.indexOf("touch")) { + if (r === this.touchedButtons[e1]) return; + this.touchedButtons[e1] = r; + } else { + if (i === this.pressedButtons[e1]) return; + this.pressedButtons[e1] = i; + } + n = this.gesture, this.gesture = this.determineGesture(), this.gesture !== n && (this.animateGesture(this.gesture, n), this.emitGestureEvents(this.gesture, n)); + }, + determineGesture: function() { + var e1, t, n, i = this.pressedButtons.grip, r = this.pressedButtons.surface || this.touchedButtons.surface, s = this.pressedButtons.trackpad || this.touchedButtons.trackpad, c = this.pressedButtons.trigger || this.touchedButtons.trigger, h = this.touchedButtons.AorX || this.touchedButtons.BorY; + return t = this.el.components["tracked-controls"], (n = t && t.controller) && (n.id && 0 === n.id.indexOf("OpenVR ") || n.profiles && n.profiles[0] && "htc-vive" === n.profiles[0]) ? i || c ? e1 = a : s && (e1 = o) : i ? e1 = r || h || s ? c ? a : o : c ? l : "Point + Thumb" : c && (e1 = "Hold"), e1; + }, + getClip: function(e1) { + var t, n; + for(n = 0; n < this.clips.length; n++)if ((t = this.clips[n]).name === e1) return t; + }, + animateGesture: function(e1, t) { + e1 ? this.playAnimation(e1 || "Open", t, !1) : this.playAnimation(t, t, !0); + }, + emitGestureEvents: function(e1, t) { + var n, i = this.el; + t !== e1 && ((n = h(t, !1)) && i.emit(n), (n = h(e1, !0)) && i.emit(n)); + }, + playAnimation: function(e1, t, n) { + var i, r, s = this.el.getObject3D("mesh"); + if (s) { + if (i = this.getClip(e1), r = s.mixer.clipAction(i), n) return r.paused = !1, void (r.timeScale = -1); + if (r.clampWhenFinished = !0, r.loop = THREE.LoopOnce, r.repetitions = 0, r.timeScale = 1, r.time = 0, r.weight = 1, !t) return s.mixer.stopAllAction(), void r.play(); + i = this.getClip(t), r.reset(), r.play(), s.mixer.clipAction(i).crossFadeTo(r, .15, !0); + } + } + }); + }, + 6655: (e1, t, n)=>{ + var i, r = n(3515).registerComponent, s = n(7629), o = n(6600).checkControllerPresentAndSetup, a = n(8309).AFRAME_CDN_ROOT, l = a + "controllers/oculus-hands/v4/left.glb", c = a + "controllers/oculus-hands/v4/right.glb", h = [ + "wrist", + "thumb-metacarpal", + "thumb-phalanx-proximal", + "thumb-phalanx-distal", + "thumb-tip", + "index-finger-metacarpal", + "index-finger-phalanx-proximal", + "index-finger-phalanx-intermediate", + "index-finger-phalanx-distal", + "index-finger-tip", + "middle-finger-metacarpal", + "middle-finger-phalanx-proximal", + "middle-finger-phalanx-intermediate", + "middle-finger-phalanx-distal", + "middle-finger-tip", + "ring-finger-metacarpal", + "ring-finger-phalanx-proximal", + "ring-finger-phalanx-intermediate", + "ring-finger-phalanx-distal", + "ring-finger-tip", + "pinky-finger-metacarpal", + "pinky-finger-phalanx-proximal", + "pinky-finger-phalanx-intermediate", + "pinky-finger-phalanx-distal", + "pinky-finger-tip" + ]; + e1.exports.Component = r("hand-tracking-controls", { + schema: { + hand: { + default: "right", + oneOf: [ + "left", + "right" + ] + }, + modelStyle: { + default: "mesh", + oneOf: [ + "dots", + "mesh" + ] + }, + modelColor: { + default: "white" + } + }, + bindMethods: function() { + this.onControllersUpdate = s(this.onControllersUpdate, this), this.checkIfControllerPresent = s(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = s(this.removeControllersUpdateListener, this); + }, + addEventListeners: function() { + this.el.addEventListener("model-loaded", this.onModelLoaded); + for(var e1 = 0; e1 < this.jointEls.length; ++e1)this.jointEls[e1].object3D.visible = !0; + }, + removeEventListeners: function() { + this.el.removeEventListener("model-loaded", this.onModelLoaded); + for(var e1 = 0; e1 < this.jointEls.length; ++e1)this.jointEls[e1].object3D.visible = !1; + }, + init: function() { + var e1 = this.el.sceneEl, t = e1.getAttribute("webxr"), n = t.optionalFeatures; + -1 === n.indexOf("hand-tracking") && (n.push("hand-tracking"), e1.setAttribute("webxr", t)), this.onModelLoaded = this.onModelLoaded.bind(this), this.jointEls = [], this.controllerPresent = !1, this.isPinched = !1, this.pinchEventDetail = { + position: new THREE.Vector3, + wristRotation: new THREE.Quaternion + }, this.indexTipPosition = new THREE.Vector3, this.hasPoses = !1, this.jointPoses = new Float32Array(16 * h.length), this.jointRadii = new Float32Array(h.length), this.bindMethods(), this.updateReferenceSpace = this.updateReferenceSpace.bind(this), this.el.sceneEl.addEventListener("enter-vr", this.updateReferenceSpace), this.el.sceneEl.addEventListener("exit-vr", this.updateReferenceSpace); + }, + update: function() { + this.updateModelColor(); + }, + updateModelColor: function() { + var e1 = this.jointEls; + this.skinnedMesh && this.skinnedMesh.material.color.set(this.data.modelColor); + for(var t = 0; t < e1.length; t++)e1[t].setAttribute("material", "color", this.data.modelColor); + }, + updateReferenceSpace: function() { + var e1 = this, t = this.el.sceneEl.xrSession; + if (this.referenceSpace = void 0, t) { + var n = e1.el.sceneEl.systems.webxr.sessionReferenceSpaceType; + t.requestReferenceSpace(n).then(function(t) { + e1.referenceSpace = t; + }).catch(function(t) { + throw e1.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n, "tracked-controls-webxr uses reference space " + n), t; + }); + } + }, + checkIfControllerPresent: function() { + var e1 = this.data, t = e1.hand ? e1.hand : void 0; + o(this, "", { + hand: t, + iterateControllerProfiles: !0, + handTracking: !0 + }); + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + tick: function() { + var e1 = this.el.sceneEl, t = this.el.components["tracked-controls"] && this.el.components["tracked-controls"].controller, n = e1.frame, i = this.el.components["tracked-controls-webxr"], r = this.referenceSpace; + t && n && r && i && (this.hasPoses = !1, t.hand && (this.el.object3D.position.set(0, 0, 0), this.el.object3D.rotation.set(0, 0, 0), this.hasPoses = n.fillPoses(t.hand.values(), r, this.jointPoses) && n.fillJointRadii(t.hand.values(), this.jointRadii), this.updateHandModel(), this.detectGesture())); + }, + updateHandModel: function() { + "dots" === this.data.modelStyle && this.updateHandDotsModel(), "mesh" === this.data.modelStyle && this.updateHandMeshModel(); + }, + getBone: function(e1) { + for(var t = this.bones, n = 0; n < t.length; n++)if (t[n].name === e1) return t[n]; + return null; + }, + updateHandMeshModel: (i = new THREE.Matrix4, function() { + var e1 = 0, t = this.jointPoses, n = this.el.components["tracked-controls"] && this.el.components["tracked-controls"].controller; + if (n && this.mesh && (this.mesh.visible = !1, this.hasPoses)) for (var r of n.hand.values()){ + var s = this.getBone(r.jointName); + null != s && (this.mesh.visible = !0, i.fromArray(t, 16 * e1), s.position.setFromMatrixPosition(i), s.quaternion.setFromRotationMatrix(i)), e1++; + } + }), + updateHandDotsModel: function() { + for(var e1, t, n = this.jointPoses, i = this.jointRadii, r = this.el.components["tracked-controls"] && this.el.components["tracked-controls"].controller, s = 0; s < r.hand.size; s++)t = (e1 = this.jointEls[s]).object3D, e1.object3D.visible = this.hasPoses, this.hasPoses && (t.matrix.fromArray(n, 16 * s), t.matrix.decompose(t.position, t.rotation, t.scale), e1.setAttribute("scale", { + x: i[s], + y: i[s], + z: i[s] + })); + }, + detectGesture: function() { + this.detectPinch(); + }, + detectPinch: function() { + var e1 = new THREE.Vector3, t = new THREE.Matrix4; + return function() { + var n = this.indexTipPosition, i = this.pinchEventDetail; + if (this.hasPoses) { + e1.setFromMatrixPosition(t.fromArray(this.jointPoses, 64)), n.setFromMatrixPosition(t.fromArray(this.jointPoses, 144)), i.wristRotation.setFromRotationMatrix(t.fromArray(this.jointPoses, 0)); + var r = n.distanceTo(e1); + r < .015 && !1 === this.isPinched && (this.isPinched = !0, this.pinchDistance = r, i.position.copy(n).add(e1).multiplyScalar(.5), this.el.emit("pinchstarted", i)), r > this.pinchDistance + .1 * this.pinchDistance && !0 === this.isPinched && (this.isPinched = !1, i.position.copy(n).add(e1).multiplyScalar(.5), this.el.emit("pinchended", i)), this.isPinched && (i.position.copy(n).add(e1).multiplyScalar(.5), this.el.emit("pinchmoved", i)); + } + }; + }(), + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + id: "", + hand: t.hand, + iterateControllerProfiles: !0, + handTrackingEnabled: !0 + }), this.mesh ? this.mesh !== e1.getObject3D("mesh") && e1.setObject3D("mesh", this.mesh) : this.initDefaultModel(); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + var e1, t = this.el; + this.checkIfControllerPresent(), e1 = t.components["tracked-controls"] && t.components["tracked-controls"].controller, this.mesh && e1 && e1.hand && e1.hand instanceof XRHand && t.setObject3D("mesh", this.mesh); + }, + initDefaultModel: function() { + var e1 = this.data; + "dots" === e1.modelStyle && this.initDotsModel(), "mesh" === e1.modelStyle && this.initMeshHandModel(); + }, + initDotsModel: function() { + if (0 === this.jointEls.length) for(var e1 = 0; e1 < h.length; ++e1){ + var t = this.jointEl = document.createElement("a-entity"); + t.setAttribute("geometry", { + primitive: "sphere", + radius: 1 + }), t.setAttribute("material", { + color: this.data.modelColor + }), t.object3D.visible = !1, this.el.appendChild(t), this.jointEls.push(t); + } + }, + initMeshHandModel: function() { + var e1 = "left" === this.data.hand ? l : c; + this.el.setAttribute("gltf-model", e1); + }, + onModelLoaded: function() { + var e1 = this.mesh = this.el.getObject3D("mesh").children[0], t = this.skinnedMesh = e1.getObjectByProperty("type", "SkinnedMesh"); + this.skinnedMesh && (this.bones = t.skeleton.bones, this.el.removeObject3D("mesh"), e1.position.set(0, 0, 0), e1.rotation.set(0, 0, 0), t.frustumCulled = !1, t.material = new THREE.MeshStandardMaterial({ + skinning: !0, + color: this.data.modelColor + }), this.el.setObject3D("mesh", e1)); + } + }); + }, + 5290: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(2666); + i("hand-tracking-grab-controls", { + schema: { + hand: { + default: "right", + oneOf: [ + "left", + "right" + ] + }, + color: { + type: "color", + default: "white" + }, + hoverColor: { + type: "color", + default: "#538df1" + }, + hoverEnabled: { + default: !1 + } + }, + init: function() { + var e1, t = this.el, n = this.data; + e1 = "right" === n.hand ? "components.hand-tracking-controls.bones.3" : "components.hand-tracking-controls.bones.21", t.setAttribute("hand-tracking-controls", { + hand: n.hand + }), t.setAttribute("obb-collider", { + trackedObject3D: e1, + size: .04 + }), this.auxMatrix = new r.Matrix4, this.auxQuaternion = new r.Quaternion, this.auxQuaternion2 = new r.Quaternion, this.auxVector = new r.Vector3, this.auxVector2 = new r.Vector3, this.grabbingObjectPosition = new r.Vector3, this.grabbedObjectPosition = new r.Vector3, this.grabbedObjectPositionDelta = new r.Vector3, this.grabDeltaPosition = new r.Vector3, this.grabInitialRotation = new r.Quaternion, this.onCollisionStarted = this.onCollisionStarted.bind(this), this.el.addEventListener("obbcollisionstarted", this.onCollisionStarted), this.onCollisionEnded = this.onCollisionEnded.bind(this), this.el.addEventListener("obbcollisionended", this.onCollisionEnded), this.onPinchStarted = this.onPinchStarted.bind(this), this.el.addEventListener("pinchstarted", this.onPinchStarted), this.onPinchEnded = this.onPinchEnded.bind(this), this.el.addEventListener("pinchended", this.onPinchEnded), this.onPinchMoved = this.onPinchMoved.bind(this), this.el.addEventListener("pinchmoved", this.onPinchMoved); + }, + transferEntityOwnership: function() { + for(var e1, t = this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"), n = 0; n < t.length; ++n)(e1 = t[n].components["hand-tracking-grab-controls"]) !== this && this.grabbedEl && this.grabbedEl === e1.grabbedEl && e1.releaseGrabbedEntity(); + return !1; + }, + onCollisionStarted: function(e1) { + var t = e1.detail.withEl; + this.collidedEl || t.getAttribute("grabbable") && (this.collidedEl = t, this.grabbingObject3D = e1.detail.trackedObject3D, this.data.hoverEnabled && this.el.setAttribute("hand-tracking-controls", "modelColor", this.data.hoverColor)); + }, + onCollisionEnded: function() { + this.collidedEl = void 0, this.grabbedEl || (this.grabbingObject3D = void 0, this.data.hoverEnabled && this.el.setAttribute("hand-tracking-controls", "modelColor", this.data.color)); + }, + onPinchStarted: function(e1) { + this.collidedEl && (this.pinchPosition = e1.detail.position, this.wristRotation = e1.detail.wristRotation, this.grabbedEl = this.collidedEl, this.transferEntityOwnership(), this.grab()); + }, + onPinchEnded: function() { + this.releaseGrabbedEntity(); + }, + onPinchMoved: function(e1) { + this.wristRotation = e1.detail.wristRotation; + }, + releaseGrabbedEntity: function() { + var e1 = this.grabbedEl; + e1 && (e1.object3D.updateMatrixWorld = this.originalUpdateMatrixWorld, e1.object3D.matrixAutoUpdate = !0, e1.object3D.matrixWorldAutoUpdate = !0, e1.object3D.matrixWorld.decompose(this.auxVector, this.auxQuaternion, this.auxVector2), e1.object3D.position.copy(this.auxVector), e1.object3D.quaternion.copy(this.auxQuaternion), this.el.emit("grabended", { + grabbedEl: e1 + }), this.grabbedEl = void 0); + }, + grab: function() { + var e1, t = this.grabbedEl; + e1 = t.object3D.getWorldPosition(this.grabbedObjectPosition), this.grabDeltaPosition.copy(e1).sub(this.pinchPosition), this.grabInitialRotation.copy(this.auxQuaternion.copy(this.wristRotation).invert()), this.originalUpdateMatrixWorld = t.object3D.updateMatrixWorld, t.object3D.updateMatrixWorld = function() {}, t.object3D.updateMatrixWorldChildren = function(e1) { + for(var t = this.children, n = 0, i = t.length; n < i; n++){ + var r = t[n]; + !0 !== r.matrixWorldAutoUpdate && !0 !== e1 || r.updateMatrixWorld(!0); + } + }, t.object3D.matrixAutoUpdate = !1, t.object3D.matrixWorldAutoUpdate = !1, this.el.emit("grabstarted", { + grabbedEl: t + }); + }, + tock: function() { + var e1, t = this.auxMatrix, n = this.auxQuaternion, i = this.auxQuaternion2, r = this.grabbedEl; + r && ((e1 = r.object3D).getWorldQuaternion(i), e1.matrixWorld.identity(), t.identity(), t.makeTranslation(this.pinchPosition), e1.matrixWorld.multiply(t), t.identity(), t.makeRotationFromQuaternion(n.copy(this.wristRotation).multiply(this.grabInitialRotation)), e1.matrixWorld.multiply(t), t.identity(), t.makeTranslation(this.grabDeltaPosition), e1.matrixWorld.multiply(t), t.identity(), t.makeRotationFromQuaternion(i), e1.matrixWorld.multiply(t), t.makeScale(r.object3D.scale.x, r.object3D.scale.y, r.object3D.scale.z), e1.matrixWorld.multiply(t), e1.updateMatrixWorldChildren()); + } + }); + }, + 4228: (e1, t, n)=>{ + var i = n(3515).registerComponent; + e1.exports.Component = i("hide-on-enter-ar", { + init: function() { + var e1 = this; + this.el.sceneEl.addEventListener("enter-vr", function() { + e1.el.sceneEl.is("ar-mode") && (e1.el.object3D.visible = !1); + }), this.el.sceneEl.addEventListener("exit-vr", function() { + e1.el.object3D.visible = !0; + }); + } + }); + }, + 9359: (e1, t, n)=>{ + var i = n(7629), r = n(3515).registerComponent, s = n(2666), o = n(6600), a = o.checkControllerPresentAndSetup, l = o.emitIfAxesChanged, c = o.onButtonEvent, h = "hp-mixed-reality", u = n(8309).AFRAME_CDN_ROOT + "controllers/hp/mixed-reality/", d = { + x: 0, + y: 0, + z: .06 + }, p = { + _x: Math.PI / 4, + _y: 0, + _z: 0, + _order: "XYZ" + }; + e1.exports.Component = r("hp-mixed-reality-controls", { + schema: { + hand: { + default: "none" + }, + model: { + default: !0 + }, + orientationOffset: { + type: "vec3" + } + }, + mapping: { + left: { + axes: { + touchpad: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "grip", + "none", + "thumbstick", + "xbutton", + "ybutton" + ] + }, + right: { + axes: { + touchpad: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "grip", + "none", + "thumbstick", + "abutton", + "bbutton" + ] + } + }, + init: function() { + var e1 = this; + this.controllerPresent = !1, this.lastControllerCheck = 0, this.onButtonChanged = i(this.onButtonChanged, this), this.onButtonDown = function(t) { + c(t.detail.id, "down", e1, e1.data.hand); + }, this.onButtonUp = function(t) { + c(t.detail.id, "up", e1, e1.data.hand); + }, this.onButtonTouchEnd = function(t) { + c(t.detail.id, "touchend", e1, e1.data.hand); + }, this.onButtonTouchStart = function(t) { + c(t.detail.id, "touchstart", e1, e1.data.hand); + }, this.previousButtonValues = {}, this.bindMethods(); + }, + update: function() { + var e1 = this.data; + this.controllerIndex = "right" === e1.hand ? 0 : "left" === e1.hand ? 1 : 2; + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + bindMethods: function() { + this.onModelLoaded = i(this.onModelLoaded, this), this.onControllersUpdate = i(this.onControllersUpdate, this), this.checkIfControllerPresent = i(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = i(this.removeControllersUpdateListener, this), this.onAxisMoved = i(this.onAxisMoved, this); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("axismove", this.onAxisMoved), e1.addEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("axismove", this.onAxisMoved), e1.removeEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + var e1 = this.data; + a(this, h, { + index: this.controllerIndex, + hand: e1.hand + }); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + idPrefix: h, + hand: t.hand, + controller: this.controllerIndex, + orientationOffset: t.orientationOffset + }), this.data.model && this.el.setAttribute("gltf-model", u + this.data.hand + ".glb"); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onButtonChanged: function(e1) { + var t, n = this.mapping[this.data.hand].buttons[e1.detail.id]; + n && ("trigger" === n && (t = e1.detail.state.value, console.log("analog value of trigger press: " + t)), this.el.emit(n + "changed", e1.detail.state)); + }, + onModelLoaded: function(e1) { + var t = e1.detail.model; + this.data.model && (t.position.copy(d), t.rotation.copy(p), this.el.emit("controllermodelready", { + name: "hp-mixed-reality-controls", + model: this.data.model, + rayOrigin: new s.Vector3(0, 0, 0) + })); + }, + onAxisMoved: function(e1) { + l(this, this.mapping.axes, e1); + } + }); + }, + 8686: (e1, t, n)=>{ + n(4649), n(9715), n(9541), n(57), n(2503), n(9577), n(3647), n(3924), n(6655), n(5290), n(2346), n(4228), n(9359), n(1714), n(7152), n(4893), n(9234), n(109), n(7479), n(240), n(9115), n(5921), n(4269), n(9536), n(5569), n(8497), n(4854), n(7454), n(4914), n(3689), n(1684), n(5538), n(6957), n(2761), n(1125), n(8666), n(8057), n(3798), n(8367), n(9507), n(6296), n(7872), n(3431), n(2819), n(1135), n(4046), n(1277), n(3969), n(3638), n(7445), n(4310), n(7579), n(5670), n(467), n(5834), n(3807); + }, + 7152: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(8903); + i("laser-controls", { + schema: { + hand: { + default: "right" + }, + model: { + default: !0 + }, + defaultModelColor: { + type: "color", + default: "grey" + } + }, + init: function() { + var e1 = this.config, t = this.data, n = this.el, i = this, s = { + hand: t.hand, + model: t.model + }; + function o(t) { + var s = e1[t.detail.name]; + if (s) { + var o = r.extend({ + showLine: !0 + }, s.raycaster || {}); + t.detail.rayOrigin && (o.origin = t.detail.rayOrigin.origin, o.direction = t.detail.rayOrigin.direction, o.showLine = !0), t.detail.rayOrigin || !i.modelReady ? n.setAttribute("raycaster", o) : n.setAttribute("raycaster", "showLine", !0), n.setAttribute("cursor", r.extend({ + fuse: !1 + }, s.cursor)); + } + } + n.setAttribute("hp-mixed-reality-controls", s), n.setAttribute("magicleap-controls", s), n.setAttribute("oculus-go-controls", s), n.setAttribute("oculus-touch-controls", s), n.setAttribute("pico-controls", s), n.setAttribute("valve-index-controls", s), n.setAttribute("vive-controls", s), n.setAttribute("vive-focus-controls", s), n.setAttribute("windows-motion-controls", s), n.setAttribute("generic-tracked-controller-controls", { + hand: s.hand + }), n.addEventListener("controllerconnected", o), n.addEventListener("controllerdisconnected", function(t) { + e1[t.detail.name] && n.setAttribute("raycaster", "showLine", !1); + }), n.addEventListener("controllermodelready", function(e1) { + o(e1), i.modelReady = !0; + }); + }, + config: { + "generic-tracked-controller-controls": { + cursor: { + downEvents: [ + "triggerdown" + ], + upEvents: [ + "triggerup" + ] + } + }, + "hp-mixed-reality-controls": { + cursor: { + downEvents: [ + "triggerdown" + ], + upEvents: [ + "triggerup" + ] + }, + raycaster: { + origin: { + x: 0, + y: 0, + z: 0 + } + } + }, + "magicleap-controls": { + cursor: { + downEvents: [ + "trackpaddown", + "triggerdown" + ], + upEvents: [ + "trackpadup", + "triggerup" + ] + } + }, + "oculus-go-controls": { + cursor: { + downEvents: [ + "triggerdown" + ], + upEvents: [ + "triggerup" + ] + }, + raycaster: { + origin: { + x: 0, + y: 5e-4, + z: 0 + } + } + }, + "oculus-touch-controls": { + cursor: { + downEvents: [ + "triggerdown" + ], + upEvents: [ + "triggerup" + ] + }, + raycaster: { + origin: { + x: 0, + y: 0, + z: 0 + } + } + }, + "valve-index-controls": { + cursor: { + downEvents: [ + "triggerdown" + ], + upEvents: [ + "triggerup" + ] + } + }, + "vive-controls": { + cursor: { + downEvents: [ + "triggerdown" + ], + upEvents: [ + "triggerup" + ] + } + }, + "vive-focus-controls": { + cursor: { + downEvents: [ + "trackpaddown", + "triggerdown" + ], + upEvents: [ + "trackpadup", + "triggerup" + ] + } + }, + "windows-motion-controls": { + cursor: { + downEvents: [ + "triggerdown" + ], + upEvents: [ + "triggerup" + ] + }, + raycaster: { + showLine: !1 + } + } + } + }); + }, + 1714: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(8903).debug("components:layer:warn"); + e1.exports.Component = i("layer", { + schema: { + type: { + default: "quad", + oneOf: [ + "quad", + "monocubemap", + "stereocubemap" + ] + }, + src: { + type: "map" + }, + rotateCubemap: { + default: !1 + }, + width: { + default: 0 + }, + height: { + default: 0 + } + }, + init: function() { + var e1 = this.el.sceneEl.renderer.getContext(); + this.quaternion = new THREE.Quaternion, this.position = new THREE.Vector3, this.bindMethods(), this.needsRedraw = !1, this.frameBuffer = e1.createFramebuffer(); + var t = this.el.sceneEl.getAttribute("webxr"), n = t.optionalFeatures; + -1 === n.indexOf("layers") && (n.push("laters"), this.el.sceneEl.setAttribute("webxr", t)), this.el.sceneEl.addEventListener("enter-vr", this.onEnterVR), this.el.sceneEl.addEventListener("exit-vr", this.onExitVR); + }, + bindMethods: function() { + this.onRequestedReferenceSpace = this.onRequestedReferenceSpace.bind(this), this.onEnterVR = this.onEnterVR.bind(this), this.onExitVR = this.onExitVR.bind(this); + }, + update: function(e1) { + this.data.src !== e1.src && this.updateSrc(); + }, + updateSrc: function() { + var e1 = this.data.type; + this.texture = void 0, "quad" !== e1 ? "monocubemap" !== e1 && "stereocubemap" !== e1 || this.loadCubeMapImages() : this.loadQuadImage(); + }, + loadCubeMapImages: function() { + var e1, t = this.xrGLFactory, n = this.el.sceneEl.frame, i = this.data.src, r = this.data.type; + this.visibilityChanged = !1, this.layer && ("monocubemap" !== r && "stereocubemap" !== r || (i.complete ? this.pendingCubeMapUpdate = !1 : this.pendingCubeMapUpdate = !0, this.loadingScreen ? this.loadingScreen = !1 : this.loadingScreen = !0, "monocubemap" === r ? (e1 = t.getSubImage(this.layer, n), this.loadCubeMapImage(e1.colorTexture, i, 0)) : (e1 = t.getSubImage(this.layer, n, "left"), this.loadCubeMapImage(e1.colorTexture, i, 0), e1 = t.getSubImage(this.layer, n, "right"), this.loadCubeMapImage(e1.colorTexture, i, 6)))); + }, + loadQuadImage: function() { + var e1 = this.data.src, t = this; + this.el.sceneEl.systems.material.loadTexture(e1, { + src: e1 + }, function(n) { + t.el.sceneEl.renderer.initTexture(n), t.texture = n, "VIDEO" === e1.tagName && setTimeout(function() { + t.textureIsVideo = !0; + }, 1e3), t.layer && (t.layer.height = t.data.height / 2 || t.texture.image.height / 1e3, t.layer.width = t.data.width / 2 || t.texture.image.width / 1e3, t.needsRedraw = !0), t.updateQuadPanel(); + }); + }, + preGenerateCubeMapTextures: function(e1, t) { + "monocubemap" === this.data.type ? this.generateCubeMapTextures(e1, 0, t) : (this.generateCubeMapTextures(e1, 0, t), this.generateCubeMapTextures(e1, 6, t)); + }, + generateCubeMapTextures: function(e1, t, n) { + for(var i, r, s = this.data, o = this.cubeFaceSize, a = Math.min(e1.width, e1.height), l = [], c = 0; c < 6; c++){ + var h = document.createElement("CANVAS"); + h.width = h.height = o; + var u = h.getContext("2d"); + s.rotateCubemap && (2 !== c && 3 !== c || (u.save(), u.translate(o, o), u.rotate(Math.PI))), u.drawImage(e1, (c + t) * a, 0, a, a, 0, 0, o, o), u.restore(), n && n(), l.push(h); + } + return s.rotateCubemap && (i = l[0], r = l[1], l[0] = r, l[1] = i, i = l[4], r = l[5], l[4] = r, l[5] = i), n && n(), l; + }, + loadCubeMapImage: function(e1, t, n) { + var i, r = this.el.sceneEl.renderer.getContext(); + r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, !1), r.bindTexture(r.TEXTURE_CUBE_MAP, e1), i = !t.complete || this.loadingScreen ? this.loadingScreenImages : this.generateCubeMapTextures(t, n); + var s = 0; + i.forEach(function(e1, t) { + r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X + t, 0, 0, 0, r.RGBA, r.UNSIGNED_BYTE, e1), s = r.getError(); + }), 0 !== s && console.log("renderingError, WebGL Error Code: " + s), r.bindTexture(r.TEXTURE_CUBE_MAP, null); + }, + tick: function() { + this.el.sceneEl.xrSession && (!this.layer && this.el.sceneEl.is("vr-mode") && this.initLayer(), this.updateTransform(), this.data.src.complete && (this.pendingCubeMapUpdate || this.loadingScreen || this.visibilityChanged) && this.loadCubeMapImages(), (this.needsRedraw || this.layer.needsRedraw || this.textureIsVideo) && ("quad" === this.data.type && this.draw(), this.needsRedraw = !1)); + }, + initLayer: function() { + var e1 = this, t = this.data.type; + this.el.sceneEl.xrSession.onvisibilitychange = function(t) { + e1.visibilityChanged = "hidden" !== t.session.visibilityState; + }, "quad" !== t ? "monocubemap" !== t && "stereocubemap" !== t || this.initCubeMapLayer() : this.initQuadLayer(); + }, + initQuadLayer: function() { + var e1 = this.el.sceneEl, t = e1.renderer.getContext(), n = this.xrGLFactory = new XRWebGLBinding(e1.xrSession, t); + this.texture && (this.layer = n.createQuadLayer({ + space: this.referenceSpace, + viewPixelHeight: 2048, + viewPixelWidth: 2048, + height: this.data.height / 2 || this.texture.image.height / 1e3, + width: this.data.width / 2 || this.texture.image.width / 1e3 + }), this.initLoadingScreenImages(), e1.renderer.xr.addLayer(this.layer)); + }, + initCubeMapLayer: function() { + var e1 = this.data.src, t = this.el.sceneEl, n = t.renderer.getContext(), i = n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE), r = this.cubeFaceSize = Math.min(i, Math.min(e1.width, e1.height)), s = this.xrGLFactory = new XRWebGLBinding(t.xrSession, n); + this.layer = s.createCubeLayer({ + space: this.referenceSpace, + viewPixelWidth: r, + viewPixelHeight: r, + layout: "monocubemap" === this.data.type ? "mono" : "stereo", + isStatic: !1 + }), this.initLoadingScreenImages(), this.loadCubeMapImages(), t.renderer.xr.addLayer(this.layer); + }, + initLoadingScreenImages: function() { + for(var e1 = this.cubeFaceSize, t = this.loadingScreenImages = [], n = 0; n < 6; n++){ + var i = document.createElement("CANVAS"); + i.width = i.height = e1; + var r = i.getContext("2d"); + i.width = i.height = e1, r.fillStyle = "black", r.fillRect(0, 0, e1, e1), 2 !== n && 3 !== n && (r.translate(e1, 0), r.scale(-1, 1), r.fillStyle = "white", r.font = "30px Arial", r.fillText("Loading", e1 / 2, e1 / 2)), t.push(i); + } + }, + destroyLayer: function() { + this.layer && (this.el.sceneEl.renderer.xr.removeLayer(this.layer), this.layer.destroy(), this.layer = void 0); + }, + toggleCompositorLayer: function() { + this.enableCompositorLayer(!this.layerEnabled); + }, + enableCompositorLayer: function(e1) { + this.layerEnabled = e1, this.quadPanelEl.object3D.visible = !this.layerEnabled; + }, + updateQuadPanel: function() { + var e1 = this.quadPanelEl; + this.quadPanelEl || (e1 = this.quadPanelEl = document.createElement("a-entity"), this.el.appendChild(e1)), e1.setAttribute("material", { + shader: "flat", + src: this.data.src, + transparent: !0 + }), e1.setAttribute("geometry", { + primitive: "plane", + height: this.data.height || this.texture.image.height / 1e3, + width: this.data.width || this.texture.image.height / 1e3 + }); + }, + draw: function() { + var e1 = this.el.sceneEl, t = this.el.sceneEl.renderer.getContext(), n = this.xrGLFactory.getSubImage(this.layer, e1.frame), i = e1.renderer.properties.get(this.texture).__webglTexture, r = t.getParameter(t.FRAMEBUFFER_BINDING); + t.viewport(n.viewport.x, n.viewport.y, n.viewport.width, n.viewport.height), t.bindFramebuffer(t.FRAMEBUFFER, this.frameBuffer), t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, n.colorTexture, 0), function(e1, t, n, i) { + var r = e1.createFramebuffer(), s = n.viewport.x, o = n.viewport.y, a = n.viewport.x + n.viewport.width, l = n.viewport.y + n.viewport.height; + "VIDEO" === i.tagName && (e1.bindTexture(e1.TEXTURE_2D, t), e1.texSubImage2D(e1.TEXTURE_2D, 0, 0, 0, i.width, i.height, e1.RGB, e1.UNSIGNED_BYTE, i)), e1.bindFramebuffer(e1.READ_FRAMEBUFFER, r), e1.framebufferTexture2D(e1.READ_FRAMEBUFFER, e1.COLOR_ATTACHMENT0, e1.TEXTURE_2D, t, 0), e1.readBuffer(e1.COLOR_ATTACHMENT0), e1.blitFramebuffer(0, 0, i.width, i.height, s, o, a, l, e1.COLOR_BUFFER_BIT, e1.NEAREST), e1.bindFramebuffer(e1.READ_FRAMEBUFFER, null), e1.deleteFramebuffer(r); + }(t, i, n, this.data.src), t.bindFramebuffer(t.FRAMEBUFFER, r); + }, + updateTransform: function() { + var e1 = this.el, t = this.position, n = this.quaternion; + e1.object3D.updateMatrixWorld(), t.setFromMatrixPosition(e1.object3D.matrixWorld), n.setFromRotationMatrix(e1.object3D.matrixWorld), this.layerEnabled || t.set(0, 0, 1e8), this.layer.transform = new XRRigidTransform(t, n); + }, + onEnterVR: function() { + var e1 = this.el.sceneEl, t = e1.xrSession; + e1.hasWebXR && XRWebGLBinding && t ? (t.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace), this.needsRedraw = !0, this.layerEnabled = !0, this.quadPanelEl && (this.quadPanelEl.object3D.visible = !1), this.data.src.play && this.data.src.play()) : r("The layer component requires WebXR and the layers API enabled"); + }, + onExitVR: function() { + this.quadPanelEl && (this.quadPanelEl.object3D.visible = !0), this.destroyLayer(); + }, + onRequestedReferenceSpace: function(e1) { + this.referenceSpace = e1; + } + }); + }, + 4893: (e1, t, n)=>{ + var i, r, s, o, a, l, c = n(7629), h = n(8903), u = h.diff, d = n(4219), p = n(3515).registerComponent, A = n(2666), f = n(3437), m = A.MathUtils.degToRad, g = d("components:light:warn"), v = new A.CubeTextureLoader, y = {}; + e1.exports.Component = p("light", { + schema: { + angle: { + default: 60, + if: { + type: [ + "spot" + ] + } + }, + color: { + type: "color", + if: { + type: [ + "ambient", + "directional", + "hemisphere", + "point", + "spot" + ] + } + }, + envMap: { + default: "", + if: { + type: [ + "probe" + ] + } + }, + groundColor: { + type: "color", + if: { + type: [ + "hemisphere" + ] + } + }, + decay: { + default: 1, + if: { + type: [ + "point", + "spot" + ] + } + }, + distance: { + default: 0, + min: 0, + if: { + type: [ + "point", + "spot" + ] + } + }, + intensity: { + default: 1, + min: 0, + if: { + type: [ + "ambient", + "directional", + "hemisphere", + "point", + "spot", + "probe" + ] + } + }, + penumbra: { + default: 0, + min: 0, + max: 1, + if: { + type: [ + "spot" + ] + } + }, + type: { + default: "directional", + oneOf: [ + "ambient", + "directional", + "hemisphere", + "point", + "spot", + "probe" + ], + schemaChange: !0 + }, + target: { + type: "selector", + if: { + type: [ + "spot", + "directional" + ] + } + }, + castShadow: { + default: !1, + if: { + type: [ + "point", + "spot", + "directional" + ] + } + }, + shadowBias: { + default: 0, + if: { + castShadow: !0 + } + }, + shadowCameraFar: { + default: 500, + if: { + castShadow: !0 + } + }, + shadowCameraFov: { + default: 90, + if: { + castShadow: !0 + } + }, + shadowCameraNear: { + default: .5, + if: { + castShadow: !0 + } + }, + shadowCameraTop: { + default: 5, + if: { + castShadow: !0 + } + }, + shadowCameraRight: { + default: 5, + if: { + castShadow: !0 + } + }, + shadowCameraBottom: { + default: -5, + if: { + castShadow: !0 + } + }, + shadowCameraLeft: { + default: -5, + if: { + castShadow: !0 + } + }, + shadowCameraVisible: { + default: !1, + if: { + castShadow: !0 + } + }, + shadowCameraAutomatic: { + default: "", + if: { + type: [ + "directional" + ] + } + }, + shadowMapHeight: { + default: 512, + if: { + castShadow: !0 + } + }, + shadowMapWidth: { + default: 512, + if: { + castShadow: !0 + } + }, + shadowRadius: { + default: 1, + if: { + castShadow: !0 + } + } + }, + init: function() { + var e1 = this.el; + this.light = null, this.defaultTarget = null, this.system.registerLight(e1); + }, + update: function(e1) { + var t = this.data, n = u(t, e1), i = this.light, r = this; + if (!i || "type" in n) this.setLight(this.data), this.updateShadow(); + else { + var s = !1; + Object.keys(n).forEach(function(e1) { + var n = t[e1]; + switch(e1){ + case "color": + i.color.set(n); + break; + case "groundColor": + i.groundColor.set(n); + break; + case "angle": + i.angle = m(n); + break; + case "target": + null === n ? "spot" !== t.type && "directional" !== t.type || (i.target = r.defaultTarget) : n.hasLoaded ? r.onSetTarget(n, i) : n.addEventListener("loaded", c(r.onSetTarget, r, n, i)); + break; + case "envMap": + r.updateProbeMap(t, i); + break; + case "castShadow": + case "shadowBias": + case "shadowCameraFar": + case "shadowCameraFov": + case "shadowCameraNear": + case "shadowCameraTop": + case "shadowCameraRight": + case "shadowCameraBottom": + case "shadowCameraLeft": + case "shadowCameraVisible": + case "shadowMapHeight": + case "shadowMapWidth": + case "shadowRadius": + s || (r.updateShadow(), s = !0); + break; + case "shadowCameraAutomatic": + t.shadowCameraAutomatic ? r.shadowCameraAutomaticEls = Array.from(document.querySelectorAll(t.shadowCameraAutomatic)) : r.shadowCameraAutomaticEls = []; + break; + default: + i[e1] = n; + } + }); + } + }, + tick: (i = new A.Box3, r = new A.Vector3, s = new A.Vector3, o = new A.Matrix4, a = new A.Sphere, l = new A.Vector3, function() { + if ("directional" === this.data.type && this.light.shadow && this.light.shadow.camera instanceof A.OrthographicCamera && this.shadowCameraAutomaticEls.length) { + var e1 = this.light.shadow.camera; + e1.getWorldDirection(r), e1.getWorldPosition(s), o.copy(e1.matrixWorld), o.invert(), e1.near = 1, e1.left = 1e5, e1.right = -100000, e1.top = -100000, e1.bottom = 1e5, this.shadowCameraAutomaticEls.forEach(function(t) { + i.setFromObject(t.object3D), i.getBoundingSphere(a); + var n = f.distanceOfPointFromPlane(s, r, a.center), c = f.nearestPointInPlane(s, r, a.center, l).applyMatrix4(o); + e1.near = Math.min(-n - a.radius - 1, e1.near), e1.left = Math.min(-a.radius + c.x, e1.left), e1.right = Math.max(a.radius + c.x, e1.right), e1.top = Math.max(a.radius + c.y, e1.top), e1.bottom = Math.min(-a.radius + c.y, e1.bottom); + }), e1.updateProjectionMatrix(); + } + }), + setLight: function(e1) { + var t = this.el, n = this.getLight(e1); + n && (this.light && t.removeObject3D("light"), this.light = n, this.light.el = t, t.setObject3D("light", this.light), "spot" !== e1.type && "directional" !== e1.type && "hemisphere" !== e1.type || t.getObject3D("light").translateY(-1), "spot" === e1.type && (t.setObject3D("light-target", this.defaultTarget), t.getObject3D("light-target").position.set(0, 0, -1)), e1.shadowCameraAutomatic ? this.shadowCameraAutomaticEls = Array.from(document.querySelectorAll(e1.shadowCameraAutomatic)) : this.shadowCameraAutomaticEls = []); + }, + updateShadow: function() { + var e1 = this.el, t = this.data, n = this.light; + n.castShadow = t.castShadow; + var i = e1.getObject3D("cameraHelper"); + if (t.shadowCameraVisible && !i ? e1.setObject3D("cameraHelper", new A.CameraHelper(n.shadow.camera)) : !t.shadowCameraVisible && i && e1.removeObject3D("cameraHelper"), !t.castShadow) return n; + n.shadow.bias = t.shadowBias, n.shadow.radius = t.shadowRadius, n.shadow.mapSize.height = t.shadowMapHeight, n.shadow.mapSize.width = t.shadowMapWidth, n.shadow.camera.near = t.shadowCameraNear, n.shadow.camera.far = t.shadowCameraFar, n.shadow.camera instanceof A.OrthographicCamera ? (n.shadow.camera.top = t.shadowCameraTop, n.shadow.camera.right = t.shadowCameraRight, n.shadow.camera.bottom = t.shadowCameraBottom, n.shadow.camera.left = t.shadowCameraLeft) : n.shadow.camera.fov = t.shadowCameraFov, n.shadow.camera.updateProjectionMatrix(), i && i.update(); + }, + getLight: function(e1) { + var t = e1.angle, n = new A.Color(e1.color); + n = n.getHex(); + var i = e1.decay, r = e1.distance, s = new A.Color(e1.groundColor); + s = s.getHex(); + var o = e1.intensity, a = e1.type, l = e1.target, h = null; + switch(a.toLowerCase()){ + case "ambient": + return new A.AmbientLight(n, o); + case "directional": + return h = new A.DirectionalLight(n, o), this.defaultTarget = h.target, l && (l.hasLoaded ? this.onSetTarget(l, h) : l.addEventListener("loaded", c(this.onSetTarget, this, l, h))), h; + case "hemisphere": + return new A.HemisphereLight(n, s, o); + case "point": + return new A.PointLight(n, o, r, i); + case "spot": + return h = new A.SpotLight(n, o, r, m(t), e1.penumbra, i), this.defaultTarget = h.target, l && (l.hasLoaded ? this.onSetTarget(l, h) : l.addEventListener("loaded", c(this.onSetTarget, this, l, h))), h; + case "probe": + return h = new A.LightProbe, this.updateProbeMap(e1, h), h; + default: + g("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.", a); + } + }, + updateProbeMap: function(e1, t) { + e1.envMap || t.copy(new A.LightProbe), y[e1.envMap] instanceof window.Promise && y[e1.envMap].then(function(e1) { + t.copy(e1); + }), y[e1.envMap] instanceof A.LightProbe && t.copy(y[e1.envMap]), y[e1.envMap] = new window.Promise(function(n) { + h.srcLoader.validateCubemapSrc(e1.envMap, function(n) { + v.load(n, function(n) { + var i = A.LightProbeGenerator.fromCubeTexture(n); + y[e1.envMap] = i, t.copy(i); + }); + }); + }); + }, + onSetTarget: function(e1, t) { + t.target = e1.object3D; + }, + remove: function() { + var e1 = this.el; + e1.removeObject3D("light"), e1.getObject3D("cameraHelper") && e1.removeObject3D("cameraHelper"); + } + }); + }, + 9234: (e1, t, n)=>{ + var i = n(3515).registerComponent; + function r(e1, t) { + return !(!e1 || !t) && e1.x === t.x && e1.y === t.y && e1.z === t.z; + } + e1.exports.Component = i("line", { + schema: { + start: { + type: "vec3", + default: { + x: 0, + y: 0, + z: 0 + } + }, + end: { + type: "vec3", + default: { + x: 0, + y: 0, + z: 0 + } + }, + color: { + type: "color", + default: "#74BEC1" + }, + opacity: { + type: "number", + default: 1 + }, + visible: { + default: !0 + } + }, + multiple: !0, + init: function() { + var e1, t, n = this.data; + t = this.material = new THREE.LineBasicMaterial({ + color: n.color, + opacity: n.opacity, + transparent: n.opacity < 1, + visible: n.visible + }), (e1 = this.geometry = new THREE.BufferGeometry).setAttribute("position", new THREE.BufferAttribute(new Float32Array(6), 3)), this.line = new THREE.Line(e1, t), this.el.setObject3D(this.attrName, this.line); + }, + update: function(e1) { + var t = this.data, n = this.geometry, i = !1, s = this.material, o = n.attributes.position.array; + r(t.start, e1.start) || (o[0] = t.start.x, o[1] = t.start.y, o[2] = t.start.z, i = !0), r(t.end, e1.end) || (o[3] = t.end.x, o[4] = t.end.y, o[5] = t.end.z, i = !0), i && (n.attributes.position.needsUpdate = !0, n.computeBoundingSphere()), s.color.setStyle(t.color), s.opacity = t.opacity, s.transparent = t.opacity < 1, s.visible = t.visible; + }, + remove: function() { + this.el.removeObject3D(this.attrName, this.line); + } + }); + }, + 109: (e1, t, n)=>{ + var i, r, s, o, a, l, c, h, u = n(3515).registerComponent, d = n(9644).registerShader, p = n(2666); + e1.exports.Component = u("link", { + schema: { + backgroundColor: { + default: "red", + type: "color" + }, + borderColor: { + default: "white", + type: "color" + }, + highlighted: { + default: !1 + }, + highlightedColor: { + default: "#24CAFF", + type: "color" + }, + href: { + default: "" + }, + image: { + type: "asset" + }, + on: { + default: "click" + }, + peekMode: { + default: !1 + }, + title: { + default: "" + }, + titleColor: { + default: "white", + type: "color" + }, + visualAspectEnabled: { + default: !1 + } + }, + init: function() { + this.navigate = this.navigate.bind(this), this.previousQuaternion = void 0, this.quaternionClone = new p.Quaternion, this.hiddenEls = []; + }, + update: function(e1) { + var t, n, i = this.data, r = this.el; + i.visualAspectEnabled && (this.initVisualAspect(), t = i.highlighted ? i.highlightedColor : i.backgroundColor, n = i.highlighted ? i.highlightedColor : i.borderColor, r.setAttribute("material", "backgroundColor", t), r.setAttribute("material", "strokeColor", n), i.on !== e1.on && this.updateEventListener(), void 0 !== e1.peekMode && i.peekMode !== e1.peekMode && this.updatePeekMode(), i.image && e1.image !== i.image && r.setAttribute("material", "pano", "string" == typeof i.image ? i.image : i.image.src)); + }, + updatePeekMode: function() { + var e1 = this.el, t = this.sphereEl; + this.data.peekMode ? (this.hideAll(), e1.getObject3D("mesh").visible = !1, t.setAttribute("visible", !0)) : (this.showAll(), e1.getObject3D("mesh").visible = !0, t.setAttribute("visible", !1)); + }, + play: function() { + this.updateEventListener(); + }, + pause: function() { + this.removeEventListener(); + }, + updateEventListener: function() { + var e1 = this.el; + e1.isPlaying && (this.removeEventListener(), e1.addEventListener(this.data.on, this.navigate)); + }, + removeEventListener: function() { + var e1 = this.data.on; + e1 && this.el.removeEventListener(e1, this.navigate); + }, + initVisualAspect: function() { + var e1, t, n, i = this.el; + this.data.visualAspectEnabled && !this.visualAspectInitialized && (n = this.textEl = this.textEl || document.createElement("a-entity"), t = this.sphereEl = this.sphereEl || document.createElement("a-entity"), e1 = this.semiSphereEl = this.semiSphereEl || document.createElement("a-entity"), i.setAttribute("geometry", { + primitive: "circle", + radius: 1, + segments: 64 + }), i.setAttribute("material", { + shader: "portal", + pano: this.data.image, + side: "double" + }), n.setAttribute("text", { + color: this.data.titleColor, + align: "center", + font: "kelsonsans", + value: this.data.title || this.data.href, + width: 4 + }), n.setAttribute("position", "0 1.5 0"), i.appendChild(n), e1.setAttribute("geometry", { + primitive: "sphere", + radius: 1, + phiStart: 0, + segmentsWidth: 64, + segmentsHeight: 64, + phiLength: 180, + thetaStart: 0, + thetaLength: 360 + }), e1.setAttribute("material", { + shader: "portal", + borderEnabled: 0, + pano: this.data.image, + side: "back" + }), e1.setAttribute("rotation", "0 180 0"), e1.setAttribute("position", "0 0 0"), e1.setAttribute("visible", !1), i.appendChild(e1), t.setAttribute("geometry", { + primitive: "sphere", + radius: 10, + segmentsWidth: 64, + segmentsHeight: 64 + }), t.setAttribute("material", { + shader: "portal", + borderEnabled: 0, + pano: this.data.image, + side: "back" + }), t.setAttribute("visible", !1), i.appendChild(t), this.visualAspectInitialized = !0); + }, + navigate: function() { + window.location = this.data.href; + }, + tick: (a = new p.Vector3, l = new p.Vector3, c = new p.Quaternion, h = new p.Vector3, function() { + var e1, t, n = this.el, i = n.object3D, r = n.sceneEl.camera, s = this.textEl; + if (this.data.visualAspectEnabled) { + if (i.updateMatrixWorld(), r.parent.updateMatrixWorld(), r.updateMatrixWorld(), i.matrix.decompose(l, c, h), l.setFromMatrixPosition(i.matrixWorld), a.setFromMatrixPosition(r.matrixWorld), (t = l.distanceTo(a)) > 20) this.previousQuaternion || (this.quaternionClone.copy(c), this.previousQuaternion = this.quaternionClone), i.lookAt(a); + else { + if (e1 = this.calculateCameraPortalOrientation(), t < .5) { + if (!0 === this.semiSphereEl.getAttribute("visible")) return; + s.setAttribute("text", "width", 1.5), e1 <= 0 ? (s.setAttribute("position", "0 0 0.75"), s.setAttribute("rotation", "0 180 0"), this.semiSphereEl.setAttribute("rotation", "0 0 0")) : (s.setAttribute("position", "0 0 -0.75"), s.setAttribute("rotation", "0 0 0"), this.semiSphereEl.setAttribute("rotation", "0 180 0")), n.getObject3D("mesh").visible = !1, this.semiSphereEl.setAttribute("visible", !0), this.peekCameraPortalOrientation = e1; + } else e1 <= 0 ? s.setAttribute("rotation", "0 180 0") : s.setAttribute("rotation", "0 0 0"), s.setAttribute("text", "width", 5), s.setAttribute("position", "0 1.5 0"), n.getObject3D("mesh").visible = !0, this.semiSphereEl.setAttribute("visible", !1), this.peekCameraPortalOrientation = void 0; + this.previousQuaternion && (i.quaternion.copy(this.previousQuaternion), this.previousQuaternion = void 0); + } + } + }), + hideAll: function() { + var e1 = this.el, t = this.hiddenEls, n = this; + t.length > 0 || e1.sceneEl.object3D.traverse(function(i) { + i && i.el && i.el.hasAttribute("link-controls") || i.el && i !== e1.sceneEl.object3D && i.el !== e1 && i.el !== n.sphereEl && i.el !== e1.sceneEl.cameraEl && !1 !== i.el.getAttribute("visible") && i.el !== n.textEl && i.el !== n.semiSphereEl && (i.el.setAttribute("visible", !1), t.push(i.el)); + }); + }, + showAll: function() { + this.hiddenEls.forEach(function(e1) { + e1.setAttribute("visible", !0); + }), this.hiddenEls = []; + }, + calculateCameraPortalOrientation: (i = new p.Matrix4, r = new p.Vector3, s = new p.Vector3(0, 0, 1), o = new p.Vector3(0, 0, 0), function() { + var e1 = this.el, t = e1.sceneEl.camera; + return r.set(0, 0, 0), s.set(0, 0, 1), o.set(0, 0, 0), e1.object3D.matrixWorld.extractRotation(i), s.applyMatrix4(i), e1.object3D.updateMatrixWorld(), e1.object3D.localToWorld(o), t.parent.parent.updateMatrixWorld(), t.parent.updateMatrixWorld(), t.updateMatrixWorld(), t.localToWorld(r), r.sub(o).normalize(), s.normalize(), Math.sign(s.dot(r)); + }), + remove: function() { + this.removeEventListener(); + } + }), d("portal", { + schema: { + borderEnabled: { + default: 1, + type: "int", + is: "uniform" + }, + backgroundColor: { + default: "red", + type: "color", + is: "uniform" + }, + pano: { + type: "map", + is: "uniform" + }, + strokeColor: { + default: "white", + type: "color", + is: "uniform" + } + }, + vertexShader: [ + "vec3 portalPosition;", + "varying vec3 vWorldPosition;", + "varying float vDistanceToCenter;", + "varying float vDistance;", + "void main() {", + "vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);", + "portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;", + "vDistance = length(portalPosition - cameraPosition);", + "vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;", + "gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);", + "}" + ].join("\n"), + fragmentShader: [ + "#define RECIPROCAL_PI2 0.15915494", + "uniform sampler2D pano;", + "uniform vec3 strokeColor;", + "uniform vec3 backgroundColor;", + "uniform float borderEnabled;", + "varying float vDistanceToCenter;", + "varying float vDistance;", + "varying vec3 vWorldPosition;", + "void main() {", + "vec3 direction = normalize(vWorldPosition - cameraPosition);", + "vec2 sampleUV;", + "float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);", + "sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);", + "sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;", + "if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {", + "gl_FragColor = vec4(strokeColor, 1.0);", + "} else {", + "gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / 15.0), 2.0), 0.0, 1.0));", + "}", + "}" + ].join("\n") + }); + }, + 7479: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(2666), s = n(8903), o = s.bind, a = Math.PI / 2; + e1.exports.Component = i("look-controls", { + dependencies: [ + "position", + "rotation" + ], + schema: { + enabled: { + default: !0 + }, + magicWindowTrackingEnabled: { + default: !0 + }, + pointerLockEnabled: { + default: !1 + }, + reverseMouseDrag: { + default: !1 + }, + reverseTouchDrag: { + default: !1 + }, + touchEnabled: { + default: !0 + }, + mouseEnabled: { + default: !0 + } + }, + init: function() { + this.deltaYaw = 0, this.previousHMDPosition = new r.Vector3, this.hmdQuaternion = new r.Quaternion, this.magicWindowAbsoluteEuler = new r.Euler, this.magicWindowDeltaEuler = new r.Euler, this.position = new r.Vector3, this.magicWindowObject = new r.Object3D, this.rotation = {}, this.deltaRotation = {}, this.savedPose = null, this.pointerLocked = !1, this.setupMouseControls(), this.bindMethods(), this.previousMouseEvent = {}, this.setupMagicWindowControls(), this.savedPose = { + position: new r.Vector3, + rotation: new r.Euler + }, (this.el.sceneEl.is("vr-mode") || this.el.sceneEl.is("ar-mode")) && this.onEnterVR(); + }, + setupMagicWindowControls: function() { + var e1, t = this.data; + (s.device.isMobile() || s.device.isMobileDeviceRequestingDesktopSite()) && (e1 = this.magicWindowControls = new r.DeviceOrientationControls(this.magicWindowObject), "undefined" != typeof DeviceOrientationEvent && DeviceOrientationEvent.requestPermission && (e1.enabled = !1, this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted ? e1.enabled = t.magicWindowTrackingEnabled : this.el.sceneEl.addEventListener("deviceorientationpermissiongranted", function() { + e1.enabled = t.magicWindowTrackingEnabled; + }))); + }, + update: function(e1) { + var t = this.data; + t.enabled !== e1.enabled && this.updateGrabCursor(t.enabled), e1 && !t.magicWindowTrackingEnabled && e1.magicWindowTrackingEnabled && (this.magicWindowAbsoluteEuler.set(0, 0, 0), this.magicWindowDeltaEuler.set(0, 0, 0)), this.magicWindowControls && (this.magicWindowControls.enabled = t.magicWindowTrackingEnabled), e1 && !t.pointerLockEnabled !== e1.pointerLockEnabled && (this.removeEventListeners(), this.addEventListeners(), this.pointerLocked && this.exitPointerLock()); + }, + tick: function(e1) { + this.data.enabled && this.updateOrientation(); + }, + play: function() { + this.addEventListeners(); + }, + pause: function() { + this.removeEventListeners(), this.pointerLocked && this.exitPointerLock(); + }, + remove: function() { + this.removeEventListeners(), this.pointerLocked && this.exitPointerLock(); + }, + bindMethods: function() { + this.onMouseDown = o(this.onMouseDown, this), this.onMouseMove = o(this.onMouseMove, this), this.onMouseUp = o(this.onMouseUp, this), this.onTouchStart = o(this.onTouchStart, this), this.onTouchMove = o(this.onTouchMove, this), this.onTouchEnd = o(this.onTouchEnd, this), this.onEnterVR = o(this.onEnterVR, this), this.onExitVR = o(this.onExitVR, this), this.onPointerLockChange = o(this.onPointerLockChange, this), this.onPointerLockError = o(this.onPointerLockError, this); + }, + setupMouseControls: function() { + this.mouseDown = !1, this.pitchObject = new r.Object3D, this.yawObject = new r.Object3D, this.yawObject.position.y = 10, this.yawObject.add(this.pitchObject); + }, + addEventListeners: function() { + var e1 = this.el.sceneEl, t = e1.canvas; + t ? (t.addEventListener("mousedown", this.onMouseDown, !1), window.addEventListener("mousemove", this.onMouseMove, !1), window.addEventListener("mouseup", this.onMouseUp, !1), t.addEventListener("touchstart", this.onTouchStart), window.addEventListener("touchmove", this.onTouchMove), window.addEventListener("touchend", this.onTouchEnd), e1.addEventListener("enter-vr", this.onEnterVR), e1.addEventListener("exit-vr", this.onExitVR), this.data.pointerLockEnabled && (document.addEventListener("pointerlockchange", this.onPointerLockChange, !1), document.addEventListener("mozpointerlockchange", this.onPointerLockChange, !1), document.addEventListener("pointerlockerror", this.onPointerLockError, !1))) : e1.addEventListener("render-target-loaded", o(this.addEventListeners, this)); + }, + removeEventListeners: function() { + var e1 = this.el.sceneEl, t = e1 && e1.canvas; + t && (t.removeEventListener("mousedown", this.onMouseDown), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), t.removeEventListener("touchstart", this.onTouchStart), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("touchend", this.onTouchEnd), e1.removeEventListener("enter-vr", this.onEnterVR), e1.removeEventListener("exit-vr", this.onExitVR), document.removeEventListener("pointerlockchange", this.onPointerLockChange, !1), document.removeEventListener("mozpointerlockchange", this.onPointerLockChange, !1), document.removeEventListener("pointerlockerror", this.onPointerLockError, !1)); + }, + updateOrientation: function() { + var e1 = this.el.object3D, t = this.pitchObject, n = this.yawObject, i = this.el.sceneEl; + (i.is("vr-mode") || i.is("ar-mode")) && i.checkHeadsetConnected() || (this.updateMagicWindowOrientation(), e1.rotation.x = this.magicWindowDeltaEuler.x + t.rotation.x, e1.rotation.y = this.magicWindowDeltaEuler.y + n.rotation.y, e1.rotation.z = this.magicWindowDeltaEuler.z); + }, + updateMagicWindowOrientation: function() { + var e1 = this.magicWindowAbsoluteEuler, t = this.magicWindowDeltaEuler; + this.magicWindowControls && this.magicWindowControls.enabled && (this.magicWindowControls.update(), e1.setFromQuaternion(this.magicWindowObject.quaternion, "YXZ"), this.previousMagicWindowYaw || 0 === e1.y || (this.previousMagicWindowYaw = e1.y), this.previousMagicWindowYaw && (t.x = e1.x, t.y += e1.y - this.previousMagicWindowYaw, t.z = e1.z, this.previousMagicWindowYaw = e1.y)); + }, + onMouseMove: function(e1) { + var t, n, i, r = this.pitchObject, s = this.previousMouseEvent, o = this.yawObject; + this.data.enabled && (this.mouseDown || this.pointerLocked) && (this.pointerLocked ? (n = e1.movementX || e1.mozMovementX || 0, i = e1.movementY || e1.mozMovementY || 0) : (n = e1.screenX - s.screenX, i = e1.screenY - s.screenY), this.previousMouseEvent.screenX = e1.screenX, this.previousMouseEvent.screenY = e1.screenY, t = this.data.reverseMouseDrag ? 1 : -1, o.rotation.y += .002 * n * t, r.rotation.x += .002 * i * t, r.rotation.x = Math.max(-a, Math.min(a, r.rotation.x))); + }, + onMouseDown: function(e1) { + var t = this.el.sceneEl; + if (this.data.enabled && this.data.mouseEnabled && (!t.is("vr-mode") && !t.is("ar-mode") || !t.checkHeadsetConnected()) && 0 === e1.button) { + var n = t && t.canvas; + this.mouseDown = !0, this.previousMouseEvent.screenX = e1.screenX, this.previousMouseEvent.screenY = e1.screenY, this.showGrabbingCursor(), this.data.pointerLockEnabled && !this.pointerLocked && (n.requestPointerLock ? n.requestPointerLock() : n.mozRequestPointerLock && n.mozRequestPointerLock()); + } + }, + showGrabbingCursor: function() { + this.el.sceneEl.canvas.style.cursor = "grabbing"; + }, + hideGrabbingCursor: function() { + this.el.sceneEl.canvas.style.cursor = ""; + }, + onMouseUp: function() { + this.mouseDown = !1, this.hideGrabbingCursor(); + }, + onTouchStart: function(e1) { + 1 !== e1.touches.length || !this.data.touchEnabled || this.el.sceneEl.is("vr-mode") || this.el.sceneEl.is("ar-mode") || (this.touchStart = { + x: e1.touches[0].pageX, + y: e1.touches[0].pageY + }, this.touchStarted = !0); + }, + onTouchMove: function(e1) { + var t, n, i = this.el.sceneEl.canvas, r = this.yawObject; + this.touchStarted && this.data.touchEnabled && (n = 2 * Math.PI * (e1.touches[0].pageX - this.touchStart.x) / i.clientWidth, t = this.data.reverseTouchDrag ? 1 : -1, r.rotation.y -= .5 * n * t, this.touchStart = { + x: e1.touches[0].pageX, + y: e1.touches[0].pageY + }); + }, + onTouchEnd: function() { + this.touchStarted = !1; + }, + onEnterVR: function() { + var e1 = this.el.sceneEl; + e1.checkHeadsetConnected() && (this.saveCameraPose(), this.el.object3D.position.set(0, 0, 0), this.el.object3D.rotation.set(0, 0, 0), e1.hasWebXR && (this.el.object3D.matrixAutoUpdate = !1, this.el.object3D.updateMatrix())); + }, + onExitVR: function() { + this.el.sceneEl.checkHeadsetConnected() && (this.restoreCameraPose(), this.previousHMDPosition.set(0, 0, 0), this.el.object3D.matrixAutoUpdate = !0); + }, + onPointerLockChange: function() { + this.pointerLocked = !(!document.pointerLockElement && !document.mozPointerLockElement); + }, + onPointerLockError: function() { + this.pointerLocked = !1; + }, + exitPointerLock: function() { + document.exitPointerLock(), this.pointerLocked = !1; + }, + updateGrabCursor: function(e1) { + var t = this.el.sceneEl; + function n() { + t.canvas.classList.add("a-grab-cursor"); + } + function i() { + t.canvas.classList.remove("a-grab-cursor"); + } + t.canvas ? e1 ? n() : i() : e1 ? t.addEventListener("render-target-loaded", n) : t.addEventListener("render-target-loaded", i); + }, + saveCameraPose: function() { + var e1 = this.el; + this.savedPose.position.copy(e1.object3D.position), this.savedPose.rotation.copy(e1.object3D.rotation), this.hasSavedPose = !0; + }, + restoreCameraPose: function() { + var e1 = this.el, t = this.savedPose; + this.hasSavedPose && (e1.object3D.position.copy(t.position), e1.object3D.rotation.copy(t.rotation), this.hasSavedPose = !1); + } + }); + }, + 240: (e1, t, n)=>{ + var i = n(7629), r = n(3515).registerComponent, s = n(6600), o = s.checkControllerPresentAndSetup, a = s.emitIfAxesChanged, l = s.onButtonEvent, c = "magicleap-one", h = n(8309).AFRAME_CDN_ROOT + "controllers/magicleap/magicleap-one-controller.glb"; + e1.exports.Component = r("magicleap-controls", { + schema: { + hand: { + default: "none" + }, + model: { + default: !0 + }, + orientationOffset: { + type: "vec3" + } + }, + mapping: { + axes: { + touchpad: [ + 0, + 1 + ] + }, + buttons: [ + "trigger", + "grip", + "touchpad", + "menu" + ] + }, + init: function() { + var e1 = this; + this.controllerPresent = !1, this.lastControllerCheck = 0, this.onButtonChanged = i(this.onButtonChanged, this), this.onButtonDown = function(t) { + l(t.detail.id, "down", e1); + }, this.onButtonUp = function(t) { + l(t.detail.id, "up", e1); + }, this.onButtonTouchEnd = function(t) { + l(t.detail.id, "touchend", e1); + }, this.onButtonTouchStart = function(t) { + l(t.detail.id, "touchstart", e1); + }, this.previousButtonValues = {}, this.bindMethods(); + }, + update: function() { + var e1 = this.data; + this.controllerIndex = "right" === e1.hand ? 0 : "left" === e1.hand ? 1 : 2; + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + bindMethods: function() { + this.onModelLoaded = i(this.onModelLoaded, this), this.onControllersUpdate = i(this.onControllersUpdate, this), this.checkIfControllerPresent = i(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = i(this.removeControllersUpdateListener, this), this.onAxisMoved = i(this.onAxisMoved, this); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("axismove", this.onAxisMoved), e1.addEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("axismove", this.onAxisMoved), e1.removeEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + var e1 = this.data; + o(this, c, { + index: this.controllerIndex, + hand: e1.hand + }); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + idPrefix: c, + hand: t.hand, + controller: this.controllerIndex, + orientationOffset: t.orientationOffset + }), this.data.model && this.el.setAttribute("gltf-model", h); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onButtonChanged: function(e1) { + var t, n = this.mapping.buttons[e1.detail.id]; + n && ("trigger" === n && (t = e1.detail.state.value, console.log("analog value of trigger press: " + t)), this.el.emit(n + "changed", e1.detail.state)); + }, + onModelLoaded: function(e1) { + e1.detail.model.scale.set(.01, .01, .01); + }, + onAxisMoved: function(e1) { + a(this, this.mapping.axes, e1); + }, + updateModel: function(e1, t) {}, + setButtonColor: function(e1, t) {} + }); + }, + 9115: (e1, t, n)=>{ + var i = n(8903), r = n(3515), s = n(2666), o = n(9644), a = i.debug("components:material:error"), l = r.registerComponent, c = o.shaders, h = o.shaderNames; + function u(e1, t) { + e1.dispose(), t.unregisterMaterial(e1); + } + e1.exports.Component = l("material", { + schema: { + alphaTest: { + default: 0, + min: 0, + max: 1 + }, + depthTest: { + default: !0 + }, + depthWrite: { + default: !0 + }, + flatShading: { + default: !1 + }, + npot: { + default: !1 + }, + offset: { + type: "vec2", + default: { + x: 0, + y: 0 + } + }, + opacity: { + default: 1, + min: 0, + max: 1 + }, + repeat: { + type: "vec2", + default: { + x: 1, + y: 1 + } + }, + shader: { + default: "standard", + oneOf: h, + schemaChange: !0 + }, + side: { + default: "front", + oneOf: [ + "front", + "back", + "double" + ] + }, + transparent: { + default: !1 + }, + vertexColorsEnabled: { + default: !1 + }, + visible: { + default: !0 + }, + blending: { + default: "normal", + oneOf: [ + "none", + "normal", + "additive", + "subtractive", + "multiply" + ] + }, + dithering: { + default: !0 + }, + anisotropy: { + default: 0, + min: 0 + } + }, + init: function() { + this.material = null; + }, + update: function(e1) { + var t = this.data; + this.shader && t.shader === e1.shader || this.updateShader(t.shader), this.shader.update(this.data), this.updateMaterial(e1); + }, + updateSchema: function(e1) { + var t, n, i, r; + n = e1 && e1.shader, t = this.oldData && this.oldData.shader, (i = c[r = n || t] && c[r].schema) || a("Unknown shader schema " + r), t && n === t || (this.extendSchema(i), this.updateBehavior()); + }, + updateBehavior: function() { + var e1, t, n = this.el.sceneEl, i = this.schema, r = this; + function s(e1, n) { + var i; + for(i in t)t[i] = e1; + r.shader.update(t); + } + for(e1 in this.tick = void 0, t = {}, i)"time" === i[e1].type && (this.tick = s, t[e1] = !0); + n && (this.tick ? n.addBehavior(this) : n.removeBehavior(this)); + }, + updateShader: function(e1) { + var t, n = this.data, i = c[e1] && c[e1].Shader; + if (!i) throw new Error("Unknown shader " + e1); + (t = this.shader = new i).el = this.el, t.init(n), this.setMaterial(t.material), this.updateSchema(n); + }, + updateMaterial: function(e1) { + var t, n = this.data, i = this.material; + for(t in i.alphaTest = n.alphaTest, i.depthTest = !1 !== n.depthTest, i.depthWrite = !1 !== n.depthWrite, i.opacity = n.opacity, i.flatShading = n.flatShading, i.side = function(e1) { + switch(e1){ + case "back": + return s.BackSide; + case "double": + return s.DoubleSide; + default: + return s.FrontSide; + } + }(n.side), i.transparent = !1 !== n.transparent || n.opacity < 1, i.vertexColors = n.vertexColorsEnabled, i.visible = n.visible, i.blending = function(e1) { + switch(e1){ + case "none": + return s.NoBlending; + case "additive": + return s.AdditiveBlending; + case "subtractive": + return s.SubtractiveBlending; + case "multiply": + return s.MultiplyBlending; + default: + return s.NormalBlending; + } + }(n.blending), i.dithering = n.dithering, e1)break; + !t || e1.alphaTest === n.alphaTest && e1.side === n.side && e1.vertexColorsEnabled === n.vertexColorsEnabled || (i.needsUpdate = !0); + }, + remove: function() { + var e1 = new s.MeshBasicMaterial, t = this.material, n = this.el.getObject3D("mesh"); + n && (n.material = e1), u(t, this.system); + }, + setMaterial: function(e1) { + var t, n = this.el, i = this.system; + this.material && u(this.material, i), this.material = e1, i.registerMaterial(e1), (t = n.getObject3D("mesh")) ? t.material = e1 : n.addEventListener("object3dset", function t(i) { + "mesh" === i.detail.type && i.target === n && (n.getObject3D("mesh").material = e1, n.removeEventListener("object3dset", t)); + }); + } + }); + }, + 5921: (e1, t, n)=>{ + var i, r, s, o, a = n(3515).registerComponent, l = n(2666); + a("obb-collider", { + schema: { + size: { + default: 0 + }, + trackedObject3D: { + default: "" + }, + minimumColliderDimension: { + default: .02 + }, + centerModel: { + default: !1 + } + }, + init: function() { + this.previousScale = new l.Vector3, this.auxEuler = new l.Euler, this.boundingBox = new l.Box3, this.boundingBoxSize = new l.Vector3, this.updateCollider = this.updateCollider.bind(this), this.onModelLoaded = this.onModelLoaded.bind(this), this.updateBoundingBox = this.updateBoundingBox.bind(this), this.el.addEventListener("model-loaded", this.onModelLoaded), this.updateCollider(), this.system.addCollider(this.el); + }, + remove: function() { + this.system.removeCollider(this.el); + }, + update: function() { + this.data.trackedObject3D && (this.trackedObject3DPath = this.data.trackedObject3D.split(".")); + }, + onModelLoaded: function() { + this.data.centerModel && this.centerModel(), this.updateCollider(); + }, + centerModel: function() { + var e1, t = this.el, n = t.components["gltf-model"] && t.components["gltf-model"].model; + n && (this.el.removeObject3D("mesh"), e1 = (new l.Box3).setFromObject(n).getCenter(new l.Vector3), n.position.x += n.position.x - e1.x, n.position.y += n.position.y - e1.y, n.position.z += n.position.z - e1.z, this.el.setObject3D("mesh", n)); + }, + updateCollider: function() { + var e1 = this.el, t = this.boundingBoxSize, n = this.aabb = this.aabb || new l.OBB; + this.obb = this.obb || new l.OBB, e1.hasLoaded ? (this.updateBoundingBox(), n.halfSize.copy(t).multiplyScalar(.5), this.el.sceneEl.systems["obb-collider"].data.showColliders && this.showCollider()) : e1.addEventListener("loaded", this.updateCollider); + }, + showCollider: function() { + this.updateColliderMesh(), this.renderColliderMesh.visible = !0; + }, + updateColliderMesh: function() { + var e1 = this.renderColliderMesh, t = this.boundingBoxSize; + e1 ? (e1.geometry.dispose(), e1.geometry = new l.BoxGeometry(t.x, t.y, t.z)) : this.initColliderMesh(); + }, + hideCollider: function() { + this.renderColliderMesh && (this.renderColliderMesh.visible = !1); + }, + initColliderMesh: function() { + var e1, t, n; + e1 = this.boundingBoxSize, t = this.renderColliderGeometry = new l.BoxGeometry(e1.x, e1.y, e1.z), (n = this.renderColliderMesh = new l.Mesh(t, new l.MeshLambertMaterial({ + color: 65280, + side: l.DoubleSide + }))).matrixAutoUpdate = !1, n.matrixWorldAutoUpdate = !1, n.updateMatrixWorld = function() {}, this.el.sceneEl.object3D.add(n); + }, + updateBoundingBox: function() { + var e1 = this.auxEuler, t = this.boundingBox, n = this.data.size, i = this.trackedObject3D || this.el.object3D, r = this.boundingBoxSize, s = this.data.minimumColliderDimension; + if (n) return this.boundingBoxSize.x = n, this.boundingBoxSize.y = n, void (this.boundingBoxSize.z = n); + this.previousScale.copy(i.scale), e1.copy(i.rotation), i.rotation.set(0, 0, 0), i.updateMatrixWorld(!0), t.setFromObject(i, !0), t.getSize(r), r.x = r.x < s ? s : r.x, r.y = r.y < s ? s : r.y, r.z = r.z < s ? s : r.z, this.el.object3D.rotation.copy(e1); + }, + checkTrackedObject: function() { + var e1, t = this.trackedObject3DPath; + if (t && t.length && !this.trackedObject3D) { + e1 = this.el; + for(var n = 0; n < t.length && (e1 = e1[t[n]]); n++); + e1 && (this.trackedObject3D = e1, this.updateCollider()); + } + return this.trackedObject3D; + }, + tick: (i = new l.Vector3, r = new l.Vector3, s = new l.Quaternion, o = new l.Matrix4, function() { + var e1 = this.obb, t = this.renderColliderMesh, n = this.checkTrackedObject() || this.el.object3D; + n && (n.scale.x === this.previousScale.x && n.scale.y === this.previousScale.y && n.scale.z === this.previousScale.z || this.updateCollider(), n.updateMatrix(), n.updateMatrixWorld(), n.matrixWorld.decompose(i, s, r), r.set(1, 1, 1), o.compose(i, s, r), t && t.matrixWorld.copy(o), e1.copy(this.aabb), e1.applyMatrix4(o)); + }) + }); + }, + 4269: (e1, t, n)=>{ + var i = n(4219), r = n(3515).registerComponent, s = n(2666), o = i("components:obj-model:warn"); + e1.exports.Component = r("obj-model", { + schema: { + mtl: { + type: "model" + }, + obj: { + type: "model" + } + }, + init: function() { + var e1 = this; + this.model = null, this.objLoader = new s.OBJLoader, this.mtlLoader = new s.MTLLoader(this.objLoader.manager), this.mtlLoader.crossOrigin = "", this.el.addEventListener("componentinitialized", function(t) { + e1.model && "material" === t.detail.name && e1.applyMaterial(); + }); + }, + update: function() { + var e1 = this.data; + e1.obj && (this.resetMesh(), this.loadObj(e1.obj, e1.mtl)); + }, + remove: function() { + this.model && this.resetMesh(); + }, + resetMesh: function() { + this.el.removeObject3D("mesh"); + }, + loadObj: function(e1, t) { + var n = this, i = this.el, r = this.mtlLoader, s = this.objLoader, a = this.el.sceneEl.systems.renderer, l = t.substr(0, t.lastIndexOf("/") + 1); + if (t) return i.hasAttribute("material") && o("Material component properties are ignored when a .MTL is provided"), r.setResourcePath(l), void r.load(t, function(t) { + t.preload(), s.setMaterials(t), s.load(e1, function(e1) { + n.model = e1, n.model.traverse(function(e1) { + if (e1.isMesh) { + var t = e1.material; + t.map && a.applyColorCorrection(t.map), t.emissiveMap && a.applyColorCorrection(t.emissiveMap); + } + }), i.setObject3D("mesh", e1), i.emit("model-loaded", { + format: "obj", + model: e1 + }); + }); + }); + s.load(e1, function(e1) { + n.model = e1, n.applyMaterial(), i.setObject3D("mesh", e1), i.emit("model-loaded", { + format: "obj", + model: e1 + }); + }); + }, + applyMaterial: function() { + var e1 = this.el.components.material; + e1 && this.model.traverse(function(t) { + t instanceof s.Mesh && (t.material = e1.material); + }); + } + }); + }, + 9536: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(7629), s = n(6600), o = s.checkControllerPresentAndSetup, a = s.emitIfAxesChanged, l = s.onButtonEvent, c = n(8903).device.isWebXRAvailable, h = n(8309).AFRAME_CDN_ROOT + "controllers/oculus/go/oculus-go-controller.gltf", u = c ? "oculus-go" : "Oculus Go", d = c ? { + axes: { + touchpad: [ + 0, + 1 + ] + }, + buttons: [ + "trigger", + "none", + "touchpad" + ] + } : { + axes: { + trackpad: [ + 0, + 1 + ] + }, + buttons: [ + "trackpad", + "trigger" + ] + }; + e1.exports.Component = i("oculus-go-controls", { + schema: { + hand: { + default: "" + }, + buttonColor: { + type: "color", + default: "#FFFFFF" + }, + buttonTouchedColor: { + type: "color", + default: "#BBBBBB" + }, + buttonHighlightColor: { + type: "color", + default: "#7A7A7A" + }, + model: { + default: !0 + }, + orientationOffset: { + type: "vec3" + }, + armModel: { + default: !0 + } + }, + mapping: d, + bindMethods: function() { + this.onModelLoaded = r(this.onModelLoaded, this), this.onControllersUpdate = r(this.onControllersUpdate, this), this.checkIfControllerPresent = r(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = r(this.removeControllersUpdateListener, this), this.onAxisMoved = r(this.onAxisMoved, this); + }, + init: function() { + var e1 = this; + this.onButtonChanged = r(this.onButtonChanged, this), this.onButtonDown = function(t) { + l(t.detail.id, "down", e1); + }, this.onButtonUp = function(t) { + l(t.detail.id, "up", e1); + }, this.onButtonTouchStart = function(t) { + l(t.detail.id, "touchstart", e1); + }, this.onButtonTouchEnd = function(t) { + l(t.detail.id, "touchend", e1); + }, this.controllerPresent = !1, this.lastControllerCheck = 0, this.bindMethods(); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("model-loaded", this.onModelLoaded), e1.addEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("model-loaded", this.onModelLoaded), e1.removeEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + o(this, u, this.data.hand ? { + hand: this.data.hand + } : {}); + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + armModel: t.armModel, + hand: t.hand, + idPrefix: u, + orientationOffset: t.orientationOffset + }), this.data.model && this.el.setAttribute("gltf-model", h); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onModelLoaded: function(e1) { + var t, n = e1.detail.model; + this.data.model && ((t = this.buttonMeshes = {}).trigger = n.getObjectByName("oculus_go_button_trigger"), t.trackpad = n.getObjectByName("oculus_go_touchpad"), t.touchpad = n.getObjectByName("oculus_go_touchpad")); + }, + onButtonChanged: function(e1) { + var t = this.mapping.buttons[e1.detail.id]; + t && this.el.emit(t + "changed", e1.detail.state); + }, + onAxisMoved: function(e1) { + a(this, this.mapping.axes, e1); + }, + updateModel: function(e1, t) { + this.data.model && this.updateButtonModel(e1, t); + }, + updateButtonModel: function(e1, t) { + var n = this.buttonMeshes; + if (n && n[e1]) { + var i; + switch(t){ + case "down": + i = this.data.buttonHighlightColor; + break; + case "touchstart": + i = this.data.buttonTouchedColor; + break; + default: + i = this.data.buttonColor; + } + n[e1].material.color.set(i); + } + } + }); + }, + 5569: (e1, t, n)=>{ + var i = n(7629), r = n(3515).registerComponent, s = n(2666), o = n(6600), a = o.checkControllerPresentAndSetup, l = o.emitIfAxesChanged, c = o.onButtonEvent, h = n(8903).device.isWebXRAvailable, u = "oculus-touch", d = h ? u : "Oculus Touch", p = n(8309).AFRAME_CDN_ROOT, A = p + "controllers/oculus/oculus-touch-controller-", f = p + "controllers/meta/", m = { + left: { + modelUrl: A + "left.gltf", + rayOrigin: { + origin: { + x: .008, + y: -0.01, + z: 0 + }, + direction: { + x: 0, + y: -0.8, + z: -1 + } + }, + modelPivotOffset: new s.Vector3(-0.005, .003, -0.055), + modelPivotRotation: new s.Euler(0, 0, 0) + }, + right: { + modelUrl: A + "right.gltf", + rayOrigin: { + origin: { + x: -0.008, + y: -0.01, + z: 0 + }, + direction: { + x: 0, + y: -0.8, + z: -1 + } + }, + modelPivotOffset: new s.Vector3(.005, .003, -0.055), + modelPivotRotation: new s.Euler(0, 0, 0) + } + }, g = { + left: { + modelUrl: A + "left.gltf", + rayOrigin: { + origin: { + x: .002, + y: -0.005, + z: -0.03 + }, + direction: { + x: 0, + y: -0.8, + z: -1 + } + }, + modelPivotOffset: new s.Vector3(-0.005, .036, -0.037), + modelPivotRotation: new s.Euler(Math.PI / 4.5, 0, 0) + }, + right: { + modelUrl: A + "right.gltf", + rayOrigin: { + origin: { + x: -0.002, + y: -0.005, + z: -0.03 + }, + direction: { + x: 0, + y: -0.8, + z: -1 + } + }, + modelPivotOffset: new s.Vector3(.005, .036, -0.037), + modelPivotRotation: new s.Euler(Math.PI / 4.5, 0, 0) + } + }, v = "oculus-touch", y = { + "oculus-touch": h ? g : m, + "oculus-touch-v2": { + left: { + modelUrl: A + "gen2-left.gltf", + rayOrigin: { + origin: { + x: -0.006, + y: -0.03, + z: -0.04 + }, + direction: { + x: 0, + y: -0.9, + z: -1 + } + }, + modelPivotOffset: new s.Vector3(0, -0.007, -0.021), + modelPivotRotation: new s.Euler(-Math.PI / 4, 0, 0) + }, + right: { + modelUrl: A + "gen2-right.gltf", + rayOrigin: { + origin: { + x: .006, + y: -0.03, + z: -0.04 + }, + direction: { + x: 0, + y: -0.9, + z: -1 + } + }, + modelPivotOffset: new s.Vector3(0, -0.007, -0.021), + modelPivotRotation: new s.Euler(-Math.PI / 4, 0, 0) + } + }, + "oculus-touch-v3": { + left: { + modelUrl: A + "v3-left.glb", + rayOrigin: { + origin: { + x: .0065, + y: -0.0186, + z: -0.05 + }, + direction: { + x: .12394785839500175, + y: -0.5944043672340157, + z: -0.7945567170519814 + } + }, + modelPivotOffset: new s.Vector3(0, 0, 0), + modelPivotRotation: new s.Euler(0, 0, 0) + }, + right: { + modelUrl: A + "v3-right.glb", + rayOrigin: { + origin: { + x: -0.0065, + y: -0.0186, + z: -0.05 + }, + direction: { + x: -0.12394785839500175, + y: -0.5944043672340157, + z: -0.7945567170519814 + } + }, + modelPivotOffset: new s.Vector3(0, 0, 0), + modelPivotRotation: new s.Euler(0, 0, 0) + } + }, + "meta-quest-touch-pro": { + left: { + modelUrl: f + "quest-touch-pro-left.glb", + rayOrigin: { + origin: { + x: .0065, + y: -0.0186, + z: -0.05 + }, + direction: { + x: .12394785839500175, + y: -0.5944043672340157, + z: -0.7945567170519814 + } + }, + modelPivotOffset: new s.Vector3(0, 0, 0), + modelPivotRotation: new s.Euler(0, 0, 0) + }, + right: { + modelUrl: f + "quest-touch-pro-right.glb", + rayOrigin: { + origin: { + x: -0.0065, + y: -0.0186, + z: -0.05 + }, + direction: { + x: -0.12394785839500175, + y: -0.5944043672340157, + z: -0.7945567170519814 + } + }, + modelPivotOffset: new s.Vector3(0, 0, 0), + modelPivotRotation: new s.Euler(0, 0, 0) + } + }, + "meta-quest-touch-plus": { + left: { + modelUrl: f + "quest-touch-plus-left.glb", + rayOrigin: { + origin: { + x: .0065, + y: -0.0186, + z: -0.05 + }, + direction: { + x: .12394785839500175, + y: -0.5944043672340157, + z: -0.7945567170519814 + } + }, + modelPivotOffset: new s.Vector3(0, 0, 0), + modelPivotRotation: new s.Euler(0, 0, 0) + }, + right: { + modelUrl: f + "quest-touch-plus-right.glb", + rayOrigin: { + origin: { + x: -0.0065, + y: -0.0186, + z: -0.05 + }, + direction: { + x: -0.12394785839500175, + y: -0.5944043672340157, + z: -0.7945567170519814 + } + }, + modelPivotOffset: new s.Vector3(0, 0, 0), + modelPivotRotation: new s.Euler(0, 0, 0) + } + } + }, E = h ? { + left: { + axes: { + thumbstick: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "grip", + "none", + "thumbstick", + "xbutton", + "ybutton", + "surface" + ] + }, + right: { + axes: { + thumbstick: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "grip", + "none", + "thumbstick", + "abutton", + "bbutton", + "surface" + ] + } + } : { + left: { + axes: { + thumbstick: [ + 0, + 1 + ] + }, + buttons: [ + "thumbstick", + "trigger", + "grip", + "xbutton", + "ybutton", + "surface" + ] + }, + right: { + axes: { + thumbstick: [ + 0, + 1 + ] + }, + buttons: [ + "thumbstick", + "trigger", + "grip", + "abutton", + "bbutton", + "surface" + ] + } + }; + function b(e1) { + e1.traverse(function(t) { + var n; + "Mesh" === t.type && (n = t.material.clone(), e1.originalColor = t.material.color, t.material.dispose(), t.material = n); + }); + } + e1.exports.Component = r("oculus-touch-controls", { + schema: { + hand: { + default: "left" + }, + buttonColor: { + type: "color", + default: "#999" + }, + buttonTouchColor: { + type: "color", + default: "#8AB" + }, + buttonHighlightColor: { + type: "color", + default: "#2DF" + }, + model: { + default: !0 + }, + controllerType: { + default: "auto", + oneOf: [ + "auto", + "oculus-touch", + "oculus-touch-v2", + "oculus-touch-v3" + ] + }, + orientationOffset: { + type: "vec3", + default: { + x: 43, + y: 0, + z: 0 + } + } + }, + mapping: E, + bindMethods: function() { + this.onButtonChanged = i(this.onButtonChanged, this), this.onThumbstickMoved = i(this.onThumbstickMoved, this), this.onModelLoaded = i(this.onModelLoaded, this), this.onControllersUpdate = i(this.onControllersUpdate, this), this.checkIfControllerPresent = i(this.checkIfControllerPresent, this), this.onAxisMoved = i(this.onAxisMoved, this); + }, + init: function() { + var e1 = this; + this.onButtonDown = function(t) { + c(t.detail.id, "down", e1, e1.data.hand); + }, this.onButtonUp = function(t) { + c(t.detail.id, "up", e1, e1.data.hand); + }, this.onButtonTouchStart = function(t) { + c(t.detail.id, "touchstart", e1, e1.data.hand); + }, this.onButtonTouchEnd = function(t) { + c(t.detail.id, "touchend", e1, e1.data.hand); + }, this.controllerPresent = !1, this.lastControllerCheck = 0, this.previousButtonValues = {}, this.bindMethods(), this.triggerEuler = new s.Euler; + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("axismove", this.onAxisMoved), e1.addEventListener("model-loaded", this.onModelLoaded), e1.addEventListener("thumbstickmoved", this.onThumbstickMoved), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("axismove", this.onAxisMoved), e1.removeEventListener("model-loaded", this.onModelLoaded), e1.removeEventListener("thumbstickmoved", this.onThumbstickMoved), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + a(this, d, { + hand: this.data.hand, + iterateControllerProfiles: !0 + }); + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + loadModel: function(e1) { + var t, n = this.data; + if (n.model) { + if (this.controllerObject3D) this.el.setObject3D("mesh", this.controllerObject3D); + else { + if (this.displayModel = y[n.controllerType] || y[v], "auto" === n.controllerType) { + var i = this.el.sceneEl.systems["tracked-controls-webvr"]; + if (i && i.vrDisplay) { + var r = i.vrDisplay.displayName; + /^Oculus Quest$/.test(r) && (this.displayModel = y["oculus-touch-v2"]); + } else { + t = v; + for(var s = Object.keys(y), o = 0; o < e1.profiles.length; o++)if (-1 !== s.indexOf(e1.profiles[o])) { + t = e1.profiles[o]; + break; + } + this.displayModel = y[t]; + } + } + var a = this.displayModel[n.hand].modelUrl; + this.isTouchV3orPROorPlus = this.displayModel === y["oculus-touch-v3"] || this.displayModel === y["meta-quest-touch-pro"] || this.displayModel === y["meta-quest-touch-plus"], this.el.setAttribute("gltf-model", a); + } + } + }, + injectTrackedControls: function(e1) { + var t = this.data, n = u, i = "right" === t.hand ? "Oculus Touch (Right)" : "Oculus Touch (Left)", r = h ? n : i; + this.el.setAttribute("tracked-controls", { + id: r, + hand: t.hand, + orientationOffset: t.orientationOffset, + handTrackingEnabled: !1, + iterateControllerProfiles: !0, + space: "gripSpace" + }), this.loadModel(e1); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onButtonChanged: function(e1) { + var t = this.mapping[this.data.hand].buttons[e1.detail.id]; + if (t) { + if (this.isTouchV3orPROorPlus) this.onButtonChangedV3orPROorPlus(e1); + else { + var n, i = this.buttonMeshes; + "trigger" !== t && "grip" !== t || (n = e1.detail.state.value), i && ("trigger" === t && i.trigger && (i.trigger.rotation.x = this.originalXRotationTrigger - n * (Math.PI / 26)), "grip" === t && i.grip && (n *= "left" === this.data.hand ? -1 : 1, i.grip.position.x = this.originalXPositionGrip + .004 * n)); + } + this.el.emit(t + "changed", e1.detail.state); + } + }, + onButtonChangedV3orPROorPlus: function(e1) { + var t, n = this.mapping[this.data.hand].buttons[e1.detail.id], i = this.buttonObjects; + i && (t = e1.detail.state.value, i[n].quaternion.slerpQuaternions(this.buttonRanges[n].min.quaternion, this.buttonRanges[n].max.quaternion, t), i[n].position.lerpVectors(this.buttonRanges[n].min.position, this.buttonRanges[n].max.position, t)); + }, + onModelLoaded: function(e1) { + if (this.data.model) { + if (this.isTouchV3orPROorPlus) this.onTouchV3orPROorPlusModelLoaded(e1); + else { + var t, n = this.controllerObject3D = e1.detail.model; + (t = this.buttonMeshes = {}).grip = n.getObjectByName("buttonHand"), this.originalXPositionGrip = t.grip && t.grip.position.x, t.trigger = n.getObjectByName("buttonTrigger"), this.originalXRotationTrigger = t.trigger && t.trigger.rotation.x, t.thumbstick = n.getObjectByName("stick"), t.xbutton = n.getObjectByName("buttonX"), t.abutton = n.getObjectByName("buttonA"), t.ybutton = n.getObjectByName("buttonY"), t.bbutton = n.getObjectByName("buttonB"); + } + for(var i in this.buttonMeshes)this.buttonMeshes[i] && b(this.buttonMeshes[i]); + this.applyOffset(e1.detail.model), this.el.emit("controllermodelready", { + name: "oculus-touch-controls", + model: this.data.model, + rayOrigin: this.displayModel[this.data.hand].rayOrigin + }); + } + }, + applyOffset: function(e1) { + e1.position.copy(this.displayModel[this.data.hand].modelPivotOffset), e1.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation); + }, + onTouchV3orPROorPlusModelLoaded: function(e1) { + var t = this.controllerObject3D = e1.detail.model, n = this.buttonObjects = {}, i = this.buttonMeshes = {}, r = this.buttonRanges = {}; + i.grip = t.getObjectByName("squeeze"), n.grip = t.getObjectByName("xr_standard_squeeze_pressed_value"), r.grip = { + min: t.getObjectByName("xr_standard_squeeze_pressed_min"), + max: t.getObjectByName("xr_standard_squeeze_pressed_max") + }, n.grip.minX = n.grip.position.x, i.thumbstick = t.getObjectByName("thumbstick"), n.thumbstick = t.getObjectByName("xr_standard_thumbstick_pressed_value"), r.thumbstick = { + min: t.getObjectByName("xr_standard_thumbstick_pressed_min"), + max: t.getObjectByName("xr_standard_thumbstick_pressed_max") + }, n.thumbstickXAxis = t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"), r.thumbstickXAxis = { + min: t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"), + max: t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max") + }, n.thumbstickYAxis = t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"), r.thumbstickYAxis = { + min: t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"), + max: t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max") + }, i.trigger = t.getObjectByName("trigger"), n.trigger = t.getObjectByName("xr_standard_trigger_pressed_value"), r.trigger = { + min: t.getObjectByName("xr_standard_trigger_pressed_min"), + max: t.getObjectByName("xr_standard_trigger_pressed_max") + }, r.trigger.diff = { + x: Math.abs(r.trigger.max.rotation.x) - Math.abs(r.trigger.min.rotation.x), + y: Math.abs(r.trigger.max.rotation.y) - Math.abs(r.trigger.min.rotation.y), + z: Math.abs(r.trigger.max.rotation.z) - Math.abs(r.trigger.min.rotation.z) + }; + var s = "left" === this.data.hand ? "x" : "a", o = "left" === this.data.hand ? "y" : "b", a = s + "button", l = o + "button"; + i[a] = t.getObjectByName(s + "_button"), n[a] = t.getObjectByName(s + "_button_pressed_value"), r[a] = { + min: t.getObjectByName(s + "_button_pressed_min"), + max: t.getObjectByName(s + "_button_pressed_max") + }, i[l] = t.getObjectByName(o + "_button"), n[l] = t.getObjectByName(o + "_button_pressed_value"), r[l] = { + min: t.getObjectByName(o + "_button_pressed_min"), + max: t.getObjectByName(o + "_button_pressed_max") + }; + }, + onAxisMoved: function(e1) { + l(this, this.mapping[this.data.hand].axes, e1); + }, + onThumbstickMoved: function(e1) { + if (this.buttonMeshes && this.buttonMeshes.thumbstick) { + if (this.isTouchV3orPROorPlus) this.updateThumbstickTouchV3orPROorPlus(e1); + else for(var t in e1.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[t]] = this.buttonRanges.thumbstick.originalRotation[this.axisMap[t]] - Math.PI / 8 * e1.detail[t] * ("y" === t || "right" === this.data.hand ? -1 : 1); + } + }, + axisMap: { + y: "x", + x: "z" + }, + updateThumbstickTouchV3orPROorPlus: function(e1) { + var t = (e1.detail.x + 1) / 2; + this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion, this.buttonRanges.thumbstickXAxis.max.quaternion, t); + var n = (e1.detail.y + 1) / 2; + this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion, this.buttonRanges.thumbstickYAxis.max.quaternion, n); + }, + updateModel: function(e1, t) { + this.data.model && this.updateButtonModel(e1, t); + }, + updateButtonModel: function(e1, t) { + var n, i = this.buttonMeshes; + i && i[e1] && (n = "up" === t || "touchend" === t ? i[e1].originalColor || this.data.buttonColor : "touchstart" === t ? this.data.buttonTouchColor : this.data.buttonHighlightColor, i[e1].material.color.set(n)); + } + }); + }, + 8497: (e1, t, n)=>{ + var i = n(7629), r = n(3515).registerComponent, s = n(2666), o = n(6600), a = o.checkControllerPresentAndSetup, l = o.emitIfAxesChanged, c = o.onButtonEvent, h = "pico-4", u = n(8309).AFRAME_CDN_ROOT + "controllers/pico/pico4/"; + e1.exports.Component = r("pico-controls", { + schema: { + hand: { + default: "none" + }, + model: { + default: !0 + }, + orientationOffset: { + type: "vec3" + } + }, + mapping: { + left: { + axes: { + touchpad: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "squeeze", + "none", + "thumbstick", + "xbutton", + "ybutton" + ] + }, + right: { + axes: { + touchpad: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "squeeze", + "none", + "thumbstick", + "abutton", + "bbutton" + ] + } + }, + init: function() { + var e1 = this; + this.onButtonChanged = i(this.onButtonChanged, this), this.onButtonDown = function(t) { + c(t.detail.id, "down", e1, e1.data.hand); + }, this.onButtonUp = function(t) { + c(t.detail.id, "up", e1, e1.data.hand); + }, this.onButtonTouchEnd = function(t) { + c(t.detail.id, "touchend", e1, e1.data.hand); + }, this.onButtonTouchStart = function(t) { + c(t.detail.id, "touchstart", e1, e1.data.hand); + }, this.bindMethods(); + }, + update: function() { + var e1 = this.data; + this.controllerIndex = "right" === e1.hand ? 0 : "left" === e1.hand ? 1 : 2; + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + bindMethods: function() { + this.onModelLoaded = i(this.onModelLoaded, this), this.onControllersUpdate = i(this.onControllersUpdate, this), this.checkIfControllerPresent = i(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = i(this.removeControllersUpdateListener, this), this.onAxisMoved = i(this.onAxisMoved, this); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("axismove", this.onAxisMoved), e1.addEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("axismove", this.onAxisMoved), e1.removeEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + var e1 = this.data; + a(this, h, { + index: this.controllerIndex, + hand: e1.hand + }); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + idPrefix: h, + hand: t.hand, + controller: this.controllerIndex, + orientationOffset: t.orientationOffset + }), this.data.model && this.el.setAttribute("gltf-model", u + this.data.hand + ".glb"); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onButtonChanged: function(e1) { + var t, n = this.mapping[this.data.hand].buttons[e1.detail.id]; + n && ("trigger" === n && (t = e1.detail.state.value, console.log("analog value of trigger press: " + t)), this.el.emit(n + "changed", e1.detail.state)); + }, + onModelLoaded: function(e1) { + this.data.model && this.el.emit("controllermodelready", { + name: "pico-controls", + model: this.data.model, + rayOrigin: new s.Vector3(0, 0, 0) + }); + }, + onAxisMoved: function(e1) { + l(this, this.mapping.axes, e1); + } + }); + }, + 4854: (e1, t, n)=>{ + var i = n(3515).registerComponent; + e1.exports.Component = i("position", { + schema: { + type: "vec3" + }, + update: function() { + var e1 = this.el.object3D, t = this.data; + e1.position.set(t.x, t.y, t.z); + }, + remove: function() { + this.el.object3D.position.set(0, 0, 0); + } + }); + }, + 7454: (e1, t, n)=>{ + var i, r, s = n(3515).registerComponent, o = n(2666), a = n(8903).debug("components:raycaster:warn"), l = /^[\w\s-.,[\]#]*$/, c = { + childList: !0, + attributes: !0, + subtree: !0 + }, h = "raycaster-intersected-cleared", u = "raycaster-intersection-cleared"; + function d(e1, t) { + var n; + for(e1.length = t.length, n = 0; n < t.length; n++)e1[n] = t[n]; + } + e1.exports.Component = s("raycaster", { + schema: { + autoRefresh: { + default: !0 + }, + direction: { + type: "vec3", + default: { + x: 0, + y: 0, + z: -1 + } + }, + enabled: { + default: !0 + }, + far: { + default: 1e3 + }, + interval: { + default: 0 + }, + near: { + default: 0 + }, + objects: { + default: "" + }, + origin: { + type: "vec3" + }, + showLine: { + default: !1 + }, + lineColor: { + default: "white" + }, + lineOpacity: { + default: 1 + }, + useWorldCoordinates: { + default: !1 + } + }, + multiple: !0, + init: function() { + this.clearedIntersectedEls = [], this.unitLineEndVec3 = new o.Vector3, this.intersectedEls = [], this.intersections = [], this.newIntersectedEls = [], this.newIntersections = [], this.objects = [], this.prevCheckTime = void 0, this.prevIntersectedEls = [], this.rawIntersections = [], this.raycaster = new o.Raycaster, this.updateOriginDirection(), this.setDirty = this.setDirty.bind(this), this.updateLine = this.updateLine.bind(this), this.observer = new MutationObserver(this.setDirty), this.dirty = !0, this.lineEndVec3 = new o.Vector3, this.otherLineEndVec3 = new o.Vector3, this.lineData = { + end: this.lineEndVec3 + }, this.getIntersection = this.getIntersection.bind(this), this.intersectedDetail = { + el: this.el, + getIntersection: this.getIntersection + }, this.intersectedClearedDetail = { + el: this.el + }, this.intersectionClearedDetail = { + clearedEls: this.clearedIntersectedEls + }, this.intersectionDetail = {}; + }, + update: function(e1) { + var t = this.data, n = this.el, i = this.raycaster; + i.far = t.far, i.near = t.near, !t.showLine || t.far === e1.far && t.origin === e1.origin && t.direction === e1.direction && e1.showLine || (this.unitLineEndVec3.copy(t.direction).normalize(), this.drawLine()), !t.showLine && e1.showLine && n.removeAttribute("line"), t.objects === e1.objects || l.test(t.objects) || a('[raycaster] Selector "' + t.objects + '" may not update automatically with DOM changes.'), t.objects || a('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'), t.autoRefresh !== e1.autoRefresh && n.isPlaying && (t.autoRefresh ? this.addEventListeners() : this.removeEventListeners()), e1.enabled && !t.enabled && this.clearAllIntersections(), this.setDirty(); + }, + play: function() { + this.addEventListeners(); + }, + pause: function() { + this.removeEventListeners(); + }, + remove: function() { + this.data.showLine && this.el.removeAttribute("line"), this.clearAllIntersections(); + }, + addEventListeners: function() { + this.data.autoRefresh && (this.observer.observe(this.el.sceneEl, c), this.el.sceneEl.addEventListener("object3dset", this.setDirty), this.el.sceneEl.addEventListener("object3dremove", this.setDirty)); + }, + removeEventListeners: function() { + this.observer.disconnect(), this.el.sceneEl.removeEventListener("object3dset", this.setDirty), this.el.sceneEl.removeEventListener("object3dremove", this.setDirty); + }, + setDirty: function() { + this.dirty = !0; + }, + refreshObjects: function() { + var e1, t = this.data; + e1 = t.objects ? this.el.sceneEl.querySelectorAll(t.objects) : this.el.sceneEl.querySelectorAll("*"), this.objects = this.flattenObject3DMaps(e1), this.dirty = !1; + }, + tock: function(e1) { + var t = this.data, n = this.prevCheckTime; + t.enabled && (n && e1 - n < t.interval || (this.prevCheckTime = e1, this.checkIntersections())); + }, + checkIntersections: function() { + var e1, t, n = this.clearedIntersectedEls, i = this.el, r = this.data, s = this.intersectedEls, o = this.intersections, a = this.newIntersectedEls, l = this.newIntersections, c = this.prevIntersectedEls, p = this.rawIntersections; + for(this.dirty && this.refreshObjects(), d(this.prevIntersectedEls, this.intersectedEls), this.updateOriginDirection(), p.length = 0, this.raycaster.intersectObjects(this.objects, !0, p), o.length = 0, s.length = 0, e1 = 0; e1 < p.length; e1++)t = p[e1], r.showLine && t.object === i.getObject3D("line") || t.object.el && (o.push(t), s.push(t.object.el)); + for(l.length = 0, a.length = 0, e1 = 0; e1 < o.length; e1++)-1 === c.indexOf(o[e1].object.el) && (l.push(o[e1]), a.push(o[e1].object.el)); + for(n.length = 0, e1 = 0; e1 < c.length; e1++)-1 === s.indexOf(c[e1]) && (c[e1].emit(h, this.intersectedClearedDetail), n.push(c[e1])); + for(n.length && i.emit(u, this.intersectionClearedDetail), e1 = 0; e1 < a.length; e1++)a[e1].emit("raycaster-intersected", this.intersectedDetail); + l.length && (this.intersectionDetail.els = a, this.intersectionDetail.intersections = l, i.emit("raycaster-intersection", this.intersectionDetail)), (0 === c.length && o.length > 0 || c.length > 0 && 0 === o.length || c.length && o.length && c[0] !== o[0].object.el) && (this.intersectionDetail.els = this.intersectedEls, this.intersectionDetail.intersections = o, i.emit("raycaster-closest-entity-changed", this.intersectionDetail)), r.showLine && setTimeout(this.updateLine); + }, + updateLine: function() { + var e1, t = this.el, n = this.intersections; + n.length && (e1 = n[0].object.el === t && n[1] ? n[1].distance : n[0].distance), this.drawLine(e1); + }, + getIntersection: function(e1) { + var t, n; + for(t = 0; t < this.intersections.length; t++)if ((n = this.intersections[t]).object.el === e1) return n; + return null; + }, + updateOriginDirection: (i = new o.Vector3, r = new o.Vector3, function() { + var e1 = this.el, t = this.data; + t.useWorldCoordinates ? this.raycaster.set(t.origin, t.direction) : (e1.object3D.updateMatrixWorld(), r.setFromMatrixPosition(e1.object3D.matrixWorld), 0 === t.origin.x && 0 === t.origin.y && 0 === t.origin.z || (r = e1.object3D.localToWorld(r.copy(t.origin))), i.copy(t.direction).transformDirection(e1.object3D.matrixWorld).normalize(), this.raycaster.set(r, i)); + }), + drawLine: function(e1) { + var t, n = this.data, i = this.el; + t = this.lineData.end === this.lineEndVec3 ? this.otherLineEndVec3 : this.lineEndVec3, void 0 === e1 && (e1 = n.far === 1 / 0 ? 1e3 : n.far), this.lineData.start = n.origin, this.lineData.end = t.copy(this.unitLineEndVec3).multiplyScalar(e1).add(n.origin), this.lineData.color = n.lineColor, this.lineData.opacity = n.lineOpacity, i.setAttribute("line", this.lineData); + }, + flattenObject3DMaps: function(e1) { + var t, n, i = this.objects, r = this.el.sceneEl.object3D; + function s(e1) { + return e1.parent ? s(e1.parent) : e1 === r; + } + for(i.length = 0, n = 0; n < e1.length; n++){ + var o = e1[n]; + if (o.isEntity && o.object3D && s(o.object3D)) for(t in o.object3DMap)i.push(o.getObject3D(t)); + } + return i; + }, + clearAllIntersections: function() { + var e1; + for(e1 = 0; e1 < this.intersectedEls.length; e1++)this.intersectedEls[e1].emit(h, this.intersectedClearedDetail); + d(this.clearedIntersectedEls, this.intersectedEls), this.intersectedEls.length = 0, this.intersections.length = 0, this.el.emit(u, this.intersectionClearedDetail); + } + }); + }, + 4914: (e1, t, n)=>{ + var i = n(2666).MathUtils.degToRad, r = n(3515).registerComponent; + e1.exports.Component = r("rotation", { + schema: { + type: "vec3" + }, + update: function() { + var e1 = this.data, t = this.el.object3D; + t.rotation.set(i(e1.x), i(e1.y), i(e1.z)), t.rotation.order = "YXZ"; + }, + remove: function() { + this.el.object3D.rotation.set(0, 0, 0); + } + }); + }, + 3689: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = 1e-5; + e1.exports.Component = i("scale", { + schema: { + type: "vec3", + default: { + x: 1, + y: 1, + z: 1 + } + }, + update: function() { + var e1 = this.data, t = this.el.object3D, n = 0 === e1.x ? r : e1.x, i = 0 === e1.y ? r : e1.y, s = 0 === e1.z ? r : e1.z; + t.scale.set(n, i, s); + }, + remove: function() { + this.el.object3D.scale.set(1, 1, 1); + } + }); + }, + 3431: (e1, t, n)=>{ + var i, r, s, o = n(3515).registerComponent, a = n(2666), l = (i = new a.Quaternion, r = new a.Vector3, function(e1, t, n) { + t.position.copy(e1.transform.position), t.quaternion.copy(e1.transform.orientation), r.copy(n), i.copy(e1.transform.orientation), r.applyQuaternion(i), t.position.sub(r); + }); + function c(e1, t) { + this.renderer = e1, this.xrHitTestSource = null, e1.xr.addEventListener("sessionend", (function() { + this.xrHitTestSource = null; + }).bind(this)), e1.xr.addEventListener("sessionstart", (function() { + this.sessionStart(t); + }).bind(this)), this.renderer.xr.isPresenting && this.sessionStart(t); + } + function h(e1) { + console.warn(e1.message), console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from ?'); + } + l.tempFakePose = { + transform: { + orientation: new a.Quaternion, + position: new a.Vector3 + } + }, c.prototype.previousFrameAnchors = new Set, c.prototype.anchorToObject3D = new Map, c.prototype.sessionStart = function(e1) { + this.session = this.renderer.xr.getSession(), "requestHitTestSource" in this.session ? e1.space ? this.session.requestHitTestSource(e1).then((function(e1) { + this.xrHitTestSource = e1; + }).bind(this)).catch(h) : e1.profile && this.session.requestHitTestSourceForTransientInput(e1).then((function(e1) { + this.xrHitTestSource = e1, this.transient = !0; + }).bind(this)).catch(h) : h({ + message: "No requestHitTestSource on the session." + }); + }, c.prototype.anchorFromLastHitTestResult = function(e1, t) { + var n = this.lastHitTest; + if (n) { + var i = { + object3D: e1, + offset: t + }; + Array.from(this.anchorToObject3D.entries()).forEach((function(t) { + var n = t[1].object3D, i = t[0]; + n === e1 && (this.anchorToObject3D.delete(i), i.delete()); + }).bind(this)), n.createAnchor && n.createAnchor().then((function(e1) { + this.anchorToObject3D.set(e1, i); + }).bind(this)).catch(function(e1) { + console.warn(e1.message), console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from ?'); + }); + } + }, c.prototype.doHit = function(e1) { + if (this.renderer.xr.isPresenting) { + var t, n, i = this.renderer.xr.getReferenceSpace(), r = e1.getViewerPose(i); + return this.xrHitTestSource && r ? this.transient ? (t = e1.getHitTestResultsForTransientInput(this.xrHitTestSource)).length > 0 && (n = t[0].results).length > 0 && (this.lastHitTest = n[0], n[0].getPose(i)) : (t = e1.getHitTestResults(this.xrHitTestSource)).length > 0 && (this.lastHitTest = t[0], t[0].getPose(i)) : void 0; + } + }, c.updateAnchorPoses = function(e1, t) { + var n = e1.trackedAnchors || c.prototype.previousFrameAnchors; + c.prototype.previousFrameAnchors.forEach(function(e1) { + n.has(e1) || c.prototype.anchorToObject3D.delete(e1); + }), n.forEach(function(n) { + var i, r, s, o; + try { + i = e1.getPose(n.anchorSpace, t); + } catch (e1) {} + i && (s = (r = c.prototype.anchorToObject3D.get(n)).offset, o = r.object3D, l(i, o, s)); + }); + }, e1.exports.Component = o("ar-hit-test", { + schema: { + target: { + type: "selector" + }, + enabled: { + default: !0 + }, + src: { + default: "data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=", + type: "map" + }, + type: { + default: "footprint", + oneOf: [ + "footprint", + "map" + ] + }, + footprintDepth: { + default: .1 + }, + mapSize: { + type: "vec2", + default: { + x: .5, + y: .5 + } + } + }, + init: function() { + this.hitTest = null, this.imageDataArray = new Uint8ClampedArray(1048576), this.imageData = new ImageData(this.imageDataArray, 512, 512), this.textureCache = new Map, this.orthoCam = new a.OrthographicCamera, this.orthoCam.layers.set(21), this.textureTarget = new a.WebGLRenderTarget(512, 512, {}), this.basicMaterial = new a.MeshBasicMaterial({ + color: 0, + side: a.DoubleSide + }), this.canvas = document.createElement("canvas"), this.context = this.canvas.getContext("2d"), this.context.imageSmoothingEnabled = !1, this.canvas.width = 512, this.canvas.height = 512, this.canvasTexture = new a.CanvasTexture(this.canvas, { + alpha: !0 + }), this.canvasTexture.flipY = !1; + var e1 = this.el.getAttribute("webxr"), t = e1.optionalFeatures; + t.includes("hit-test") && t.includes("anchors") || (t.push("hit-test"), t.push("anchors"), this.el.setAttribute("webxr", e1)), this.el.sceneEl.renderer.xr.addEventListener("sessionend", (function() { + this.hitTest = null; + }).bind(this)), this.el.sceneEl.renderer.xr.addEventListener("sessionstart", (function() { + if (this.el.is("ar-mode")) { + var e1 = this.el.sceneEl.renderer, t = this.session = e1.xr.getSession(); + this.hasPosedOnce = !1, this.bboxMesh.visible = !1, s || (s = new Map), t.requestReferenceSpace("viewer").then((function(t) { + this.hitTest = new c(e1, { + space: t + }), s.set(t, this.hitTest), this.el.emit("ar-hit-test-start"); + }).bind(this)); + var n = "generic-touchscreen", i = new c(e1, { + profile: n + }); + t.addEventListener("selectstart", (function(t) { + if (!0 === this.data.enabled) { + var r = t.inputSource; + this.bboxMesh.visible = !0, !0 === this.hasPosedOnce && (this.el.emit("ar-hit-test-select-start", { + inputSource: r, + position: this.bboxMesh.position, + orientation: this.bboxMesh.quaternion + }), r.profiles[0] === n ? this.hitTest = i : (this.hitTest = s.get(r) || new c(e1, { + space: r.targetRaySpace + }), s.set(r, this.hitTest))); + } + }).bind(this)), t.addEventListener("selectend", (function(e1) { + if (this.hitTest && !0 === this.data.enabled) { + var t, n = e1.inputSource; + !0 === this.hasPosedOnce && (this.bboxMesh.visible = !1, this.data.target && (t = this.data.target.object3D) && (l.tempFakePose.transform.position.copy(this.bboxMesh.position), l.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion), l(l.tempFakePose, t, this.bboxOffset), t.visible = !0, this.hitTest.anchorFromLastHitTestResult(t, this.bboxOffset)), this.el.emit("ar-hit-test-select", { + inputSource: n, + position: this.bboxMesh.position, + orientation: this.bboxMesh.quaternion + })), this.hitTest = null; + } else this.hitTest = null; + }).bind(this)); + } + }).bind(this)), this.bboxOffset = new a.Vector3, this.update = this.update.bind(this), this.makeBBox(); + }, + update: function() { + !1 === this.data.enabled && (this.hitTest = null, this.bboxMesh.visible = !1), this.data.target && (this.data.target.object3D ? (this.data.target.addEventListener("model-loaded", this.update), this.data.target.object3D.layers.enable(21), this.data.target.object3D.traverse(function(e1) { + e1.layers.enable(21); + })) : this.data.target.addEventListener("loaded", this.update, { + once: !0 + })), this.bboxNeedsUpdate = !0; + }, + makeBBox: function() { + var e1 = new a.PlaneGeometry(1, 1), t = new a.MeshBasicMaterial({ + transparent: !0, + color: 16777215 + }); + e1.rotateX(-Math.PI / 2), e1.rotateY(-Math.PI / 2), this.bbox = new a.Box3, this.bboxMesh = new a.Mesh(e1, t), this.el.setObject3D("ar-hit-test", this.bboxMesh), this.bboxMesh.visible = !1; + }, + updateFootprint: function() { + var e1, t, n, i = this.el.sceneEl.renderer, r = i.xr.enabled; + this.bboxMesh.material.map = this.canvasTexture, this.bboxMesh.material.needsUpdate = !0, this.orthoCam.rotation.set(-Math.PI / 2, 0, -Math.PI / 2), this.orthoCam.position.copy(this.bboxMesh.position), this.orthoCam.position.y -= this.bboxMesh.scale.y / 2, this.orthoCam.near = .1, this.orthoCam.far = this.orthoCam.near + this.data.footprintDepth * this.bboxMesh.scale.y, this.orthoCam.position.y += this.orthoCam.far, this.orthoCam.right = this.bboxMesh.scale.z / 2, this.orthoCam.left = -this.bboxMesh.scale.z / 2, this.orthoCam.top = this.bboxMesh.scale.x / 2, this.orthoCam.bottom = -this.bboxMesh.scale.x / 2, this.orthoCam.updateProjectionMatrix(), t = i.getRenderTarget(), i.setRenderTarget(this.textureTarget), i.xr.enabled = !1, n = this.el.object3D.background, this.el.object3D.overrideMaterial = this.basicMaterial, this.el.object3D.background = null, i.render(this.el.object3D, this.orthoCam), this.el.object3D.background = n, this.el.object3D.overrideMaterial = null, i.xr.enabled = r, i.setRenderTarget(t), i.readRenderTargetPixels(this.textureTarget, 0, 0, 512, 512, this.imageDataArray), this.context.putImageData(this.imageData, 0, 0), this.context.shadowColor = "white", this.context.shadowBlur = 10, this.context.drawImage(this.canvas, 0, 0), e1 = this.context.getImageData(0, 0, 512, 512); + for(var s = 0; s < 262144; s++)0 !== e1.data[4 * s + 3] && 255 !== e1.data[4 * s + 3] && (e1.data[4 * s + 3] = 128); + this.context.putImageData(e1, 0, 0), this.canvasTexture.needsUpdate = !0; + }, + tick: function() { + var e1, t, n = this.el.sceneEl.frame, i = this.el.sceneEl.renderer; + (n && c.updateAnchorPoses(n, i.xr.getReferenceSpace()), this.bboxNeedsUpdate) && (this.bboxNeedsUpdate = !1, this.data.target && "map" !== this.data.type || (this.textureCache.has(this.data.src) ? t = this.textureCache.get(this.data.src) : (t = (new a.TextureLoader).load(this.data.src), this.textureCache.set(this.data.src, t)), this.bboxMesh.material.map = t, this.bboxMesh.material.needsUpdate = !0), this.data.target && this.data.target.object3D ? (this.bbox.setFromObject(this.data.target.object3D), this.bbox.getCenter(this.bboxMesh.position), this.bbox.getSize(this.bboxMesh.scale), "footprint" === this.data.type && (this.bboxMesh.scale.x *= 1.04, this.bboxMesh.scale.z *= 1.04, this.updateFootprint()), this.bboxMesh.position.y -= this.bboxMesh.scale.y / 2, this.bboxOffset.copy(this.bboxMesh.position), this.bboxOffset.sub(this.data.target.object3D.position)) : this.bboxMesh.scale.set(this.data.mapSize.x, 1, this.data.mapSize.y)); + this.hitTest && (e1 = this.hitTest.doHit(n)) && (!0 !== this.hasPosedOnce && (this.hasPosedOnce = !0, this.el.emit("ar-hit-test-achieved")), this.bboxMesh.visible = !0, this.bboxMesh.position.copy(e1.transform.position), this.bboxMesh.quaternion.copy(e1.transform.orientation)); + } + }); + }, + 2819: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(3515).components; + e1.exports.Component = i("background", { + schema: { + color: { + type: "color", + default: "black" + }, + transparent: { + default: !1 + } + }, + update: function() { + var e1 = this.data, t = this.el.object3D; + e1.transparent ? t.background = null : t.background = new THREE.Color(e1.color); + }, + remove: function() { + var e1 = this.data, t = this.el.object3D; + e1.transparent ? t.background = null : t.background = r[this.name].schema.color.default; + } + }); + }, + 1135: (e1, t, n)=>{ + var i = n(3515).registerComponent; + e1.exports.Component = i("debug", { + schema: { + default: !0 + } + }); + }, + 4046: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(8903).bind, s = n(8309), o = "a-dialog-buttons-container", a = "a-dialog-button"; + function l(e1, t) { + var n, i, r, o; + return (n = document.createElement("div")).classList.add("a-modal"), n.setAttribute(s.AFRAME_INJECTED, ""), (i = document.createElement("div")).className = "a-dialog", i.setAttribute(s.AFRAME_INJECTED, ""), n.appendChild(i), (r = document.createElement("div")).classList.add("a-dialog-text-container"), i.appendChild(r), (o = document.createElement("div")).classList.add("a-dialog-text"), o.innerHTML = e1, r.appendChild(o), i.appendChild(t), n; + } + e1.exports.Component = i("device-orientation-permission-ui", { + schema: { + enabled: { + default: !0 + }, + deviceMotionMessage: { + default: "This immersive website requires access to your device motion sensors." + }, + httpsMessage: { + default: "Access this site over HTTPS to enter VR mode and grant access to the device sensors." + }, + denyButtonText: { + default: "Deny" + }, + allowButtonText: { + default: "Allow" + }, + cancelButtonText: { + default: "Cancel" + } + }, + init: function() { + var e1 = this; + this.data.enabled && ("localhost" !== location.hostname && "127.0.0.1" !== location.hostname && "http:" === location.protocol && this.showHTTPAlert(), "undefined" != typeof DeviceOrientationEvent && DeviceOrientationEvent.requestPermission ? (this.onDeviceMotionDialogAllowClicked = r(this.onDeviceMotionDialogAllowClicked, this), this.onDeviceMotionDialogDenyClicked = r(this.onDeviceMotionDialogDenyClicked, this), DeviceOrientationEvent.requestPermission().then(function() { + e1.el.emit("deviceorientationpermissiongranted"), e1.permissionGranted = !0; + }).catch(function() { + var t, n, i, r, c, h, u, d; + e1.devicePermissionDialogEl = (t = e1.data.denyButtonText, n = e1.data.allowButtonText, i = e1.data.deviceMotionMessage, r = e1.onDeviceMotionDialogAllowClicked, c = e1.onDeviceMotionDialogDenyClicked, (h = document.createElement("div")).classList.add(o), (u = document.createElement("button")).classList.add(a, "a-dialog-deny-button"), u.setAttribute(s.AFRAME_INJECTED, ""), u.innerHTML = t, h.appendChild(u), (d = document.createElement("button")).classList.add(a, "a-dialog-allow-button"), d.setAttribute(s.AFRAME_INJECTED, ""), d.innerHTML = n, h.appendChild(d), d.addEventListener("click", function(e1) { + e1.stopPropagation(), r(); + }), u.addEventListener("click", function(e1) { + e1.stopPropagation(), c(); + }), l(i, h)), e1.el.appendChild(e1.devicePermissionDialogEl); + })) : this.permissionGranted = !0); + }, + remove: function() { + this.devicePermissionDialogEl && this.el.removeChild(this.devicePermissionDialogEl); + }, + onDeviceMotionDialogDenyClicked: function() { + this.remove(); + }, + showHTTPAlert: function() { + var e1, t, n, i, r, c = this, h = (e1 = c.data.cancelButtonText, t = c.data.httpsMessage, n = function() { + c.el.removeChild(h); + }, (i = document.createElement("div")).classList.add(o), (r = document.createElement("button")).classList.add(a, "a-dialog-ok-button"), r.setAttribute(s.AFRAME_INJECTED, ""), r.innerHTML = e1, i.appendChild(r), r.addEventListener("click", function(e1) { + e1.stopPropagation(), n(); + }), l(t, i)); + this.el.appendChild(h); + }, + onDeviceMotionDialogAllowClicked: function() { + var e1 = this; + this.el.emit("deviceorientationpermissionrequested"), DeviceOrientationEvent.requestPermission().then(function(t) { + "granted" === t ? (e1.el.emit("deviceorientationpermissiongranted"), e1.permissionGranted = !0) : e1.el.emit("deviceorientationpermissionrejected"), e1.remove(); + }).catch(console.error); + } + }); + }, + 1277: (e1, t, n)=>{ + var i = n(3515).registerComponent; + e1.exports.Component = i("embedded", { + dependencies: [ + "xr-mode-ui" + ], + schema: { + default: !0 + }, + update: function() { + var e1 = this.el, t = e1.querySelector(".a-enter-vr"); + !0 === this.data ? (t && t.classList.add("embedded"), e1.removeFullScreenStyles()) : (t && t.classList.remove("embedded"), e1.addFullScreenStyles()); + } + }); + }, + 3638: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(2666), s = n(4219)("components:fog:warn"); + e1.exports.Component = i("fog", { + schema: { + color: { + type: "color", + default: "#000" + }, + density: { + default: 25e-5 + }, + far: { + default: 1e3, + min: 0 + }, + near: { + default: 1, + min: 0 + }, + type: { + default: "linear", + oneOf: [ + "linear", + "exponential" + ] + } + }, + update: function() { + var e1 = this.data, t = this.el, n = this.el.object3D.fog; + if (t.isScene) return n && e1.type === n.name ? void Object.keys(this.schema).forEach(function(t) { + var i = e1[t]; + "color" === t && (i = new r.Color(i)), n[t] = i; + }) : (t.object3D.fog = function(e1) { + var t; + return (t = "exponential" === e1.type ? new r.FogExp2(e1.color, e1.density) : new r.Fog(e1.color, e1.near, e1.far)).name = e1.type, t; + }(e1), void t.systems.material.updateMaterials()); + s("Fog component can only be applied to "); + }, + remove: function() { + var e1 = this.el.object3D.fog; + e1 && (e1.far = 0, e1.near = .1); + } + }); + }, + 3969: (e1, t, n)=>{ + var i, r = n(8309).AFRAME_INJECTED, s = n(4147), o = n(3515).registerComponent, a = n(8903), l = "https://unpkg.com/aframe-inspector@" + ((i = s.version.split("."))[2] = "x", i.join(".") + "/dist/aframe-inspector.min.js"); + e1.exports.Component = o("inspector", { + schema: { + url: { + default: l + } + }, + init: function() { + this.firstPlay = !0, this.onKeydown = this.onKeydown.bind(this), this.onMessage = this.onMessage.bind(this), this.initOverlay(), window.addEventListener("keydown", this.onKeydown), window.addEventListener("message", this.onMessage); + }, + play: function() { + var e1; + this.firstPlay && "false" !== (e1 = a.getUrlParameter("inspector")) && e1 && (this.openInspector(), this.firstPlay = !1); + }, + initOverlay: function() { + this.loadingMessageEl = document.createElement("div"), this.loadingMessageEl.classList.add("a-inspector-loader"), this.loadingMessageEl.innerHTML = 'Loading Inspector...'; + }, + remove: function() { + this.removeEventListeners(); + }, + onKeydown: function(e1) { + 73 === e1.keyCode && (e1.ctrlKey && e1.altKey || e1.getModifierState("AltGraph")) && this.openInspector(); + }, + showLoader: function() { + document.body.appendChild(this.loadingMessageEl); + }, + hideLoader: function() { + document.body.removeChild(this.loadingMessageEl); + }, + onMessage: function(e1) { + "INJECT_AFRAME_INSPECTOR" === e1.data && this.openInspector(); + }, + openInspector: function(e1) { + var t, n = this; + AFRAME.INSPECTOR || AFRAME.inspectorInjected ? AFRAME.INSPECTOR.open(e1) : (this.showLoader(), (t = document.createElement("script")).src = this.data.url, t.setAttribute("data-name", "aframe-inspector"), t.setAttribute(r, ""), t.onload = function() { + AFRAME.INSPECTOR.open(e1), n.hideLoader(), n.removeEventListeners(); + }, t.onerror = function() { + n.loadingMessageEl.innerHTML = "Error loading Inspector"; + }, document.head.appendChild(t), AFRAME.inspectorInjected = !0); + }, + removeEventListeners: function() { + window.removeEventListener("keydown", this.onKeydown), window.removeEventListener("message", this.onMessage); + } + }); + }, + 7445: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(8903).shouldCaptureKeyEvent; + e1.exports.Component = i("keyboard-shortcuts", { + schema: { + enterVR: { + default: !0 + }, + exitVR: { + default: !0 + } + }, + init: function() { + this.onKeyup = this.onKeyup.bind(this); + }, + update: function(e1) { + var t = this.data; + this.enterVREnabled = t.enterVR; + }, + play: function() { + window.addEventListener("keyup", this.onKeyup, !1); + }, + pause: function() { + window.removeEventListener("keyup", this.onKeyup); + }, + onKeyup: function(e1) { + var t = this.el; + r(e1) && (this.enterVREnabled && 70 === e1.keyCode && t.enterVR(), this.enterVREnabled && 27 === e1.keyCode && t.exitVR()); + } + }); + }, + 4310: (e1, t, n)=>{ + var i = n(4219), r = n(3515).registerComponent, s = i("components:pool:warn"); + e1.exports.Component = r("pool", { + schema: { + container: { + default: "" + }, + mixin: { + default: "" + }, + size: { + default: 0 + }, + dynamic: { + default: !1 + } + }, + multiple: !0, + initPool: function() { + var e1; + for(this.availableEls = [], this.usedEls = [], this.data.mixin || s("No mixin provided for pool component."), this.data.container && (this.container = document.querySelector(this.data.container), this.container || s("Container " + this.data.container + " not found.")), this.container = this.container || this.el, e1 = 0; e1 < this.data.size; ++e1)this.createEntity(); + }, + update: function(e1) { + var t = this.data; + e1.mixin === t.mixin && e1.size === t.size || this.initPool(); + }, + createEntity: function() { + var e1; + (e1 = document.createElement("a-entity")).play = this.wrapPlay(e1.play), e1.setAttribute("mixin", this.data.mixin), e1.object3D.visible = !1, e1.pause(), this.container.appendChild(e1), this.availableEls.push(e1); + var t = this.usedEls; + e1.addEventListener("loaded", function() { + -1 === t.indexOf(e1) && (e1.object3DParent = e1.object3D.parent, e1.object3D.parent.remove(e1.object3D)); + }); + }, + wrapPlay: function(e1) { + var t = this.usedEls; + return function() { + -1 !== t.indexOf(this) && e1.call(this); + }; + }, + requestEntity: function() { + var e1; + if (0 === this.availableEls.length) { + if (!1 === this.data.dynamic) return void s("Requested entity from empty pool: " + this.attrName); + s("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: " + this.attrName), this.createEntity(); + } + return e1 = this.availableEls.shift(), this.usedEls.push(e1), e1.object3DParent && (e1.object3DParent.add(e1.object3D), this.updateRaycasters()), e1.object3D.visible = !0, e1; + }, + returnEntity: function(e1) { + var t = this.usedEls.indexOf(e1); + if (-1 !== t) return this.usedEls.splice(t, 1), this.availableEls.push(e1), e1.object3DParent = e1.object3D.parent, e1.object3D.parent.remove(e1.object3D), this.updateRaycasters(), e1.object3D.visible = !1, e1.pause(), e1; + s("The returned entity was not previously pooled from " + this.attrName); + }, + updateRaycasters: function() { + document.querySelectorAll("[raycaster]").forEach(function(e1) { + e1.components.raycaster.setDirty(); + }); + } + }); + }, + 7579: (e1, t, n)=>{ + var i, r = n(3515).registerComponent, s = n(2666); + e1.exports.Component = r("real-world-meshing", { + schema: { + filterLabels: { + type: "array" + }, + meshesEnabled: { + default: !0 + }, + meshMixin: { + default: !0 + }, + planesEnabled: { + default: !0 + }, + planeMixin: { + default: "" + } + }, + init: function() { + var e1 = this.el.getAttribute("webxr"), t = e1.requiredFeatures; + -1 === t.indexOf("mesh-detection") && (t.push("mesh-detection"), this.el.setAttribute("webxr", e1)), -1 === t.indexOf("plane-detection") && (t.push("plane-detection"), this.el.setAttribute("webxr", e1)), this.meshEntities = [], this.initWorldMeshEntity = this.initWorldMeshEntity.bind(this); + }, + tick: function() { + this.el.is("ar-mode") && (this.detectMeshes(), this.updateMeshes()); + }, + detectMeshes: function() { + var e1, t, n, i = this.data, r = this.el, s = (r.renderer.xr, this.meshEntities), o = !1, a = [], l = this.data.filterLabels; + e1 = (n = r.frame).detectedMeshes, t = n.detectedPlanes; + for(var c = 0; c < s.length; c++)s[c].present = !1; + if (i.meshesEnabled) { + for (var h of e1.values())if (!l.length || -1 !== l.indexOf(h.semanticLabel)) { + for(c = 0; c < s.length; c++)if (h === s[c].mesh) { + o = !0, s[c].present = !0, s[c].lastChangedTime < h.lastChangedTime && this.updateMeshGeometry(s[c].el, h), s[c].lastChangedTime = h.lastChangedTime; + break; + } + o || a.push(h), o = !1; + } + } + if (i.planesEnabled) { + for (h of t.values())if (!l.length || -1 !== l.indexOf(h.semanticLabel)) { + for(c = 0; c < s.length; c++)if (h === s[c].mesh) { + o = !0, s[c].present = !0, s[c].lastChangedTime < h.lastChangedTime && this.updateMeshGeometry(s[c].el, h), s[c].lastChangedTime = h.lastChangedTime; + break; + } + o || a.push(h), o = !1; + } + } + this.deleteMeshes(), this.createNewMeshes(a); + }, + updateMeshes: (i = new s.Matrix4, function() { + for(var e1, t, n, r = this.el, s = r.frame, o = this.meshEntities, a = r.renderer.xr.getReferenceSpace(), l = 0; l < o.length; l++)n = o[l].mesh.meshSpace || o[l].mesh.planeSpace, e1 = s.getPose(n, a), (t = o[l].el).hasLoaded && (i.fromArray(e1.transform.matrix), i.decompose(t.object3D.position, t.object3D.quaternion, t.object3D.scale)); + }), + deleteMeshes: function() { + for(var e1 = this.meshEntities, t = [], n = 0; n < e1.length; n++)e1[n].present ? t.push(e1[n]) : this.el.removeChild(e1[n]); + this.meshEntities = t; + }, + createNewMeshes: function(e1) { + for(var t, n = 0; n < e1.length; n++)t = document.createElement("a-entity"), this.meshEntities.push({ + mesh: e1[n], + el: t + }), t.addEventListener("loaded", this.initWorldMeshEntity), this.el.appendChild(t); + }, + initMeshGeometry: function(e1) { + var t, n, i; + if (e1 instanceof XRPlane) { + n = new s.Shape, i = e1.polygon; + for(var r = 0; r < i.length; ++r)0 === r ? n.moveTo(i[r].x, i[r].z) : n.lineTo(i[r].x, i[r].z); + return (t = new s.ShapeGeometry(n)).rotateX(Math.PI / 2), t; + } + return (t = new s.BufferGeometry).setAttribute("position", new s.BufferAttribute(e1.vertices, 3)), t.setIndex(new s.BufferAttribute(e1.indices, 1)), t; + }, + initWorldMeshEntity: function(e1) { + for(var t, n, i, r = e1.target, o = this.meshEntities, a = 0; a < o.length; a++)if (o[a].el === r) { + i = o[a]; + break; + } + t = this.initMeshGeometry(i.mesh), n = new s.Mesh(t, new s.MeshBasicMaterial({ + color: 16777215 * Math.random(), + side: s.DoubleSide + })), r.setObject3D("mesh", n), i.mesh instanceof XRPlane && this.data.planeMixin ? r.setAttribute("mixin", this.data.planeMixin) : this.data.meshMixin && r.setAttribute("mixin", this.data.meshMixin), r.setAttribute("data-world-mesh", i.mesh.semanticLabel); + }, + updateMeshGeometry: function(e1, t) { + var n = e1.getObject3D("mesh"); + n.geometry.dispose(), n.geometry = this.initMeshGeometry(t); + } + }); + }, + 5670: (e1, t, n)=>{ + var i = n(3515).registerComponent; + e1.exports.Component = i("reflection", { + schema: { + directionalLight: { + type: "selector" + } + }, + init: function() { + var e1 = this; + this.cubeRenderTarget = new THREE.WebGLCubeRenderTarget(16), this.cubeCamera = new THREE.CubeCamera(.1, 1e3, this.cubeRenderTarget), this.lightingEstimationTexture = new THREE.WebGLCubeRenderTarget(16).texture, this.needsVREnvironmentUpdate = !0; + var t = this.el.getAttribute("webxr"), n = t.optionalFeatures; + n.includes("light-estimation") || (n.push("light-estimation"), this.el.setAttribute("webxr", t)), this.el.addEventListener("enter-vr", function() { + e1.el.renderer.xr.getSession().requestLightProbe && e1.el.is("ar-mode") && e1.startLightProbe(); + }), this.el.addEventListener("exit-vr", function() { + e1.stopLightProbe(); + }), this.el.object3D.environment = this.cubeRenderTarget.texture; + }, + stopLightProbe: function() { + this.xrLightProbe = null, this.probeLight && (this.probeLight.components.light.light.intensity = 0), this.needsVREnvironmentUpdate = !0, this.el.object3D.environment = this.cubeRenderTarget.texture; + }, + startLightProbe: function() { + this.needsLightProbeUpdate = !0; + }, + setupLightProbe: function() { + var e1 = this.el.renderer, t = e1.xr.getSession(), n = this, i = e1.getContext(); + if (!this.probeLight) { + var r = document.createElement("a-light"); + r.setAttribute("type", "probe"), r.setAttribute("intensity", 0), this.el.appendChild(r), this.probeLight = r; + } + switch(t.preferredReflectionFormat){ + case "srgba8": + i.getExtension("EXT_sRGB"); + break; + case "rgba16f": + i.getExtension("OES_texture_half_float"); + } + this.glBinding = new XRWebGLBinding(t, i), i.getExtension("EXT_sRGB"), i.getExtension("OES_texture_half_float"), t.requestLightProbe().then(function(e1) { + n.xrLightProbe = e1, e1.addEventListener("reflectionchange", n.updateXRCubeMap.bind(n)); + }).catch(function(e1) { + console.warn("Lighting estimation not supported: " + e1.message), console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from ?'); + }); + }, + updateXRCubeMap: function() { + var e1 = this.el.renderer, t = this.glBinding.getReflectionCubeMap(this.xrLightProbe); + t && (e1.properties.get(this.lightingEstimationTexture).__webglTexture = t, this.lightingEstimationTexture.needsPMREMUpdate = !0, this.el.object3D.environment = this.lightingEstimationTexture); + }, + tick: function() { + var e1 = this.el.object3D, t = this.el.renderer, n = this.el.frame; + if (n && this.xrLightProbe) { + var i = n.getLightEstimate(this.xrLightProbe); + i && function(e1, t, n, i) { + var r = Math.max(e1.primaryLightIntensity.x, Math.max(e1.primaryLightIntensity.y, e1.primaryLightIntensity.z)); + t.sh.fromArray(e1.sphericalHarmonicsCoefficients), t.intensity = 1, n && (n.color.setRGB(e1.primaryLightIntensity.x / r, e1.primaryLightIntensity.y / r, e1.primaryLightIntensity.z / r), n.intensity = r, i.copy(e1.primaryLightDirection)); + }(i, this.probeLight.components.light.light, this.data.directionalLight && this.data.directionalLight.components.light.light, this.data.directionalLight && this.data.directionalLight.object3D.position); + } + this.needsVREnvironmentUpdate && (e1.environment = null, this.needsVREnvironmentUpdate = !1, this.cubeCamera.position.set(0, 1.6, 0), this.cubeCamera.update(t, e1), e1.environment = this.cubeRenderTarget.texture), this.needsLightProbeUpdate && n && (this.setupLightProbe(), this.needsLightProbeUpdate = !1); + }, + remove: function() { + this.el.object3D.environment = null, this.probeLight && this.el.removeChild(this.probeLight); + } + }); + }, + 467: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(2666), s = [ + "attribute vec3 position;", + "attribute vec2 uv;", + "uniform mat4 projectionMatrix;", + "uniform mat4 modelViewMatrix;", + "varying vec2 vUv;", + "void main() {", + " vUv = vec2( 1.- uv.x, uv.y );", + " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", + "}" + ].join("\n"), o = [ + "precision mediump float;", + "uniform samplerCube map;", + "varying vec2 vUv;", + "#define M_PI 3.141592653589793238462643383279", + "void main() {", + " vec2 uv = vUv;", + " float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;", + " float latitude = uv.y * M_PI;", + " vec3 dir = vec3(", + " - sin( longitude ) * sin( latitude ),", + " cos( latitude ),", + " - cos( longitude ) * sin( latitude )", + " );", + " normalize( dir );", + " gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );", + "}" + ].join("\n"); + e1.exports.Component = i("screenshot", { + schema: { + width: { + default: 4096 + }, + height: { + default: 2048 + }, + camera: { + type: "selector" + } + }, + init: function() { + var e1 = this.el, t = this; + function n() { + var n = e1.renderer.getContext(); + n && (t.cubeMapSize = n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE), t.material = new r.RawShaderMaterial({ + uniforms: { + map: { + type: "t", + value: null + } + }, + vertexShader: s, + fragmentShader: o, + side: r.DoubleSide + }), t.quad = new r.Mesh(new r.PlaneGeometry(1, 1), t.material), t.quad.visible = !1, t.camera = new r.OrthographicCamera(-0.5, .5, .5, -0.5, -10000, 1e4), t.canvas = document.createElement("canvas"), t.ctx = t.canvas.getContext("2d"), e1.object3D.add(t.quad), t.onKeyDown = t.onKeyDown.bind(t)); + } + e1.renderer ? n() : e1.addEventListener("render-target-loaded", n); + }, + getRenderTarget: function(e1, t) { + return new r.WebGLRenderTarget(e1, t, { + colorSpace: this.el.sceneEl.renderer.outputColorSpace, + minFilter: r.LinearFilter, + magFilter: r.LinearFilter, + wrapS: r.ClampToEdgeWrapping, + wrapT: r.ClampToEdgeWrapping, + format: r.RGBAFormat, + type: r.UnsignedByteType + }); + }, + resize: function(e1, t) { + this.quad.scale.set(e1, t, 1), this.camera.left = -1 * e1 / 2, this.camera.right = e1 / 2, this.camera.top = t / 2, this.camera.bottom = -1 * t / 2, this.camera.updateProjectionMatrix(), this.canvas.width = e1, this.canvas.height = t; + }, + play: function() { + window.addEventListener("keydown", this.onKeyDown); + }, + onKeyDown: function(e1) { + var t = 83 === e1.keyCode && e1.ctrlKey && e1.altKey; + if (this.data && t) { + var n = e1.shiftKey ? "equirectangular" : "perspective"; + this.capture(n); + } + }, + setCapture: function(e1) { + var t, n, i, s, o = this.el; + return "perspective" === e1 ? (this.quad.visible = !1, n = this.data.camera && this.data.camera.components.camera.camera || o.camera, t = { + width: this.data.width, + height: this.data.height + }) : (n = this.camera, s = new r.WebGLCubeRenderTarget(Math.min(this.cubeMapSize, 2048), { + format: r.RGBFormat, + generateMipmaps: !0, + minFilter: r.LinearMipmapLinearFilter, + colorSpace: r.SRGBColorSpace + }), i = new r.CubeCamera(o.camera.near, o.camera.far, s), o.camera.getWorldPosition(i.position), o.camera.getWorldQuaternion(i.quaternion), i.update(o.renderer, o.object3D), this.quad.material.uniforms.map.value = i.renderTarget.texture, t = { + width: this.data.width, + height: this.data.height + }, this.quad.visible = !0), { + camera: n, + size: t, + projection: e1 + }; + }, + capture: function(e1) { + var t, n = this.el.renderer.xr.enabled, i = this.el.renderer; + i.xr.enabled = !1, t = this.setCapture(e1), this.renderCapture(t.camera, t.size, t.projection), this.saveCapture(), i.xr.enabled = n; + }, + getCanvas: function(e1) { + var t = this.el.renderer.xr.enabled, n = this.el.renderer, i = this.setCapture(e1); + return n.xr.enabled = !1, this.renderCapture(i.camera, i.size, i.projection), n.xr.enabled = t, this.canvas; + }, + renderCapture: function(e1, t, n) { + var i, r, s, o = this.el.renderer.autoClear, a = this.el, l = a.renderer; + r = this.getRenderTarget(t.width, t.height), s = new Uint8Array(4 * t.width * t.height), this.resize(t.width, t.height), l.autoClear = !0, l.clear(), l.setRenderTarget(r), l.render(a.object3D, e1), l.autoClear = o, l.readRenderTargetPixels(r, 0, 0, t.width, t.height, s), l.setRenderTarget(null), "perspective" === n && (s = this.flipPixelsVertically(s, t.width, t.height)), i = new ImageData(new Uint8ClampedArray(s), t.width, t.height), this.quad.visible = !1, this.ctx.putImageData(i, 0, 0); + }, + flipPixelsVertically: function(e1, t, n) { + for(var i = e1.slice(0), r = 0; r < t; ++r)for(var s = 0; s < n; ++s)i[4 * r + s * t * 4] = e1[4 * r + (n - s) * t * 4], i[4 * r + 1 + s * t * 4] = e1[4 * r + 1 + (n - s) * t * 4], i[4 * r + 2 + s * t * 4] = e1[4 * r + 2 + (n - s) * t * 4], i[4 * r + 3 + s * t * 4] = e1[4 * r + 3 + (n - s) * t * 4]; + return i; + }, + saveCapture: function() { + this.canvas.toBlob(function(e1) { + var t = "screenshot-" + document.title.toLowerCase() + "-" + Date.now() + ".png", n = document.createElement("a"), i = URL.createObjectURL(e1); + n.href = i, n.setAttribute("download", t), n.innerHTML = "downloading...", n.style.display = "none", document.body.appendChild(n), setTimeout(function() { + n.click(), document.body.removeChild(n); + }, 1); + }, "image/png"); + } + }); + }, + 5834: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(1326), s = n(8903); + n(9625), n(1543); + var o = window.aframeStats, a = s.bind, l = "a-hidden", c = window.threeStats; + e1.exports.Component = i("stats", { + schema: { + default: !0 + }, + init: function() { + var e1 = this.el; + "false" !== s.getUrlParameter("stats") && (this.stats = function(e1) { + var t = new c(e1.renderer), n = new o(e1), i = e1.isMobile ? [] : [ + t, + n + ]; + return new r({ + css: [], + values: { + fps: { + caption: "fps", + below: 30 + } + }, + groups: [ + { + caption: "Framerate", + values: [ + "fps", + "raf" + ] + } + ], + plugins: i + }); + }(e1), this.statsEl = document.querySelector(".rs-base"), this.hideBound = a(this.hide, this), this.showBound = a(this.show, this), e1.addEventListener("enter-vr", this.hideBound), e1.addEventListener("exit-vr", this.showBound)); + }, + update: function() { + if (this.stats) return this.data ? this.show() : this.hide(); + }, + remove: function() { + this.el.removeEventListener("enter-vr", this.hideBound), this.el.removeEventListener("exit-vr", this.showBound), this.statsEl && this.statsEl.parentNode.removeChild(this.statsEl); + }, + tick: function() { + var e1 = this.stats; + e1 && (e1("rAF").tick(), e1("FPS").frame(), e1().update()); + }, + hide: function() { + this.statsEl.classList.add(l); + }, + show: function() { + this.statsEl.classList.remove(l); + } + }); + }, + 3807: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(8309), s = n(8903), o = s.bind, a = "a-hidden"; + function l(e1) { + e1.addEventListener("touchstart", function() { + e1.classList.remove("resethover"); + }), e1.addEventListener("touchend", function() { + e1.classList.add("resethover"); + }); + } + e1.exports.Component = i("xr-mode-ui", { + dependencies: [ + "canvas" + ], + schema: { + enabled: { + default: !0 + }, + cardboardModeEnabled: { + default: !1 + }, + enterVRButton: { + default: "" + }, + enterVREnabled: { + default: !0 + }, + enterARButton: { + default: "" + }, + enterAREnabled: { + default: !0 + }, + XRMode: { + default: "vr", + oneOf: [ + "vr", + "ar", + "xr" + ] + } + }, + init: function() { + var e1 = this, t = this.el; + "false" !== s.getUrlParameter("ui") && (this.insideLoader = !1, this.enterVREl = null, this.enterAREl = null, this.orientationModalEl = null, this.bindMethods(), t.addEventListener("enter-vr", this.updateEnterInterfaces), t.addEventListener("exit-vr", this.updateEnterInterfaces), t.addEventListener("update-vr-devices", this.updateEnterInterfaces), window.addEventListener("message", function(t) { + "loaderReady" === t.data.type && (e1.insideLoader = !0, e1.remove()); + }), window.addEventListener("orientationchange", this.toggleOrientationModalIfNeeded)); + }, + bindMethods: function() { + this.onEnterVRButtonClick = o(this.onEnterVRButtonClick, this), this.onEnterARButtonClick = o(this.onEnterARButtonClick, this), this.onModalClick = o(this.onModalClick, this), this.toggleOrientationModalIfNeeded = o(this.toggleOrientationModalIfNeeded, this), this.updateEnterInterfaces = o(this.updateEnterInterfaces, this); + }, + onModalClick: function() { + this.el.exitVR(); + }, + onEnterVRButtonClick: function() { + this.el.enterVR(); + }, + onEnterARButtonClick: function() { + this.el.enterAR(); + }, + update: function() { + var e1, t, n, i = this.data, o = this.el; + if (!i.enabled || this.insideLoader || "false" === s.getUrlParameter("ui")) return this.remove(); + this.enterVREl || this.enterAREl || this.orientationModalEl || (this.enterVREl || !i.enterVREnabled || "xr" !== i.XRMode && "vr" !== i.XRMode || (i.enterVRButton ? (this.enterVREl = document.querySelector(i.enterVRButton), this.enterVREl.addEventListener("click", this.onEnterVRButtonClick)) : (this.enterVREl = (e1 = this.onEnterVRButtonClick, (n = document.createElement("div")).classList.add("a-enter-vr"), n.setAttribute(r.AFRAME_INJECTED, ""), (t = document.createElement("button")).className = "a-enter-vr-button", t.setAttribute("title", "Enter VR mode with a headset or fullscreen without"), t.setAttribute(r.AFRAME_INJECTED, ""), s.device.isMobile() && l(t), n.appendChild(t), t.addEventListener("click", function(t) { + e1(), t.stopPropagation(); + }), n), o.appendChild(this.enterVREl))), this.enterAREl || !i.enterAREnabled || "xr" !== i.XRMode && "ar" !== i.XRMode || (i.enterARButton ? (this.enterAREl = document.querySelector(i.enterARButton), this.enterAREl.addEventListener("click", this.onEnterARButtonClick)) : (this.enterAREl = function(e1, t) { + var n, i; + return (i = document.createElement("div")).classList.add("a-enter-ar"), t && i.classList.add("xr"), i.setAttribute(r.AFRAME_INJECTED, ""), (n = document.createElement("button")).className = "a-enter-ar-button", n.setAttribute("title", "Enter AR mode with a headset or handheld device."), n.setAttribute(r.AFRAME_INJECTED, ""), s.device.isMobile() && l(n), i.appendChild(n), n.addEventListener("click", function(t) { + e1(), t.stopPropagation(); + }), i; + }(this.onEnterARButtonClick, "xr" === i.XRMode), o.appendChild(this.enterAREl))), this.orientationModalEl = function(e1) { + var t = document.createElement("div"); + t.className = "a-orientation-modal", t.classList.add(a), t.setAttribute(r.AFRAME_INJECTED, ""); + var n = document.createElement("button"); + return n.setAttribute(r.AFRAME_INJECTED, ""), n.innerHTML = "Exit VR", n.addEventListener("click", e1), t.appendChild(n), t; + }(this.onModalClick), o.appendChild(this.orientationModalEl), this.updateEnterInterfaces()); + }, + remove: function() { + [ + this.enterVREl, + this.enterAREl, + this.orientationModalEl + ].forEach(function(e1) { + e1 && e1.parentNode && e1.parentNode.removeChild(e1); + }), this.enterVREl = void 0, this.enterAREl = void 0, this.orientationModalEl = void 0; + }, + updateEnterInterfaces: function() { + this.toggleEnterVRButtonIfNeeded(), this.toggleEnterARButtonIfNeeded(), this.toggleOrientationModalIfNeeded(); + }, + toggleEnterVRButtonIfNeeded: function() { + var e1 = this.el; + this.enterVREl && (e1.is("vr-mode") || (e1.isMobile || s.device.isMobileDeviceRequestingDesktopSite()) && !this.data.cardboardModeEnabled && !s.device.checkVRSupport() ? this.enterVREl.classList.add(a) : (s.device.checkVRSupport() || this.enterVREl.classList.add("fullscreen"), this.enterVREl.classList.remove(a))); + }, + toggleEnterARButtonIfNeeded: function() { + var e1 = this.el; + this.enterAREl && (e1.is("vr-mode") || !s.device.checkARSupport() ? this.enterAREl.classList.add(a) : this.enterAREl.classList.remove(a)); + }, + toggleOrientationModalIfNeeded: function() { + var e1 = this.el, t = this.orientationModalEl; + t && e1.isMobile && (!s.device.isLandscape() && e1.is("vr-mode") ? t.classList.remove(a) : t.classList.add(a)); + } + }); + }, + 1684: (e1, t, n)=>{ + var i = n(3515), r = n(2666), s = n(7629), o = i.registerComponent; + e1.exports.Component = o("shadow", { + schema: { + cast: { + default: !0 + }, + receive: { + default: !0 + } + }, + init: function() { + this.onMeshChanged = s(this.update, this), this.el.addEventListener("object3dset", this.onMeshChanged), this.system.setShadowMapEnabled(!0); + }, + update: function() { + var e1 = this.data; + this.updateDescendants(e1.cast, e1.receive); + }, + remove: function() { + this.el.removeEventListener("object3dset", this.onMeshChanged), this.updateDescendants(!1, !1); + }, + updateDescendants: function(e1, t) { + var n = this.el.sceneEl; + this.el.object3D.traverse(function(i) { + if (i instanceof r.Mesh && (i.castShadow = e1, i.receiveShadow = t, n.hasLoaded && i.material)) for(var s = Array.isArray(i.material) ? i.material : [ + i.material + ], o = 0; o < s.length; o++)s[o].needsUpdate = !0; + }); + } + }); + }, + 5538: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(4219), s = n(2666), o = r("components:sound:warn"); + e1.exports.Component = i("sound", { + schema: { + autoplay: { + default: !1 + }, + distanceModel: { + default: "inverse", + oneOf: [ + "linear", + "inverse", + "exponential" + ] + }, + loop: { + default: !1 + }, + loopStart: { + default: 0 + }, + loopEnd: { + default: 0 + }, + maxDistance: { + default: 1e4 + }, + on: { + default: "" + }, + poolSize: { + default: 1 + }, + positional: { + default: !0 + }, + refDistance: { + default: 1 + }, + rolloffFactor: { + default: 1 + }, + src: { + type: "audio" + }, + volume: { + default: 1 + } + }, + multiple: !0, + init: function() { + var e1 = this; + this.listener = null, this.audioLoader = new s.AudioLoader, this.pool = new s.Group, this.loaded = !1, this.mustPlay = !1, this.playSoundBound = function() { + e1.playSound(); + }; + }, + update: function(e1) { + var t, n, i = this.data, r = i.src !== e1.src; + if (r) { + if (!i.src) return; + this.setupSound(); + } + for(t = 0; t < this.pool.children.length; t++)n = this.pool.children[t], i.positional && (n.setDistanceModel(i.distanceModel), n.setMaxDistance(i.maxDistance), n.setRefDistance(i.refDistance), n.setRolloffFactor(i.rolloffFactor)), n.setLoop(i.loop), n.setLoopStart(i.loopStart), 0 !== i.loopStart && 0 === i.loopEnd ? n.setLoopEnd(n.buffer.duration) : n.setLoopEnd(i.loopEnd), n.setVolume(i.volume), n.isPaused = !1; + if (i.on !== e1.on && this.updateEventListener(e1.on), r) { + var o = this; + this.loaded = !1, this.audioLoader.load(i.src, function(e1) { + for(t = 0; t < o.pool.children.length; t++)(n = o.pool.children[t]).setBuffer(e1); + o.loaded = !0, s.Cache.remove(i.src), (o.data.autoplay || o.mustPlay) && o.playSound(this.processSound), o.el.emit("sound-loaded", o.evtDetail, !1); + }); + } + }, + pause: function() { + this.stopSound(), this.removeEventListener(); + }, + play: function() { + this.data.autoplay && this.playSound(), this.updateEventListener(); + }, + remove: function() { + var e1; + this.removeEventListener(), this.el.getObject3D(this.attrName) && this.el.removeObject3D(this.attrName); + try { + for(e1 = 0; e1 < this.pool.children.length; e1++)this.pool.children[e1].disconnect(); + } catch (e1) { + o("Audio source not properly disconnected"); + } + }, + updateEventListener: function(e1) { + var t = this.el; + e1 && t.removeEventListener(e1, this.playSoundBound), t.addEventListener(this.data.on, this.playSoundBound); + }, + removeEventListener: function() { + this.el.removeEventListener(this.data.on, this.playSoundBound); + }, + setupSound: function() { + var e1, t, n = this.el, i = n.sceneEl, r = this; + this.pool.children.length > 0 && (this.stopSound(), n.removeObject3D("sound")); + var o = this.listener = i.audioListener || new s.AudioListener; + for(i.audioListener = o, i.camera && i.camera.add(o), i.addEventListener("camera-set-active", function(e1) { + e1.detail.cameraEl.getObject3D("camera").add(o); + }), this.pool = new s.Group, e1 = 0; e1 < this.data.poolSize; e1++)t = this.data.positional ? new s.PositionalAudio(o) : new s.Audio(o), this.pool.add(t); + for(n.setObject3D(this.attrName, this.pool), e1 = 0; e1 < this.pool.children.length; e1++)(t = this.pool.children[e1]).onEnded = function() { + this.isPlaying = !1, r.el.emit("sound-ended", r.evtDetail, !1); + }; + }, + pauseSound: function() { + var e1, t; + for(this.isPlaying = !1, e1 = 0; e1 < this.pool.children.length; e1++)(t = this.pool.children[e1]).source && t.source.buffer && t.isPlaying && !t.isPaused && (t.isPaused = !0, t.pause()); + }, + playSound: function(e1) { + var t, n, i; + if (!this.loaded) return o("Sound not loaded yet. It will be played once it finished loading"), this.mustPlay = !0, void (this.processSound = e1); + for(t = !1, this.isPlaying = !0, n = 0; n < this.pool.children.length; n++)(i = this.pool.children[n]).isPlaying || !i.buffer || t || (e1 && e1(i), i.play(), i.isPaused = !1, t = !0); + t ? (this.mustPlay = !1, this.processSound = void 0) : o("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.", this.el); + }, + stopSound: function() { + var e1, t; + for(this.isPlaying = !1, e1 = 0; e1 < this.pool.children.length; e1++){ + if (!(t = this.pool.children[e1]).source || !t.source.buffer) return; + t.stop(); + } + } + }); + }, + 6957: (e1, t, n)=>{ + var i = n(6559), r = n(1880), s = n(3515).registerComponent, o = n(9644), a = n(2666), l = n(8903), c = l.debug("components:text:error"), h = o.shaders, u = l.debug("components:text:warn"), d = n(8309).AFRAME_CDN_ROOT + "fonts/", p = { + aileronsemibold: d + "Aileron-Semibold.fnt", + dejavu: d + "DejaVu-sdf.fnt", + exo2bold: d + "Exo2Bold.fnt", + exo2semibold: d + "Exo2SemiBold.fnt", + kelsonsans: d + "KelsonSans.fnt", + monoid: d + "Monoid.fnt", + mozillavr: d + "mozillavr.fnt", + roboto: d + "Roboto-msdf.json", + sourcecodepro: d + "SourceCodePro.fnt" + }, A = [ + "roboto" + ], f = "roboto"; + e1.exports.FONTS = p; + var m, g, v, y, E = new function() { + var e1 = this.cache = {}; + this.get = function(t, n) { + return t in e1 || (e1[t] = n()), e1[t]; + }; + }, b = {}, x = {}, C = /^\w+:/; + function w(e1, t, n) { + return e1 || (.5 + t) * n; + } + e1.exports.Component = s("text", { + multiple: !0, + schema: { + align: { + type: "string", + default: "left", + oneOf: [ + "left", + "right", + "center" + ] + }, + alphaTest: { + default: .5 + }, + anchor: { + default: "center", + oneOf: [ + "left", + "right", + "center", + "align" + ] + }, + baseline: { + default: "center", + oneOf: [ + "top", + "center", + "bottom" + ] + }, + color: { + type: "color", + default: "#FFF" + }, + font: { + type: "string", + default: f + }, + fontImage: { + type: "string" + }, + height: { + type: "number" + }, + letterSpacing: { + type: "number", + default: 0 + }, + lineHeight: { + type: "number" + }, + negate: { + type: "boolean", + default: !0 + }, + opacity: { + type: "number", + default: 1 + }, + shader: { + default: "sdf", + oneOf: h + }, + side: { + default: "front", + oneOf: [ + "front", + "back", + "double" + ] + }, + tabSize: { + default: 4 + }, + transparent: { + default: !0 + }, + value: { + type: "string" + }, + whiteSpace: { + default: "normal", + oneOf: [ + "normal", + "pre", + "nowrap" + ] + }, + width: { + type: "number" + }, + wrapCount: { + type: "number", + default: 40 + }, + wrapPixels: { + type: "number" + }, + xOffset: { + type: "number", + default: 0 + }, + yOffset: { + type: "number", + default: 0 + }, + zOffset: { + type: "number", + default: .001 + } + }, + init: function() { + this.shaderData = {}, this.geometry = i(), this.createOrUpdateMaterial(), this.explicitGeoDimensionsChecked = !1; + }, + update: function(e1) { + var t = this.data, n = this.currentFont; + x[t.font] ? this.texture = x[t.font] : (this.texture = x[t.font] = new a.Texture, this.texture.anisotropy = 16), this.createOrUpdateMaterial(), e1.font === t.font ? n && (this.updateGeometry(this.geometry, n), this.updateLayout()) : this.updateFont(); + }, + remove: function() { + this.geometry.dispose(), this.geometry = null, this.el.removeObject3D(this.attrName), this.material.dispose(), this.material = null, this.texture.dispose(), this.texture = null, this.shaderObject && delete this.shaderObject; + }, + createOrUpdateMaterial: function() { + var e1, t, n, i = this.data, r = this.material, s = this.shaderData; + if (n = i.shader, -1 !== A.indexOf(i.font) || i.font.indexOf("-msdf.") >= 0 ? n = "msdf" : i.font in p && -1 === A.indexOf(i.font) && (n = "sdf"), e1 = (this.shaderObject && this.shaderObject.name) !== n, s.alphaTest = i.alphaTest, s.color = i.color, s.map = this.texture, s.opacity = i.opacity, s.side = function(e1) { + switch(e1){ + case "back": + return a.FrontSide; + case "double": + return a.DoubleSide; + default: + return a.BackSide; + } + }(i.side), s.transparent = i.transparent, s.negate = i.negate, !e1) return this.shaderObject.update(s), r.transparent = s.transparent, void (r.side = s.side); + t = function(e1, t, n) { + var i, r; + return (r = new h[t].Shader).el = e1, r.init(n), r.update(n), (i = r.material).transparent = n.transparent, { + material: i, + shader: r + }; + }(this.el, n, s), this.material = t.material, this.shaderObject = t.shader, this.material.side = s.side, this.mesh && (this.mesh.material = this.material); + }, + updateFont: function() { + var e1, t = this.data, n = this.el, i = this.geometry, s = this; + t.font || u("No font specified. Using the default font."), this.mesh && (this.mesh.visible = !1), e1 = this.lookupFont(t.font || f) || t.font, E.get(e1, function() { + var n, i; + return n = e1, i = t.yOffset, new Promise(function(e1, t) { + r(n, function(r, s) { + if (r) return c("Error loading font", n), void t(r); + n.indexOf("/Roboto-msdf.json") >= 0 && (i = 30), i && s.chars.map(function(e1) { + e1.yoffset += i; + }), e1(s); + }); + }); + }).then(function(r) { + var o; + if (1 !== r.pages.length) throw new Error("Currently only single-page bitmap fonts are supported."); + b[e1] || (r.widthFactor = b[r] = function(e1) { + var t = 0, n = 0, i = 0; + return e1.chars.map(function(e1) { + t += e1.xadvance, e1.id >= 48 && e1.id <= 57 && (i++, n += e1.xadvance); + }), i ? n / i : t / e1.chars.length; + }(r)), s.currentFont = r, o = s.getFontImageSrc(), E.get(o, function() { + var e1; + return e1 = o, new Promise(function(t, n) { + (new a.ImageLoader).load(e1, function(e1) { + t(e1); + }, void 0, function() { + c("Error loading font image", e1), n(null); + }); + }); + }).then(function(e1) { + var o = s.texture; + o && (o.image = e1, o.needsUpdate = !0, x[t.font] = o, s.texture = o, s.initMesh(), s.currentFont = r, s.updateGeometry(i, r), s.updateLayout(), s.mesh.visible = !0, n.emit("textfontset", { + font: t.font, + fontObj: r + })); + }).catch(function(e1) { + c(e1.message), c(e1.stack); + }); + }).catch(function(e1) { + c(e1.message), c(e1.stack); + }); + }, + initMesh: function() { + this.mesh || (this.mesh = new a.Mesh(this.geometry, this.material), this.el.setObject3D(this.attrName, this.mesh)); + }, + getFontImageSrc: function() { + if (this.data.fontImage) return this.data.fontImage; + var e1 = this.lookupFont(this.data.font || f) || this.data.font, t = this.currentFont.pages[0]; + return t.match(C) && 0 !== t.indexOf("http") ? e1.replace(/(\.fnt)|(\.json)/, ".png") : a.LoaderUtils.extractUrlBase(e1) + t; + }, + updateLayout: function() { + var e1, t, n, i, r, s, o, a, l, c = this.el, h = this.data, u = this.geometry, d = this.mesh; + if (d && u.layout) { + if (n = c.getAttribute("geometry"), i = (s = (o = h.width || n && n.width || 1) / w(h.wrapPixels, h.wrapCount, this.currentFont.widthFactor)) * ((r = u.layout).height + r.descender), n && "plane" === n.primitive && (this.explicitGeoDimensionsChecked || (this.explicitGeoDimensionsChecked = !0, this.hasExplicitGeoWidth = !!n.width, this.hasExplicitGeoHeight = !!n.height), this.hasExplicitGeoWidth || c.setAttribute("geometry", "width", o), this.hasExplicitGeoHeight || c.setAttribute("geometry", "height", i)), "left" === (e1 = "align" === h.anchor ? h.align : h.anchor)) a = 0; + else if ("right" === e1) a = -1 * r.width; + else { + if ("center" !== e1) throw new TypeError("Invalid text.anchor property value", e1); + a = -1 * r.width / 2; + } + if ("bottom" === (t = h.baseline)) l = 0; + else if ("top" === t) l = -1 * r.height + r.ascender; + else { + if ("center" !== t) throw new TypeError("Invalid text.baseline property value", t); + l = -1 * r.height / 2; + } + d.position.x = a * s + h.xOffset, d.position.y = l * s, d.position.z = h.zOffset, d.scale.set(s, -1 * s, s); + } + }, + lookupFont: function(e1) { + return p[e1]; + }, + updateGeometry: (m = {}, g = {}, v = /\\n/g, y = /\\t/g, function(e1, t) { + var n = this.data; + g.font = t, g.lineHeight = n.lineHeight && isFinite(n.lineHeight) ? n.lineHeight : t.common.lineHeight, g.text = n.value.toString().replace(v, "\n").replace(y, " "), g.width = w(n.wrapPixels, n.wrapCount, t.widthFactor), e1.update(l.extend(m, n, g)); + }) + }); + }, + 1125: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(6600), s = n(8309).DEFAULT_CAMERA_HEIGHT, o = n(2666), a = n(8309).DEFAULT_HANDEDNESS, l = { + touches: [] + }; + e1.exports.Component = i("tracked-controls-webvr", { + schema: { + autoHide: { + default: !0 + }, + controller: { + default: 0 + }, + id: { + type: "string", + default: "" + }, + hand: { + type: "string", + default: "" + }, + idPrefix: { + type: "string", + default: "" + }, + orientationOffset: { + type: "vec3" + }, + armModel: { + default: !1 + }, + headElement: { + type: "selector" + } + }, + init: function() { + this.axis = this.el.components["tracked-controls"].axis = [ + 0, + 0, + 0 + ], this.buttonStates = this.el.components["tracked-controls"].buttonStates = {}, this.changedAxes = [], this.targetControllerNumber = this.data.controller, this.axisMoveEventDetail = { + axis: this.axis, + changed: this.changedAxes + }, this.deltaControllerPosition = new o.Vector3, this.controllerQuaternion = new o.Quaternion, this.controllerEuler = new o.Euler, this.updateGamepad(), this.buttonEventDetails = {}; + }, + tick: function(e1, t) { + var n = this.el.getObject3D("mesh"); + n && n.update && n.update(t / 1e3), this.updateGamepad(), this.updatePose(), this.updateButtons(); + }, + defaultUserHeight: function() { + return s; + }, + getHeadElement: function() { + return this.data.headElement || this.el.sceneEl.camera.el; + }, + updateGamepad: function() { + var e1 = this.data, t = r.findMatchingControllerWebVR(this.system.controllers, e1.id, e1.idPrefix, e1.hand, e1.controller); + this.controller = t, this.el.components["tracked-controls"].controller = t, this.data.autoHide && (this.el.object3D.visible = !!this.controller); + }, + applyArmModel: function(e1) { + var t, n, i, r, s = this.controller, o = this.controllerEuler, l = this.controllerQuaternion, c = this.deltaControllerPosition; + n = this.getHeadElement().object3D, r = this.defaultUserHeight(), i = s.pose, t = (s ? s.hand : void 0) || a, e1.copy(n.position), c.set(.175 * ("left" === t ? -1 : "right" === t ? 1 : 0), -0.3, -0.03), c.multiplyScalar(r), c.applyAxisAngle(n.up, n.rotation.y), e1.add(c), c.set(0, 0, -0.175), c.multiplyScalar(r), i.orientation ? l.fromArray(i.orientation) : l.copy(n.quaternion), o.setFromQuaternion(l), o.set(o.x, o.y, 0), c.applyEuler(o), e1.add(c); + }, + updatePose: function() { + var e1, t, n = this.controller, i = this.data, r = this.el.object3D, s = this.system.vrDisplay; + n && ((e1 = n.pose).position ? r.position.fromArray(e1.position) : i.armModel && this.applyArmModel(r.position), e1.orientation && r.quaternion.fromArray(e1.orientation), s && e1.position && (t = this.el.sceneEl.renderer.xr.getStandingMatrix(), r.matrix.compose(r.position, r.quaternion, r.scale), r.matrix.multiplyMatrices(t, r.matrix), r.matrix.decompose(r.position, r.quaternion, r.scale)), r.rotateX(this.data.orientationOffset.x * o.MathUtils.DEG2RAD), r.rotateY(this.data.orientationOffset.y * o.MathUtils.DEG2RAD), r.rotateZ(this.data.orientationOffset.z * o.MathUtils.DEG2RAD)); + }, + updateButtons: function() { + var e1, t, n = this.controller; + if (n) { + for(t = 0; t < n.buttons.length; ++t)this.buttonStates[t] || (this.buttonStates[t] = { + pressed: !1, + touched: !1, + value: 0 + }), this.buttonEventDetails[t] || (this.buttonEventDetails[t] = { + id: t, + state: this.buttonStates[t] + }), e1 = n.buttons[t], this.handleButton(t, e1); + this.handleAxes(); + } + }, + handleButton: function(e1, t) { + return !!(this.handlePress(e1, t) | this.handleTouch(e1, t) | this.handleValue(e1, t)) && (this.el.emit("buttonchanged", this.buttonEventDetails[e1], !1), !0); + }, + handleAxes: function() { + var e1, t = !1, n = this.controller.axes, i = this.axis, r = this.changedAxes; + for(this.changedAxes.splice(0, this.changedAxes.length), e1 = 0; e1 < n.length; ++e1)r.push(i[e1] !== n[e1]), r[e1] && (t = !0); + if (!t) return !1; + for(this.axis.splice(0, this.axis.length), e1 = 0; e1 < n.length; e1++)this.axis.push(n[e1]); + return this.el.emit("axismove", this.axisMoveEventDetail, !1), !0; + }, + handlePress: function(e1, t) { + var n, i = this.buttonStates[e1]; + return t.pressed !== i.pressed && (n = t.pressed ? "buttondown" : "buttonup", this.el.emit(n, this.buttonEventDetails[e1], !1), i.pressed = t.pressed, !0); + }, + handleTouch: function(e1, t) { + var n, i = this.buttonStates[e1]; + return t.touched !== i.touched && (n = t.touched ? "touchstart" : "touchend", this.el.emit(n, this.buttonEventDetails[e1], !1, l), i.touched = t.touched, !0); + }, + handleValue: function(e1, t) { + var n = this.buttonStates[e1]; + return t.value !== n.value && (n.value = t.value, !0); + } + }); + }, + 8666: (e1, t, n)=>{ + var i = n(6600), r = n(3515).registerComponent; + e1.exports.Component = r("tracked-controls-webxr", { + schema: { + id: { + type: "string", + default: "" + }, + hand: { + type: "string", + default: "" + }, + handTrackingEnabled: { + default: !1 + }, + index: { + type: "int", + default: -1 + }, + iterateControllerProfiles: { + default: !1 + }, + space: { + type: "string", + oneOf: [ + "targetRaySpace", + "gripSpace" + ], + default: "gripSpace" + } + }, + init: function() { + this.updateController = this.updateController.bind(this), this.buttonEventDetails = {}, this.buttonStates = this.el.components["tracked-controls"].buttonStates = {}, this.axis = this.el.components["tracked-controls"].axis = [ + 0, + 0, + 0 + ], this.changedAxes = [], this.axisMoveEventDetail = { + axis: this.axis, + changed: this.changedAxes + }; + }, + update: function() { + this.updateController(); + }, + play: function() { + var e1 = this.el.sceneEl; + this.updateController(), e1.addEventListener("controllersupdated", this.updateController); + }, + pause: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.updateController); + }, + isControllerPresent: function(e1) { + return !(!this.controller || this.controller.gamepad || "none" !== e1.inputSource.handedness && e1.inputSource.handedness !== this.data.hand); + }, + updateController: function() { + this.controller = i.findMatchingControllerWebXR(this.system.controllers, this.data.id, this.data.hand, this.data.index, this.data.iterateControllerProfiles, this.data.handTrackingEnabled), this.el.components["tracked-controls"].controller = this.controller, this.data.autoHide && (this.el.object3D.visible = !!this.controller); + }, + tick: function() { + var e1 = this.el.sceneEl, t = this.controller, n = e1.frame; + t && e1.frame && this.system.referenceSpace && (t.hand || (this.pose = n.getPose(t[this.data.space], this.system.referenceSpace), this.updatePose(), this.updateButtons())); + }, + updatePose: function() { + var e1 = this.el.object3D, t = this.pose; + t && (e1.matrix.elements = t.transform.matrix, e1.matrix.decompose(e1.position, e1.rotation, e1.scale)); + }, + updateButtons: function() { + var e1, t, n, i = this.controller; + if (i && i.gamepad) { + for(n = i.gamepad, t = 0; t < n.buttons.length; ++t)this.buttonStates[t] || (this.buttonStates[t] = { + pressed: !1, + touched: !1, + value: 0 + }), this.buttonEventDetails[t] || (this.buttonEventDetails[t] = { + id: t, + state: this.buttonStates[t] + }), e1 = n.buttons[t], this.handleButton(t, e1); + this.handleAxes(); + } + }, + handleButton: function(e1, t) { + return !!(this.handlePress(e1, t) | this.handleTouch(e1, t) | this.handleValue(e1, t)) && (this.el.emit("buttonchanged", this.buttonEventDetails[e1], !1), !0); + }, + handleAxes: function() { + var e1, t = !1, n = this.controller.gamepad.axes, i = this.axis, r = this.changedAxes; + for(this.changedAxes.splice(0, this.changedAxes.length), e1 = 0; e1 < n.length; ++e1)r.push(i[e1] !== n[e1]), r[e1] && (t = !0); + if (!t) return !1; + for(this.axis.splice(0, this.axis.length), e1 = 0; e1 < n.length; e1++)this.axis.push(n[e1]); + return this.el.emit("axismove", this.axisMoveEventDetail, !1), !0; + }, + handlePress: function(e1, t) { + var n, i = this.buttonStates[e1]; + return t.pressed !== i.pressed && (n = t.pressed ? "buttondown" : "buttonup", this.el.emit(n, this.buttonEventDetails[e1], !1), i.pressed = t.pressed, !0); + }, + handleTouch: function(e1, t) { + var n, i = this.buttonStates[e1]; + return t.touched !== i.touched && (n = t.touched ? "touchstart" : "touchend", this.el.emit(n, this.buttonEventDetails[e1], !1), i.touched = t.touched, !0); + }, + handleValue: function(e1, t) { + var n = this.buttonStates[e1]; + return t.value !== n.value && (n.value = t.value, !0); + } + }); + }, + 2761: (e1, t, n)=>{ + var i = n(3515).registerComponent; + e1.exports.Component = i("tracked-controls", { + schema: { + autoHide: { + default: !0 + }, + controller: { + default: -1 + }, + id: { + type: "string", + default: "" + }, + hand: { + type: "string", + default: "" + }, + idPrefix: { + type: "string", + default: "" + }, + handTrackingEnabled: { + default: !1 + }, + orientationOffset: { + type: "vec3" + }, + armModel: { + default: !1 + }, + headElement: { + type: "selector" + }, + iterateControllerProfiles: { + default: !1 + }, + space: { + type: "string", + oneOf: [ + "targetRaySpace", + "gripSpace" + ], + default: "targetRaySpace" + } + }, + update: function() { + var e1 = this.data, t = this.el; + t.sceneEl.hasWebXR ? t.setAttribute("tracked-controls-webxr", { + id: e1.id, + hand: e1.hand, + index: e1.controller, + iterateControllerProfiles: e1.iterateControllerProfiles, + handTrackingEnabled: e1.handTrackingEnabled, + space: e1.space + }) : t.setAttribute("tracked-controls-webvr", e1); + } + }); + }, + 3798: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(7629), s = n(2666), o = n(6600), a = o.checkControllerPresentAndSetup, l = o.emitIfAxesChanged, c = o.onButtonEvent, h = n(8309).AFRAME_CDN_ROOT + "controllers/valve/index/valve-index-", u = { + left: h + "left.glb", + right: h + "right.glb" + }, d = "valve", p = n(8903).device.isWebXRAvailable, A = { + left: { + _x: Math.PI / 3, + _y: 0, + _z: 0, + _order: "XYZ" + }, + right: { + _x: Math.PI / 3, + _y: 0, + _z: 0, + _order: "XYZ" + } + }, f = p ? A : { + left: { + _x: .692295102620542, + _y: -0.0627618864318427, + _z: -0.06265893149611756, + _order: "XYZ" + }, + right: { + _x: .6484021229942998, + _y: -0.032563619881892894, + _z: -0.1327973171917482, + _order: "XYZ" + } + }, m = p ? { + left: { + x: 0, + y: -0.05, + z: .06 + }, + right: { + x: 0, + y: -0.05, + z: .06 + } + } : { + left: { + x: -0.00023692678902063457, + y: .04724540367838371, + z: -0.061959880395271096 + }, + right: { + x: .002471558599671131, + y: .055765208987076195, + z: -0.061068168708348844 + } + }; + e1.exports.Component = i("valve-index-controls", { + schema: { + hand: { + default: "left" + }, + buttonColor: { + type: "color", + default: "#FAFAFA" + }, + buttonHighlightColor: { + type: "color", + default: "#22D1EE" + }, + model: { + default: !0 + }, + orientationOffset: { + type: "vec3" + } + }, + mapping: { + axes: { + trackpad: [ + 0, + 1 + ], + thumbstick: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "grip", + "trackpad", + "thumbstick", + "abutton" + ] + }, + init: function() { + var e1 = this; + this.controllerPresent = !1, this.lastControllerCheck = 0, this.onButtonChanged = r(this.onButtonChanged, this), this.onButtonDown = function(t) { + c(t.detail.id, "down", e1); + }, this.onButtonUp = function(t) { + c(t.detail.id, "up", e1); + }, this.onButtonTouchEnd = function(t) { + c(t.detail.id, "touchend", e1); + }, this.onButtonTouchStart = function(t) { + c(t.detail.id, "touchstart", e1); + }, this.previousButtonValues = {}, this.bindMethods(); + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + bindMethods: function() { + this.onModelLoaded = r(this.onModelLoaded, this), this.onControllersUpdate = r(this.onControllersUpdate, this), this.checkIfControllerPresent = r(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = r(this.removeControllersUpdateListener, this), this.onAxisMoved = r(this.onAxisMoved, this); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("model-loaded", this.onModelLoaded), e1.addEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("model-loaded", this.onModelLoaded), e1.removeEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + var e1 = this.data, t = "right" === e1.hand ? 0 : "left" === e1.hand ? 1 : 2; + a(this, d, { + index: t, + iterateControllerProfiles: !0, + hand: e1.hand + }); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + idPrefix: d, + controller: "right" === t.hand ? 1 : "left" === t.hand ? 0 : 2, + hand: t.hand, + orientationOffset: t.orientationOffset + }), this.loadModel(); + }, + loadModel: function() { + var e1 = this.data; + e1.model && this.el.setAttribute("gltf-model", "" + u[e1.hand]); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onButtonChanged: function(e1) { + var t, n = this.mapping.buttons[e1.detail.id], i = this.buttonMeshes; + n && ("trigger" === n && (t = e1.detail.state.value, i && i.trigger && (i.trigger.rotation.x = this.triggerOriginalRotationX - t * (Math.PI / 40))), this.el.emit(n + "changed", e1.detail.state)); + }, + onModelLoaded: function(e1) { + var t, n = e1.detail.model, i = this; + this.data.model && ((t = this.buttonMeshes = {}).grip = { + left: n.getObjectByName("leftgrip"), + right: n.getObjectByName("rightgrip") + }, t.menu = n.getObjectByName("menubutton"), t.system = n.getObjectByName("systembutton"), t.trackpad = n.getObjectByName("touchpad"), t.trigger = n.getObjectByName("trigger"), this.triggerOriginalRotationX = t.trigger.rotation.x, Object.keys(t).forEach(function(e1) { + i.setButtonColor(e1, i.data.buttonColor); + }), n.position.copy(m[this.data.hand]), n.rotation.copy(f[this.data.hand]), this.el.emit("controllermodelready", { + name: "valve-index-controlls", + model: this.data.model, + rayOrigin: new s.Vector3(0, 0, 0) + })); + }, + onAxisMoved: function(e1) { + l(this, this.mapping.axes, e1); + }, + updateModel: function(e1, t) { + var n; + this.data.model && (-1 !== t.indexOf("touch") || (n = "up" === t ? this.data.buttonColor : this.data.buttonHighlightColor, this.setButtonColor(e1, n))); + }, + setButtonColor: function(e1, t) {} + }); + }, + 8057: (e1, t, n)=>{ + var i = n(3515).registerComponent; + e1.exports.Component = i("visible", { + schema: { + default: !0 + }, + update: function() { + this.el.object3D.visible = this.data; + } + }); + }, + 8367: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(7629), s = n(6600), o = s.checkControllerPresentAndSetup, a = s.emitIfAxesChanged, l = s.onButtonEvent, c = n(8309).AFRAME_CDN_ROOT, h = c + "controllers/vive/vr_controller_vive.obj", u = c + "controllers/vive/vr_controller_vive.mtl", d = n(8903).device.isWebXRAvailable, p = d ? "htc-vive" : "OpenVR ", A = d ? { + axes: { + thumbstick: [ + 0, + 1 + ] + }, + buttons: [ + "trigger", + "grip", + "trackpad", + "none", + "menu" + ] + } : { + axes: { + trackpad: [ + 0, + 1 + ] + }, + buttons: [ + "trackpad", + "trigger", + "grip", + "menu", + "system" + ] + }; + e1.exports.Component = i("vive-controls", { + schema: { + hand: { + default: "left" + }, + buttonColor: { + type: "color", + default: "#FAFAFA" + }, + buttonHighlightColor: { + type: "color", + default: "#22D1EE" + }, + model: { + default: !0 + }, + orientationOffset: { + type: "vec3" + } + }, + mapping: A, + init: function() { + var e1 = this; + this.controllerPresent = !1, this.lastControllerCheck = 0, this.onButtonChanged = r(this.onButtonChanged, this), this.onButtonDown = function(t) { + l(t.detail.id, "down", e1); + }, this.onButtonUp = function(t) { + l(t.detail.id, "up", e1); + }, this.onButtonTouchEnd = function(t) { + l(t.detail.id, "touchend", e1); + }, this.onButtonTouchStart = function(t) { + l(t.detail.id, "touchstart", e1); + }, this.previousButtonValues = {}, this.bindMethods(); + }, + update: function() { + var e1 = this.data; + this.controllerIndex = "right" === e1.hand ? 0 : "left" === e1.hand ? 1 : 2; + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + bindMethods: function() { + this.onModelLoaded = r(this.onModelLoaded, this), this.onControllersUpdate = r(this.onControllersUpdate, this), this.checkIfControllerPresent = r(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = r(this.removeControllersUpdateListener, this), this.onAxisMoved = r(this.onAxisMoved, this); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("model-loaded", this.onModelLoaded), e1.addEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("model-loaded", this.onModelLoaded), e1.removeEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + var e1 = this.data; + o(this, p, { + index: this.controllerIndex, + hand: e1.hand + }); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + idPrefix: p, + hand: t.hand, + controller: this.controllerIndex, + orientationOffset: t.orientationOffset + }), this.data.model && this.el.setAttribute("obj-model", { + obj: h, + mtl: u + }); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onButtonChanged: function(e1) { + var t, n = this.mapping.buttons[e1.detail.id], i = this.buttonMeshes; + n && ("trigger" === n && (t = e1.detail.state.value, i && i.trigger && (i.trigger.rotation.x = -t * (Math.PI / 12))), this.el.emit(n + "changed", e1.detail.state)); + }, + onModelLoaded: function(e1) { + var t, n = e1.detail.model, i = this; + this.data.model && ((t = this.buttonMeshes = {}).grip = { + left: n.getObjectByName("leftgrip"), + right: n.getObjectByName("rightgrip") + }, t.menu = n.getObjectByName("menubutton"), t.system = n.getObjectByName("systembutton"), t.trackpad = n.getObjectByName("touchpad"), t.trigger = n.getObjectByName("trigger"), Object.keys(t).forEach(function(e1) { + i.setButtonColor(e1, i.data.buttonColor); + }), n.position.set(0, -0.015, .04)); + }, + onAxisMoved: function(e1) { + a(this, this.mapping.axes, e1); + }, + updateModel: function(e1, t) { + var n; + this.data.model && (-1 !== t.indexOf("touch") || (n = "up" === t ? this.data.buttonColor : this.data.buttonHighlightColor, this.setButtonColor(e1, n))); + }, + setButtonColor: function(e1, t) { + var n = this.buttonMeshes; + if (n) return "grip" === e1 ? (n.grip.left.material.color.set(t), void n.grip.right.material.color.set(t)) : void n[e1].material.color.set(t); + } + }); + }, + 9507: (e1, t, n)=>{ + var i = n(3515).registerComponent, r = n(7629), s = n(6600), o = s.checkControllerPresentAndSetup, a = s.emitIfAxesChanged, l = s.onButtonEvent, c = "HTC Vive Focus", h = n(8309).AFRAME_CDN_ROOT + "controllers/vive/focus-controller/focus-controller.gltf"; + e1.exports.Component = i("vive-focus-controls", { + schema: { + hand: { + default: "" + }, + buttonTouchedColor: { + type: "color", + default: "#BBBBBB" + }, + buttonHighlightColor: { + type: "color", + default: "#7A7A7A" + }, + model: { + default: !0 + }, + orientationOffset: { + type: "vec3" + }, + armModel: { + default: !0 + } + }, + mapping: { + axes: { + trackpad: [ + 0, + 1 + ] + }, + buttons: [ + "trackpad", + "trigger" + ] + }, + bindMethods: function() { + this.onModelLoaded = r(this.onModelLoaded, this), this.onControllersUpdate = r(this.onControllersUpdate, this), this.checkIfControllerPresent = r(this.checkIfControllerPresent, this), this.removeControllersUpdateListener = r(this.removeControllersUpdateListener, this), this.onAxisMoved = r(this.onAxisMoved, this); + }, + init: function() { + var e1 = this; + this.onButtonChanged = r(this.onButtonChanged, this), this.onButtonDown = function(t) { + l(t.detail.id, "down", e1); + }, this.onButtonUp = function(t) { + l(t.detail.id, "up", e1); + }, this.onButtonTouchStart = function(t) { + l(t.detail.id, "touchstart", e1); + }, this.onButtonTouchEnd = function(t) { + l(t.detail.id, "touchend", e1); + }, this.controllerPresent = !1, this.lastControllerCheck = 0, this.bindMethods(); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("model-loaded", this.onModelLoaded), e1.addEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !0, this.addControllersUpdateListener(); + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("model-loaded", this.onModelLoaded), e1.removeEventListener("axismove", this.onAxisMoved), this.controllerEventsActive = !1, this.removeControllersUpdateListener(); + }, + checkIfControllerPresent: function() { + o(this, c, this.data.hand ? { + hand: this.data.hand + } : {}); + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + injectTrackedControls: function() { + var e1 = this.el, t = this.data; + e1.setAttribute("tracked-controls", { + armModel: t.armModel, + idPrefix: c, + orientationOffset: t.orientationOffset + }), this.data.model && this.el.setAttribute("gltf-model", h); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onModelLoaded: function(e1) { + var t, n = e1.detail.model; + this.data.model && ((t = this.buttonMeshes = {}).trigger = n.getObjectByName("BumperKey"), t.triggerPressed = n.getObjectByName("BumperKey_Press"), t.triggerPressed && (t.triggerPressed.visible = !1), t.trackpad = n.getObjectByName("TouchPad"), t.trackpadPressed = n.getObjectByName("TouchPad_Press"), t.trackpadPressed && (t.trackpadPressed.visible = !1)); + }, + onButtonChanged: function(e1) { + var t = this.mapping.buttons[e1.detail.id]; + t && this.el.emit(t + "changed", e1.detail.state); + }, + onAxisMoved: function(e1) { + a(this, this.mapping.axes, e1); + }, + updateModel: function(e1, t) { + this.data.model && this.updateButtonModel(e1, t); + }, + updateButtonModel: function(e1, t) { + var n = this.buttonMeshes, i = e1 + "Pressed"; + if (n && n[e1] && n[i]) { + var r; + switch(t){ + case "down": + r = this.data.buttonHighlightColor; + break; + case "touchstart": + r = this.data.buttonTouchedColor; + } + r && n[i].material.color.set(r), n[i].visible = !!r, n[e1].visible = !r; + } + } + }); + }, + 6296: (e1, t, n)=>{ + var i, r, s = n(8309).keyboardevent.KEYCODE_TO_CODE, o = n(3515).registerComponent, a = n(2666), l = n(8903), c = l.bind, h = l.shouldCaptureKeyEvent, u = 1e-5, d = [ + "KeyW", + "KeyA", + "KeyS", + "KeyD", + "ArrowUp", + "ArrowLeft", + "ArrowRight", + "ArrowDown" + ]; + e1.exports.Component = o("wasd-controls", { + schema: { + acceleration: { + default: 65 + }, + adAxis: { + default: "x", + oneOf: [ + "x", + "y", + "z" + ] + }, + adEnabled: { + default: !0 + }, + adInverted: { + default: !1 + }, + enabled: { + default: !0 + }, + fly: { + default: !1 + }, + wsAxis: { + default: "z", + oneOf: [ + "x", + "y", + "z" + ] + }, + wsEnabled: { + default: !0 + }, + wsInverted: { + default: !1 + } + }, + init: function() { + this.keys = {}, this.easing = 1.1, this.velocity = new a.Vector3, this.onBlur = c(this.onBlur, this), this.onContextMenu = c(this.onContextMenu, this), this.onFocus = c(this.onFocus, this), this.onKeyDown = c(this.onKeyDown, this), this.onKeyUp = c(this.onKeyUp, this), this.onVisibilityChange = c(this.onVisibilityChange, this), this.attachVisibilityEventListeners(); + }, + tick: function(e1, t) { + var n = this.data, i = this.el, r = this.velocity; + (r[n.adAxis] || r[n.wsAxis] || !function(e1) { + var t; + for(t in e1)return !1; + return !0; + }(this.keys)) && (t /= 1e3, this.updateVelocity(t), (r[n.adAxis] || r[n.wsAxis]) && i.object3D.position.add(this.getMovementVector(t))); + }, + update: function(e1) { + e1.adAxis !== this.data.adAxis && (this.velocity[e1.adAxis] = 0), e1.wsAxis !== this.data.wsAxis && (this.velocity[e1.wsAxis] = 0); + }, + remove: function() { + this.removeKeyEventListeners(), this.removeVisibilityEventListeners(); + }, + play: function() { + this.attachKeyEventListeners(); + }, + pause: function() { + this.keys = {}, this.removeKeyEventListeners(); + }, + updateVelocity: function(e1) { + var t, n, i, r, s, o = this.data, a = this.keys, l = this.velocity; + if (n = o.adAxis, r = o.wsAxis, e1 > .2) return l[n] = 0, void (l[r] = 0); + var c = Math.pow(1 / this.easing, 60 * e1); + 0 !== l[n] && (l[n] = l[n] * c), 0 !== l[r] && (l[r] = l[r] * c), Math.abs(l[n]) < u && (l[n] = 0), Math.abs(l[r]) < u && (l[r] = 0), o.enabled && (t = o.acceleration, o.adEnabled && (i = o.adInverted ? -1 : 1, (a.KeyA || a.ArrowLeft) && (l[n] -= i * t * e1), (a.KeyD || a.ArrowRight) && (l[n] += i * t * e1)), o.wsEnabled && (s = o.wsInverted ? -1 : 1, (a.KeyW || a.ArrowUp) && (l[r] -= s * t * e1), (a.KeyS || a.ArrowDown) && (l[r] += s * t * e1))); + }, + getMovementVector: (i = new a.Vector3(0, 0, 0), r = new a.Euler(0, 0, 0, "YXZ"), function(e1) { + var t, n = this.el.getAttribute("rotation"), s = this.velocity; + return i.copy(s), i.multiplyScalar(e1), n ? (t = this.data.fly ? n.x : 0, r.set(a.MathUtils.degToRad(t), a.MathUtils.degToRad(n.y), 0), i.applyEuler(r), i) : i; + }), + attachVisibilityEventListeners: function() { + window.oncontextmenu = this.onContextMenu, window.addEventListener("blur", this.onBlur), window.addEventListener("focus", this.onFocus), document.addEventListener("visibilitychange", this.onVisibilityChange); + }, + removeVisibilityEventListeners: function() { + window.removeEventListener("blur", this.onBlur), window.removeEventListener("focus", this.onFocus), document.removeEventListener("visibilitychange", this.onVisibilityChange); + }, + attachKeyEventListeners: function() { + window.addEventListener("keydown", this.onKeyDown), window.addEventListener("keyup", this.onKeyUp); + }, + removeKeyEventListeners: function() { + window.removeEventListener("keydown", this.onKeyDown), window.removeEventListener("keyup", this.onKeyUp); + }, + onContextMenu: function() { + for(var e1 = Object.keys(this.keys), t = 0; t < e1.length; t++)delete this.keys[e1[t]]; + }, + onBlur: function() { + this.pause(); + }, + onFocus: function() { + this.play(); + }, + onVisibilityChange: function() { + document.hidden ? this.onBlur() : this.onFocus(); + }, + onKeyDown: function(e1) { + var t; + h(e1) && (t = e1.code || s[e1.keyCode], -1 !== d.indexOf(t) && (this.keys[t] = !0)); + }, + onKeyUp: function(e1) { + var t; + t = e1.code || s[e1.keyCode], delete this.keys[t]; + } + }); + }, + 7872: (e1, t, n)=>{ + var i, r = n(3515).registerComponent, s = n(7629), o = n(6600), a = o.checkControllerPresentAndSetup, l = o.emitIfAxesChanged, c = o.onButtonEvent, h = n(8903), u = h.debug("components:windows-motion-controls:debug"), d = h.debug("components:windows-motion-controls:warn"), p = n(8309).DEFAULT_HANDEDNESS, A = n(8309).AFRAME_CDN_ROOT + "controllers/microsoft/", f = { + left: "left.glb", + right: "right.glb", + default: "universal.glb" + }, m = n(8903).device.isWebXRAvailable, g = /([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/, v = m ? "windows-mixed-reality" : "Spatial Controller (Spatial Interaction Source) ", y = m ? { + axes: { + touchpad: [ + 0, + 1 + ], + thumbstick: [ + 2, + 3 + ] + }, + buttons: [ + "trigger", + "squeeze", + "touchpad", + "thumbstick", + "menu" + ], + axisMeshNames: [ + "TOUCHPAD_TOUCH_X", + "TOUCHPAD_TOUCH_X", + "THUMBSTICK_X", + "THUMBSTICK_Y" + ], + buttonMeshNames: { + trigger: "SELECT", + menu: "MENU", + squeeze: "GRASP", + thumbstick: "THUMBSTICK_PRESS", + touchpad: "TOUCHPAD_PRESS" + }, + pointingPoseMeshName: "POINTING_POSE" + } : { + axes: { + thumbstick: [ + 0, + 1 + ], + trackpad: [ + 2, + 3 + ] + }, + buttons: [ + "thumbstick", + "trigger", + "grip", + "menu", + "trackpad" + ], + axisMeshNames: [ + "THUMBSTICK_X", + "THUMBSTICK_Y", + "TOUCHPAD_TOUCH_X", + "TOUCHPAD_TOUCH_Y" + ], + buttonMeshNames: { + trigger: "SELECT", + menu: "MENU", + grip: "GRASP", + thumbstick: "THUMBSTICK_PRESS", + trackpad: "TOUCHPAD_PRESS" + }, + pointingPoseMeshName: "POINTING_POSE" + }; + e1.exports.Component = r("windows-motion-controls", { + schema: { + hand: { + default: p + }, + pair: { + default: 0 + }, + model: { + default: !0 + }, + hideDisconnected: { + default: !0 + } + }, + mapping: y, + bindMethods: function() { + this.onModelError = s(this.onModelError, this), this.onModelLoaded = s(this.onModelLoaded, this), this.onControllersUpdate = s(this.onControllersUpdate, this), this.checkIfControllerPresent = s(this.checkIfControllerPresent, this), this.onAxisMoved = s(this.onAxisMoved, this); + }, + init: function() { + var e1 = this, t = this.el; + this.onButtonChanged = s(this.onButtonChanged, this), this.onButtonDown = function(t) { + c(t.detail.id, "down", e1); + }, this.onButtonUp = function(t) { + c(t.detail.id, "up", e1); + }, this.onButtonTouchStart = function(t) { + c(t.detail.id, "touchstart", e1); + }, this.onButtonTouchEnd = function(t) { + c(t.detail.id, "touchend", e1); + }, this.onControllerConnected = function() { + e1.setModelVisibility(!0); + }, this.onControllerDisconnected = function() { + e1.setModelVisibility(!1); + }, this.controllerPresent = !1, this.lastControllerCheck = 0, this.previousButtonValues = {}, this.bindMethods(), this.loadedMeshInfo = { + buttonMeshes: null, + axisMeshes: null + }, this.rayOrigin = { + origin: new THREE.Vector3, + direction: new THREE.Vector3(0, 0, -1), + createdFromMesh: !1 + }, t.addEventListener("controllerconnected", this.onControllerConnected), t.addEventListener("controllerdisconnected", this.onControllerDisconnected); + }, + addEventListeners: function() { + var e1 = this.el; + e1.addEventListener("buttonchanged", this.onButtonChanged), e1.addEventListener("buttondown", this.onButtonDown), e1.addEventListener("buttonup", this.onButtonUp), e1.addEventListener("touchstart", this.onButtonTouchStart), e1.addEventListener("touchend", this.onButtonTouchEnd), e1.addEventListener("axismove", this.onAxisMoved), e1.addEventListener("model-error", this.onModelError), e1.addEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !0; + }, + removeEventListeners: function() { + var e1 = this.el; + e1.removeEventListener("buttonchanged", this.onButtonChanged), e1.removeEventListener("buttondown", this.onButtonDown), e1.removeEventListener("buttonup", this.onButtonUp), e1.removeEventListener("touchstart", this.onButtonTouchStart), e1.removeEventListener("touchend", this.onButtonTouchEnd), e1.removeEventListener("axismove", this.onAxisMoved), e1.removeEventListener("model-error", this.onModelError), e1.removeEventListener("model-loaded", this.onModelLoaded), this.controllerEventsActive = !1; + }, + checkIfControllerPresent: function() { + a(this, v, { + hand: this.data.hand, + index: this.data.pair, + iterateControllerProfiles: !0 + }); + }, + play: function() { + this.checkIfControllerPresent(), this.addControllersUpdateListener(); + }, + pause: function() { + this.removeEventListeners(), this.removeControllersUpdateListener(); + }, + updateControllerModel: function() { + if (this.data.model && !this.rayOrigin.createdFromMesh) { + var e1 = this.createControllerModelUrl(); + this.loadModel(e1); + } else this.modelReady(); + }, + createControllerModelUrl: function(e1) { + var t = this.el.components["tracked-controls"], n = t ? t.controller : null, i = "default", r = this.data.hand; + if (n && !window.hasNativeWebXRImplementation && (r = n.hand, !e1)) { + var s = n.id.match(g); + i = s && s[0] || i; + } + return A + i + "/" + (f[r] || f.default); + }, + injectTrackedControls: function() { + var e1 = this.data; + this.el.setAttribute("tracked-controls", { + idPrefix: v, + controller: e1.pair, + hand: e1.hand, + armModel: !1 + }), this.updateControllerModel(); + }, + addControllersUpdateListener: function() { + this.el.sceneEl.addEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + removeControllersUpdateListener: function() { + this.el.sceneEl.removeEventListener("controllersupdated", this.onControllersUpdate, !1); + }, + onControllersUpdate: function() { + this.checkIfControllerPresent(); + }, + onModelError: function(e1) { + var t = this.createControllerModelUrl(!0); + e1.detail.src !== t ? (d("Failed to load controller model for device, attempting to load default."), this.loadModel(t)) : d("Failed to load default controller model."); + }, + loadModel: function(e1) { + this.el.setAttribute("gltf-model", "url(" + e1 + ")"); + }, + onModelLoaded: function(e1) { + var t, n, i, r, s = this.controllerModel = e1.detail.model, o = this.loadedMeshInfo; + if (u("Processing model"), o.buttonMeshes = {}, o.axisMeshes = {}, s) { + for(t = 0; t < this.mapping.buttons.length; t++)(n = this.mapping.buttonMeshNames[this.mapping.buttons[t]]) ? (i = s.getObjectByName(n)) ? (r = { + index: t, + value: a(i, "VALUE"), + pressed: a(i, "PRESSED"), + unpressed: a(i, "UNPRESSED") + }).value && r.pressed && r.unpressed ? o.buttonMeshes[this.mapping.buttons[t]] = r : d("Missing button submesh under mesh with name: " + n + "(VALUE: " + !!r.value + ", PRESSED: " + !!r.pressed + ", UNPRESSED:" + !!r.unpressed + ")") : d("Missing button mesh with name: " + n) : u("Skipping unknown button at index: " + t + " with mapped name: " + this.mapping.buttons[t]); + for(t = 0; t < this.mapping.axisMeshNames.length; t++)(n = this.mapping.axisMeshNames[t]) ? (i = s.getObjectByName(n)) ? (r = { + index: t, + value: a(i, "VALUE"), + min: a(i, "MIN"), + max: a(i, "MAX") + }).value && r.min && r.max ? o.axisMeshes[t] = r : d("Missing axis submesh under mesh with name: " + n + "(VALUE: " + !!r.value + ", MIN: " + !!r.min + ", MAX:" + !!r.max + ")") : d("Missing axis mesh with name: " + n) : u("Skipping unknown axis at index: " + t); + this.calculateRayOriginFromMesh(s), this.setModelVisibility(); + } + function a(e1, t) { + for(var n = 0, i = e1.children.length; n < i; n++){ + var r = e1.children[n]; + if (r && r.name === t) return r; + } + } + u("Model load complete."); + }, + calculateRayOriginFromMesh: (i = new THREE.Quaternion, function(e1) { + var t; + if (this.rayOrigin.origin.set(0, 0, 0), this.rayOrigin.direction.set(0, 0, -1), this.rayOrigin.createdFromMesh = !0, t = e1.getObjectByName(this.mapping.pointingPoseMeshName)) { + var n = e1.parent; + n && (e1.parent = null, e1.updateMatrixWorld(!0), e1.parent = n), t.getWorldPosition(this.rayOrigin.origin), t.getWorldQuaternion(i), this.rayOrigin.direction.applyQuaternion(i), n && e1.updateMatrixWorld(!0); + } else u("Mesh does not contain pointing origin data, defaulting to none."); + this.modelReady(); + }), + lerpAxisTransform: function() { + var e1 = new THREE.Quaternion; + return function(t, n) { + var i = this.loadedMeshInfo.axisMeshes[t]; + if (i) { + var r = i.min, s = i.max, o = i.value, a = .5 * n + .5; + o.setRotationFromQuaternion(e1.copy(r.quaternion).slerp(s.quaternion, a)), o.position.lerpVectors(r.position, s.position, a); + } + }; + }(), + lerpButtonTransform: function() { + var e1 = new THREE.Quaternion; + return function(t, n) { + var i = this.loadedMeshInfo.buttonMeshes[t]; + if (i) { + var r = i.unpressed, s = i.pressed, o = i.value; + o.setRotationFromQuaternion(e1.copy(r.quaternion).slerp(s.quaternion, n)), o.position.lerpVectors(r.position, s.position, n); + } + }; + }(), + modelReady: function() { + this.el.emit("controllermodelready", { + name: "windows-motion-controls", + model: this.data.model, + rayOrigin: this.rayOrigin + }); + }, + onButtonChanged: function(e1) { + var t = this.mapping.buttons[e1.detail.id]; + t && (this.loadedMeshInfo && this.loadedMeshInfo.buttonMeshes && this.lerpButtonTransform(t, e1.detail.state.value), this.el.emit(t + "changed", e1.detail.state)); + }, + onAxisMoved: function(e1) { + var t = this.mapping.axisMeshNames.length; + if (this.loadedMeshInfo && this.loadedMeshInfo.axisMeshes) for(var n = 0; n < t; n++)this.lerpAxisTransform(n, e1.detail.axis[n] || 0); + l(this, this.mapping.axes, e1); + }, + setModelVisibility: function(e1) { + var t = this.el.getObject3D("mesh"); + this.controllerPresent && (e1 = void 0 !== e1 ? e1 : this.modelVisible, this.modelVisible = e1, t && (t.visible = e1)); + } + }); + }, + 8309: (e1, t, n)=>{ + e1.exports = { + AFRAME_CDN_ROOT: window.AFRAME_CDN_ROOT || "https://cdn.aframe.io/", + AFRAME_INJECTED: "aframe-injected", + DEFAULT_CAMERA_HEIGHT: 1.6, + DEFAULT_HANDEDNESS: "right", + keyboardevent: n(5065) + }; + }, + 5065: (e1)=>{ + e1.exports = { + KEYCODE_TO_CODE: { + 38: "ArrowUp", + 37: "ArrowLeft", + 40: "ArrowDown", + 39: "ArrowRight", + 87: "KeyW", + 65: "KeyA", + 83: "KeyS", + 68: "KeyD" + } + }; + }, + 2385: (e1, t, n)=>{ + var i = n(9721).X, r = n(7629), s = n(4219), o = n(2666), a = new o.FileLoader, l = s("core:a-assets:warn"); + function c(e1) { + if (e1.hasAttribute("autoplay") || "auto" === e1.getAttribute("preload")) return new Promise(function(t, n) { + if (4 === e1.readyState) return t(); + if (e1.error) return n(); + function i() { + for(var n = 0, i = 0; i < e1.buffered.length; i++)n += e1.buffered.end(i) - e1.buffered.start(i); + n >= e1.duration && ("VIDEO" === e1.tagName && o.Cache.add(e1.getAttribute("src"), e1), t()); + } + e1.addEventListener("loadeddata", i, !1), e1.addEventListener("progress", i, !1), e1.addEventListener("error", n, !1); + }); + } + function h(e1) { + var t = function(e1) { + var t, n, i; + if (e1.hasAttribute("crossorigin")) return e1; + if (null !== (t = e1.getAttribute("src"))) { + if (-1 === t.indexOf("://")) return e1; + if ((i = (n = t).indexOf("://") > -1 ? n.split("/")[2] : n.split("/")[0]).substring(0, i.indexOf(":")) === window.location.host) return e1; + } + return l('Cross-origin element (e.g., ) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., )', t), e1.crossOrigin = "anonymous", e1.cloneNode(!0); + }(e1); + return t.tagName && "video" === t.tagName.toLowerCase() && (t.setAttribute("playsinline", ""), t.setAttribute("webkit-playsinline", "")), t !== e1 && (e1.parentNode.appendChild(t), e1.parentNode.removeChild(e1)), t; + } + function u(e1) { + var t = d(e1), n = t.lastIndexOf("."); + return n >= 0 && ".glb" === t.slice(n, e1.search(/\?|#|$/)) ? "arraybuffer" : "text"; + } + function d(e1) { + var t = document.createElement("a"); + t.href = e1; + var n = t.search.replace(/^\?/, ""), i = e1.replace(n, "").replace("?", ""); + return i.substring(i.lastIndexOf("/") + 1); + } + customElements.define("a-assets", class extends i { + constructor(){ + super(), this.isAssets = !0, this.fileLoader = a, this.timeout = null; + } + connectedCallback() { + "complete" === document.readyState ? this.doConnectedCallback() : document.addEventListener("readystatechange", this.onReadyStateChange.bind(this)); + } + doConnectedCallback() { + var e1, t, n, i, s, a, u = this, d = []; + if (super.connectedCallback(), !this.parentNode.isScene) throw new Error(" must be a child of a ."); + for(s = this.querySelectorAll("img"), e1 = 0; e1 < s.length; e1++)i = h(s[e1]), d.push(new Promise(function(t, n) { + o.Cache.add(s[e1].getAttribute("src"), i), i.complete ? t() : (i.onload = t, i.onerror = n); + })); + for(n = this.querySelectorAll("audio, video"), e1 = 0; e1 < n.length; e1++)(t = h(n[e1])).src || t.srcObject || l("Audio/video asset has neither `src` nor `srcObject` attributes."), d.push(c(t)); + Promise.allSettled(d).then(r(this.load, this)), a = parseInt(this.getAttribute("timeout"), 10) || 3e3, this.timeout = setTimeout(function() { + u.hasLoaded || (l("Asset loading timed out in ", a, "ms"), u.emit("timeout"), u.load()); + }, a); + } + disconnectedCallback() { + super.disconnectedCallback(), this.timeout && clearTimeout(this.timeout); + } + load() { + super.load.call(this, null, function(e1) { + return e1.isAssetItem && e1.hasAttribute("src"); + }); + } + }), customElements.define("a-asset-item", class extends i { + constructor(){ + super(), this.data = null, this.isAssetItem = !0; + } + connectedCallback() { + var e1 = this, t = this.getAttribute("src"); + a.setResponseType(this.getAttribute("response-type") || u(t)), a.load(t, function(t) { + e1.data = t, i.prototype.load.call(e1); + }, function(t) { + e1.emit("progress", { + loadedBytes: t.loaded, + totalBytes: t.total, + xhr: t + }); + }, function(t) { + e1.emit("error", { + xhr: t + }); + }); + } + }), e1.exports.inferResponseType = u, e1.exports.getFileNameFromURL = d; + }, + 1397: (e1, t, n)=>{ + var i = n(4219)("core:cubemap:warn"); + class r extends HTMLElement { + constructor(e1){ + return super(e1); + } + onReadyStateChange() { + "complete" === document.readyState && this.doConnectedCallback(); + } + connectedCallback() { + "complete" === document.readyState ? r.prototype.doConnectedCallback.call(this) : document.addEventListener("readystatechange", this.onReadyStateChange.bind(this)); + } + doConnectedCallback() { + this.srcs = this.validate(); + } + validate() { + var e1, t = this.querySelectorAll("[src]"), n = []; + if (6 === t.length) { + for(e1 = 0; e1 < t.length; e1++)n.push(t[e1].getAttribute("src")); + return n; + } + i(" did not contain exactly six elements each with a `src` attribute."); + } + } + customElements.define("a-cubemap", r); + }, + 1956: (e1, t, n)=>{ + var i = n(9721).X, r = n(3515).components, s = n(2666), o = n(8903), a = o.debug("core:a-entity:debug"), l = o.debug("core:a-entity:warn"), c = "__", h = [ + "position", + "rotation", + "scale", + "visible" + ], u = { + once: !0 + }; + class d extends i { + constructor(){ + super(), this.components = {}, this.initializingComponents = {}, this.componentsToUpdate = {}, this.isEntity = !0, this.isPlaying = !1, this.object3D = new s.Group, this.object3D.el = this, this.object3DMap = {}, this.parentEl = null, this.rotationObj = {}, this.states = []; + } + attributeChangedCallback(e1, t, n) { + var i = this.components[e1]; + super.attributeChangedCallback(), i && i.justInitialized && "" === n ? delete i.justInitialized : (i || null !== n) && this.setEntityAttribute(e1, t, n); + } + connectedCallback() { + "complete" === document.readyState ? d.prototype.doConnectedCallback.call(this) : document.addEventListener("readystatechange", this.onReadyStateChange.bind(this)); + } + doConnectedCallback() { + var e1, t, n = this; + super.connectedCallback(), t = this.sceneEl, this.addToParent(), this.isScene || (t ? !(e1 = t.querySelector("a-assets")) || e1.hasLoaded ? this.load() : e1.addEventListener("loaded", function() { + n.load(); + }) : this.load()); + } + disconnectedCallback() { + var e1; + if (this.parentEl) { + for(e1 in this.components)this.removeComponent(e1, !1); + this.isScene || (this.removeFromParent(), super.disconnectedCallback(), this.object3D.el = null); + } + } + getObject3D(e1) { + return this.object3DMap[e1]; + } + setObject3D(e1, t) { + var n, i = this; + if (!(t instanceof s.Object3D)) throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D."); + (n = this.getObject3D(e1)) && this.object3D.remove(n), t.el = this, t.children.length && t.traverse(function(e1) { + e1.el = i; + }), this.object3D.add(t), this.object3DMap[e1] = t, this.emit("object3dset", { + object: t, + type: e1 + }); + } + removeObject3D(e1) { + var t = this.getObject3D(e1); + t ? (this.object3D.remove(t), delete this.object3DMap[e1], this.emit("object3dremove", { + type: e1 + })) : l("Tried to remove `Object3D` of type:", e1, "which was not defined."); + } + getOrCreateObject3D(e1, t) { + var n = this.getObject3D(e1); + return !n && t && (n = new t, this.setObject3D(e1, n)), l("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."), n; + } + add(e1) { + if (!e1.object3D) throw new Error("Trying to add an element that doesn't have an `object3D`"); + this.object3D.add(e1.object3D), this.emit("child-attached", { + el: e1 + }); + } + addToParent() { + var e1 = this.parentEl = this.parentNode; + e1 && e1.add && !this.attachedToParent && (e1.add(this), this.attachedToParent = !0); + } + removeFromParent() { + var e1 = this.parentEl; + this.parentEl.remove(this), this.attachedToParent = !1, this.parentEl = null, e1.emit("child-detached", { + el: this + }); + } + load() { + var e1 = this; + !this.hasLoaded && this.parentEl && super.load.call(this, function() { + e1.parentEl && (e1.updateComponents(), (e1.isScene || e1.parentEl.isPlaying) && e1.play()); + }); + } + remove(e1) { + e1 ? this.object3D.remove(e1.object3D) : this.parentNode.removeChild(this); + } + getChildEntities() { + for(var e1 = this.children, t = [], n = 0; n < e1.length; n++){ + var i = e1[n]; + i instanceof d && t.push(i); + } + return t; + } + initComponent(e1, t, n) { + var i, s, l, h; + if (h = (l = o.split(e1, c))[0], s = l.length > 2 ? l.slice(1).join("__") : l[1], r[h] && (p(this, e1) || void 0 !== t || n) && !(e1 in this.components)) { + if (this.initComponentDependencies(h), s && !r[h].multiple) throw new Error("Trying to initialize multiple components of type `" + h + "`. There can only be one component of this type per entity."); + i = new r[h].Component(this, t, s), this.isPlaying && i.play(), this.hasAttribute(e1) || (i.justInitialized = !0, window.HTMLElement.prototype.setAttribute.call(this, e1, "")), a("Component initialized: %s", e1); + } + } + initComponentDependencies(e1) { + var t, n; + if (r[e1] && (t = r[e1].dependencies)) for(n = 0; n < t.length; n++)this.initComponent(t[n], window.HTMLElement.prototype.getAttribute.call(this, t[n]) || void 0, !0); + } + removeComponent(e1, t) { + var n; + (n = this.components[e1]) && (n.initialized ? (n.pause(), n.remove(), t && (n.destroy(), delete this.components[e1]), this.emit("componentremoved", n.evtDetail, !1)) : this.addEventListener("componentinitialized", function n(i) { + i.detail.name === e1 && (this.removeComponent(e1, t), this.removeEventListener("componentinitialized", n)); + })); + } + updateComponents() { + var e1, t, n, i, r, s, a = this.componentsToUpdate; + if (this.hasLoaded) { + for(n = 0; n < this.mixinEls.length; n++)for(i in this.mixinEls[n].componentCache)A(i) && (a[i] = !0); + if (this.getExtraComponents) for(i in t = this.getExtraComponents())A(i) && (a[i] = !0); + for(n = 0; n < this.attributes.length; ++n)i = this.attributes[n].name, -1 === h.indexOf(i) && A(i) && (a[i] = !0); + for(n = 0; n < h.length; n++)i = h[n], this.hasAttribute(i) && this.updateComponent(i, this.getDOMAttribute(i)); + for(i in a)r = this.getDOMAttribute(i), e1 = (s = t && t[i]) ? s.constructor === Object ? o.extend(s, o.styleParser.parse(r || {})) : r || s : r, this.updateComponent(i, e1), delete a[i]; + } + } + updateComponent(e1, t, n) { + var i = this.components[e1]; + if (i) return null !== t || p(this, e1) ? void i.updateProperties(t, n) : void this.removeComponent(e1, !0); + this.initComponent(e1, t, !1); + } + removeAttribute(e1, t) { + var n = this.components[e1]; + n && void 0 === t && this.removeComponent(e1, !0), n && void 0 !== t ? n.resetProperty(t) : ("mixin" === e1 && this.mixinUpdate(""), window.HTMLElement.prototype.removeAttribute.call(this, e1)); + } + play() { + var e1, t, n; + if (!this.isPlaying && this.hasLoaded) { + for(n in this.isPlaying = !0, this.components)this.components[n].play(); + for(e1 = this.getChildEntities(), t = 0; t < e1.length; t++)e1[t].play(); + this.emit("play"); + } + } + pause() { + var e1, t, n; + if (this.isPlaying) { + for(n in this.isPlaying = !1, this.components)this.components[n].pause(); + for(e1 = this.getChildEntities(), t = 0; t < e1.length; t++)e1[t].pause(); + this.emit("pause"); + } + } + setEntityAttribute(e1, t, n) { + if (r[e1] || this.components[e1]) this.updateComponent(e1, n); + else if ("mixin" === e1) { + if (n === this.computedMixinStr) return; + this.mixinUpdate(n, t); + } + } + mixinUpdate(e1, t) { + var n, i, r, s, o = d.componentsUpdated, a = this; + if (this.hasLoaded) { + for(t = t || this.getAttribute("mixin"), r = this.updateMixins(e1, t), o.length = 0, s = 0; s < this.mixinEls.length; s++)for(n in this.mixinEls[s].componentCache)-1 === o.indexOf(n) && (this.components[n] ? this.components[n].handleMixinUpdate() : this.initComponent(n, null), o.push(n)); + for(s = 0; s < r.oldMixinIds.length; s++)if (i = document.getElementById(r.oldMixinIds[s])) for(n in i.componentCache)-1 === o.indexOf(n) && this.components[n] && (this.getDOMAttribute(n) ? this.components[n].handleMixinUpdate() : this.removeComponent(n, !0)); + } else this.addEventListener("loaded", function() { + a.mixinUpdate(e1, t); + }, u); + } + setAttribute(e1, t, n) { + var i, s, a, l, h, u = d.singlePropUpdate; + if (a = (l = e1.indexOf(c)) > 0 ? e1.substring(0, l) : e1, !r[a]) return "mixin" === e1 && this.mixinUpdate(t), void super.setAttribute.call(this, e1, t); + if (!this.components[e1] && this.hasAttribute(e1) && this.updateComponent(e1, window.HTMLElement.prototype.getAttribute.call(this, e1)), void 0 !== n && "string" == typeof t && t.length > 0 && "string" == typeof o.styleParser.parse(t)) { + for(h in u)delete u[h]; + (i = u)[t] = n, s = !1; + } else i = t, s = !0 === n; + this.updateComponent(e1, i, s), this.sceneEl && this.sceneEl.getAttribute("debug") && this.components[e1].flushToDOM(); + } + flushToDOM(e1) { + var t, n, i, r = this.components, s = this.children; + for(i in r)r[i].flushToDOM(); + if (e1) for(n = 0; n < s.length; ++n)(t = s[n]).flushToDOM && t.flushToDOM(e1); + } + getAttribute(e1) { + var t, n, i, r; + return "position" === e1 ? this.object3D.position : "rotation" === e1 ? (this, n = s.MathUtils.radToDeg, i = this.object3D.rotation, (r = this.rotationObj).x = n(i.x), r.y = n(i.y), r.z = n(i.z), r) : "scale" === e1 ? this.object3D.scale : "visible" === e1 ? this.object3D.visible : (t = this.components[e1]) ? t.data : window.HTMLElement.prototype.getAttribute.call(this, e1); + } + getDOMAttribute(e1) { + var t = this.components[e1]; + return t ? t.attrValue : window.HTMLElement.prototype.getAttribute.call(this, e1); + } + addState(e1) { + this.is(e1) || (this.states.push(e1), this.emit("stateadded", e1)); + } + removeState(e1) { + var t = this.states.indexOf(e1); + -1 !== t && (this.states.splice(t, 1), this.emit("stateremoved", e1)); + } + is(e1) { + return -1 !== this.states.indexOf(e1); + } + inspect() { + this.sceneEl.components.inspector.openInspector(this); + } + destroy() { + var e1; + if (this.parentNode) l("Entity can only be destroyed if detached from scenegraph."); + else for(e1 in this.components)this.components[e1].destroy(); + } + } + function p(e1, t) { + return !(!e1.components[t] || !e1.components[t].attrValue) || function(e1, t) { + var n, i = !1; + for(n = 0; n < t.length && !(i = t[n].hasAttribute(e1)); ++n); + return i; + }(t, e1.mixinEls); + } + function A(e1) { + return -1 !== e1.indexOf(c) && (e1 = o.split(e1, c)[0]), !!r[e1]; + } + d.componentsUpdated = [], d.singlePropUpdate = {}, customElements.define("a-entity", d), e1.exports.F = d; + }, + 8022: (e1, t, n)=>{ + var i = n(9721).X, r = n(3515).components, s = n(8903); + customElements.define("a-mixin", class extends i { + constructor(){ + super(), this.componentCache = {}, this.isMixin = !0; + } + connectedCallback() { + "complete" === document.readyState ? this.doConnectedCallback() : document.addEventListener("readystatechange", this.onReadyStateChange.bind(this)); + } + doConnectedCallback() { + super.connectedCallback(), this.sceneEl = this.closestScene(), this.id = this.getAttribute("id"), this.cacheAttributes(), this.updateEntities(), this.load(); + } + attributeChangedCallback(e1, t, n) { + super.attributeChangedCallback(), this.cacheAttribute(e1, n), this.updateEntities(); + } + setAttribute(e1, t) { + window.HTMLElement.prototype.setAttribute.call(this, e1, t), this.cacheAttribute(e1, t); + } + cacheAttribute(e1, t) { + var n, i; + i = s.split(e1, "__")[0], (n = r[i]) && (void 0 === t && (t = window.HTMLElement.prototype.getAttribute.call(this, e1)), this.componentCache[e1] = n.parseAttrValueForCache(t)); + } + getAttribute(e1) { + return this.componentCache[e1] || window.HTMLElement.prototype.getAttribute.call(this, e1); + } + cacheAttributes() { + var e1, t, n = this.attributes; + for(t = 0; t < n.length; t++)e1 = n[t].name, this.cacheAttribute(e1); + } + updateEntities() { + var e1, t, n; + if (this.sceneEl) for(t = this.sceneEl.querySelectorAll("[mixin~=" + this.id + "]"), n = 0; n < t.length; n++)(e1 = t[n]).hasLoaded && !e1.isMixin && e1.mixinUpdate(this.id); + } + }); + }, + 9721: (e1, t, n)=>{ + var i = n(8903), r = i.debug("core:a-node:warn"), s = { + "a-scene": !0, + "a-assets": !0, + "a-assets-items": !0, + "a-cubemap": !0, + "a-mixin": !0, + "a-node": !0, + "a-entity": !0 + }; + function o(e1) { + return e1.tagName.toLowerCase() in s || e1.isNode; + } + class a extends HTMLElement { + constructor(){ + super(), this.computedMixinStr = "", this.hasLoaded = !1, this.isNode = !0, this.mixinEls = []; + } + onReadyStateChange() { + "complete" === document.readyState && this.doConnectedCallback(); + } + connectedCallback() { + "complete" === document.readyState ? a.prototype.doConnectedCallback.call(this) : document.addEventListener("readystatechange", this.onReadyStateChange.bind(this)); + } + doConnectedCallback() { + var e1; + this.sceneEl = this.closestScene(), this.sceneEl || r("You are attempting to attach <" + this.tagName + "> outside of an A-Frame scene. Append this element to `` instead."), this.hasLoaded = !1, this.emit("nodeready", void 0, !1), this.isMixin || (e1 = this.getAttribute("mixin")) && this.updateMixins(e1); + } + attributeChangedCallback(e1, t, n) { + n !== this.computedMixinStr && ("mixin" !== e1 || this.isMixin || this.updateMixins(n, t)); + } + closestScene() { + for(var e1 = this; e1 && !e1.isScene;)e1 = e1.parentElement; + return e1; + } + closest(e1) { + for(var t = this.matches || this.mozMatchesSelector || this.msMatchesSelector || this.oMatchesSelector || this.webkitMatchesSelector, n = this; n && !t.call(n, e1);)n = n.parentElement; + return n; + } + disconnectedCallback() { + this.hasLoaded = !1; + } + load(e1, t) { + var n, i = this; + this.hasLoaded || (t = t || o, n = this.getChildren().filter(t).map(function(e1) { + return new Promise(function(t, n) { + if (e1.hasLoaded) return t(); + e1.addEventListener("loaded", t), e1.addEventListener("error", n); + }); + }), Promise.allSettled(n).then(function(t) { + t.forEach(function(e1) { + "rejected" === e1.status && r("Rendering scene with errors on node: ", e1.reason.target); + }), i.hasLoaded = !0, i.setupMutationObserver(), e1 && e1(), i.emit("loaded", void 0, !1); + })); + } + setupMutationObserver() { + var e1 = this; + new MutationObserver(function(t) { + var n; + for(n = 0; n < t.length; n++)if ("attributes" === t[n].type) { + var i = t[n].attributeName, r = window.HTMLElement.prototype.getAttribute.call(e1, i), s = t[n].oldValue; + e1.attributeChangedCallback(i, s, r); + } + }).observe(this, { + attributes: !0, + attributeOldValue: !0 + }); + } + getChildren() { + return Array.prototype.slice.call(this.children, 0); + } + updateMixins(e1, t) { + var n, r, s, o = a.newMixinIdArray, l = a.oldMixinIdArray, c = a.mixinIds; + for(o.length = 0, l.length = 0, r = e1 ? i.split(e1.trim(), /\s+/) : o, s = t ? i.split(t.trim(), /\s+/) : l, c.newMixinIds = r, c.oldMixinIds = s, n = 0; n < s.length; n++)-1 === r.indexOf(s[n]) && this.unregisterMixin(s[n]); + for(this.computedMixinStr = "", this.mixinEls.length = 0, n = 0; n < r.length; n++)this.registerMixin(document.getElementById(r[n])); + return this.computedMixinStr && (this.computedMixinStr = this.computedMixinStr.trim(), window.HTMLElement.prototype.setAttribute.call(this, "mixin", this.computedMixinStr)), c; + } + registerMixin(e1) { + var t, n, r; + if (e1) { + if (r = e1.getAttribute("mixin")) for(t = i.split(r.trim(), /\s+/), n = 0; n < t.length; n++)this.registerMixin(document.getElementById(t[n])); + this.computedMixinStr = this.computedMixinStr + " " + e1.id, this.mixinEls.push(e1); + } + } + setAttribute(e1, t) { + "mixin" === e1 && this.updateMixins(t), window.HTMLElement.prototype.setAttribute.call(this, e1, t); + } + unregisterMixin(e1) { + var t, n = this.mixinEls; + for(t = 0; t < n.length; ++t)if (e1 === n[t].id) { + n.splice(t, 1); + break; + } + } + emit(e1, t, n, r) { + var s = a.evtData; + void 0 === n && (n = !0), s.bubbles = !!n, s.detail = t, r && (s = i.extend({}, r, s)), this.dispatchEvent(new CustomEvent(e1, s)); + } + } + a.evtData = {}, a.newMixinIdArray = [], a.oldMixinIdArray = [], a.mixinIds = {}, customElements.define("a-node", a), e1.exports.X = a, e1.exports.U = s; + }, + 3515: (e1, t, n)=>{ + var i = n(5941), r = n(1435), s = n(365), o = n(8903), a = e1.exports.components = {}, l = i.parseProperties, c = i.parseProperty, h = i.process, u = i.isSingleProperty, d = i.stringifyProperties, p = i.stringifyProperty, A = o.styleParser, f = o.debug("core:component:warn"), m = document.currentScript, g = new RegExp("[A-Z]+"), v = {}, y = e1.exports.Component = function(e1, t, n) { + var i = this; + this.el = e1, this.id = n, this.attrName = this.name + (n ? "__" + n : ""), this.evtDetail = { + id: this.id, + name: this.name + }, this.initialized = !1, this.el.components[this.attrName] = this, this.objectPool = v[this.name]; + var r = this.events; + this.events = {}, function(e1, t) { + var n; + for(n in t)e1.events[n] = t[n].bind(e1); + }(this, r), this.attrValue = void 0, this.isObjectBased ? (this.nextData = this.objectPool.use(), o.objectPool.removeUnusedKeys(this.nextData, this.schema), this.oldData = this.objectPool.use(), o.objectPool.removeUnusedKeys(this.oldData, this.schema), this.previousOldData = this.objectPool.use(), o.objectPool.removeUnusedKeys(this.previousOldData, this.schema), this.parsingAttrValue = this.objectPool.use(), o.objectPool.removeUnusedKeys(this.parsingAttrValue, this.schema)) : (this.nextData = void 0, this.oldData = void 0, this.previousOldData = void 0, this.parsingAttrValue = void 0), this.throttledEmitComponentChanged = o.throttleLeadingAndTrailing(function() { + e1.emit("componentchanged", i.evtDetail, !1); + }, 200), this.updateProperties(t); + }; + if (y.prototype = { + schema: {}, + init: function() {}, + events: {}, + update: function(e1) {}, + updateSchema: void 0, + tick: void 0, + tock: void 0, + play: function() {}, + pause: function() {}, + remove: function() {}, + parse: function(e1, t) { + var n = this.schema; + return this.isSingleProperty ? c(e1, n) : l(A.parse(e1), n, !0, this.name, t); + }, + stringify: function(e1) { + var t = this.schema; + return "string" == typeof e1 ? e1 : this.isSingleProperty ? p(e1, t) : (e1 = d(e1, t), A.stringify(e1)); + }, + updateCachedAttrValue: function(e1, t) { + var n, i, r; + if (void 0 !== e1) { + if (null === e1) return this.isObjectBased && this.attrValue && this.objectPool.recycle(this.attrValue), void (this.attrValue = void 0); + if (e1 instanceof Object && !(e1 instanceof window.HTMLElement) ? (i = this.objectPool.use(), n = o.extend(i, e1)) : n = this.parseAttrValueForCache(e1), this.isObjectBased && !t && this.attrValue) for(r in this.attrValue)void 0 === n[r] && (n[r] = this.attrValue[r]); + this.isObjectBased && !this.attrValue && (this.attrValue = this.objectPool.use()), o.objectPool.clearObject(this.attrValue), this.attrValue = x(this.attrValue, n, this.isObjectBased), o.objectPool.clearObject(i); + } + }, + parseAttrValueForCache: function(e1) { + var t; + return "string" != typeof e1 ? e1 : (this.isSingleProperty ? "string" == typeof (t = this.schema.parse(e1)) && (t = e1) : (o.objectPool.clearObject(this.parsingAttrValue), t = A.parse(e1, this.parsingAttrValue)), t); + }, + flushToDOM: function(e1) { + var t = e1 ? this.data : this.attrValue; + null != t && window.HTMLElement.prototype.setAttribute.call(this.el, this.attrName, this.stringify(t)); + }, + updateProperties: function(e1, t) { + this.el.hasLoaded ? (null !== e1 && (e1 = this.parseAttrValueForCache(e1)), this.updateCachedAttrValue(e1, t), this.initialized ? (this.updateComponent(e1, t), this.callUpdateHandler()) : this.initComponent()) : this.updateCachedAttrValue(e1); + }, + initComponent: function() { + var e1, t = this.el; + this.updateSchema && this.updateSchema(this.buildData(this.attrValue, !1, !0)), this.data = this.buildData(this.attrValue), t.initializingComponents[this.name] || (t.initializingComponents[this.name] = !0, this.init(), this.initialized = !0, delete t.initializingComponents[this.name], this.oldData = x(this.oldData, this.data, this.isObjectBased), e1 = this.isObjectBased ? this.objectPool.use() : void 0, this.update(e1), this.isObjectBased && this.objectPool.recycle(e1), t.isPlaying && this.play(), t.emit("componentinitialized", this.evtDetail, !1)); + }, + updateComponent: function(e1, t) { + var n, i; + if (t) return this.updateSchema && this.updateSchema(this.buildData(this.attrValue, !0, !0)), void (this.data = this.buildData(this.attrValue, !0, !1)); + if (this.isSingleProperty) return this.isObjectBased && c(e1, this.schema), void (this.data = e1); + if (l(e1, this.schema, !0, this.name), this.schemaChangeKeys.length) { + for(n in e1)if (this.schema[n].schemaChange) { + i = !0; + break; + } + } + if (i) return this.updateSchema && this.updateSchema(this.buildData(this.attrValue, !0, !0)), void (this.data = this.buildData(this.attrValue, !0, !1)); + for(n in e1)void 0 !== e1[n] && (this.data[n] = e1[n]); + }, + callUpdateHandler: function() { + var e1; + this.previousOldData instanceof Object && o.objectPool.clearObject(this.previousOldData), this.isObjectBased ? b(this.previousOldData, this.oldData) : this.previousOldData = this.oldData, e1 = !o.deepEqual(this.oldData, this.data), (this.isPositionRotationScale || e1) && (this.oldData instanceof Object && o.objectPool.clearObject(this.oldData), this.oldData = x(this.oldData, this.data, this.isObjectBased), this.update(this.previousOldData), this.throttledEmitComponentChanged()); + }, + handleMixinUpdate: function() { + this.data = this.buildData(this.attrValue), this.callUpdateHandler(); + }, + resetProperty: function(e1) { + if (this.isObjectBased) { + if (!(e1 in this.attrValue)) return; + delete this.attrValue[e1], this.data[e1] = this.schema[e1].default; + } else this.attrValue = this.schema.default, this.data = this.schema.default; + this.updateProperties(this.attrValue); + }, + extendSchema: function(e1) { + var t; + t = o.extend({}, a[this.name].schema), o.extend(t, e1), this.schema = h(t), this.el.emit("schemachanged", this.evtDetail); + }, + buildData: function(e1, t, n) { + var i, r, s, a, h, u, d, p = this.nextData, A = this.schema, f = this.el.mixinEls; + if (i = e1 && e1.constructor === Array ? e1.length : null != e1, this.isObjectBased && o.objectPool.clearObject(p), this.isSingleProperty) r = this.isObjectBased ? b(p, A.default) : _(A.default) ? o.clone(A.default) : A.default; + else for(a in r = (d = !t && this.attrValue) instanceof Object ? b(p, d) : p, A)s = A[a].default, void 0 === r[a] && (r[a] = _(s) ? o.clone(s) : s); + for(u = 0; u < f.length; u++)(h = f[u].getAttribute(this.attrName)) && (r = x(r, h, this.isObjectBased)); + if (i) { + if (this.isSingleProperty) return w(e1) ? (b(this.parsingAttrValue, e1), c(this.parsingAttrValue, A)) : c(e1, A); + r = x(r, e1, this.isObjectBased); + } else if (this.isSingleProperty) return c(r, A); + return l(r, A, void 0, this.name, n); + }, + eventsAttach: function() { + var e1; + for(e1 in this.eventsDetach(), this.events)this.el.addEventListener(e1, this.events[e1]); + }, + eventsDetach: function() { + var e1; + for(e1 in this.events)this.el.removeEventListener(e1, this.events[e1]); + }, + destroy: function() { + this.objectPool.recycle(this.attrValue), this.objectPool.recycle(this.oldData), this.objectPool.recycle(this.parsingAttrValue), this.attrValue = this.oldData = this.parsingAttrValue = void 0; + } + }, window.debug) var E = e1.exports.registrationOrderWarnings = {}; + function b(e1, t) { + var n, i; + for(i in t)void 0 !== t[i] && (n = t[i], e1[i] = _(n) ? o.clone(n) : n); + return e1; + } + function x(e1, t, n) { + var i; + if (n && t.constructor === Object) { + for(i in t)void 0 !== t[i] && (t[i] && t[i].constructor === Object ? e1[i] = o.clone(t[i]) : e1[i] = t[i]); + return e1; + } + return t; + } + function C(e1) { + return e1.tick || e1.tock; + } + function w(e1) { + return e1 && e1.constructor === Object && !(e1 instanceof window.HTMLElement); + } + function _(e1) { + return e1 && (e1.constructor === Object || e1.constructor === Array) && !(e1 instanceof window.HTMLElement); + } + e1.exports.registerComponent = function(e1, t) { + var n, i, l, d, p, A, b, x = {}; + if (document.currentScript && document.currentScript !== m && r.forEach(function(t) { + t.hasLoaded || document.currentScript.compareDocumentPosition(t) !== Node.DOCUMENT_POSITION_FOLLOWING && (f("The component `" + e1 + "` was registered in a