Last active
November 28, 2017 04:44
-
-
Save mdunham/e8f72ffdaebc9951ed1e8a5f9599d793 to your computer and use it in GitHub Desktop.
This is a very interesting piece of obfuscation that I found as Angular.IO's service worker.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !function() { | |
| "use strict"; | |
| function t(t) {} | |
| function e(t, e, n, r) { | |
| void 0 === r && (r = !0); | |
| var i = 3 | |
| , o = function(e) { | |
| if (0 === i--) | |
| return Promise.reject("Hit redirect limit when attempting to fetch " + e + "."); | |
| var n = t.adapter.newRequest(e); | |
| return t.refresh(n, r).then(function(t) { | |
| return t.redirected && t.url && "" !== t.url ? o(t.url) : t | |
| }) | |
| } | |
| , s = function() { | |
| return o(e).then(function(r) { | |
| return t.cache.store(n, e, r) | |
| }) | |
| }; | |
| return s.desc = { | |
| type: "cacheFromNetworkOp", | |
| worker: t, | |
| url: e, | |
| cache: n | |
| }, | |
| s | |
| } | |
| function n(t, e, n, r) { | |
| var i = function() { | |
| return t.cache.load(r, n).then(function(t) { | |
| return t ? e.cache.store(r, n, t).then(function() { | |
| return !0 | |
| }) : null | |
| }) | |
| }; | |
| return i.desc = { | |
| type: "copyExistingCacheOp", | |
| oldWorker: t, | |
| newWorker: e, | |
| url: n, | |
| cache: r | |
| }, | |
| i | |
| } | |
| function r(t, r, i, o) { | |
| var s = function() { | |
| return n(t, r, i, o)().then(function(t) { | |
| return t ? t : e(r, i, o)() | |
| }) | |
| }; | |
| return s.desc = { | |
| type: "copyExistingOrFetchOp", | |
| oldWorker: t, | |
| newWorker: r, | |
| url: i, | |
| cache: o | |
| }, | |
| s | |
| } | |
| function i(t, e) { | |
| var n = function() { | |
| return t.cache.remove(e) | |
| }; | |
| return n.desc = { | |
| type: "deleteCacheOp", | |
| worker: t, | |
| key: e | |
| }, | |
| n | |
| } | |
| function o(t, e, n) { | |
| var r = function(r) { | |
| return t.cache.load(n, e).then(function(t) { | |
| return t ? t : r() | |
| }) | |
| }; | |
| return r.desc = { | |
| type: "fetchFromCacheInstruction", | |
| worker: t, | |
| req: e, | |
| cache: n | |
| }, | |
| r | |
| } | |
| function s(t, e, n) { | |
| void 0 === n && (n = !0); | |
| var r = function(r) { | |
| return n ? t.refresh(e) : t.scope.fetch(e) | |
| }; | |
| return r.desc = { | |
| type: "fetchFromNetworkInstruction", | |
| worker: t, | |
| req: e | |
| }, | |
| r | |
| } | |
| function a(t, e, n) { | |
| var r = t.adapter.newRequest(n) | |
| , i = function(e) { | |
| return t.fetch(r) | |
| }; | |
| return i.desc = { | |
| type: "rewriteUrlInstruction", | |
| worker: t, | |
| req: e, | |
| destUrl: n | |
| }, | |
| i | |
| } | |
| function u(t, e) { | |
| return e = { | |
| exports: {} | |
| }, | |
| t(e, e.exports), | |
| e.exports | |
| } | |
| function c(t) { | |
| var e = JSON.parse(t); | |
| return e._json = t, | |
| e._hash = (new N).hex(t), | |
| e | |
| } | |
| function h(t) { | |
| var e = { | |
| method: t.method, | |
| headers: t.headers, | |
| credentials: t.credentials, | |
| cache: t.cache, | |
| redirect: t.redirect, | |
| referrer: t.referrer | |
| }; | |
| return "navigate" !== t.mode.toString() && (e.mode = t.mode), | |
| e | |
| } | |
| function f(t) { | |
| var e = t && t.manifestUrl || "/ngsw-manifest.json" | |
| , n = t && t.plugins || [] | |
| , r = new O | |
| , i = new C(I.caches,r) | |
| , o = new E(I) | |
| , s = new B(I,r) | |
| , a = new D; | |
| return _.setVerbosity(t.logLevel), | |
| t.logHandlers && (_.messages = function(e) { | |
| return t.logHandlers.forEach(function(t) { | |
| return t.handle(e) | |
| }) | |
| } | |
| ), | |
| _.release(), | |
| new M(e,n,I,r,i,o,s,a) | |
| } | |
| function l(t) { | |
| return t ? t() : Promise.resolve() | |
| } | |
| function p(t, e) { | |
| return t < e ? -1 : t === e ? 0 : 1 | |
| } | |
| function d(t) { | |
| return function(e) { | |
| return new H(e,t) | |
| } | |
| } | |
| function m(t) { | |
| var e = t && t.manifestKey || "external"; | |
| return function(t) { | |
| return new W(t,e) | |
| } | |
| } | |
| function y() { | |
| return function(t) { | |
| return new Y(t) | |
| } | |
| } | |
| function v(t) { | |
| var e = t.toLowerCase().startsWith("http://") | |
| , n = t.toLowerCase().startsWith("https://"); | |
| if (!e && !n) | |
| return ["", t]; | |
| var r = "http://" | |
| , i = t.substr("http://".length); | |
| n && (r = "https://", | |
| i = t.substr("https://".length)); | |
| var o = i.indexOf("/"); | |
| return o === -1 ? [t, "/"] : [t.substr(0, r.length + o), i.substr(o)] | |
| } | |
| function g(t) { | |
| var e = t && t.manifestKey || "static"; | |
| return function(t) { | |
| return new J(t,e) | |
| } | |
| } | |
| function w() { | |
| return function(t) { | |
| return new $(t) | |
| } | |
| } | |
| var A, D = function() { | |
| function t() {} | |
| return t.prototype.dateNow = function() { | |
| return Date.now() | |
| } | |
| , | |
| t.prototype.setTimeout = function(t, e) { | |
| return setTimeout(t, e) | |
| } | |
| , | |
| t | |
| }(), C = function() { | |
| function t(t, e) { | |
| this.caches = t, | |
| this.adapter = e | |
| } | |
| return t.prototype.normalize = function(t) { | |
| return "string" == typeof t ? this.adapter.newRequest(t) : t | |
| } | |
| , | |
| t.prototype.load = function(t, e) { | |
| var n = this; | |
| return this.caches.open(t).then(function(t) { | |
| return t.match(n.normalize(e)) | |
| }) | |
| } | |
| , | |
| t.prototype.store = function(t, e, n) { | |
| var r = this; | |
| return this.caches.open(t).then(function(t) { | |
| return t.put(r.normalize(e), n) | |
| }) | |
| } | |
| , | |
| t.prototype.invalidate = function(t, e) { | |
| var n = this; | |
| return this.caches.open(t).then(function(t) { | |
| return t.delete(n.normalize(e)) | |
| }) | |
| } | |
| , | |
| t.prototype.remove = function(t) { | |
| return this.caches.delete(t) | |
| } | |
| , | |
| t.prototype.keys = function() { | |
| return this.caches.keys() | |
| } | |
| , | |
| t.prototype.keysOf = function(t) { | |
| return this.caches.open(t).then(function(t) { | |
| return t.keys() | |
| }) | |
| } | |
| , | |
| t | |
| }(), E = function() { | |
| function e(e) { | |
| var n = this; | |
| this.install = t, | |
| this.activate = t, | |
| this.fetch = t, | |
| this.message = t, | |
| this.push = t, | |
| e.addEventListener("install", function(t) { | |
| return n.install(t) | |
| }), | |
| e.addEventListener("activate", function(t) { | |
| return n.activate(t) | |
| }), | |
| e.addEventListener("fetch", function(t) { | |
| return n.fetch(t) | |
| }), | |
| e.addEventListener("message", function(t) { | |
| return n.message(t) | |
| }), | |
| e.addEventListener("push", function(t) { | |
| return n.push(t) | |
| }) | |
| } | |
| return e | |
| }(), B = function() { | |
| function t(t, e) { | |
| this.scope = t, | |
| this.adapter = e | |
| } | |
| return t.prototype._request = function(t) { | |
| var e = this; | |
| return this.scope.fetch(t).catch(function(t) { | |
| return e.adapter.newResponse("", { | |
| status: 503 | |
| }) | |
| }) | |
| } | |
| , | |
| t.prototype._followRedirectIfAny = function(t, e, n) { | |
| var r = this; | |
| return t.redirected ? e <= 0 ? Promise.reject("Hit redirect limit when attempting to fetch " + n + ".") : t.url ? this._request(this.adapter.newRequest(t.url)).then(function(t) { | |
| return r._followRedirectIfAny(t, e - 1, n) | |
| }) : t : t | |
| } | |
| , | |
| t.prototype.request = function(t, e) { | |
| var n = this; | |
| return void 0 === e && (e = !1), | |
| e ? this._request(t).then(function(e) { | |
| return n._followRedirectIfAny(e, 3, t.url) | |
| }) : this._request(t) | |
| } | |
| , | |
| t.prototype.refresh = function(t) { | |
| var e; | |
| return e = "string" == typeof t ? this.adapter.newRequest(this._cacheBust(t)) : this.adapter.newRequest(this._cacheBust(t.url), t), | |
| this.request(e, !1) | |
| } | |
| , | |
| t.prototype._cacheBust = function(t) { | |
| var e = Math.random(); | |
| return t.indexOf("?") == -1 ? t + "?ngsw-cache-bust=" + e : t + "&ngsw-cache-bust=" + e | |
| } | |
| , | |
| t | |
| }(), F = function() { | |
| function t(t, e, n, r, i, o, s, a) { | |
| this.streamController = t, | |
| this.scope = e, | |
| this.manifest = n, | |
| this.adapter = r, | |
| this.cache = i, | |
| this.clock = o, | |
| this.fetcher = s, | |
| this.plugins = a | |
| } | |
| return t.prototype.refresh = function(t, e) { | |
| return void 0 === e && (e = !0), | |
| e ? this.fetcher.refresh(t) : this.fetcher.request(t) | |
| } | |
| , | |
| t.prototype.fetch = function(t) { | |
| var e = this; | |
| s(this, t, !1); | |
| return this.plugins.filter(function(t) { | |
| return !!t.fetch | |
| }).map(function(e) { | |
| return e.fetch(t) | |
| }).filter(function(t) { | |
| return !!t | |
| }).reduceRight(function(t, e) { | |
| return function() { | |
| return e(t) | |
| } | |
| }, function() { | |
| return e.fetcher.request(t, !0) | |
| })() | |
| } | |
| , | |
| t.prototype.validate = function() { | |
| return Promise.all(this.plugins.filter(function(t) { | |
| return !!t.validate | |
| }).map(function(t) { | |
| return t.validate() | |
| })).then(function(t) { | |
| return t.every(function(t) { | |
| return t | |
| }) | |
| }) | |
| } | |
| , | |
| t.prototype.setup = function(t) { | |
| for (var e = [], n = 0; n < this.plugins.length; n++) { | |
| var r = this.plugins[n]; | |
| r.update && t ? r.update(e, t.plugins[n]) : r.setup(e) | |
| } | |
| return e.reduce(function(t, e) { | |
| return t.then(function() { | |
| return e() | |
| }) | |
| }, Promise.resolve(null)) | |
| } | |
| , | |
| t.prototype.cleanup = function() { | |
| return this.plugins.reduce(function(t, e) { | |
| return e.cleanup && e.cleanup(t), | |
| t | |
| }, []) | |
| } | |
| , | |
| t.prototype.message = function(t, e) { | |
| this.plugins.filter(function(t) { | |
| return !!t.message | |
| }).forEach(function(n) { | |
| return n.message(t, e) | |
| }) | |
| } | |
| , | |
| t.prototype.messageClosed = function(t) { | |
| this.plugins.filter(function(t) { | |
| return !!t.messageClosed | |
| }).forEach(function(e) { | |
| return e.messageClosed(t) | |
| }) | |
| } | |
| , | |
| t.prototype.sendToStream = function(t, e) { | |
| this.streamController.sendToStream(t, e) | |
| } | |
| , | |
| t.prototype.closeStream = function(t) { | |
| this.streamController.closeStream(t) | |
| } | |
| , | |
| t.prototype.push = function(t) { | |
| this.plugins.filter(function(t) { | |
| return !!t.push | |
| }).forEach(function(e) { | |
| return e.push(t) | |
| }) | |
| } | |
| , | |
| t.prototype.showNotification = function(t, e) { | |
| this.scope.registration.showNotification(t, e) | |
| } | |
| , | |
| t | |
| }(), b = function() { | |
| function t(t, e) { | |
| this.delegate = t, | |
| this.prefix = e | |
| } | |
| return t.prototype.load = function(t, e) { | |
| return this.delegate.load(this.prefix + t, e) | |
| } | |
| , | |
| t.prototype.store = function(t, e, n) { | |
| return this.delegate.store(this.prefix + t, e, n) | |
| } | |
| , | |
| t.prototype.remove = function(t) { | |
| return this.delegate.remove(this.prefix + t) | |
| } | |
| , | |
| t.prototype.invalidate = function(t, e) { | |
| return this.delegate.invalidate(this.prefix + t, e) | |
| } | |
| , | |
| t.prototype.keys = function() { | |
| var t = this; | |
| return this.delegate.keys().then(function(e) { | |
| return e.filter(function(e) { | |
| return e.startsWith(t.prefix) | |
| }).map(function(e) { | |
| return e.substr(t.prefix.length) | |
| }) | |
| }) | |
| } | |
| , | |
| t.prototype.keysOf = function(t) { | |
| return this.delegate.keysOf(this.prefix + t) | |
| } | |
| , | |
| t | |
| }(); | |
| !function(t) { | |
| t[t.DEBUG = 1] = "DEBUG", | |
| t[t.TECHNICAL = 2] = "TECHNICAL", | |
| t[t.INFO = 3] = "INFO", | |
| t[t.STATUS = 4] = "STATUS", | |
| t[t.DISABLED = 1e3] = "DISABLED" | |
| }(A || (A = {})); | |
| var P, k = function() { | |
| function t() { | |
| this.buffer = [], | |
| this.verbosity = A.DISABLED, | |
| this.messages = function() { | |
| return null | |
| } | |
| } | |
| return t.prototype.debug = function(t) { | |
| for (var e = [], n = 1; n < arguments.length; n++) | |
| e[n - 1] = arguments[n]; | |
| this._log(A.DEBUG, t, e) | |
| } | |
| , | |
| t.prototype.technical = function(t) { | |
| for (var e = [], n = 1; n < arguments.length; n++) | |
| e[n - 1] = arguments[n]; | |
| this._log(A.TECHNICAL, t, e) | |
| } | |
| , | |
| t.prototype.info = function(t) { | |
| for (var e = [], n = 1; n < arguments.length; n++) | |
| e[n - 1] = arguments[n]; | |
| this._log(A.INFO, t, e) | |
| } | |
| , | |
| t.prototype.status = function(t) { | |
| for (var e = [], n = 1; n < arguments.length; n++) | |
| e[n - 1] = arguments[n]; | |
| this._log(A.STATUS, t, e) | |
| } | |
| , | |
| t.prototype.log = function(t, e) { | |
| for (var n = [], r = 2; r < arguments.length; r++) | |
| n[r - 2] = arguments[r]; | |
| this._log(t, e, n) | |
| } | |
| , | |
| t.prototype.setVerbosity = function(t) { | |
| this.verbosity = t | |
| } | |
| , | |
| t.prototype.release = function() { | |
| var t = this; | |
| this.buffer.forEach(function(e) { | |
| return t.messages(e) | |
| }), | |
| this.buffer = null | |
| } | |
| , | |
| t.prototype._log = function(t, e, n) { | |
| var r = this | |
| , i = e; | |
| n.length > 0 && (i = e + " " + n.map(function(t) { | |
| return r._serialize(t) | |
| }).join(" ")), | |
| t < this.verbosity || (null !== this.buffer ? this.buffer.push({ | |
| verbosity: t, | |
| message: i | |
| }) : this.messages({ | |
| verbosity: t, | |
| message: i | |
| })) | |
| } | |
| , | |
| t.prototype._serialize = function(t) { | |
| return "object" != typeof t ? "" + t : JSON.stringify(t) | |
| } | |
| , | |
| t | |
| }(), _ = (function() { | |
| function t() {} | |
| return t.prototype.handle = function(t) { | |
| console.log(A[t.verbosity].toString() + ": " + t.message) | |
| } | |
| , | |
| t | |
| }(), | |
| function() { | |
| function t(t) { | |
| this.url = t | |
| } | |
| return t.prototype.handle = function(t) { | |
| fetch(this.url, { | |
| body: A[t.verbosity].toString() + ": " + t.message, | |
| method: "POST" | |
| }) | |
| } | |
| , | |
| t | |
| }(), | |
| new k), x = _, T = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, U = u(function(t, e) { | |
| !function() { | |
| function n(t) { | |
| var e, n, r, i = "", o = -1; | |
| if (t && t.length) | |
| for (r = t.length; (o += 1) < r; ) | |
| e = t.charCodeAt(o), | |
| n = o + 1 < r ? t.charCodeAt(o + 1) : 0, | |
| 55296 <= e && e <= 56319 && 56320 <= n && n <= 57343 && (e = 65536 + ((1023 & e) << 10) + (1023 & n), | |
| o += 1), | |
| e <= 127 ? i += String.fromCharCode(e) : e <= 2047 ? i += String.fromCharCode(192 | e >>> 6 & 31, 128 | 63 & e) : e <= 65535 ? i += String.fromCharCode(224 | e >>> 12 & 15, 128 | e >>> 6 & 63, 128 | 63 & e) : e <= 2097151 && (i += String.fromCharCode(240 | e >>> 18 & 7, 128 | e >>> 12 & 63, 128 | e >>> 6 & 63, 128 | 63 & e)); | |
| return i | |
| } | |
| function r(t) { | |
| var e, n, r, i, o, s, a = []; | |
| if (e = n = r = i = o = 0, | |
| t && t.length) | |
| for (s = t.length, | |
| t += ""; e < s; ) | |
| r = t.charCodeAt(e), | |
| n += 1, | |
| r < 128 ? (a[n] = String.fromCharCode(r), | |
| e += 1) : r > 191 && r < 224 ? (i = t.charCodeAt(e + 1), | |
| a[n] = String.fromCharCode((31 & r) << 6 | 63 & i), | |
| e += 2) : (i = t.charCodeAt(e + 1), | |
| o = t.charCodeAt(e + 2), | |
| a[n] = String.fromCharCode((15 & r) << 12 | (63 & i) << 6 | 63 & o), | |
| e += 3); | |
| return a.join("") | |
| } | |
| function i(t, e) { | |
| var n = (65535 & t) + (65535 & e) | |
| , r = (t >> 16) + (e >> 16) + (n >> 16); | |
| return r << 16 | 65535 & n | |
| } | |
| function o(t, e) { | |
| return t << e | t >>> 32 - e | |
| } | |
| function s(t, e) { | |
| for (var n, r = e ? "0123456789ABCDEF" : "0123456789abcdef", i = "", o = 0, s = t.length; o < s; o += 1) | |
| n = t.charCodeAt(o), | |
| i += r.charAt(n >>> 4 & 15) + r.charAt(15 & n); | |
| return i | |
| } | |
| function a(t) { | |
| var e, n = 32 * t.length, r = ""; | |
| for (e = 0; e < n; e += 8) | |
| r += String.fromCharCode(t[e >> 5] >>> 24 - e % 32 & 255); | |
| return r | |
| } | |
| function u(t) { | |
| var e, n = 32 * t.length, r = ""; | |
| for (e = 0; e < n; e += 8) | |
| r += String.fromCharCode(t[e >> 5] >>> e % 32 & 255); | |
| return r | |
| } | |
| function c(t) { | |
| var e, n = 8 * t.length, r = Array(t.length >> 2), i = r.length; | |
| for (e = 0; e < i; e += 1) | |
| r[e] = 0; | |
| for (e = 0; e < n; e += 8) | |
| r[e >> 5] |= (255 & t.charCodeAt(e / 8)) << e % 32; | |
| return r | |
| } | |
| function h(t) { | |
| var e, n = 8 * t.length, r = Array(t.length >> 2), i = r.length; | |
| for (e = 0; e < i; e += 1) | |
| r[e] = 0; | |
| for (e = 0; e < n; e += 8) | |
| r[e >> 5] |= (255 & t.charCodeAt(e / 8)) << 24 - e % 32; | |
| return r | |
| } | |
| function f(t, e) { | |
| var n, r, i, o, s, a, u, c, h = e.length, f = Array(); | |
| for (a = Array(Math.ceil(t.length / 2)), | |
| o = a.length, | |
| n = 0; n < o; n += 1) | |
| a[n] = t.charCodeAt(2 * n) << 8 | t.charCodeAt(2 * n + 1); | |
| for (; a.length > 0; ) { | |
| for (s = Array(), | |
| i = 0, | |
| n = 0; n < a.length; n += 1) | |
| i = (i << 16) + a[n], | |
| r = Math.floor(i / h), | |
| i -= r * h, | |
| (s.length > 0 || r > 0) && (s[s.length] = r); | |
| f[f.length] = i, | |
| a = s | |
| } | |
| for (u = "", | |
| n = f.length - 1; n >= 0; n--) | |
| u += e.charAt(f[n]); | |
| for (c = Math.ceil(8 * t.length / (Math.log(e.length) / Math.log(2))), | |
| n = u.length; n < c; n += 1) | |
| u = e[0] + u; | |
| return u | |
| } | |
| function l(t, e) { | |
| var n, r, i, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = "", a = t.length; | |
| for (e = e || "=", | |
| n = 0; n < a; n += 3) | |
| for (i = t.charCodeAt(n) << 16 | (n + 1 < a ? t.charCodeAt(n + 1) << 8 : 0) | (n + 2 < a ? t.charCodeAt(n + 2) : 0), | |
| r = 0; r < 4; r += 1) | |
| s += 8 * n + 6 * r > 8 * t.length ? e : o.charAt(i >>> 6 * (3 - r) & 63); | |
| return s | |
| } | |
| var p; | |
| p = { | |
| VERSION: "1.0.6", | |
| Base64: function() { | |
| var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" | |
| , e = "=" | |
| , i = !0; | |
| this.encode = function(r) { | |
| var o, s, a, u = "", c = r.length; | |
| for (e = e || "=", | |
| r = i ? n(r) : r, | |
| o = 0; o < c; o += 3) | |
| for (a = r.charCodeAt(o) << 16 | (o + 1 < c ? r.charCodeAt(o + 1) << 8 : 0) | (o + 2 < c ? r.charCodeAt(o + 2) : 0), | |
| s = 0; s < 4; s += 1) | |
| u += 8 * o + 6 * s > 8 * c ? e : t.charAt(a >>> 6 * (3 - s) & 63); | |
| return u | |
| } | |
| , | |
| this.decode = function(n) { | |
| var o, s, a, u, c, h, f, l, p, d, m = "", y = []; | |
| if (!n) | |
| return n; | |
| o = d = 0, | |
| n = n.replace(new RegExp("\\" + e,"gi"), ""); | |
| do | |
| c = t.indexOf(n.charAt(o += 1)), | |
| h = t.indexOf(n.charAt(o += 1)), | |
| f = t.indexOf(n.charAt(o += 1)), | |
| l = t.indexOf(n.charAt(o += 1)), | |
| p = c << 18 | h << 12 | f << 6 | l, | |
| s = p >> 16 & 255, | |
| a = p >> 8 & 255, | |
| u = 255 & p, | |
| d += 1, | |
| 64 === f ? y[d] = String.fromCharCode(s) : 64 === l ? y[d] = String.fromCharCode(s, a) : y[d] = String.fromCharCode(s, a, u); | |
| while (o < n.length);return m = y.join(""), | |
| m = i ? r(m) : m | |
| } | |
| , | |
| this.setPad = function(t) { | |
| return e = t || e, | |
| this | |
| } | |
| , | |
| this.setTab = function(e) { | |
| return t = e || t, | |
| this | |
| } | |
| , | |
| this.setUTF8 = function(t) { | |
| return "boolean" == typeof t && (i = t), | |
| this | |
| } | |
| }, | |
| CRC32: function(t) { | |
| var e, r, i, o = 0, s = 0, a = 0; | |
| for (t = n(t), | |
| e = ["00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 ", "79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 ", "84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F ", "63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD ", "A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC ", "51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 ", "B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 ", "06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 ", "E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 ", "12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 ", "D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 ", "33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 ", "CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 ", "9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E ", "7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D ", "806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 ", "60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA ", "AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 ", "5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 ", "B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 ", "05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 ", "F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA ", "11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 ", "D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F ", "30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E ", "C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D"].join(""), | |
| o ^= -1, | |
| r = 0, | |
| i = t.length; r < i; r += 1) | |
| a = 255 & (o ^ t.charCodeAt(r)), | |
| s = "0x" + e.substr(9 * a, 8), | |
| o = o >>> 8 ^ s; | |
| return (o ^ -1) >>> 0 | |
| }, | |
| MD5: function(t) { | |
| function e(t) { | |
| return t = w ? n(t) : t, | |
| u(a(c(t), 8 * t.length)) | |
| } | |
| function r(t, e) { | |
| var r, i, o, s, h; | |
| for (t = w ? n(t) : t, | |
| e = w ? n(e) : e, | |
| r = c(t), | |
| r.length > 16 && (r = a(r, 8 * t.length)), | |
| i = Array(16), | |
| o = Array(16), | |
| h = 0; h < 16; h += 1) | |
| i[h] = 909522486 ^ r[h], | |
| o[h] = 1549556828 ^ r[h]; | |
| return s = a(i.concat(c(e)), 512 + 8 * e.length), | |
| u(a(o.concat(s), 640)) | |
| } | |
| function a(t, e) { | |
| var n, r, o, s, a, u = 1732584193, c = -271733879, h = -1732584194, f = 271733878; | |
| for (t[e >> 5] |= 128 << e % 32, | |
| t[(e + 64 >>> 9 << 4) + 14] = e, | |
| n = 0; n < t.length; n += 16) | |
| r = u, | |
| o = c, | |
| s = h, | |
| a = f, | |
| u = p(u, c, h, f, t[n + 0], 7, -680876936), | |
| f = p(f, u, c, h, t[n + 1], 12, -389564586), | |
| h = p(h, f, u, c, t[n + 2], 17, 606105819), | |
| c = p(c, h, f, u, t[n + 3], 22, -1044525330), | |
| u = p(u, c, h, f, t[n + 4], 7, -176418897), | |
| f = p(f, u, c, h, t[n + 5], 12, 1200080426), | |
| h = p(h, f, u, c, t[n + 6], 17, -1473231341), | |
| c = p(c, h, f, u, t[n + 7], 22, -45705983), | |
| u = p(u, c, h, f, t[n + 8], 7, 1770035416), | |
| f = p(f, u, c, h, t[n + 9], 12, -1958414417), | |
| h = p(h, f, u, c, t[n + 10], 17, -42063), | |
| c = p(c, h, f, u, t[n + 11], 22, -1990404162), | |
| u = p(u, c, h, f, t[n + 12], 7, 1804603682), | |
| f = p(f, u, c, h, t[n + 13], 12, -40341101), | |
| h = p(h, f, u, c, t[n + 14], 17, -1502002290), | |
| c = p(c, h, f, u, t[n + 15], 22, 1236535329), | |
| u = d(u, c, h, f, t[n + 1], 5, -165796510), | |
| f = d(f, u, c, h, t[n + 6], 9, -1069501632), | |
| h = d(h, f, u, c, t[n + 11], 14, 643717713), | |
| c = d(c, h, f, u, t[n + 0], 20, -373897302), | |
| u = d(u, c, h, f, t[n + 5], 5, -701558691), | |
| f = d(f, u, c, h, t[n + 10], 9, 38016083), | |
| h = d(h, f, u, c, t[n + 15], 14, -660478335), | |
| c = d(c, h, f, u, t[n + 4], 20, -405537848), | |
| u = d(u, c, h, f, t[n + 9], 5, 568446438), | |
| f = d(f, u, c, h, t[n + 14], 9, -1019803690), | |
| h = d(h, f, u, c, t[n + 3], 14, -187363961), | |
| c = d(c, h, f, u, t[n + 8], 20, 1163531501), | |
| u = d(u, c, h, f, t[n + 13], 5, -1444681467), | |
| f = d(f, u, c, h, t[n + 2], 9, -51403784), | |
| h = d(h, f, u, c, t[n + 7], 14, 1735328473), | |
| c = d(c, h, f, u, t[n + 12], 20, -1926607734), | |
| u = m(u, c, h, f, t[n + 5], 4, -378558), | |
| f = m(f, u, c, h, t[n + 8], 11, -2022574463), | |
| h = m(h, f, u, c, t[n + 11], 16, 1839030562), | |
| c = m(c, h, f, u, t[n + 14], 23, -35309556), | |
| u = m(u, c, h, f, t[n + 1], 4, -1530992060), | |
| f = m(f, u, c, h, t[n + 4], 11, 1272893353), | |
| h = m(h, f, u, c, t[n + 7], 16, -155497632), | |
| c = m(c, h, f, u, t[n + 10], 23, -1094730640), | |
| u = m(u, c, h, f, t[n + 13], 4, 681279174), | |
| f = m(f, u, c, h, t[n + 0], 11, -358537222), | |
| h = m(h, f, u, c, t[n + 3], 16, -722521979), | |
| c = m(c, h, f, u, t[n + 6], 23, 76029189), | |
| u = m(u, c, h, f, t[n + 9], 4, -640364487), | |
| f = m(f, u, c, h, t[n + 12], 11, -421815835), | |
| h = m(h, f, u, c, t[n + 15], 16, 530742520), | |
| c = m(c, h, f, u, t[n + 2], 23, -995338651), | |
| u = y(u, c, h, f, t[n + 0], 6, -198630844), | |
| f = y(f, u, c, h, t[n + 7], 10, 1126891415), | |
| h = y(h, f, u, c, t[n + 14], 15, -1416354905), | |
| c = y(c, h, f, u, t[n + 5], 21, -57434055), | |
| u = y(u, c, h, f, t[n + 12], 6, 1700485571), | |
| f = y(f, u, c, h, t[n + 3], 10, -1894986606), | |
| h = y(h, f, u, c, t[n + 10], 15, -1051523), | |
| c = y(c, h, f, u, t[n + 1], 21, -2054922799), | |
| u = y(u, c, h, f, t[n + 8], 6, 1873313359), | |
| f = y(f, u, c, h, t[n + 15], 10, -30611744), | |
| h = y(h, f, u, c, t[n + 6], 15, -1560198380), | |
| c = y(c, h, f, u, t[n + 13], 21, 1309151649), | |
| u = y(u, c, h, f, t[n + 4], 6, -145523070), | |
| f = y(f, u, c, h, t[n + 11], 10, -1120210379), | |
| h = y(h, f, u, c, t[n + 2], 15, 718787259), | |
| c = y(c, h, f, u, t[n + 9], 21, -343485551), | |
| u = i(u, r), | |
| c = i(c, o), | |
| h = i(h, s), | |
| f = i(f, a); | |
| return Array(u, c, h, f) | |
| } | |
| function h(t, e, n, r, s, a) { | |
| return i(o(i(i(e, t), i(r, a)), s), n) | |
| } | |
| function p(t, e, n, r, i, o, s) { | |
| return h(e & n | ~e & r, t, e, i, o, s) | |
| } | |
| function d(t, e, n, r, i, o, s) { | |
| return h(e & r | n & ~r, t, e, i, o, s) | |
| } | |
| function m(t, e, n, r, i, o, s) { | |
| return h(e ^ n ^ r, t, e, i, o, s) | |
| } | |
| function y(t, e, n, r, i, o, s) { | |
| return h(n ^ (e | ~r), t, e, i, o, s) | |
| } | |
| var v = !(!t || "boolean" != typeof t.uppercase) && t.uppercase | |
| , g = t && "string" == typeof t.pad ? t.pad : "=" | |
| , w = !t || "boolean" != typeof t.utf8 || t.utf8; | |
| this.hex = function(t) { | |
| return s(e(t, w), v) | |
| } | |
| , | |
| this.b64 = function(t) { | |
| return l(e(t), g) | |
| } | |
| , | |
| this.any = function(t, n) { | |
| return f(e(t, w), n) | |
| } | |
| , | |
| this.raw = function(t) { | |
| return e(t, w) | |
| } | |
| , | |
| this.hex_hmac = function(t, e) { | |
| return s(r(t, e), v) | |
| } | |
| , | |
| this.b64_hmac = function(t, e) { | |
| return l(r(t, e), g) | |
| } | |
| , | |
| this.any_hmac = function(t, e, n) { | |
| return f(r(t, e), n) | |
| } | |
| , | |
| this.vm_test = function() { | |
| return "900150983cd24fb0d6963f7d28e17f72" === hex("abc").toLowerCase() | |
| } | |
| , | |
| this.setUpperCase = function(t) { | |
| return "boolean" == typeof t && (v = t), | |
| this | |
| } | |
| , | |
| this.setPad = function(t) { | |
| return g = t || g, | |
| this | |
| } | |
| , | |
| this.setUTF8 = function(t) { | |
| return "boolean" == typeof t && (w = t), | |
| this | |
| } | |
| }, | |
| SHA1: function(t) { | |
| function e(t) { | |
| return t = y ? n(t) : t, | |
| a(u(h(t), 8 * t.length)) | |
| } | |
| function r(t, e) { | |
| var r, i, o, s, c; | |
| for (t = y ? n(t) : t, | |
| e = y ? n(e) : e, | |
| r = h(t), | |
| r.length > 16 && (r = u(r, 8 * t.length)), | |
| i = Array(16), | |
| o = Array(16), | |
| s = 0; s < 16; s += 1) | |
| i[s] = 909522486 ^ r[s], | |
| o[s] = 1549556828 ^ r[s]; | |
| return c = u(i.concat(h(e)), 512 + 8 * e.length), | |
| a(u(o.concat(c), 672)) | |
| } | |
| function u(t, e) { | |
| var n, r, s, a, u, h, f, l, d = Array(80), m = 1732584193, y = -271733879, v = -1732584194, g = 271733878, w = -1009589776; | |
| for (t[e >> 5] |= 128 << 24 - e % 32, | |
| t[(e + 64 >> 9 << 4) + 15] = e, | |
| n = 0; n < t.length; n += 16) { | |
| for (a = m, | |
| u = y, | |
| h = v, | |
| f = g, | |
| l = w, | |
| r = 0; r < 80; r += 1) | |
| r < 16 ? d[r] = t[n + r] : d[r] = o(d[r - 3] ^ d[r - 8] ^ d[r - 14] ^ d[r - 16], 1), | |
| s = i(i(o(m, 5), c(r, y, v, g)), i(i(w, d[r]), p(r))), | |
| w = g, | |
| g = v, | |
| v = o(y, 30), | |
| y = m, | |
| m = s; | |
| m = i(m, a), | |
| y = i(y, u), | |
| v = i(v, h), | |
| g = i(g, f), | |
| w = i(w, l) | |
| } | |
| return Array(m, y, v, g, w) | |
| } | |
| function c(t, e, n, r) { | |
| return t < 20 ? e & n | ~e & r : t < 40 ? e ^ n ^ r : t < 60 ? e & n | e & r | n & r : e ^ n ^ r | |
| } | |
| function p(t) { | |
| return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514 | |
| } | |
| var d = !(!t || "boolean" != typeof t.uppercase) && t.uppercase | |
| , m = t && "string" == typeof t.pad ? t.pad : "=" | |
| , y = !t || "boolean" != typeof t.utf8 || t.utf8; | |
| this.hex = function(t) { | |
| return s(e(t, y), d) | |
| } | |
| , | |
| this.b64 = function(t) { | |
| return l(e(t, y), m) | |
| } | |
| , | |
| this.any = function(t, n) { | |
| return f(e(t, y), n) | |
| } | |
| , | |
| this.raw = function(t) { | |
| return e(t, y) | |
| } | |
| , | |
| this.hex_hmac = function(t, e) { | |
| return s(r(t, e)) | |
| } | |
| , | |
| this.b64_hmac = function(t, e) { | |
| return l(r(t, e), m) | |
| } | |
| , | |
| this.any_hmac = function(t, e, n) { | |
| return f(r(t, e), n) | |
| } | |
| , | |
| this.vm_test = function() { | |
| return "900150983cd24fb0d6963f7d28e17f72" === hex("abc").toLowerCase() | |
| } | |
| , | |
| this.setUpperCase = function(t) { | |
| return "boolean" == typeof t && (d = t), | |
| this | |
| } | |
| , | |
| this.setPad = function(t) { | |
| return m = t || m, | |
| this | |
| } | |
| , | |
| this.setUTF8 = function(t) { | |
| return "boolean" == typeof t && (y = t), | |
| this | |
| } | |
| }, | |
| SHA256: function(t) { | |
| function e(t, e) { | |
| return t = e ? n(t) : t, | |
| a(g(h(t), 8 * t.length)) | |
| } | |
| function r(t, e) { | |
| t = C ? n(t) : t, | |
| e = C ? n(e) : e; | |
| var r, i = 0, o = h(t), s = Array(16), u = Array(16); | |
| for (o.length > 16 && (o = g(o, 8 * t.length)); i < 16; i += 1) | |
| s[i] = 909522486 ^ o[i], | |
| u[i] = 1549556828 ^ o[i]; | |
| return r = g(s.concat(h(e)), 512 + 8 * e.length), | |
| a(g(u.concat(r), 768)) | |
| } | |
| function o(t, e) { | |
| return t >>> e | t << 32 - e | |
| } | |
| function u(t, e) { | |
| return t >>> e | |
| } | |
| function c(t, e, n) { | |
| return t & e ^ ~t & n | |
| } | |
| function p(t, e, n) { | |
| return t & e ^ t & n ^ e & n | |
| } | |
| function d(t) { | |
| return o(t, 2) ^ o(t, 13) ^ o(t, 22) | |
| } | |
| function m(t) { | |
| return o(t, 6) ^ o(t, 11) ^ o(t, 25) | |
| } | |
| function y(t) { | |
| return o(t, 7) ^ o(t, 18) ^ u(t, 3) | |
| } | |
| function v(t) { | |
| return o(t, 17) ^ o(t, 19) ^ u(t, 10) | |
| } | |
| function g(t, e) { | |
| var n, r, o, s, a, u, h, f, l, g, A, D, C = [1779033703, -1150833019, 1013904242, -1521486534, 1359893119, -1694144372, 528734635, 1541459225], E = new Array(64); | |
| for (t[e >> 5] |= 128 << 24 - e % 32, | |
| t[(e + 64 >> 9 << 4) + 15] = e, | |
| l = 0; l < t.length; l += 16) { | |
| for (n = C[0], | |
| r = C[1], | |
| o = C[2], | |
| s = C[3], | |
| a = C[4], | |
| u = C[5], | |
| h = C[6], | |
| f = C[7], | |
| g = 0; g < 64; g += 1) | |
| g < 16 ? E[g] = t[g + l] : E[g] = i(i(i(v(E[g - 2]), E[g - 7]), y(E[g - 15])), E[g - 16]), | |
| A = i(i(i(i(f, m(a)), c(a, u, h)), w[g]), E[g]), | |
| D = i(d(n), p(n, r, o)), | |
| f = h, | |
| h = u, | |
| u = a, | |
| a = i(s, A), | |
| s = o, | |
| o = r, | |
| r = n, | |
| n = i(A, D); | |
| C[0] = i(n, C[0]), | |
| C[1] = i(r, C[1]), | |
| C[2] = i(o, C[2]), | |
| C[3] = i(s, C[3]), | |
| C[4] = i(a, C[4]), | |
| C[5] = i(u, C[5]), | |
| C[6] = i(h, C[6]), | |
| C[7] = i(f, C[7]) | |
| } | |
| return C | |
| } | |
| var w, A = !(!t || "boolean" != typeof t.uppercase) && t.uppercase, D = t && "string" == typeof t.pad ? t.pad : "=", C = !t || "boolean" != typeof t.utf8 || t.utf8; | |
| this.hex = function(t) { | |
| return s(e(t, C)) | |
| } | |
| , | |
| this.b64 = function(t) { | |
| return l(e(t, C), D) | |
| } | |
| , | |
| this.any = function(t, n) { | |
| return f(e(t, C), n) | |
| } | |
| , | |
| this.raw = function(t) { | |
| return e(t, C) | |
| } | |
| , | |
| this.hex_hmac = function(t, e) { | |
| return s(r(t, e)) | |
| } | |
| , | |
| this.b64_hmac = function(t, e) { | |
| return l(r(t, e), D) | |
| } | |
| , | |
| this.any_hmac = function(t, e, n) { | |
| return f(r(t, e), n) | |
| } | |
| , | |
| this.vm_test = function() { | |
| return "900150983cd24fb0d6963f7d28e17f72" === hex("abc").toLowerCase() | |
| } | |
| , | |
| this.setUpperCase = function(t) { | |
| return "boolean" == typeof t && (A = t), | |
| this | |
| } | |
| , | |
| this.setPad = function(t) { | |
| return D = t || D, | |
| this | |
| } | |
| , | |
| this.setUTF8 = function(t) { | |
| return "boolean" == typeof t && (C = t), | |
| this | |
| } | |
| , | |
| w = [1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998] | |
| }, | |
| SHA512: function(t) { | |
| function e(t) { | |
| return t = D ? n(t) : t, | |
| a(i(h(t), 8 * t.length)) | |
| } | |
| function r(t, e) { | |
| t = D ? n(t) : t, | |
| e = D ? n(e) : e; | |
| var r, o = 0, s = h(t), u = Array(32), c = Array(32); | |
| for (s.length > 32 && (s = i(s, 8 * t.length)); o < 32; o += 1) | |
| u[o] = 909522486 ^ s[o], | |
| c[o] = 1549556828 ^ s[o]; | |
| return r = i(u.concat(h(e)), 1024 + 8 * e.length), | |
| a(i(c.concat(r), 1536)) | |
| } | |
| function i(t, e) { | |
| var n, r, i, s = new Array(80), a = new Array(16), h = [new o(1779033703,-205731576), new o(-1150833019,-2067093701), new o(1013904242,-23791573), new o(-1521486534,1595750129), new o(1359893119,-1377402159), new o(-1694144372,725511199), new o(528734635,-79577749), new o(1541459225,327033209)], f = new o(0,0), l = new o(0,0), w = new o(0,0), A = new o(0,0), D = new o(0,0), C = new o(0,0), E = new o(0,0), B = new o(0,0), F = new o(0,0), b = new o(0,0), P = new o(0,0), k = new o(0,0), _ = new o(0,0), x = new o(0,0), T = new o(0,0), U = new o(0,0), N = new o(0,0); | |
| for (void 0 === g && (g = [new o(1116352408,-685199838), new o(1899447441,602891725), new o(-1245643825,-330482897), new o(-373957723,-2121671748), new o(961987163,-213338824), new o(1508970993,-1241133031), new o(-1841331548,-1357295717), new o(-1424204075,-630357736), new o(-670586216,-1560083902), new o(310598401,1164996542), new o(607225278,1323610764), new o(1426881987,-704662302), new o(1925078388,-226784913), new o(-2132889090,991336113), new o(-1680079193,633803317), new o(-1046744716,-815192428), new o(-459576895,-1628353838), new o(-272742522,944711139), new o(264347078,-1953704523), new o(604807628,2007800933), new o(770255983,1495990901), new o(1249150122,1856431235), new o(1555081692,-1119749164), new o(1996064986,-2096016459), new o(-1740746414,-295247957), new o(-1473132947,766784016), new o(-1341970488,-1728372417), new o(-1084653625,-1091629340), new o(-958395405,1034457026), new o(-710438585,-1828018395), new o(113926993,-536640913), new o(338241895,168717936), new o(666307205,1188179964), new o(773529912,1546045734), new o(1294757372,1522805485), new o(1396182291,-1651133473), new o(1695183700,-1951439906), new o(1986661051,1014477480), new o(-2117940946,1206759142), new o(-1838011259,344077627), new o(-1564481375,1290863460), new o(-1474664885,-1136513023), new o(-1035236496,-789014639), new o(-949202525,106217008), new o(-778901479,-688958952), new o(-694614492,1432725776), new o(-200395387,1467031594), new o(275423344,851169720), new o(430227734,-1194143544), new o(506948616,1363258195), new o(659060556,-544281703), new o(883997877,-509917016), new o(958139571,-976659869), new o(1322822218,-482243893), new o(1537002063,2003034995), new o(1747873779,-692930397), new o(1955562222,1575990012), new o(2024104815,1125592928), new o(-2067236844,-1578062990), new o(-1933114872,442776044), new o(-1866530822,593698344), new o(-1538233109,-561857047), new o(-1090935817,-1295615723), new o(-965641998,-479046869), new o(-903397682,-366583396), new o(-779700025,566280711), new o(-354779690,-840897762), new o(-176337025,-294727304), new o(116418474,1914138554), new o(174292421,-1563912026), new o(289380356,-1090974290), new o(460393269,320620315), new o(685471733,587496836), new o(852142971,1086792851), new o(1017036298,365543100), new o(1126000580,-1676669620), new o(1288033470,-885112138), new o(1501505948,-60457430), new o(1607167915,987167468), new o(1816402316,1246189591)]), | |
| r = 0; r < 80; r += 1) | |
| s[r] = new o(0,0); | |
| for (t[e >> 5] |= 128 << 24 - (31 & e), | |
| t[(e + 128 >> 10 << 5) + 31] = e, | |
| i = t.length, | |
| r = 0; r < i; r += 32) { | |
| for (u(w, h[0]), | |
| u(A, h[1]), | |
| u(D, h[2]), | |
| u(C, h[3]), | |
| u(E, h[4]), | |
| u(B, h[5]), | |
| u(F, h[6]), | |
| u(b, h[7]), | |
| n = 0; n < 16; n += 1) | |
| s[n].h = t[r + 2 * n], | |
| s[n].l = t[r + 2 * n + 1]; | |
| for (n = 16; n < 80; n += 1) | |
| c(T, s[n - 2], 19), | |
| p(U, s[n - 2], 29), | |
| d(N, s[n - 2], 6), | |
| k.l = T.l ^ U.l ^ N.l, | |
| k.h = T.h ^ U.h ^ N.h, | |
| c(T, s[n - 15], 1), | |
| c(U, s[n - 15], 8), | |
| d(N, s[n - 15], 7), | |
| P.l = T.l ^ U.l ^ N.l, | |
| P.h = T.h ^ U.h ^ N.h, | |
| y(s[n], k, s[n - 7], P, s[n - 16]); | |
| for (n = 0; n < 80; n += 1) | |
| _.l = E.l & B.l ^ ~E.l & F.l, | |
| _.h = E.h & B.h ^ ~E.h & F.h, | |
| c(T, E, 14), | |
| c(U, E, 18), | |
| p(N, E, 9), | |
| k.l = T.l ^ U.l ^ N.l, | |
| k.h = T.h ^ U.h ^ N.h, | |
| c(T, w, 28), | |
| p(U, w, 2), | |
| p(N, w, 7), | |
| P.l = T.l ^ U.l ^ N.l, | |
| P.h = T.h ^ U.h ^ N.h, | |
| x.l = w.l & A.l ^ w.l & D.l ^ A.l & D.l, | |
| x.h = w.h & A.h ^ w.h & D.h ^ A.h & D.h, | |
| v(f, b, k, _, g[n], s[n]), | |
| m(l, P, x), | |
| u(b, F), | |
| u(F, B), | |
| u(B, E), | |
| m(E, C, f), | |
| u(C, D), | |
| u(D, A), | |
| u(A, w), | |
| m(w, f, l); | |
| m(h[0], h[0], w), | |
| m(h[1], h[1], A), | |
| m(h[2], h[2], D), | |
| m(h[3], h[3], C), | |
| m(h[4], h[4], E), | |
| m(h[5], h[5], B), | |
| m(h[6], h[6], F), | |
| m(h[7], h[7], b) | |
| } | |
| for (r = 0; r < 8; r += 1) | |
| a[2 * r] = h[r].h, | |
| a[2 * r + 1] = h[r].l; | |
| return a | |
| } | |
| function o(t, e) { | |
| this.h = t, | |
| this.l = e | |
| } | |
| function u(t, e) { | |
| t.h = e.h, | |
| t.l = e.l | |
| } | |
| function c(t, e, n) { | |
| t.l = e.l >>> n | e.h << 32 - n, | |
| t.h = e.h >>> n | e.l << 32 - n | |
| } | |
| function p(t, e, n) { | |
| t.l = e.h >>> n | e.l << 32 - n, | |
| t.h = e.l >>> n | e.h << 32 - n | |
| } | |
| function d(t, e, n) { | |
| t.l = e.l >>> n | e.h << 32 - n, | |
| t.h = e.h >>> n | |
| } | |
| function m(t, e, n) { | |
| var r = (65535 & e.l) + (65535 & n.l) | |
| , i = (e.l >>> 16) + (n.l >>> 16) + (r >>> 16) | |
| , o = (65535 & e.h) + (65535 & n.h) + (i >>> 16) | |
| , s = (e.h >>> 16) + (n.h >>> 16) + (o >>> 16); | |
| t.l = 65535 & r | i << 16, | |
| t.h = 65535 & o | s << 16 | |
| } | |
| function y(t, e, n, r, i) { | |
| var o = (65535 & e.l) + (65535 & n.l) + (65535 & r.l) + (65535 & i.l) | |
| , s = (e.l >>> 16) + (n.l >>> 16) + (r.l >>> 16) + (i.l >>> 16) + (o >>> 16) | |
| , a = (65535 & e.h) + (65535 & n.h) + (65535 & r.h) + (65535 & i.h) + (s >>> 16) | |
| , u = (e.h >>> 16) + (n.h >>> 16) + (r.h >>> 16) + (i.h >>> 16) + (a >>> 16); | |
| t.l = 65535 & o | s << 16, | |
| t.h = 65535 & a | u << 16 | |
| } | |
| function v(t, e, n, r, i, o) { | |
| var s = (65535 & e.l) + (65535 & n.l) + (65535 & r.l) + (65535 & i.l) + (65535 & o.l) | |
| , a = (e.l >>> 16) + (n.l >>> 16) + (r.l >>> 16) + (i.l >>> 16) + (o.l >>> 16) + (s >>> 16) | |
| , u = (65535 & e.h) + (65535 & n.h) + (65535 & r.h) + (65535 & i.h) + (65535 & o.h) + (a >>> 16) | |
| , c = (e.h >>> 16) + (n.h >>> 16) + (r.h >>> 16) + (i.h >>> 16) + (o.h >>> 16) + (u >>> 16); | |
| t.l = 65535 & s | a << 16, | |
| t.h = 65535 & u | c << 16 | |
| } | |
| var g, w = !(!t || "boolean" != typeof t.uppercase) && t.uppercase, A = t && "string" == typeof t.pad ? t.pad : "=", D = !t || "boolean" != typeof t.utf8 || t.utf8; | |
| this.hex = function(t) { | |
| return s(e(t)) | |
| } | |
| , | |
| this.b64 = function(t) { | |
| return l(e(t), A) | |
| } | |
| , | |
| this.any = function(t, n) { | |
| return f(e(t), n) | |
| } | |
| , | |
| this.raw = function(t) { | |
| return e(t, D) | |
| } | |
| , | |
| this.hex_hmac = function(t, e) { | |
| return s(r(t, e)) | |
| } | |
| , | |
| this.b64_hmac = function(t, e) { | |
| return l(r(t, e), A) | |
| } | |
| , | |
| this.any_hmac = function(t, e, n) { | |
| return f(r(t, e), n) | |
| } | |
| , | |
| this.vm_test = function() { | |
| return "900150983cd24fb0d6963f7d28e17f72" === hex("abc").toLowerCase() | |
| } | |
| , | |
| this.setUpperCase = function(t) { | |
| return "boolean" == typeof t && (w = t), | |
| this | |
| } | |
| , | |
| this.setPad = function(t) { | |
| return A = t || A, | |
| this | |
| } | |
| , | |
| this.setUTF8 = function(t) { | |
| return "boolean" == typeof t && (D = t), | |
| this | |
| } | |
| }, | |
| RMD160: function(t) { | |
| function e(t) { | |
| return t = v ? n(t) : t, | |
| a(u(c(t), 8 * t.length)) | |
| } | |
| function r(t, e) { | |
| t = v ? n(t) : t, | |
| e = v ? n(e) : e; | |
| var r, i, o = c(t), s = Array(16), h = Array(16); | |
| for (o.length > 16 && (o = u(o, 8 * t.length)), | |
| r = 0; r < 16; r += 1) | |
| s[r] = 909522486 ^ o[r], | |
| h[r] = 1549556828 ^ o[r]; | |
| return i = u(s.concat(c(e)), 512 + 8 * e.length), | |
| a(u(h.concat(i), 672)) | |
| } | |
| function a(t) { | |
| var e, n = "", r = 32 * t.length; | |
| for (e = 0; e < r; e += 8) | |
| n += String.fromCharCode(t[e >> 5] >>> e % 32 & 255); | |
| return n | |
| } | |
| function u(t, e) { | |
| var n, r, s, a, u, c, f, l, m, y, v, C, E, B, F = 1732584193, b = 4023233417, P = 2562383102, k = 271733878, _ = 3285377520; | |
| for (t[e >> 5] |= 128 << e % 32, | |
| t[(e + 64 >>> 9 << 4) + 14] = e, | |
| a = t.length, | |
| s = 0; s < a; s += 16) { | |
| for (u = y = F, | |
| c = v = b, | |
| f = C = P, | |
| l = E = k, | |
| m = B = _, | |
| r = 0; r <= 79; r += 1) | |
| n = i(u, h(r, c, f, l)), | |
| n = i(n, t[s + g[r]]), | |
| n = i(n, p(r)), | |
| n = i(o(n, A[r]), m), | |
| u = m, | |
| m = l, | |
| l = o(f, 10), | |
| f = c, | |
| c = n, | |
| n = i(y, h(79 - r, v, C, E)), | |
| n = i(n, t[s + w[r]]), | |
| n = i(n, d(r)), | |
| n = i(o(n, D[r]), B), | |
| y = B, | |
| B = E, | |
| E = o(C, 10), | |
| C = v, | |
| v = n; | |
| n = i(b, i(f, E)), | |
| b = i(P, i(l, B)), | |
| P = i(k, i(m, y)), | |
| k = i(_, i(u, v)), | |
| _ = i(F, i(c, C)), | |
| F = n | |
| } | |
| return [F, b, P, k, _] | |
| } | |
| function h(t, e, n, r) { | |
| return 0 <= t && t <= 15 ? e ^ n ^ r : 16 <= t && t <= 31 ? e & n | ~e & r : 32 <= t && t <= 47 ? (e | ~n) ^ r : 48 <= t && t <= 63 ? e & r | n & ~r : 64 <= t && t <= 79 ? e ^ (n | ~r) : "rmd160_f: j out of range" | |
| } | |
| function p(t) { | |
| return 0 <= t && t <= 15 ? 0 : 16 <= t && t <= 31 ? 1518500249 : 32 <= t && t <= 47 ? 1859775393 : 48 <= t && t <= 63 ? 2400959708 : 64 <= t && t <= 79 ? 2840853838 : "rmd160_K1: j out of range" | |
| } | |
| function d(t) { | |
| return 0 <= t && t <= 15 ? 1352829926 : 16 <= t && t <= 31 ? 1548603684 : 32 <= t && t <= 47 ? 1836072691 : 48 <= t && t <= 63 ? 2053994217 : 64 <= t && t <= 79 ? 0 : "rmd160_K2: j out of range" | |
| } | |
| var m = !(!t || "boolean" != typeof t.uppercase) && t.uppercase | |
| , y = t && "string" == typeof t.pad ? t.pa : "=" | |
| , v = !t || "boolean" != typeof t.utf8 || t.utf8 | |
| , g = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13] | |
| , w = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11] | |
| , A = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6] | |
| , D = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]; | |
| this.hex = function(t) { | |
| return s(e(t, v)) | |
| } | |
| , | |
| this.b64 = function(t) { | |
| return l(e(t, v), y) | |
| } | |
| , | |
| this.any = function(t, n) { | |
| return f(e(t, v), n) | |
| } | |
| , | |
| this.raw = function(t) { | |
| return e(t, v) | |
| } | |
| , | |
| this.hex_hmac = function(t, e) { | |
| return s(r(t, e)) | |
| } | |
| , | |
| this.b64_hmac = function(t, e) { | |
| return l(r(t, e), y) | |
| } | |
| , | |
| this.any_hmac = function(t, e, n) { | |
| return f(r(t, e), n) | |
| } | |
| , | |
| this.vm_test = function() { | |
| return "900150983cd24fb0d6963f7d28e17f72" === hex("abc").toLowerCase() | |
| } | |
| , | |
| this.setUpperCase = function(t) { | |
| return "boolean" == typeof t && (m = t), | |
| this | |
| } | |
| , | |
| this.setPad = function(t) { | |
| return "undefined" != typeof t && (y = t), | |
| this | |
| } | |
| , | |
| this.setUTF8 = function(t) { | |
| return "boolean" == typeof t && (v = t), | |
| this | |
| } | |
| } | |
| }, | |
| function(n, r) { | |
| var i = !1; | |
| "object" == typeof e && (i = e, | |
| e && "object" == typeof T && T && T === T.global && (n = T)), | |
| "function" == typeof define && "object" == typeof define.amd && define.amd ? define(function() { | |
| return p | |
| }) : i ? "object" == typeof t && t && t.exports === i ? t.exports = p : i.Hashes = p : n.Hashes = p | |
| }(this) | |
| }() | |
| }), N = U.SHA1, S = 0; | |
| !function(t) { | |
| t[t.STARTUP = 0] = "STARTUP", | |
| t[t.READY = 1] = "READY", | |
| t[t.UPDATE_PENDING = 2] = "UPDATE_PENDING", | |
| t[t.INSTALLING = 3] = "INSTALLING", | |
| t[t.LAME = 4] = "LAME" | |
| }(P || (P = {})); | |
| var M = function() { | |
| function t(t, e, n, r, i, o, s, a) { | |
| var u = this; | |
| this.manifestUrl = t, | |
| this.plugins = e, | |
| this.scope = n, | |
| this.adapter = r, | |
| this.cache = i, | |
| this.events = o, | |
| this.fetcher = s, | |
| this.clock = a, | |
| this.state = P.STARTUP, | |
| this.pendingUpdateHash = null, | |
| this.streamId = 0, | |
| this.streams = {}, | |
| this.lifecycleLog = [], | |
| this.updateListeners = [], | |
| this.id = S++, | |
| this.ready = new Promise(function(t) { | |
| return u.readyResolve = t | |
| } | |
| ), | |
| this.updatePending = new Promise(function(t) { | |
| return u.updatePendingResolve = t | |
| } | |
| ), | |
| this.scopedCache = new b(this.cache,"ngsw:"), | |
| o.install = function(t) { | |
| u.lifecycle("install event"), | |
| t.waitUntil(Promise.resolve().then(function() { | |
| return u.reset() | |
| }).then(function() { | |
| return u.scope.skipWaiting() | |
| })) | |
| } | |
| , | |
| o.activate = function(t) { | |
| u.lifecycle("activate event"), | |
| u.init || u.startup(), | |
| t.waitUntil(u.scope.clients.claim()) | |
| } | |
| , | |
| o.fetch = function(t) { | |
| var e = t.request; | |
| if (e.url.endsWith("/ngsw.log")) | |
| return void t.respondWith(u.status().then(function(t) { | |
| return u.adapter.newResponse(JSON.stringify(t, null, 2)) | |
| })); | |
| if (u.state !== P.LAME) { | |
| if (u.state !== P.STARTUP || u.init || u.startup(), | |
| !u.init) | |
| throw new Error("init Promise not present in state " + P[u.state]); | |
| t.respondWith(u.init.then(function() { | |
| switch (u.state) { | |
| case P.READY: | |
| return u.active.fetch(e); | |
| case P.UPDATE_PENDING: | |
| return u.maybeUpdate(t.clientId).then(function() { | |
| return u.active.fetch(e) | |
| }); | |
| case P.INSTALLING: | |
| case P.LAME: | |
| return u.fetcher.request(e, !0); | |
| default: | |
| return u.fetcher.request(e, !0) | |
| } | |
| })) | |
| } | |
| } | |
| , | |
| o.message = function(t) { | |
| if (u.state !== P.LAME) { | |
| if (u.state !== P.STARTUP || u.init || u.startup(), | |
| !u.init) | |
| throw new Error("init Promise not present in state " + P[u.state]); | |
| 1 === t.ports.length && t.data && t.data.hasOwnProperty("$ngsw") && u.init.then(function() { | |
| if (u.state === P.READY || u.state === P.UPDATE_PENDING) { | |
| var e = t.ports[0] | |
| , n = u.streamId++; | |
| u.streams[n] = e, | |
| e.postMessage({ | |
| $ngsw: !0, | |
| id: n | |
| }), | |
| u.handleMessage(t.data, n) | |
| } | |
| }) | |
| } | |
| } | |
| , | |
| o.push = function(t) { | |
| if (u.state !== P.LAME) { | |
| if (u.state !== P.STARTUP || u.init || u.startup(), | |
| !u.init) | |
| throw new Error("init Promise not present in state " + P[u.state]); | |
| Promise.all([u.init, t.data.text()]).then(function(t) { | |
| return t[1] | |
| }).then(function(t) { | |
| u.state !== P.READY && u.state !== P.UPDATE_PENDING || u.active.push(t) | |
| }) | |
| } | |
| } | |
| } | |
| return t.prototype.lifecycle = function(t) { | |
| this.lifecycleLog.push(t) | |
| } | |
| , | |
| t.prototype.reset = function() { | |
| var t = this; | |
| return this.scopedCache.keys().then(function(e) { | |
| return Promise.all(e.map(function(e) { | |
| return t.scopedCache.remove(e) | |
| })).then(function() { | |
| return t.lifecycle("reset removed " + e.length + " ngsw: caches") | |
| }) | |
| }) | |
| } | |
| , | |
| t.prototype.startup = function() { | |
| var t = this; | |
| this.init = this.initialize(), | |
| this.init.then(function() { | |
| return t.checkForUpdate() | |
| }) | |
| } | |
| , | |
| t.prototype.maybeUpdate = function(t) { | |
| var e = this; | |
| return this.scope.clients.matchAll().then(function(t) { | |
| return 0 !== t.length ? null : e.doUpdate() | |
| }) | |
| } | |
| , | |
| t.prototype.doUpdate = function(t) { | |
| var e = this; | |
| return this.fetchManifestFromCache("staged").then(function(n) { | |
| return n ? (!t || n._hash === t) && e.openManifest(n).then(function(t) { | |
| return e.clearStaged().then(function() { | |
| return t ? e.setManifest(n, "active") : null | |
| }).then(function() { | |
| if (t) { | |
| var r = e.active; | |
| e.active = t, | |
| e.cleanup(r).then(function() { | |
| return e.lifecycle("cleaned up old version " + r.manifest._hash) | |
| }), | |
| e.updateListeners.forEach(function(t) { | |
| e.sendToStream(t, { | |
| type: "activation", | |
| version: n._hash | |
| }) | |
| }), | |
| e.lifecycle("updated to manifest " + n._hash) | |
| } | |
| return e.transition(P.READY), | |
| !0 | |
| }) | |
| }) : (e.transition(P.READY), | |
| !1) | |
| }) | |
| } | |
| , | |
| t.prototype.clearActive = function() { | |
| return this.state === P.READY || this.state === P.UPDATE_PENDING ? Promise.reject("Cannot clear the active manifest when it's being used.") : this.scopedCache.invalidate("active", this.manifestUrl) | |
| } | |
| , | |
| t.prototype.clearStaged = function() { | |
| return this.scopedCache.invalidate("staged", this.manifestUrl) | |
| } | |
| , | |
| t.prototype.checkForUpdate = function() { | |
| var t = this; | |
| return this.state !== P.READY && this.state !== P.UPDATE_PENDING ? (this.lifecycle("skipping update check, in state " + P[this.state]), | |
| Promise.resolve(!1)) : this.state === P.UPDATE_PENDING ? Promise.resolve(!0) : Promise.all([this.fetchManifestFromCache("active"), this.fetchManifestFromCache("staged"), this.fetchManifestFromNetwork()]).then(function(e) { | |
| var n = e[0] | |
| , r = e[1] | |
| , i = e[2]; | |
| if (!i) | |
| return !!r && (t.pendingUpdateHash = r._hash, | |
| t.transition(P.UPDATE_PENDING), | |
| !0); | |
| if (n && n._hash === i._hash) | |
| return !1; | |
| if (r && r._hash === i._hash) | |
| return t.lifecycle("network manifest " + i._hash + " is already staged"), | |
| t.pendingUpdateHash = r._hash, | |
| t.transition(P.UPDATE_PENDING), | |
| !0; | |
| var o = Promise.resolve(); | |
| return r && (t.lifecycle("staged manifest " + r._hash + " is old, removing"), | |
| o = t.clearStaged()), | |
| o.then(function() { | |
| return t.setupManifest(i, t.active) | |
| }).then(function() { | |
| return t.setManifest(i, "staged") | |
| }).then(function() { | |
| return t.pendingUpdateHash = i._hash, | |
| t.transition(P.UPDATE_PENDING), | |
| t.lifecycle("staged update to " + i._hash), | |
| !0 | |
| }) | |
| }) | |
| } | |
| , | |
| t.prototype.initialize = function() { | |
| var t = this; | |
| if (this.init) | |
| throw new Error("double initialization!"); | |
| return this.state !== P.STARTUP ? Promise.reject(new Error("driver: initialize() called when not in STARTUP state")) : Promise.all([this.fetchManifestFromCache("active"), this.fetchManifestFromCache("staged")]).then(function(e) { | |
| var n = e[0] | |
| , r = e[1]; | |
| return n ? t.openManifest(n).then(function(e) { | |
| return e ? (t.lifecycle("manifest " + n._hash + " activated"), | |
| t.active = e, | |
| r ? r._hash === n._hash ? (t.lifecycle("staged manifest " + r._hash + " is already active, cleaning it up"), | |
| t.transition(P.READY), | |
| t.clearStaged()) : (t.lifecycle("staged manifest " + r._hash + " present at initialization"), | |
| t.pendingUpdateHash = r._hash, | |
| t.transition(P.UPDATE_PENDING), | |
| null) : void t.transition(P.READY)) : (t.transition(P.LAME), | |
| t.clearActive()) | |
| }) : (t.transition(P.INSTALLING), | |
| t.doInstallFromNetwork(), | |
| null) | |
| }) | |
| } | |
| , | |
| t.prototype.doInstallFromNetwork = function() { | |
| var t = this; | |
| return this.fetchManifestFromNetwork().then(function(e) { | |
| return e ? t.setupManifest(e, null).then(function(n) { | |
| return n ? void t.setManifest(e, "active").then(function() { | |
| t.active = n, | |
| t.lifecycle("installed version " + e._hash + " from network"), | |
| t.transition(P.READY) | |
| }) : (t.lifecycle("network manifest setup failed"), | |
| t.transition(P.LAME), | |
| null) | |
| }) : (t.lifecycle("no network manifest found to install from"), | |
| t.transition(P.LAME), | |
| null) | |
| }) | |
| } | |
| , | |
| t.prototype.fetchManifestFromCache = function(t) { | |
| var e = this; | |
| return this.scopedCache.load(t, this.manifestUrl).then(function(t) { | |
| return e.manifestFromResponse(t) | |
| }) | |
| } | |
| , | |
| t.prototype.fetchManifestFromNetwork = function() { | |
| var t = this; | |
| return this.fetcher.refresh(this.manifestUrl).then(function(e) { | |
| return t.manifestFromResponse(e) | |
| }).catch(function() { | |
| return null | |
| }) | |
| } | |
| , | |
| t.prototype.manifestFromResponse = function(t) { | |
| return t && 200 === t.status ? t.text().then(function(t) { | |
| return c(t) | |
| }) : null | |
| } | |
| , | |
| t.prototype.setManifest = function(t, e) { | |
| return this.scopedCache.store(e, this.manifestUrl, this.adapter.newResponse(t._json)) | |
| } | |
| , | |
| t.prototype.workerFromManifest = function(t) { | |
| var e = [] | |
| , n = new F(this,this.scope,t,this.adapter,new b(this.scopedCache,"manifest:" + t._hash + ":"),this.clock,this.fetcher,e); | |
| return e.push.apply(e, this.plugins.map(function(t) { | |
| return t(n) | |
| })), | |
| n | |
| } | |
| , | |
| t.prototype.setupManifest = function(t, e) { | |
| void 0 === e && (e = null); | |
| var n = this.workerFromManifest(t); | |
| return n.setup(e).then(function() { | |
| return n | |
| }) | |
| } | |
| , | |
| t.prototype.openManifest = function(t) { | |
| var e = this | |
| , n = this.workerFromManifest(t); | |
| return n.validate().then(function(r) { | |
| return r ? n : (e.lifecycle("cached version " + t._hash + " not valid"), | |
| e.cleanup(n).then(function() { | |
| return null | |
| })) | |
| }) | |
| } | |
| , | |
| t.prototype.cleanup = function(t) { | |
| return t.cleanup().reduce(function(t, e) { | |
| return t.then(function(t) { | |
| return e() | |
| }) | |
| }, Promise.resolve(null)) | |
| } | |
| , | |
| t.prototype.status = function() { | |
| return Promise.resolve({ | |
| state: P[this.state], | |
| lifecycleLog: this.lifecycleLog | |
| }) | |
| } | |
| , | |
| t.prototype.transition = function(t) { | |
| var e = this; | |
| if (this.lifecycle("transition from " + P[this.state] + " to " + P[t]), | |
| this.state = t, | |
| t === P.READY && null !== this.readyResolve) { | |
| var n = this.readyResolve; | |
| this.readyResolve = null, | |
| n() | |
| } | |
| if (t === P.UPDATE_PENDING && null !== this.updatePendingResolve) { | |
| this.ready = new Promise(function(t) { | |
| return e.readyResolve = t | |
| } | |
| ); | |
| var n = this.updatePendingResolve; | |
| this.updatePendingResolve = null, | |
| n() | |
| } | |
| t === P.UPDATE_PENDING && null !== this.pendingUpdateHash ? this.updateListeners.forEach(function(t) { | |
| return e.sendToStream(t, { | |
| type: "pending", | |
| version: e.pendingUpdateHash | |
| }) | |
| }) : t !== P.UPDATE_PENDING && (this.pendingUpdateHash = null) | |
| } | |
| , | |
| t.prototype.handleMessage = function(t, e) { | |
| var n = this; | |
| if (this.state !== P.READY && this.state !== P.UPDATE_PENDING) | |
| return void this.lifecycle("can't handle message in state " + P[this.state]); | |
| switch (t.cmd) { | |
| case "ping": | |
| this.lifecycle("responding to ping on " + e), | |
| this.closeStream(e); | |
| break; | |
| case "update": | |
| this.updateListeners.push(e), | |
| this.state === P.UPDATE_PENDING && null !== this.pendingUpdateHash && this.sendToStream(e, { | |
| type: "pending", | |
| version: this.pendingUpdateHash | |
| }); | |
| break; | |
| case "checkUpdate": | |
| this.checkForUpdate().then(function(t) { | |
| n.sendToStream(e, t), | |
| n.closeStream(e) | |
| }); | |
| break; | |
| case "activateUpdate": | |
| this.doUpdate(t.version || void 0).then(function(t) { | |
| n.sendToStream(e, t), | |
| n.closeStream(e) | |
| }); | |
| break; | |
| case "cancel": | |
| t.id; | |
| if (!this.streams.hasOwnProperty(e)) | |
| return; | |
| this.active.messageClosed(e), | |
| this.maybeRemoveUpdateListener(e), | |
| delete this.streams[e]; | |
| break; | |
| case "log": | |
| _.messages = function(t) { | |
| n.sendToStream(e, t) | |
| } | |
| ; | |
| break; | |
| default: | |
| this.active.message(t, e) | |
| } | |
| } | |
| , | |
| t.prototype.maybeRemoveUpdateListener = function(t) { | |
| var e = this.updateListeners.indexOf(t); | |
| e !== -1 && this.updateListeners.splice(e, 1) | |
| } | |
| , | |
| t.prototype.sendToStream = function(t, e) { | |
| this.streams.hasOwnProperty(t) && this.streams[t].postMessage(e) | |
| } | |
| , | |
| t.prototype.closeStream = function(t) { | |
| this.streams.hasOwnProperty(t) && (this.streams[t].postMessage(null), | |
| delete this.streams[t]) | |
| } | |
| , | |
| t | |
| }() | |
| , R = /^(https?:\/\/[^\/]+)(\/.*)?$/ | |
| , I = "undefined" != typeof self ? self : global | |
| , O = function() { | |
| function t() { | |
| this._scope = R.exec(I.registration.scope)[1] | |
| } | |
| return t.prototype.newRequest = function(t, e) { | |
| return e && e instanceof Request && (e = h(e)), | |
| new Request(t,e) | |
| } | |
| , | |
| t.prototype.newResponse = function(t, e) { | |
| return new Response(t,e) | |
| } | |
| , | |
| Object.defineProperty(t.prototype, "scope", { | |
| get: function() { | |
| return this._scope | |
| }, | |
| enumerable: !0, | |
| configurable: !0 | |
| }), | |
| t | |
| }() | |
| , L = function() { | |
| function t(t, e, n) { | |
| void 0 === e && (e = {}), | |
| this.pattern = t, | |
| this.scope = n, | |
| this.match = e.match || "exact", | |
| "regex" === this.match && (this._regex = new RegExp(t)) | |
| } | |
| return t.prototype.matches = function(t) { | |
| switch (t.startsWith(this.scope) && (t = t.substr(this.scope.length)), | |
| this.match) { | |
| case "exact": | |
| return this.pattern === t; | |
| case "prefix": | |
| return t.startsWith(this.pattern); | |
| case "regex": | |
| return this._regex.test(t) | |
| } | |
| } | |
| , | |
| t | |
| }() | |
| , j = function() { | |
| function t(t) { | |
| this.compare = t, | |
| this.head = null, | |
| this.tail = null, | |
| this.length = 0 | |
| } | |
| return t.prototype.insert = function(t) { | |
| if (this.length++, | |
| null === this.head) | |
| return void (this.head = this.tail = { | |
| value: t, | |
| next: null, | |
| prev: null | |
| }); | |
| for (var e = this.head; null !== e; ) { | |
| var n = this.compare(t, e.value); | |
| if (n <= 0) | |
| return void (null === e.prev ? this.head = this.head.prev = { | |
| value: t, | |
| next: this.head, | |
| prev: null | |
| } : e.prev = e.prev.next = { | |
| value: t, | |
| next: e, | |
| prev: e.prev | |
| }); | |
| e = e.next | |
| } | |
| this.tail = this.tail.next = { | |
| value: t, | |
| next: null, | |
| prev: this.tail | |
| } | |
| } | |
| , | |
| t.prototype.remove = function(t) { | |
| for (var e = this.head; null !== e; ) { | |
| if (e.value === t) | |
| return null !== e.prev ? e.prev.next = e.next : (this.head = e.next, | |
| null !== this.head && (this.head.prev = null)), | |
| null !== e.next ? e.next.prev = e.prev : (this.tail = e.prev, | |
| null !== this.tail && (this.tail.next = null)), | |
| void this.length--; | |
| e = e.next | |
| } | |
| } | |
| , | |
| t.prototype.pop = function() { | |
| if (null === this.head) | |
| return null; | |
| this.length--; | |
| var t = this.head.value; | |
| return this.head === this.tail ? (this.head = null, | |
| this.tail = null, | |
| t) : (this.head.next.prev = null, | |
| this.head = this.head.next, | |
| t) | |
| } | |
| , | |
| t | |
| }() | |
| , q = 100 | |
| , G = function() { | |
| function t(t, e, n, r, i, o, s) { | |
| var a = this; | |
| switch (this.strategy = t, | |
| this.config = e, | |
| this.adapter = n, | |
| this.cache = r, | |
| this.matchers = i, | |
| this.metadata = o, | |
| this.clock = s, | |
| e.cache.strategy) { | |
| case "fifo": | |
| this.queue = new j(this.fifoCompare.bind(this)); | |
| break; | |
| case "lfu": | |
| this.queue = new j(this.lfuCompare.bind(this)); | |
| break; | |
| case "lru": | |
| this.queue = new j(this.lruCompare.bind(this)); | |
| break; | |
| default: | |
| throw new Error("Unknown cache strategy: " + e.cache.strategy) | |
| } | |
| Object.keys(this.metadata).forEach(function(t) { | |
| return a.queue.insert(t) | |
| }) | |
| } | |
| return t.open = function(e, n, r, i, o) { | |
| var s = new b(r,"dynamic:" + e.name + ":") | |
| , a = o[e.cache.optimizeFor]; | |
| if (!a) | |
| throw new Error("No registered optimizeFor handler (" + e.cache.optimizeFor + ") for group " + e.name); | |
| var u = Object.keys(e.urls).map(function(t) { | |
| return new L(t,e.urls[t],n.scope) | |
| }); | |
| return s.keysOf("metadata").then(function(t) { | |
| return Promise.all(t.map(function(t) { | |
| return s.load("metadata", t).then(function(t) { | |
| return t.json() | |
| }).then(function(e) { | |
| return { | |
| url: t.url, | |
| metadata: e | |
| } | |
| }) | |
| })) | |
| }).then(function(t) { | |
| return t.reduce(function(t, e) { | |
| return t[e.url] = e.metadata, | |
| t | |
| }, {}) | |
| }).then(function(r) { | |
| return new t(a,e,n,s,u,r,i) | |
| }) | |
| } | |
| , | |
| t.prototype.matches = function(t) { | |
| return this.matchers.some(function(e) { | |
| return e.matches(t.url) | |
| }) | |
| } | |
| , | |
| t.prototype.fifoCompare = function(t, e) { | |
| var n = this.metadata[t] | |
| , r = this.metadata[e]; | |
| return p(n.addedTs, r.addedTs) | |
| } | |
| , | |
| t.prototype.lfuCompare = function(t, e) { | |
| var n = this.metadata[t] | |
| , r = this.metadata[e]; | |
| return p(n.accessCount, r.accessCount) | |
| } | |
| , | |
| t.prototype.lruCompare = function(t, e) { | |
| var n = this.metadata[t] | |
| , r = this.metadata[e]; | |
| return p(n.accessedTs, r.accessedTs) | |
| } | |
| , | |
| t.prototype.fetchFromCache = function(t) { | |
| var e = this | |
| , n = this.metadata[t.url]; | |
| if (!n) | |
| return Promise.resolve({ | |
| response: null | |
| }); | |
| var r = this.clock.dateNow() - n.addedTs; | |
| return this.config.cache.maxAgeMs && r > this.config.cache.maxAgeMs ? (this.queue.remove(t.url), | |
| delete this.metadata[t.url], | |
| Promise.all([this.cache.invalidate("cache", t.url), this.cache.invalidate("metadata", t.url)]).then(function() { | |
| return { | |
| response: null | |
| } | |
| })) : this.cache.load("cache", t.url).then(function(i) { | |
| if (!i) | |
| return { | |
| response: null | |
| }; | |
| var o = function() { | |
| return n.accessCount++, | |
| n.accessedTs = e.clock.dateNow(), | |
| e.cache.store("metadata", t.url, e.adapter.newResponse(JSON.stringify(n))).then(function() { | |
| e.queue.remove(t.url), | |
| e.queue.insert(t.url) | |
| }) | |
| }; | |
| return { | |
| response: i, | |
| cacheAge: r, | |
| sideEffect: o | |
| } | |
| }) | |
| } | |
| , | |
| t.prototype.fetchAndCache = function(t, e) { | |
| var n = this; | |
| return e().then(function(e) { | |
| if (!e.ok) | |
| return { | |
| response: e | |
| }; | |
| var r = e.clone() | |
| , i = function() { | |
| var e = n.metadata[t.url]; | |
| return e ? n.updateIntoCache(t.url, r) : n.insertIntoCache(t.url, r) | |
| }; | |
| return { | |
| response: e, | |
| sideEffect: i | |
| } | |
| }) | |
| } | |
| , | |
| t.prototype.fetch = function(t, e) { | |
| if ("GET" !== t.method && "OPTIONS" !== t.method && "HEAD" !== t.method) { | |
| e().then(function(t) { | |
| return { | |
| response: t | |
| } | |
| }) | |
| } | |
| return this.strategy.fetch(this, t, e) | |
| } | |
| , | |
| t.prototype.insertIntoCache = function(t, e) { | |
| var n = this; | |
| if (this.metadata[t]) | |
| return Promise.reject(new Error("insertIntoCache(" + t + ") but url is already cached")); | |
| var r = this.clock.dateNow() | |
| , i = { | |
| addedTs: r, | |
| accessCount: 1, | |
| accessedTs: r | |
| }; | |
| return Promise.resolve().then(function() { | |
| for (var t = Promise.resolve(), e = n.queue.length; e >= (n.config.cache.maxEntries || q); ) | |
| e--, | |
| t = t.then(function() { | |
| var t = n.queue.pop(); | |
| return delete n.metadata[t], | |
| Promise.all([n.cache.invalidate("cache", t), n.cache.invalidate("metadata", t)]) | |
| }); | |
| return t | |
| }).then(function() { | |
| return Promise.all([n.cache.store("cache", t, e), n.cache.store("metadata", t, n.adapter.newResponse(JSON.stringify(i)))]) | |
| }).then(function() { | |
| n.metadata[t] = i, | |
| n.queue.insert(t) | |
| }) | |
| } | |
| , | |
| t.prototype.updateIntoCache = function(t, e) { | |
| var n = this | |
| , r = this.metadata[t]; | |
| return r ? (r.accessCount++, | |
| r.addedTs = r.accessedTs = this.clock.dateNow(), | |
| Promise.all([this.cache.store("cache", t, e), this.cache.store("metadata", t, this.adapter.newResponse(JSON.stringify(r)))]).then(function() { | |
| n.queue.remove(t), | |
| n.queue.insert(t) | |
| })) : Promise.reject(new Error("updateIntoCache(" + t + ") but url is not cached")) | |
| } | |
| , | |
| t | |
| }() | |
| , H = function() { | |
| function t(t, e) { | |
| var n = this; | |
| this.worker = t, | |
| this.strategies = {}, | |
| this.manifest = t.manifest.dynamic, | |
| this.sideEffectQueue = Promise.resolve(), | |
| e.forEach(function(t) { | |
| return n.strategies[t.name] = t | |
| }) | |
| } | |
| return t.prototype.setup = function(t) { | |
| var e = this; | |
| this.manifest && t.push(function() { | |
| return e._setupGroups() | |
| }) | |
| } | |
| , | |
| t.prototype.fetch = function(t) { | |
| var e = this; | |
| if (!this.manifest) | |
| return null; | |
| var n = function(n) { | |
| var r = e.group.filter(function(e) { | |
| return e.matches(t) | |
| }); | |
| return 0 === r.length ? n() : e.sideEffectQueue.then(function() { | |
| return r[0].fetch(t, n) | |
| }).then(function(t) { | |
| if (t.sideEffect) { | |
| var n = t.sideEffect; | |
| e.sideEffectQueue = e.sideEffectQueue.then(function() { | |
| return n() | |
| }).catch(function() {}) | |
| } | |
| return t.response | |
| }) | |
| }; | |
| return n | |
| } | |
| , | |
| t.prototype.validate = function() { | |
| return this.manifest ? this._setupGroups().then(function() { | |
| return !0 | |
| }).catch(function() { | |
| return !1 | |
| }) : Promise.resolve(!0) | |
| } | |
| , | |
| t.prototype._setupGroups = function() { | |
| var t = this; | |
| return Promise.all(this.manifest.group.map(function(e) { | |
| return G.open(e, t.worker.adapter, t.worker.cache, t.worker.clock, t.strategies) | |
| })).then(function(e) { | |
| return t.group = e | |
| }) | |
| } | |
| , | |
| t | |
| }() | |
| , K = function() { | |
| function t() {} | |
| return Object.defineProperty(t.prototype, "name", { | |
| get: function() { | |
| return "freshness" | |
| }, | |
| enumerable: !0, | |
| configurable: !0 | |
| }), | |
| t.prototype.config = function(t) { | |
| return t.config.cache | |
| } | |
| , | |
| t.prototype.fetch = function(t, e, n) { | |
| var r = this.config(t) | |
| , i = t.fetchAndCache(e, n).catch(function() { | |
| return { | |
| response: null | |
| } | |
| }) | |
| , o = i; | |
| return r.networkTimeoutMs && (o = Promise.race([i, this.timeout(r.networkTimeoutMs, t.clock).then(function() { | |
| return { | |
| response: null | |
| } | |
| })])), | |
| o.then(function(n) { | |
| return null === n.response ? t.fetchFromCache(e).then(function(t) { | |
| var e = function() { | |
| return l(t.sideEffect).then(function() { | |
| return i | |
| }).then(function(t) { | |
| return l(t.sideEffect) | |
| }) | |
| }; | |
| return null !== t.response ? { | |
| response: t.response, | |
| cacheAge: t.cacheAge, | |
| sideEffect: e | |
| } : i | |
| }) : n | |
| }) | |
| } | |
| , | |
| t.prototype.timeout = function(t, e) { | |
| return new Promise(function(n) { | |
| return e.setTimeout(n, t) | |
| } | |
| ) | |
| } | |
| , | |
| t | |
| }() | |
| , z = function() { | |
| function t() {} | |
| return Object.defineProperty(t.prototype, "name", { | |
| get: function() { | |
| return "performance" | |
| }, | |
| enumerable: !0, | |
| configurable: !0 | |
| }), | |
| t.prototype.config = function(t) { | |
| return t.config.cache | |
| } | |
| , | |
| t.prototype.fetch = function(t, e, n) { | |
| var r = this.config(t); | |
| return t.fetchFromCache(e).then(function(i) { | |
| return null === i.response ? t.fetchAndCache(e, n) : i.cacheAge && void 0 !== r.refreshAheadMs && i.cacheAge >= r.refreshAheadMs ? { | |
| response: i.response, | |
| cacheAge: i.cacheAge, | |
| sideEffect: function() { | |
| return t.fetchAndCache(e, n).then(function(t) { | |
| return l(t.sideEffect) | |
| }) | |
| } | |
| } : i | |
| }) | |
| } | |
| , | |
| t | |
| }() | |
| , W = function() { | |
| function t(t, e) { | |
| this.worker = t, | |
| this.key = e, | |
| this.cacheKey = "external" === e ? e : "external:" + e | |
| } | |
| return Object.defineProperty(t.prototype, "externalManifest", { | |
| get: function() { | |
| return this.worker.manifest[this.key] | |
| }, | |
| enumerable: !0, | |
| configurable: !0 | |
| }), | |
| t.prototype.setup = function(t) { | |
| var n = this; | |
| this.externalManifest && this.externalManifest.urls && t.push.apply(t, this.externalManifest.urls.map(function(t) { | |
| return e(n.worker, t.url, n.cacheKey) | |
| })) | |
| } | |
| , | |
| t.prototype.fetch = function(t) { | |
| return o(this.worker, t, this.cacheKey) | |
| } | |
| , | |
| t | |
| }() | |
| , Y = function() { | |
| function t(t) { | |
| this.worker = t | |
| } | |
| return Object.defineProperty(t.prototype, "routeManifest", { | |
| get: function() { | |
| return this.worker.manifest.routing | |
| }, | |
| enumerable: !0, | |
| configurable: !0 | |
| }), | |
| t.prototype.hasExtension = function(t) { | |
| var e = t.substr(t.lastIndexOf("/") + 1); | |
| return e.indexOf(".") !== -1 | |
| } | |
| , | |
| t.prototype.setup = function(t) {} | |
| , | |
| t.prototype.fetch = function(t) { | |
| var e = this | |
| , n = this.routeManifest; | |
| if (n && n.routes) { | |
| var r = v(t.url) | |
| , i = r[0] | |
| , o = r[1] | |
| , s = Object.keys(n.routes).some(function(r) { | |
| var i = n.routes[r]; | |
| if (i.match) { | |
| var s = new L(r,i,e.worker.adapter.scope); | |
| return s.matches(t.url) | |
| } | |
| var a = i | |
| , u = a.prefix ? 0 === o.indexOf(r) : o === r | |
| , c = u && (!a.onlyWithoutExtension || !e.hasExtension(o)); | |
| return c | |
| }); | |
| return s ? a(this.worker, t, i + n.index) : null | |
| } | |
| } | |
| , | |
| t | |
| }() | |
| , J = function() { | |
| function t(t, e) { | |
| this.worker = t, | |
| this.key = e, | |
| this.cacheKey = "static" === e ? e : "static:" + e | |
| } | |
| return Object.defineProperty(t.prototype, "staticManifest", { | |
| get: function() { | |
| return this.worker.manifest[this.key] | |
| }, | |
| enumerable: !0, | |
| configurable: !0 | |
| }), | |
| t.prototype.shouldCacheBustFn = function() { | |
| var t = function(t) { | |
| return !0 | |
| }; | |
| if (this.staticManifest.versioned && Array.isArray(this.staticManifest.versioned)) { | |
| var e = this.staticManifest.versioned.map(function(t) { | |
| return new RegExp(t) | |
| }); | |
| t = function(t) { | |
| return !e.some(function(e) { | |
| return e.test(t) | |
| }) | |
| } | |
| } | |
| return t | |
| } | |
| , | |
| t.prototype.setup = function(t) { | |
| var n = this | |
| , r = this.shouldCacheBustFn(); | |
| t.push.apply(t, Object.keys(this.staticManifest.urls).map(function(t) { | |
| return function() { | |
| return n.worker.cache.load(n.cacheKey, t).then(function(i) { | |
| return i ? (x.technical("setup(" + n.cacheKey + ", " + t + "): no need to refresh " + t + " in the cache"), | |
| null) : (x.technical("setup(" + n.cacheKey + ", " + t + "): caching from network"), | |
| e(n.worker, t, n.cacheKey, r(t))()) | |
| }) | |
| } | |
| })) | |
| } | |
| , | |
| t.prototype.update = function(t, n) { | |
| var i = this | |
| , o = this.shouldCacheBustFn(); | |
| t.push.apply(t, Object.keys(this.staticManifest.urls).map(function(t) { | |
| var s = i.staticManifest.urls[t] | |
| , a = n.staticManifest.urls[t]; | |
| return a === s ? (x.technical("update(" + i.cacheKey + ", " + t + "): no need to refresh " + t + " in the cache"), | |
| r(n.worker, i.worker, t, i.cacheKey)) : (x.technical("update(" + i.cacheKey + ", " + t + "): caching from network"), | |
| e(i.worker, t, i.cacheKey, o(t))) | |
| })) | |
| } | |
| , | |
| t.prototype.fetch = function(t) { | |
| return o(this.worker, t, this.cacheKey) | |
| } | |
| , | |
| t.prototype.cleanup = function(t) { | |
| t.push(i(this.worker, this.cacheKey)) | |
| } | |
| , | |
| t.prototype.validate = function() { | |
| var t = this; | |
| return Promise.all(Object.keys(this.staticManifest.urls).map(function(e) { | |
| return t.worker.cache.load(t.cacheKey, e) | |
| })).then(function(t) { | |
| return t.every(function(t) { | |
| return !!t && t.ok | |
| }) | |
| }) | |
| } | |
| , | |
| t | |
| }() | |
| , Q = {} | |
| , V = ["actions", "body", "dir", "icon", "lang", "renotify", "requireInteraction", "tag", "vibrate", "data"] | |
| , $ = function() { | |
| function t(t) { | |
| this.worker = t, | |
| this.streams = [], | |
| this.buffer = [] | |
| } | |
| return Object.defineProperty(t.prototype, "pushManifest", { | |
| get: function() { | |
| return this.worker.manifest.push || Q | |
| }, | |
| enumerable: !0, | |
| configurable: !0 | |
| }), | |
| t.prototype.setup = function(t) {} | |
| , | |
| t.prototype.message = function(t, e) { | |
| var n = this; | |
| switch (t.cmd) { | |
| case "push": | |
| this.streams.push(e), | |
| null !== this.buffer && (this.buffer.forEach(function(t) { | |
| return n.worker.sendToStream(e, t) | |
| }), | |
| this.buffer = null) | |
| } | |
| } | |
| , | |
| t.prototype.messageClosed = function(t) { | |
| var e = this.streams.indexOf(t); | |
| e !== -1 && (this.streams.splice(e, 1), | |
| 0 === this.streams.length && (this.buffer = [])) | |
| } | |
| , | |
| t.prototype.push = function(t) { | |
| var e, n = this; | |
| try { | |
| e = JSON.parse(t) | |
| } catch (n) { | |
| e = { | |
| notification: { | |
| title: t | |
| } | |
| } | |
| } | |
| this.maybeShowNotification(e), | |
| null !== this.buffer ? this.buffer.push(e) : this.streams.forEach(function(t) { | |
| n.worker.sendToStream(t, e) | |
| }) | |
| } | |
| , | |
| t.prototype.maybeShowNotification = function(t) { | |
| if (t.notification && t.notification.title) { | |
| var e = this.pushManifest; | |
| if (e.showNotifications && (!e.backgroundOnly || null !== this.buffer)) { | |
| var n = t.notification | |
| , r = {}; | |
| V.filter(function(t) { | |
| return n.hasOwnProperty(t) | |
| }).forEach(function(t) { | |
| return r[t] = n[t] | |
| }), | |
| this.worker.showNotification(n.title, r) | |
| } | |
| } | |
| } | |
| , | |
| t | |
| }(); | |
| f({ | |
| manifestUrl: "ngsw-manifest.json", | |
| plugins: [g(), d([new K, new z]), m(), y(), w()] | |
| }) | |
| }(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment