Created
June 5, 2019 10:30
-
-
Save nicoandmee/2450a9dffd513f7ddf34e8d8b5ea69c3 to your computer and use it in GitHub Desktop.
browser fingerprinting by citi
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
| /*************************************** | |
| * @preserve | |
| * ForeSee Web SDK: Utils Library | |
| * Built June 01, 18 13:03:06 | |
| * Code version: 19.6.8 | |
| * Template version: 19.6.8 | |
| ***************************************/ | |
| _fsDefine(["require", "fs"], function (t, e) { | |
| function i(t, e) { | |
| var i = (65535 & t) + (65535 & e); | |
| return (t >> 16) + (e >> 16) + (i >> 16) << 16 | 65535 & i | |
| } | |
| function r(t, e) { | |
| return t << e | t >>> 32 - e | |
| } | |
| function n(t, e, n, s, a, o) { | |
| return i(r(i(i(e, t), i(s, o)), a), n) | |
| } | |
| function a(t, e, i, r, s, a, o) { | |
| return n(e & i | ~e & r, t, e, s, a, o) | |
| } | |
| function o(t, e, i, r, s, a, o) { | |
| return n(e & r | i & ~r, t, e, s, a, o) | |
| } | |
| function h(t, e, i, r, s, a, o) { | |
| return n(e ^ i ^ r, t, e, s, a, o) | |
| } | |
| function f(t, e, i, r, s, a, o) { | |
| return n(i ^ (e | ~r), t, e, s, a, o) | |
| } | |
| function u(t, e) { | |
| t[e >> 5] |= 128 << e % 32, t[14 + (e + 64 >>> 9 << 4)] = e; | |
| var r, n, s, u, l, c = 1732584193, | |
| d = -271733879, | |
| p = -1732584194, | |
| g = 271733878; | |
| for (r = 0; r < t.length; r += 16) n = c, s = d, u = p, l = g, c = a(c, d, p, g, t[r], 7, -680876936), g = a(g, c, d, p, t[r + 1], 12, -389564586), p = a(p, g, c, d, t[r + 2], 17, 606105819), d = a(d, p, g, c, t[r + 3], 22, -1044525330), c = a(c, d, p, g, t[r + 4], 7, -176418897), g = a(g, c, d, p, t[r + 5], 12, 1200080426), p = a(p, g, c, d, t[r + 6], 17, -1473231341), d = a(d, p, g, c, t[r + 7], 22, -45705983), c = a(c, d, p, g, t[r + 8], 7, 1770035416), g = a(g, c, d, p, t[r + 9], 12, -1958414417), p = a(p, g, c, d, t[r + 10], 17, -42063), d = a(d, p, g, c, t[r + 11], 22, -1990404162), c = a(c, d, p, g, t[r + 12], 7, 1804603682), g = a(g, c, d, p, t[r + 13], 12, -40341101), p = a(p, g, c, d, t[r + 14], 17, -1502002290), d = a(d, p, g, c, t[r + 15], 22, 1236535329), c = o(c, d, p, g, t[r + 1], 5, -165796510), g = o(g, c, d, p, t[r + 6], 9, -1069501632), p = o(p, g, c, d, t[r + 11], 14, 643717713), d = o(d, p, g, c, t[r], 20, -373897302), c = o(c, d, p, g, t[r + 5], 5, -701558691), g = o(g, c, d, p, t[r + 10], 9, 38016083), p = o(p, g, c, d, t[r + 15], 14, -660478335), d = o(d, p, g, c, t[r + 4], 20, -405537848), c = o(c, d, p, g, t[r + 9], 5, 568446438), g = o(g, c, d, p, t[r + 14], 9, -1019803690), p = o(p, g, c, d, t[r + 3], 14, -187363961), d = o(d, p, g, c, t[r + 8], 20, 1163531501), c = o(c, d, p, g, t[r + 13], 5, -1444681467), g = o(g, c, d, p, t[r + 2], 9, -51403784), p = o(p, g, c, d, t[r + 7], 14, 1735328473), d = o(d, p, g, c, t[r + 12], 20, -1926607734), c = h(c, d, p, g, t[r + 5], 4, -378558), g = h(g, c, d, p, t[r + 8], 11, -2022574463), p = h(p, g, c, d, t[r + 11], 16, 1839030562), d = h(d, p, g, c, t[r + 14], 23, -35309556), c = h(c, d, p, g, t[r + 1], 4, -1530992060), g = h(g, c, d, p, t[r + 4], 11, 1272893353), p = h(p, g, c, d, t[r + 7], 16, -155497632), d = h(d, p, g, c, t[r + 10], 23, -1094730640), c = h(c, d, p, g, t[r + 13], 4, 681279174), g = h(g, c, d, p, t[r], 11, -358537222), p = h(p, g, c, d, t[r + 3], 16, -722521979), d = h(d, p, g, c, t[r + 6], 23, 76029189), c = h(c, d, p, g, t[r + 9], 4, -640364487), g = h(g, c, d, p, t[r + 12], 11, -421815835), p = h(p, g, c, d, t[r + 15], 16, 530742520), d = h(d, p, g, c, t[r + 2], 23, -995338651), c = f(c, d, p, g, t[r], 6, -198630844), g = f(g, c, d, p, t[r + 7], 10, 1126891415), p = f(p, g, c, d, t[r + 14], 15, -1416354905), d = f(d, p, g, c, t[r + 5], 21, -57434055), c = f(c, d, p, g, t[r + 12], 6, 1700485571), g = f(g, c, d, p, t[r + 3], 10, -1894986606), p = f(p, g, c, d, t[r + 10], 15, -1051523), d = f(d, p, g, c, t[r + 1], 21, -2054922799), c = f(c, d, p, g, t[r + 8], 6, 1873313359), g = f(g, c, d, p, t[r + 15], 10, -30611744), p = f(p, g, c, d, t[r + 6], 15, -1560198380), d = f(d, p, g, c, t[r + 13], 21, 1309151649), c = f(c, d, p, g, t[r + 4], 6, -145523070), g = f(g, c, d, p, t[r + 11], 10, -1120210379), p = f(p, g, c, d, t[r + 2], 15, 718787259), d = f(d, p, g, c, t[r + 9], 21, -343485551), c = i(c, n), d = i(d, s), p = i(p, u), g = i(g, l); | |
| return [c, d, p, g] | |
| } | |
| function c(t) { | |
| var e, i = ""; | |
| for (e = 0; e < 32 * t.length; e += 8) i += String.fromCharCode(t[e >> 5] >>> e % 32 & 255); | |
| return i | |
| } | |
| function d(t) { | |
| var e, i = []; | |
| for (i[(t.length >> 2) - 1] = void 0, e = 0; e < i.length; e += 1) i[e] = 0; | |
| for (e = 0; e < 8 * t.length; e += 8) i[e >> 5] |= (255 & t.charCodeAt(e / 8)) << e % 32; | |
| return i | |
| } | |
| function p(t) { | |
| return c(u(d(t), 8 * t.length)) | |
| } | |
| function g(t, e) { | |
| var i, r, n = d(t), | |
| s = [], | |
| a = []; | |
| for (s[15] = a[15] = void 0, n.length > 16 && (n = u(n, 8 * t.length)), i = 0; i < 16; i += 1) s[i] = 909522486 ^ n[i], a[i] = 1549556828 ^ n[i]; | |
| return r = u(s.concat(d(e)), 512 + 8 * e.length), c(u(a.concat(r), 640)) | |
| } | |
| function y(t) { | |
| var e, i, r = "0123456789abcdef", | |
| n = ""; | |
| for (i = 0; i < t.length; i += 1) e = t.charCodeAt(i), n += r.charAt(e >>> 4 & 15) + r.charAt(15 & e); | |
| return n | |
| } | |
| function b(t) { | |
| return decodeURIComponent(e.enc(t)) | |
| } | |
| function w(t) { | |
| return p(b(t)) | |
| } | |
| function m(t) { | |
| return y(w(t)) | |
| } | |
| function v(t, e) { | |
| return g(b(t), b(e)) | |
| } | |
| function S(t, e) { | |
| return y(v(t, e)) | |
| } | |
| function x(t, e) { | |
| var i, r, n, s = t.keys, | |
| a = e.keys; | |
| for (i in s) n = a[i], r = s[i], n ? r.t < n.t && (t.keys[i] = a[i]) : r.t < e.when && delete s[i]; | |
| for (i in a) s.hasOwnProperty(i) || (n = a[i], n.t > t.when && (t.keys[i] = a[i])); | |
| return t | |
| } | |
| function _(t, i) { | |
| return ["properties", "metrics", "data"].reduce(function (t, r) { | |
| return i[r] && (t[r] = e.ext(t[r], i[r])), t | |
| }, t) | |
| } | |
| var k = "undefined" != typeof Uint8Array, | |
| B = window, | |
| T = { | |
| APPID: { | |
| TRIGGER: "funcxm", | |
| FEEDBACK: "funfbk", | |
| REPLAY: "funrep" | |
| } | |
| }, | |
| I = { | |
| StorageInstances: {} | |
| }; | |
| e && e.home && e.home, T.md5 = function (t, e, i) { | |
| return e ? i ? v(e, t) : S(e, t) : i ? w(t) : m(t) | |
| }, T.escapeRegExp = function (t) { | |
| return (t || "").toString().replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1") | |
| }, T.trim = function (t) { | |
| return (t || "").toString().replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "") | |
| }, T.stripHTML = function (t) { | |
| return (t || "").replace(/(<([^>]+)>)/gi, "") | |
| }, T.unlink = function (t) { | |
| var i, r; | |
| if (e.isPlainObject(t)) { | |
| i = {}; | |
| for (var n in t) i[n] = T.unlink(t[n]) | |
| } else if (Array.isArray(t)) | |
| for (i = [], r = 0, l = t.length; r < l; r++) i[r] = T.unlink(t[r]); | |
| else i = t; | |
| return i | |
| }; | |
| var A = {}; | |
| T.preventDefault = function (t) { | |
| t && t.preventDefault ? t.preventDefault() : window.event && window.event.returnValue ? window.eventReturnValue = !1 : t.returnValue = !1 | |
| }; | |
| var E = [], | |
| R = function (t) { | |
| var e = "default"; | |
| if (t.indexOf(":") > -1) { | |
| var i = t.split(":"); | |
| e = i[0], t = i[1] | |
| } | |
| return A[e] || (A[e] = {}), A[e][t] || (A[e][t] = []), { | |
| ns: e, | |
| en: t | |
| } | |
| }; | |
| T.Bind = function (t, e, i, r) { | |
| if (t && e) { | |
| var n = R(e); | |
| if (A[n.ns][n.en].push({ | |
| elem: t, | |
| cb: i, | |
| ub: !!r | |
| }), e.indexOf("unload") > -1) return void E.push(i); | |
| "propertychange" != n.en && t.addEventListener ? t.addEventListener(n.en, i, !r) : t.attachEvent && t.attachEvent("on" + n.en, i) | |
| } | |
| }, T.BindOnce = function (t, e, i) { | |
| if (t && e) { | |
| var r = R(e); | |
| if (t["_acsEvent" + r.en]) return; | |
| t["_acsEvent" + r.en] = !0, T.Bind(t, e, i) | |
| } | |
| }; | |
| var D = function (t, e, i, r) { | |
| e && (e.parentNode || e.window || 9 == e.nodeType) && ("propertychange" != t && e.removeEventListener ? e.removeEventListener(t, i, !r) : e.detachEvent && e.detachEvent("on" + t, i)) | |
| }; | |
| T.Unbind = function (t, e, i, r) { | |
| var n, s, a, o; | |
| if (e && e.indexOf("unload") > -1) { | |
| for (o = 0; o < E.length; o++) | |
| if (E[o] == i) { | |
| E.splice(o, 1); | |
| break | |
| } | |
| } else if (0 === arguments.length) | |
| for (var h in A) T.Unbind(h + ":*"), delete A[h]; | |
| else if ("string" == typeof t) | |
| if (n = R(t), "default" == n.ns) { | |
| for (var f in A) | |
| if (A.hasOwnProperty(f)) { | |
| s = A[f]; | |
| for (var u in s) | |
| if (s.hasOwnProperty(u) && (u == n.en || "*" == n.en)) | |
| for (o = 0; o < s[u].length; o++) a = s[u][o], D(u, a.elem, a.cb, a.ub), s[u].splice(o--, 1) | |
| } | |
| } else { | |
| s = A[n.ns]; | |
| for (var l in s) | |
| if (s.hasOwnProperty(l) && (l == n.en || "*" == n.en)) | |
| for (o = 0; o < s[l].length; o++) a = s[l][o], D(l, a.elem, a.cb, a.ub), s[l].splice(o--, 1) | |
| } | |
| else if (t && !e) { | |
| for (var c in A) | |
| if (A.hasOwnProperty(c)) { | |
| s = A[c]; | |
| for (var d in s) | |
| if (s.hasOwnProperty(d)) | |
| for (o = 0; o < s[d].length; o++) a = s[d][o], a.elem === t && (D(d, a.elem, a.cb, a.ub), s[d].splice(o--, 1)) | |
| } | |
| } else if (t && e) | |
| if (n = R(e), "default" == n.ns) { | |
| for (var p in A) | |
| if (A.hasOwnProperty(p)) { | |
| s = A[p]; | |
| for (var g in s) | |
| if (s.hasOwnProperty(g) && (g == n.en || "*" == n.en)) | |
| for (o = 0; o < s[g].length; o++) a = s[g][o], a.elem === t && (D(g, a.elem, i || a.cb, a.ub), s[g].splice(o--, 1)) | |
| } | |
| } else { | |
| n = R(e), s = A[n.ns]; | |
| for (var y in s) | |
| if (s.hasOwnProperty(y) && (y == n.en || "*" == n.en)) | |
| for (o = 0; o < s[y].length; o++) a = s[y][o], a.elem === t && (D(y, a.elem, i || a.cb, a.ub), s[y].splice(o--, 1)) | |
| } | |
| }; | |
| var C = !1; | |
| if (T.preventUnloadFlag = !1, T._preventUnloadFor = function (t) { | |
| C = !0, setTimeout(function () { | |
| C = !1 | |
| }, t) | |
| }, T.HandleUnload = function () { | |
| if (!C && !T.preventUnloadFlag) { | |
| for (var t = E.length - 1; t >= 0; t--) try { | |
| E[t].call() | |
| } catch (t) {} | |
| e.dispose(E), T.Unbind() | |
| } | |
| }, document.addEventListener ? (window.addEventListener("beforeunload", T.HandleUnload, !0), window.addEventListener("pagehide", T.HandleUnload, !0), document.addEventListener("unload", T.HandleUnload, !0)) : document.attachEvent && window.attachEvent("onunload", T.HandleUnload), T.getKeyCode = function (t) { | |
| return t && void 0 !== t.key ? t.key.toLowerCase() : { | |
| 32: " ", | |
| 13: "enter", | |
| 37: "arrowleft", | |
| 39: "arrowright" | |
| } [t.keyCode > 0 ? t.keyCode : t.which] | |
| }, T.FSEvent = function () { | |
| this.id = "_" + Math.round(99999 * Math.random()), this.subscriptions = [], this.didFire = !1 | |
| }, T.FSEvent.prototype.subscribe = function (t, e, i) { | |
| return this.subscriptions.push({ | |
| once: !!e, | |
| cb: t | |
| }), i && this.didFire && (this.prevArgs ? this.fire.apply(this, this.prevArgs) : this.fire()), { | |
| unsubscribe: function (t, e) { | |
| return function () { | |
| t.unsubscribe(e) | |
| } | |
| }(this, t) | |
| } | |
| }, T.FSEvent.prototype.unsubscribe = function (t) { | |
| for (var e = 0; e < this.subscriptions.length; e++) this.subscriptions[e].cb == t && (this.subscriptions.splice(e, 1), e--) | |
| }, T.FSEvent.prototype.unsubscribeAll = function () { | |
| this.subscriptions = [] | |
| }, T.FSEvent.prototype.fire = function () { | |
| this.didFire = !0, this.prevArgs = arguments; | |
| for (var t = 0; t < this.subscriptions.length; t++) { | |
| var e = this.subscriptions[t]; | |
| e.once && this.subscriptions.splice(t--, 1), e.cb.apply(this, arguments) | |
| } | |
| }, T.pageNavEvent = new T.FSEvent, history && history.pushState) { | |
| window.addEventListener("popstate", function (t) { | |
| C || T.pageNavEvent.fire() | |
| }); | |
| var O = history.pushState; | |
| history.pushState = function () { | |
| O.apply(history, arguments), C || T.pageNavEvent.fire() | |
| } | |
| } | |
| T.FSEvent.prototype.chain = function (t, i, r) { | |
| t && t.constructor === T.FSEvent && t.subscribe(e.proxy(function () { | |
| this.fire.apply(this, arguments) | |
| }, this), i, r) | |
| }; | |
| var L = function (t) { | |
| this.browser = t, this.sig = "not detected", this.ready = new T.FSEvent, this._detect() | |
| }; | |
| L.prototype._detect = function () { | |
| var t, i = e.proxy(function (t) { | |
| this.sig = t, this.ready.fire(t) | |
| }, this), | |
| r = [], | |
| n = navigator, | |
| s = this.browser; | |
| if (B != B.top) { | |
| var a = location.search.match(/uid=([\d\w]*)/i); | |
| a && a[1] && (t = a[1]) | |
| } | |
| t && "not detected" != t || !s.supportsLocalStorage || (t = localStorage.getItem("_fsPRINT")), t || (r = T.trim(navigator.userAgent.replace(/[0-9\.\/\\\(\);_\-]*/gi, "")).split(" "), r.push(n.language || ""), r.push(n.hardwareConcurrency || ""), r.push(n.platform || ""), r.push(n.vendor || ""), r.push(n.appName || ""), r.push(n.maxTouchPoints || ""), r.push(n.doNotTrack || "false"), r.push(s.os.name || "false"), r.push(s.os.version || "false"), r.push(this._getCanvasPrint()), t = T.md5(r.join("")), this.sig = t, s.supportsLocalStorage && localStorage.setItem("_fsPRINT", t)), e.nextTick(function () { | |
| i(t) | |
| }) | |
| }, L.prototype._getCanvasPrint = function () { | |
| try { | |
| var t = document.createElement("canvas"), | |
| e = t.getContext("2d"), | |
| i = "ForeSee,CloudUser <canvas> 1.0"; | |
| return t.width = 250, t.height = 30, e.textBaseline = "top", e.font = "14px 'Arial'", e.textBaseline = "alphabetic", e.fillStyle = "#f60", e.fillRect(125, 1, 62, 20), e.fillStyle = "#069", e.fillText(i, 2, 15), e.fillStyle = "rgba(102, 204, 0, 0.7)", e.fillText(i, 4, 17), t.toDataURL() | |
| } catch (t) { | |
| return "nocanvas" | |
| } | |
| }, T.Fingerprint = L; | |
| var N = function (t) { | |
| this.browser = t, this.ready = new T.FSEvent, this.ajax = new T.AjaxTransport, e.nextTick(e.proxy(function () { | |
| this.ready.fire() | |
| }, this)) | |
| }; | |
| N.prototype.send = function (t) { | |
| this.ready.subscribe(e.proxy(function () { | |
| if (this.ajax) this.ajax.send(t); | |
| else { | |
| var i = e.ext({ | |
| method: "GET", | |
| contentType: "application/x-www-form-urlencoded; charset=UTF-8", | |
| success: function () {}, | |
| failure: function () {} | |
| }, t); | |
| this.fstg.ajax(i.method, i.url, i.data, function (t) { | |
| return function (e, i) { | |
| e ? t.success(i) : t.failure(i) | |
| } | |
| }(i), !e.isDefined(t.skipEncode) || !!t.skipEncode, i.contentType) | |
| } | |
| }, this), !0, !0) | |
| }, N.prototype.dispose = function () { | |
| this.ajax && this.ajax.dispose() | |
| }, T.CORS = N, T.storageTypes = { | |
| CK: "COOKIE", | |
| MC: "MICROCOOKIE", | |
| CL: "COOKIELESS", | |
| DS: "DOMSTORAGE" | |
| }; | |
| var U = function (t) { | |
| var i = new Date; | |
| return { | |
| path: "/", | |
| domain: t.selectCookieDomain(e.config.cookieDomain, window.location.toString()), | |
| secure: !1, | |
| encode: !0, | |
| expires: new Date(i.getFullYear() + 2, i.getMonth(), i.getDate()).toUTCString() | |
| } | |
| }, | |
| F = function (t, i) { | |
| T.storageTypes; | |
| this.pers = (e.config.storage || "").toUpperCase(), e.ext(this, { | |
| _storageKey: "_4c_", | |
| _microStorageKey: "_4c_mc_", | |
| isReady: !1, | |
| defaultExpire: 7776e6, | |
| ready: new T.FSEvent, | |
| onCommit: new T.FSEvent, | |
| onSync: new T.FSEvent, | |
| _readyState: new T.FSEvent, | |
| maxExpire: -1, | |
| timeOffset: 0, | |
| _keyEvents: {}, | |
| _updateTimeout: 6e4, | |
| _data: { | |
| when: 0, | |
| keys: {} | |
| }, | |
| isStale: !1, | |
| lock: null, | |
| lastMaint: T.now(), | |
| lastSave: T.now(), | |
| lastSync: T.now(), | |
| isSyncing: !1 | |
| }), this.browser = t, T.Bind(window, "unload", function () { | |
| this.save(!0) | |
| }.bind(this)) | |
| }; | |
| F.prototype.selectCookieDomain = function (t, i) { | |
| if (!e.isDefined(t) || !Array.isArray(t) || t.length < 1) return T.getRootDomain(); | |
| var r, n, s; | |
| for (n = 0; n < t.length; n++) | |
| if ((s = t[n]) && s.path && s.domain && T.testAgainstSearch(s.path, i)) { | |
| r = s; | |
| break | |
| } return r && e.isString(r.domain) ? r.domain : null | |
| }, F.prototype.upgradeOldStorage = function (i) { | |
| var r = this.ckie, | |
| n = ["fsr.r", "fsr.s", "_fsspl_", "fsr.t", "acs.t"], | |
| s = !1; | |
| this.pers === T.storageTypes.MC && n.push("_4c_"); | |
| for (var a = 0; a < n.length; a++) | |
| if (r.get(n[a])) { | |
| s = !0; | |
| break | |
| } s ? t([e.makeURI("$fs.storageupgrade.js")], function (t) { | |
| t(this, r, i) | |
| }.bind(this)) : e.nextTick(i) | |
| }, F.prototype.setUpdateInterval = function (t) { | |
| t && !isNaN(t) && (this._updateTimeout = t, clearInterval(this._updateInterval), this._updateInterval = setInterval(function () { | |
| this._sync() | |
| }.bind(this), t)) | |
| }, F.prototype.stopUpdateInterval = function () { | |
| clearInterval(this._updateInterval), this._updateInterval = null | |
| }, F.prototype._fireChangeEvents = function (t) { | |
| var i, r = this; | |
| for (var n in t)(!(i = this._data.keys[n]) || i.t < t[n].t || i.x !== t[n].x) && (this._keyEvents[n] || (this._keyEvents[n] = new T.FSEvent), e.nextTick(function (e) { | |
| return function () { | |
| r._keyEvents[e].fire(e, r._data.keys[e], t[e].v) | |
| } | |
| }(n))) | |
| }, F.prototype.save = function (t) { | |
| if (t) this._commit(); | |
| else { | |
| var e = T.now(); | |
| !this.lock && this.isStale && (this.lock = setTimeout(this._commit.bind(this), Math.max(0, this.cThreshold - (e - this.lastSave)))) | |
| } | |
| }, F.prototype._maint = function (t) { | |
| var e, i = T.now(), | |
| r = !1, | |
| n = this._data.keys; | |
| if (i - this.lastMaint > 5e3 || t) { | |
| for (var s in n) e = n[s], i - this.timeOffset > e.x && (delete n[s], r = !0); | |
| this.lastMaint = i | |
| }!r || this.pers != T.storageTypes.CK && this.pers != T.storageTypes.DS || this._commit() | |
| }, F.prototype.set = function (t, i, r, n, s) { | |
| this._readyState.subscribe(function () { | |
| this._data.keys || (this._data.keys = {}); | |
| var a = this._data.keys[t], | |
| o = T.now(), | |
| h = null; | |
| if (r) | |
| if ("number" == typeof r) h = r, this.maxExpire > 0 && this.maxExpire < r && (h = r = this.maxExpire), r = o + r; | |
| else if (r instanceof Date && (r = r.getTime() + r, this.maxExpire > 0)) { | |
| var f = r - o; | |
| f > this.maxExpire && (h = r = this.maxExpire, r = o + r) | |
| } | |
| if (a) { | |
| var u = {}; | |
| u[t] = { | |
| v: i, | |
| x: r || a.x, | |
| t: o | |
| }, this._fireChangeEvents(u), a.v = "cp" == t ? e.ext(a.v, i) : "ckcpps" == t ? e.ext(a.v, i) : i, a.x = r || a.x, h && (a.ttl = h), a.t = o | |
| } else { | |
| var l = {}; | |
| l[t] = { | |
| v: i, | |
| x: r || this.defaultExpire + o, | |
| t: o | |
| }, h && (l[t].ttl = h), this._fireChangeEvents(l), this._data.keys[t] = l[t] | |
| } | |
| this.isStale = !0, s && this.onCommit.subscribe(s, !0, !1), this._maint(), this.save(!!n) | |
| }.bind(this), !0, !0) | |
| }, F.prototype.get = function (t) { | |
| if (Array.isArray(t)) { | |
| for (var e = {}, i = 0; i < t.length; i++) e[t[i]] = this.get(t[i]); | |
| return e | |
| } | |
| return this._maint(), this._data.keys || (this._data.keys = {}), (this._data.keys[t] || { | |
| v: null | |
| }).v | |
| }, F.prototype.all = function () { | |
| return this._data.keys | |
| }, F.prototype.erase = function (t, e, i) { | |
| if (Array.isArray(t)) | |
| for (var r = 0; r < t.length; r++) this.erase(t[r]); | |
| else this._maint(), delete this._data.keys[t], e && this.onCommit.subscribe(e, !0, !1), I.StorageInstances.brainStorage && this._delete(t), this.pers == T.storageTypes.CL && this.pers == T.storageTypes.MC || this.save(!!i) | |
| }, F.prototype.reset = function (t, i, r) { | |
| var n = document.getElementById("acsOverrideSettings"), | |
| s = document.getElementById("acsClearStateWaitMessage"), | |
| a = !!n && !!s; | |
| if (this._data.keys = {}, t && this.onCommit.subscribe(t, !0, !1), r || (this.ckie.kill(this._storageKey), this.ckie.kill(this._microStorageKey), this.browser.supportsSessionStorage && window.sessionStorage.removeItem(this._microStorageKey, this.uid)), this.pers == T.storageTypes.CK) { | |
| if (localStorage && e.supportsDomStorage) | |
| for (var o in localStorage) /^(_fsr|__fsFr)/.test(o) && localStorage.removeItem(o); | |
| this.onCommit.fire() | |
| } else this.pers == T.storageTypes.DS ? (localStorage.removeItem(this._storageKey), this.onCommit.fire()) : (this._readyState.didFire && (this._readyState = new T.FSEvent), a && (T.addClass(n, "acsNoDisplay"), T.removeClass(s, "acsNoDisplay")), this.cors.send({ | |
| method: "DELETE", | |
| url: e.config.brainUrl + "/state/" + e.config.siteKey + "/" + this.uid, | |
| success: function () { | |
| a && (T.removeClass(n, "acsNoDisplay"), T.addClass(s, "acsNoDisplay")), this.lastSync = T.now() - 1e4, this.onCommit.fire(), this._readyState.fire(this) | |
| }.bind(this), | |
| failure: function () { | |
| a && (T.removeClass(n, "acsNoDisplay"), T.addClass(s, "acsNoDisplay"), i && i()), this._serverFails++, this._readyState.fire(this) | |
| }.bind(this) | |
| })) | |
| }, F.prototype.setMaxKeyExpiration = function (t) { | |
| this.maxExpire = this.defaultExpire = t; | |
| var e, i = T.now(), | |
| r = this._data.keys; | |
| for (var n in r) { | |
| e = r[n]; | |
| var s = e.x - i; | |
| (s > t || e.ttl > t) && (e.ttl = t, e.x && (e.x -= s - t)) | |
| } | |
| this.save(!0) | |
| }, F.prototype.getMaxKeyExpiration = function () { | |
| var t = T.now(), | |
| e = this._data.keys, | |
| i = 0; | |
| for (var r in e) i = Math.max(i, e[r].x - t); | |
| return i | |
| }, F.prototype.watchForChanges = function (t, e, i, r) { | |
| Array.isArray(t) || (t = [t]); | |
| for (var n = 0; n < t.length; n++) { | |
| var s = t[n]; | |
| this._keyEvents[s] || (this._keyEvents[s] = new T.FSEvent), this._keyEvents[s].subscribe(e, i, r) | |
| } | |
| }, T.getGeneralStorage = function (t, i) { | |
| var r, n = e.config.storage.toUpperCase(), | |
| s = I.StorageInstances, | |
| a = T.storageTypes; | |
| return t.supportsLocalStorage || n != a.DS ? t.isMobile && n == a.CL && (n = a.MC) : n = a.CK, r = n == T.storageTypes.CK || n == T.storageTypes.DS, r ? (s.generalStorage || (s.generalStorage = new M(t, i)), s.generalStorage) : (s.brainStorage || (s.brainStorage = new P(t, i)), s.brainStorage) | |
| }, T.getBrainStorage = function (t, e, i, r) { | |
| var n = I.StorageInstances; | |
| return n.brainStorage || (n.brainStorage = new P(t, e, i, r)), n.brainStorage | |
| }, T.INT = {}, T.getSize = function (t) { | |
| var e = 0, | |
| i = 0, | |
| r = t.document, | |
| n = r.documentElement; | |
| return "number" == typeof t.innerWidth ? (e = t.innerWidth, i = t.innerHeight) : n && (n.clientWidth || n.clientHeight) ? (e = n.clientWidth, i = n.clientHeight) : r.body && (r.body.clientWidth || r.body.clientHeight) && (e = r.body.clientWidth, i = r.body.clientHeight), { | |
| w: e, | |
| h: i | |
| } | |
| }, T.getScroll = function (t) { | |
| var e = 0, | |
| i = 0, | |
| r = t.document, | |
| n = r.documentElement; | |
| return "number" == typeof t.pageYOffset ? (i = t.pageYOffset, e = t.pageXOffset) : r.body && (r.body.scrollLeft || r.body.scrollTop) ? (i = r.body.scrollTop, e = r.body.scrollLeft) : n && (n.scrollLeft || n.scrollTop) && (i = n.scrollTop, e = n.scrollLeft), { | |
| x: e, | |
| y: i | |
| } | |
| }, T.setScroll = function (t, e, i) { | |
| t.scrollTo(e, i) | |
| }, T.getScreenResolution = function () { | |
| var t = window.screen; | |
| return e.isDefined(t) && e.isDefined(t.width) && "number" == typeof t.width ? { | |
| w: t.width, | |
| h: t.height | |
| } : { | |
| w: 0, | |
| h: 0 | |
| } | |
| }, T.getFrameWindow = function (t) { | |
| var e; | |
| return t && t.contentWindow ? e = t.contentWindow : t && t.contentDocument && t.contentDocument.defaultView && (e = t.contentDocument.defaultView), e && e != e.top ? e : null | |
| }; | |
| var M = function (t, i) { | |
| F.call(this, t, i), e.ext(this, { | |
| cThreshold: 2e3 | |
| }); | |
| var r = T.storageTypes; | |
| t.ready.subscribe(function () { | |
| this.pers == r.CK ? this.ckie = new T.Cookie(U(this)) : this.pers == r.DS ? this.cThreshold = 500 : i && (this.uid = i), this._sync(function () { | |
| this.get("rid") ? this.uid = this.get("rid") : (this.uid = this.uid || T.generateGUID(), this.set("rid", this.uid)), this.setUpdateInterval(this._updateTimeout), this._maint(!0), this._readyState.fire(this), this.ready.fire(this) | |
| }.bind(this)) | |
| }.bind(this), !0, !0) | |
| }; | |
| M.prototype = Object.create(F.prototype), M.prototype.constructor = F, M.prototype._sync = function (t) { | |
| if (!this.isSyncing) { | |
| this.isSyncing = !0, t = t || function () {}; | |
| var i, r; | |
| if (this.pers == T.storageTypes.CK) { | |
| if (i = this.ckie.get(this._storageKey)) return i = $.decompress(i), this._lastSync = T.now(), r = JSON.parse(i), this._fireChangeEvents(r.keys), r.keys = r.keys || {}, this._data = r, this.onSync.fire(this), this.isSyncing = !1, void e.nextTick(t); | |
| this.isSyncing = !1, e.nextTick(t) | |
| } else if (this.pers == T.storageTypes.DS) { | |
| if (i = localStorage.getItem(this._storageKey)) { | |
| if (i = $.decompress(i), this.lastSync = T.now(), r = JSON.parse(i), r.keys = r.keys || {}, this._fireChangeEvents(r.keys), this._data = r, e.nextTick(function () { | |
| this.onSync.fire(this) | |
| }.bind(this)), T.now() - this._data.when < 3e5) return this.isSyncing = !1, void e.nextTick(t); | |
| this.lastSync = T.now(), this._data = { | |
| when: T.now(), | |
| keys: {} | |
| } | |
| } | |
| this.isSyncing = !1, e.nextTick(t) | |
| } | |
| } | |
| }, M.prototype._commit = function () { | |
| clearTimeout(this.lock), this.lock = null, this.lastSave = T.now(), this._data.when = this.lastSave; | |
| var t = ""; | |
| try { | |
| t = JSON.stringify(this._data) | |
| } catch (t) { | |
| return | |
| } | |
| if (this.pers == T.storageTypes.CK) { | |
| var i = e.ext({}, this._data); | |
| for (var r in i.keys) delete i.keys[r].t; | |
| t = JSON.stringify(i), this.ckie.set(this._storageKey, $.compress(t)), this.onCommit.fire(this._data) | |
| } else this.pers == T.storageTypes.DS && (localStorage.setItem(this._storageKey, $.compress(t)), this.onCommit.fire(this._data)); | |
| this.isStale = !1 | |
| }; | |
| var P = function (t, i, r, n) { | |
| this.brainUrl = n || e.config.brainUrl, this.siteKey = r || e.config.siteKey, F.call(this, t, i), e.ext(this, { | |
| _serverFails: 0, | |
| cThreshold: 300 | |
| }); | |
| var s = T.storageTypes; | |
| t.ready.subscribe(function () { | |
| this.cors = new T.CORS(t), this.pers == s.MC ? (this.ckie = new T.Cookie(U(this)), this.uid = i, this.uid || (this.uid = this.ckie.get(this._microStorageKey)), !this.uid && t.supportsSessionStorage && (this.uid = window.sessionStorage.getItem(this._microStorageKey)), (!this.uid || this.uid && (this.uid.length > 64 || this.uid.indexOf("{") > -1)) && (this.uid = T.generateGUID(), this.ckie.set(this._microStorageKey, this.uid)), this.browser.supportsSessionStorage && window.sessionStorage.setItem(this._microStorageKey, this.uid), this.ckie.set(this._microStorageKey, this.uid)) : this.pers == s.CL ? (this.ckie = new T.Cookie(U(this)), this.uid = i || t.fp) : i && (this.uid = i), this._sync(function () { | |
| this.get("rid") ? this.uid = this.get("rid") : (this.uid = this.uid || T.generateGUID(), this.set("rid", this.uid)), this.setUpdateInterval(this._updateTimeout), this._readyState.fire(this), this.ready.fire(this) | |
| }.bind(this)) | |
| }.bind(this), !0, !0) | |
| }; | |
| if (P.prototype = Object.create(F.prototype), P.prototype.constructor = F, P.prototype._sync = function (t) { | |
| if (!this.isSyncing) { | |
| this.isSyncing = !0, t = t || function () {}; | |
| var i; | |
| if (this._serverFails > 5) return; | |
| this.cors.send({ | |
| method: "GET", | |
| url: this.brainUrl + "/state/" + this.siteKey + "/" + this.uid, | |
| success: function (r) { | |
| this.lastSync = T.now(), i = JSON.parse(r), this.timeOffset = T.isNumeric(i._asof_) ? T.now() - i._asof_ : 0, this._fireChangeEvents(i.keys), this.mergeBrainData(i), this.isSyncing = !1, e.nextTick(function () { | |
| this.onSync.fire(this), this._readyState.fire(this) | |
| }.bind(this)), t() | |
| }.bind(this), | |
| failure: function () { | |
| this.lastSync = T.now(), this.isSyncing = !1, this._serverFails++, this._readyState.fire(this) | |
| }.bind(this) | |
| }) | |
| } | |
| }, P.prototype._commit = function () { | |
| clearTimeout(this.lock), this.lock = null, this.lastSave = this._data.when = T.now(), this._serverFails > 5 || (this.cors.send({ | |
| method: "POST", | |
| url: this.brainUrl + "/state/" + this.siteKey + "/" + this.uid, | |
| data: this._data, | |
| contentType: "application/json", | |
| success: function (t) { | |
| this._lastSync = T.now(), this.mergeBrainData(JSON.parse(t)), this.onCommit.fire(this._data), this._readyState.fire(this) | |
| }.bind(this), | |
| failure: function () { | |
| this._serverFails++, this._readyState.fire(this) | |
| }.bind(this) | |
| }), this.isStale = !1) | |
| }, P.prototype._delete = function (t) { | |
| this.lastSave = this._data.when = T.now(), this.cors.send({ | |
| method: "DELETE", | |
| url: this.brainUrl + "/state/" + this.siteKey + "/" + this.uid + "/" + e.enc(t), | |
| contentType: "application/json", | |
| success: function (t) { | |
| this._lastSync = T.now(), this.onCommit.fire(this._data), this._readyState.fire(this) | |
| }.bind(this), | |
| failure: function () { | |
| this._serverFails++, this._readyState.fire(this) | |
| }.bind(this) | |
| }) | |
| }, P.prototype.mergeBrainData = function (t) { | |
| return x(this._data, t) | |
| }, T.testSameDomain = function (t, i) { | |
| var r = document.createElement("a"); | |
| r.href = location.href; | |
| var n = r.hostname, | |
| s = r.protocol; | |
| r.href = t; | |
| var a = r.hostname || n, | |
| o = 0 === r.protocol.indexOf("http") ? r.protocol : s; | |
| r.href = i; | |
| var h = r.hostname || n, | |
| f = 0 === r.protocol.indexOf("http") ? r.protocol : s; | |
| return e.toLowerCase(a) == e.toLowerCase(h) && e.toLowerCase(o) == e.toLowerCase(f) | |
| }, T.addParameterToURL = function (t, e) { | |
| return t += (t.split("?")[1] ? "&" : "?") + e | |
| }, T.hash = function (t) { | |
| var e = t.split("_"); | |
| return 3 * e[0] + 1357 + "" + (9 * e[1] + 58) | |
| }, T.hashCode = function (t) { | |
| var e, i = 0, | |
| r = ""; | |
| if (0 === t.length) return i; | |
| for (e = 0; e < t.length; e++) r = t.charCodeAt(e), i = (i << 5) - i + r, i &= i; | |
| return i | |
| }, T.testAgainstSearch = function (t, i) { | |
| if (null === t || "boolean" == typeof t || "boolean" == typeof i) return !1; | |
| if ("." === t) return !0; | |
| if (t instanceof RegExp) return t.test(i); | |
| if (-1 == t.indexOf("*") && -1 == t.indexOf("//") && "" !== t.trim()) return i.indexOf(t) > -1; | |
| var r, n, s; | |
| if (t = e.toLowerCase(t.replace(/^\s+|\s+$/g, "").replace(/[\*]{2,}/g, "*")), i = e.toLowerCase(i), "*" == t) return !0; | |
| for (n = []; t.indexOf("*") > -1;) t.indexOf("*") > 0 && n.push(t.substr(0, t.indexOf("*"))), n.push("*"), t = t.substr(t.indexOf("*") + 1); | |
| for (t.length > 0 && n.push(t), r = 0 !== n.length, s = 0; s < n.length; s++) | |
| if ("*" == (t = n[s])) { | |
| if (n.length > s + 1) { | |
| if (s++, -1 == i.indexOf(n[s])) { | |
| r = !1; | |
| break | |
| } | |
| i = i.substr(i.indexOf(n[s]) + n[s].length) | |
| } | |
| if (s == n.length - 1 && "*" !== n[s] && i != n[s] && i != n[s] + "/" && n[s] != i + "/" && i.length > 0 && "/" != i) { | |
| r = !1; | |
| break | |
| } | |
| } else { | |
| if (i.substr(0, t.length) != t && i != t + "/" && t != i + "/") { | |
| r = !1; | |
| break | |
| } | |
| if (i = i.substr(t.length), s == n.length - 1 && i.length > 0 && "/" != i) { | |
| r = !1; | |
| break | |
| } | |
| } return !!r | |
| }, T.getRootDomain = function (t) { | |
| t = e.toLowerCase(t || document.domain).replace("https://", "").replace("http://", ""); | |
| for (var i, r = ["/", "?", ":"], n = r.length, s = 0; s < n; s++)(i = t.indexOf(r[s])) > -1 && (t = t.substr(0, i)); | |
| if (t.indexOf("localhost") > -1 || 0 === t.replace(/[0-9\.]/g, "").length) return t; | |
| var a = t.split("."), | |
| o = a.length; | |
| return o > 2 && (function (t) { | |
| return ["com", "co", "org", "gov", "edu", "net"].indexOf(t) > -1 | |
| }(a[o - 2]) || function (t) { | |
| return t.indexOf("qc.ca") > -1 | |
| }(t)) ? a[o - 3] + "." + a[o - 2] + "." + a[o - 1] : o > 1 ? a[o - 2] + "." + a[o - 1] : t | |
| }, T.FULL_DAY = 864e5, T.now = function () { | |
| return +new Date | |
| }, T.startTime = T.now(), T.AjaxTransport = function (t) { | |
| var i = { | |
| method: "POST", | |
| data: {}, | |
| contentType: "application/x-www-form-urlencoded", | |
| success: function () {}, | |
| failure: function () {} | |
| }; | |
| this.options = e.ext(i, t) | |
| }, T.AjaxTransport.prototype.send = function (t) { | |
| var i = e.ext({}, this.options, t || {}); | |
| window.XDomainRequest && -1 == window.navigator.userAgent.indexOf("MSIE 10") ? this._sendViaXDR(i) : window.XMLHttpRequest && this._sendViaXHR(i), i = null | |
| }, T.AjaxTransport.prototype.dispose = function () { | |
| e.dispose(this.options) | |
| }, T.AjaxTransport.isSupported = function () { | |
| return !0 | |
| }, T.AjaxTransport.initialize = function (t) { | |
| t.call(T.AjaxTransport) | |
| }, T.AjaxTransport.prototype._sendViaXHR = function (t) { | |
| var i = new window.XMLHttpRequest, | |
| r = t.contentType ? e.toLowerCase(t.contentType).indexOf("json") > -1 ? "application/json; charset=utf-8" : t.contentType : "application/x-www-form-urlencoded", | |
| n = e.toLowerCase(r).indexOf("json") > -1, | |
| s = n ? "GET" == t.method ? e.enc(JSON.stringify(t.data)) : JSON.stringify(t.data) : e.isDefined(t.skipEncode) && !0 === t.skipEncode ? t.data : e.toQueryString(t.data), | |
| a = t.url; | |
| t.failure = t.failure || function () {}, "GET" == t.method && s && s.length > 0 && (a.indexOf("?") > -1 ? a += "&" : a += "?", a += s); | |
| try { | |
| i.open(t.method, a, !0) | |
| } catch (t) { | |
| return | |
| } | |
| if (i.setRequestHeader("Accept", "*/*"), i.setRequestHeader("Content-Type", r), e.isObject(t.headers)) | |
| for (var o in t.headers) e.isDefined(o) && e.isDefined(t.headers[o]) && i.setRequestHeader(o, t.headers[o]); | |
| i.timeout = t.timeout || 0, i.onreadystatechange = function (t, e) { | |
| return function () { | |
| 4 == e.readyState && 200 == e.status ? t.success && t.success.apply(t, [e.responseText]) : 4 == e.readyState && 200 != e.status && t.failure && t.failure.apply(t, [e.responseText]) | |
| } | |
| }(t, i), i.send(s) | |
| }, T.AjaxTransport.prototype._sendViaXDR = function (t) { | |
| var i = e.isDefined(t.skipEncode) && !0 === t.skipEncode && "GET" !== t.method.toUpperCase() ? t.data : e.toQueryString(t.data, null, !1), | |
| r = t.url; | |
| t.failure = t.failure || function () {}, "GET" == t.method && i && i.length > 0 && (i = i.replace("?", ""), r.indexOf("?") > -1 ? r += "&" : r += "?", r += i); | |
| var n = new window.XDomainRequest; | |
| n.onerror = t.failure || function () {}, n.ontimeout = t.failure || function () {}, n.onprogress = function () {}, n.onload = function (t, e) { | |
| return function () { | |
| e.success(t.responseText), t = null, e = null | |
| } | |
| }(n, t), n.timeout = 6e4; | |
| try { | |
| n.open(t.method, r) | |
| } catch (e) { | |
| return void(t.failure && t.failure(e)) | |
| } | |
| e.nextTick(function () { | |
| i ? (e.isString(i) || (i = JSON.stringify(i)), n.send(i)) : n.send() | |
| }) | |
| }, !window.btoa) { | |
| var j = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", | |
| z = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); | |
| window.btoa = function (t) { | |
| var e, i, r, n, s, a; | |
| for (r = t.length, i = 0, e = ""; r > i;) { | |
| if (n = 255 & t.charCodeAt(i++), i == r) { | |
| e += j.charAt(n >> 2), e += j.charAt((3 & n) << 4), e += "=="; | |
| break | |
| } | |
| if (s = t.charCodeAt(i++), i == r) { | |
| e += j.charAt(n >> 2), e += j.charAt((3 & n) << 4 | (240 & s) >> 4), e += j.charAt((15 & s) << 2), e += "="; | |
| break | |
| } | |
| a = t.charCodeAt(i++), e += j.charAt(n >> 2), e += j.charAt((3 & n) << 4 | (240 & s) >> 4), e += j.charAt((15 & s) << 2 | (192 & a) >> 6), e += j.charAt(63 & a) | |
| } | |
| return e | |
| }, window.atob = function (t) { | |
| var e, i, r, n, s, a, o; | |
| for (a = t.length, s = 0, o = ""; a > s;) { | |
| do { | |
| e = z[255 & t.charCodeAt(s++)] | |
| } while (a > s && -1 == e); | |
| if (-1 == e) break; | |
| do { | |
| i = z[255 & t.charCodeAt(s++)] | |
| } while (a > s && -1 == i); | |
| if (-1 == i) break; | |
| o += String.fromCharCode(e << 2 | (48 & i) >> 4); | |
| do { | |
| if (61 == (r = 255 & t.charCodeAt(s++))) return o; | |
| r = z[r] | |
| } while (a > s && -1 == r); | |
| if (-1 == r) break; | |
| o += String.fromCharCode((15 & i) << 4 | (60 & r) >> 2); | |
| do { | |
| if (61 == (n = 255 & t.charCodeAt(s++))) return o; | |
| n = z[n] | |
| } while (a > s && -1 == n); | |
| if (-1 == n) break; | |
| o += String.fromCharCode((3 & r) << 6 | n) | |
| } | |
| return o | |
| } | |
| } | |
| T.b64EncodeUnicode = function (t) { | |
| return btoa(e.enc(t).replace(/%([0-9A-F]{2})/g, function (t, e) { | |
| return String.fromCharCode("0x" + e) | |
| })) | |
| }, T.b64DecodeUnicode = function (t) { | |
| return decodeURIComponent(Array.prototype.map.call(atob(t).split(""), function (t) { | |
| return "%" + ("00" + t.charCodeAt(0).toString(16)).slice(-2) | |
| }).join("")) | |
| }; | |
| var H = { | |
| Util: { | |
| stringToByteArray: function (t) { | |
| var e, i, r = t.split(""); | |
| for (e = 0, i = r.length; e < i; e++) r[e] = (255 & r[e].charCodeAt(0)) >>> 0; | |
| return r | |
| } | |
| } | |
| }; | |
| H.CompressionMethod = { | |
| DEFLATE: 8, | |
| RESERVED: 15 | |
| }, H.BitStream = function (t, e) { | |
| if (this.index = "number" == typeof e ? e : 0, this.bitindex = 0, this.buffer = t instanceof(k ? Uint8Array : Array) ? t : new(k ? Uint8Array : Array)(H.BitStream.DefaultBlockSize), 2 * this.buffer.length <= this.index) throw new Error("invalid index"); | |
| this.buffer.length <= this.index && this.expandBuffer() | |
| }, H.BitStream.DefaultBlockSize = 32768, H.BitStream.prototype.expandBuffer = function () { | |
| var t, e = this.buffer, | |
| i = e.length, | |
| r = new(k ? Uint8Array : Array)(i << 1); | |
| if (k) r.set(e); | |
| else | |
| for (t = 0; t < i; ++t) r[t] = e[t]; | |
| return this.buffer = r | |
| }, H.BitStream.prototype.writeBits = function (t, e, i) { | |
| var r, n = this.buffer, | |
| s = this.index, | |
| a = this.bitindex, | |
| o = n[s]; | |
| if (i && e > 1 && (t = e > 8 ? function (t) { | |
| return H.BitStream.ReverseTable[255 & t] << 24 | H.BitStream.ReverseTable[t >>> 8 & 255] << 16 | H.BitStream.ReverseTable[t >>> 16 & 255] << 8 | H.BitStream.ReverseTable[t >>> 24 & 255] | |
| }(t) >> 32 - e : H.BitStream.ReverseTable[t] >> 8 - e), e + a < 8) o = o << e | t, a += e; | |
| else | |
| for (r = 0; r < e; ++r) o = o << 1 | t >> e - r - 1 & 1, 8 == ++a && (a = 0, n[s++] = H.BitStream.ReverseTable[o], o = 0, s === n.length && (n = this.expandBuffer())); | |
| n[s] = o, this.buffer = n, this.bitindex = a, this.index = s | |
| }, H.BitStream.prototype.finish = function () { | |
| var t, e = this.buffer, | |
| i = this.index; | |
| return this.bitindex > 0 && (e[i] <<= 8 - this.bitindex, e[i] = H.BitStream.ReverseTable[e[i]], i++), k ? t = e.subarray(0, i) : (e.length = i, t = e), t | |
| }, H.BitStream.ReverseTable = function (t) { | |
| return t | |
| }(function () { | |
| var t, e = new(k ? Uint8Array : Array)(256); | |
| for (t = 0; t < 256; ++t) e[t] = function (t) { | |
| var e = t, | |
| i = 7; | |
| for (t >>>= 1; t; t >>>= 1) e <<= 1, e |= 1 & t, --i; | |
| return (e << i & 255) >>> 0 | |
| }(t); | |
| return e | |
| }()), H.Huffman = {}, H.Huffman.buildHuffmanTable = function (t) { | |
| var e, i, r, n, s, a, o, h, f, u, l, c = t.length, | |
| d = 0, | |
| p = Number.POSITIVE_INFINITY; | |
| for (h = 0, f = c; h < f; ++h) t[h] > d && (d = t[h]), t[h] < p && (p = t[h]); | |
| for (e = 1 << d, i = new(k ? Uint32Array : Array)(e), r = 1, n = 0, s = 2; r <= d;) { | |
| for (h = 0; h < c; ++h) | |
| if (t[h] === r) { | |
| for (a = 0, o = n, u = 0; u < r; ++u) a = a << 1 | 1 & o, o >>= 1; | |
| for (l = r << 16 | h, u = a; u < e; u += s) i[u] = l; | |
| ++n | |
| }++ r, n <<= 1, s <<= 1 | |
| } | |
| return [i, d, p] | |
| }, H.Heap = function (t) { | |
| this.buffer = new(k ? Uint16Array : Array)(2 * t), this.length = 0 | |
| }, H.Heap.prototype.getParent = function (t) { | |
| return 2 * ((t - 2) / 4 | 0) | |
| }, H.Heap.prototype.getChild = function (t) { | |
| return 2 * t + 2 | |
| }, H.Heap.prototype.push = function (t, e) { | |
| var i, r, n, s = this.buffer; | |
| for (i = this.length, s[this.length++] = e, s[this.length++] = t; i > 0 && (r = this.getParent(i), s[i] > s[r]);) n = s[i], s[i] = s[r], s[r] = n, n = s[i + 1], s[i + 1] = s[r + 1], s[r + 1] = n, i = r; | |
| return this.length | |
| }, H.Heap.prototype.pop = function () { | |
| var t, e, i, r, n, s = this.buffer; | |
| for (e = s[0], t = s[1], this.length -= 2, s[0] = s[this.length], s[1] = s[this.length + 1], n = 0;;) { | |
| if ((r = this.getChild(n)) >= this.length) break; | |
| if (r + 2 < this.length && s[r + 2] > s[r] && (r += 2), !(s[r] > s[n])) break; | |
| i = s[n], s[n] = s[r], s[r] = i, i = s[n + 1], s[n + 1] = s[r + 1], s[r + 1] = i, n = r | |
| } | |
| return { | |
| index: t, | |
| value: e, | |
| length: this.length | |
| } | |
| }, H.RawDeflate = function (t, e) { | |
| this.compressionType = H.RawDeflate.CompressionType.DYNAMIC, this.lazy = 0, this.freqsLitLen, this.freqsDist, this.input = k && t instanceof Array ? new Uint8Array(t) : t, this.output, this.op = 0, e && (e.lazy && (this.lazy = e.lazy), "number" == typeof e.compressionType && (this.compressionType = e.compressionType), e.outputBuffer && (this.output = k && e.outputBuffer instanceof Array ? new Uint8Array(e.outputBuffer) : e.outputBuffer), "number" == typeof e.outputIndex && (this.op = e.outputIndex)), this.output || (this.output = new(k ? Uint8Array : Array)(32768)) | |
| }, H.RawDeflate.CompressionType = { | |
| NONE: 0, | |
| FIXED: 1, | |
| DYNAMIC: 2, | |
| RESERVED: 3 | |
| }, H.RawDeflate.Lz77MinLength = 3, H.RawDeflate.Lz77MaxLength = 258, H.RawDeflate.WindowSize = 32768, H.RawDeflate.MaxCodeLength = 16, H.RawDeflate.HUFMAX = 286, H.RawDeflate.FixedHuffmanTable = function () { | |
| var t, e = []; | |
| for (t = 0; t < 288; t++) switch (!0) { | |
| case t <= 143: | |
| e.push([t + 48, 8]); | |
| break; | |
| case t <= 255: | |
| e.push([t - 144 + 400, 9]); | |
| break; | |
| case t <= 279: | |
| e.push([t - 256 + 0, 7]); | |
| break; | |
| case t <= 287: | |
| e.push([t - 280 + 192, 8]); | |
| break; | |
| default: | |
| throw "invalid literal: " + t | |
| } | |
| return e | |
| }(), H.RawDeflate.prototype.compress = function () { | |
| var t, e, i, r = this.input; | |
| switch (this.compressionType) { | |
| case H.RawDeflate.CompressionType.NONE: | |
| for (e = 0, i = r.length; e < i;) t = k ? r.subarray(e, e + 65535) : r.slice(e, e + 65535), e += t.length, this.makeNocompressBlock(t, e === i); | |
| break; | |
| case H.RawDeflate.CompressionType.FIXED: | |
| this.output = this.makeFixedHuffmanBlock(r, !0), this.op = this.output.length; | |
| break; | |
| case H.RawDeflate.CompressionType.DYNAMIC: | |
| this.output = this.makeDynamicHuffmanBlock(r, !0), this.op = this.output.length; | |
| break; | |
| default: | |
| throw "invalid compression type" | |
| } | |
| return this.output | |
| }, H.RawDeflate.prototype.makeNocompressBlock = function (t, e) { | |
| var i, r, n, s, a, o, h = this.output, | |
| f = this.op; | |
| if (k) { | |
| for (h = new Uint8Array(this.output.buffer); h.length <= f + t.length + 5;) h = new Uint8Array(h.length << 1); | |
| h.set(this.output) | |
| } | |
| if (i = e ? 1 : 0, r = H.RawDeflate.CompressionType.NONE, h[f++] = i | r << 1, n = t.length, s = 65536 + ~n & 65535, h[f++] = 255 & n, h[f++] = n >>> 8 & 255, h[f++] = 255 & s, h[f++] = s >>> 8 & 255, k) h.set(t, f), f += t.length, h = h.subarray(0, f); | |
| else { | |
| for (a = 0, o = t.length; a < o; ++a) h[f++] = t[a]; | |
| h.length = f | |
| } | |
| return this.op = f, this.output = h, h | |
| }, H.RawDeflate.prototype.makeFixedHuffmanBlock = function (t, e) { | |
| var i, r, n, s = new H.BitStream(k ? new Uint8Array(this.output.buffer) : this.output, this.op); | |
| return i = e ? 1 : 0, r = H.RawDeflate.CompressionType.FIXED, s.writeBits(i, 1, !0), s.writeBits(r, 2, !0), n = this.lz77(t), this.fixedHuffman(n, s), s.finish() | |
| }, H.RawDeflate.prototype.makeDynamicHuffmanBlock = function (t, e) { | |
| var i, r, n, s, a, o, h, f, u, l, c, d, p, g, y, b, w, m = new H.BitStream(k ? new Uint8Array(this.output.buffer) : this.output, this.op), | |
| v = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], | |
| S = new Array(19); | |
| for (i = e ? 1 : 0, r = H.RawDeflate.CompressionType.DYNAMIC, m.writeBits(i, 1, !0), m.writeBits(r, 2, !0), n = this.lz77(t), h = this.getLengths_(this.freqsLitLen, 15), f = this.getCodesFromLengths_(h), u = this.getLengths_(this.freqsDist, 7), l = this.getCodesFromLengths_(u), s = 286; s > 257 && 0 === h[s - 1]; s--); | |
| for (a = 30; a > 1 && 0 === u[a - 1]; a--); | |
| for (c = this.getTreeSymbols_(s, h, a, u), d = this.getLengths_(c.freqs, 7), b = 0; b < 19; b++) S[b] = d[v[b]]; | |
| for (o = 19; o > 4 && 0 === S[o - 1]; o--); | |
| for (p = this.getCodesFromLengths_(d), m.writeBits(s - 257, 5, !0), m.writeBits(a - 1, 5, !0), m.writeBits(o - 4, 4, !0), b = 0; b < o; b++) m.writeBits(S[b], 3, !0); | |
| for (b = 0, w = c.codes.length; b < w; b++) | |
| if (g = c.codes[b], m.writeBits(p[g], d[g], !0), g >= 16) { | |
| switch (b++, g) { | |
| case 16: | |
| y = 2; | |
| break; | |
| case 17: | |
| y = 3; | |
| break; | |
| case 18: | |
| y = 7; | |
| break; | |
| default: | |
| throw "invalid code: " + g | |
| } | |
| m.writeBits(c.codes[b], y, !0) | |
| } return this.dynamicHuffman(n, [f, h], [l, u], m), m.finish() | |
| }, H.RawDeflate.prototype.dynamicHuffman = function (t, e, i, r) { | |
| var n, s, a, o, h, f, u, l; | |
| for (h = e[0], f = e[1], u = i[0], l = i[1], n = 0, s = t.length; n < s; ++n) | |
| if (a = t[n], r.writeBits(h[a], f[a], !0), a > 256) r.writeBits(t[++n], t[++n], !0), o = t[++n], r.writeBits(u[o], l[o], !0), r.writeBits(t[++n], t[++n], !0); | |
| else if (256 === a) break; | |
| return r | |
| }, H.RawDeflate.prototype.fixedHuffman = function (t, e) { | |
| var i, r, n; | |
| for (i = 0, r = t.length; i < r; i++) | |
| if (n = t[i], H.BitStream.prototype.writeBits.apply(e, H.RawDeflate.FixedHuffmanTable[n]), n > 256) e.writeBits(t[++i], t[++i], !0), e.writeBits(t[++i], 5), e.writeBits(t[++i], t[++i], !0); | |
| else if (256 === n) break; | |
| return e | |
| }, H.RawDeflate.Lz77Match = function (t, e) { | |
| this.length = t, this.backwardDistance = e | |
| }, H.RawDeflate.Lz77Match.LengthCodeTable = function (t) { | |
| return k ? new Uint32Array(t) : t | |
| }(function () { | |
| var t, e, i = []; | |
| for (t = 3; t <= 258; t++) e = function (t) { | |
| switch (!0) { | |
| case 3 === t: | |
| return [257, t - 3, 0]; | |
| case 4 === t: | |
| return [258, t - 4, 0]; | |
| case 5 === t: | |
| return [259, t - 5, 0]; | |
| case 6 === t: | |
| return [260, t - 6, 0]; | |
| case 7 === t: | |
| return [261, t - 7, 0]; | |
| case 8 === t: | |
| return [262, t - 8, 0]; | |
| case 9 === t: | |
| return [263, t - 9, 0]; | |
| case 10 === t: | |
| return [264, t - 10, 0]; | |
| case t <= 12: | |
| return [265, t - 11, 1]; | |
| case t <= 14: | |
| return [266, t - 13, 1]; | |
| case t <= 16: | |
| return [267, t - 15, 1]; | |
| case t <= 18: | |
| return [268, t - 17, 1]; | |
| case t <= 22: | |
| return [269, t - 19, 2]; | |
| case t <= 26: | |
| return [270, t - 23, 2]; | |
| case t <= 30: | |
| return [271, t - 27, 2]; | |
| case t <= 34: | |
| return [272, t - 31, 2]; | |
| case t <= 42: | |
| return [273, t - 35, 3]; | |
| case t <= 50: | |
| return [274, t - 43, 3]; | |
| case t <= 58: | |
| return [275, t - 51, 3]; | |
| case t <= 66: | |
| return [276, t - 59, 3]; | |
| case t <= 82: | |
| return [277, t - 67, 4]; | |
| case t <= 98: | |
| return [278, t - 83, 4]; | |
| case t <= 114: | |
| return [279, t - 99, 4]; | |
| case t <= 130: | |
| return [280, t - 115, 4]; | |
| case t <= 162: | |
| return [281, t - 131, 5]; | |
| case t <= 194: | |
| return [282, t - 163, 5]; | |
| case t <= 226: | |
| return [283, t - 195, 5]; | |
| case t <= 257: | |
| return [284, t - 227, 5]; | |
| case 258 === t: | |
| return [285, t - 258, 0]; | |
| default: | |
| throw "invalid length: " + t | |
| } | |
| }(t), i[t] = e[2] << 24 | e[1] << 16 | e[0]; | |
| return i | |
| }()), H.RawDeflate.Lz77Match.prototype.getDistanceCode_ = function (t) { | |
| var e; | |
| switch (!0) { | |
| case 1 === t: | |
| e = [0, t - 1, 0]; | |
| break; | |
| case 2 === t: | |
| e = [1, t - 2, 0]; | |
| break; | |
| case 3 === t: | |
| e = [2, t - 3, 0]; | |
| break; | |
| case 4 === t: | |
| e = [3, t - 4, 0]; | |
| break; | |
| case t <= 6: | |
| e = [4, t - 5, 1]; | |
| break; | |
| case t <= 8: | |
| e = [5, t - 7, 1]; | |
| break; | |
| case t <= 12: | |
| e = [6, t - 9, 2]; | |
| break; | |
| case t <= 16: | |
| e = [7, t - 13, 2]; | |
| break; | |
| case t <= 24: | |
| e = [8, t - 17, 3]; | |
| break; | |
| case t <= 32: | |
| e = [9, t - 25, 3]; | |
| break; | |
| case t <= 48: | |
| e = [10, t - 33, 4]; | |
| break; | |
| case t <= 64: | |
| e = [11, t - 49, 4]; | |
| break; | |
| case t <= 96: | |
| e = [12, t - 65, 5]; | |
| break; | |
| case t <= 128: | |
| e = [13, t - 97, 5]; | |
| break; | |
| case t <= 192: | |
| e = [14, t - 129, 6]; | |
| break; | |
| case t <= 256: | |
| e = [15, t - 193, 6]; | |
| break; | |
| case t <= 384: | |
| e = [16, t - 257, 7]; | |
| break; | |
| case t <= 512: | |
| e = [17, t - 385, 7]; | |
| break; | |
| case t <= 768: | |
| e = [18, t - 513, 8]; | |
| break; | |
| case t <= 1024: | |
| e = [19, t - 769, 8]; | |
| break; | |
| case t <= 1536: | |
| e = [20, t - 1025, 9]; | |
| break; | |
| case t <= 2048: | |
| e = [21, t - 1537, 9]; | |
| break; | |
| case t <= 3072: | |
| e = [22, t - 2049, 10]; | |
| break; | |
| case t <= 4096: | |
| e = [23, t - 3073, 10]; | |
| break; | |
| case t <= 6144: | |
| e = [24, t - 4097, 11]; | |
| break; | |
| case t <= 8192: | |
| e = [25, t - 6145, 11]; | |
| break; | |
| case t <= 12288: | |
| e = [26, t - 8193, 12]; | |
| break; | |
| case t <= 16384: | |
| e = [27, t - 12289, 12]; | |
| break; | |
| case t <= 24576: | |
| e = [28, t - 16385, 13]; | |
| break; | |
| case t <= 32768: | |
| e = [29, t - 24577, 13]; | |
| break; | |
| default: | |
| throw "invalid distance" | |
| } | |
| return e | |
| }, H.RawDeflate.Lz77Match.prototype.toLz77Array = function () { | |
| var t, e = this.length, | |
| i = this.backwardDistance, | |
| r = [], | |
| n = 0; | |
| return t = H.RawDeflate.Lz77Match.LengthCodeTable[e], r[n++] = 65535 & t, r[n++] = t >> 16 & 255, r[n++] = t >> 24, t = this.getDistanceCode_(i), r[n++] = t[0], r[n++] = t[1], r[n++] = t[2], r | |
| }, H.RawDeflate.prototype.lz77 = function (t) { | |
| function e(t, e) { | |
| var i, r, n = t.toLz77Array(); | |
| for (i = 0, r = n.length; i < r; ++i) d[p++] = n[i]; | |
| y[n[0]]++, b[n[3]]++, g = t.length + e - 1, f = null | |
| } | |
| var i, r, n, s, a, o, h, f, u, l = {}, | |
| c = H.RawDeflate.WindowSize, | |
| d = k ? new Uint16Array(2 * t.length) : [], | |
| p = 0, | |
| g = 0, | |
| y = new(k ? Uint32Array : Array)(286), | |
| b = new(k ? Uint32Array : Array)(30), | |
| w = this.lazy; | |
| if (!k) { | |
| for (n = 0; n <= 285;) y[n++] = 0; | |
| for (n = 0; n <= 29;) b[n++] = 0 | |
| } | |
| for (y[256] = 1, i = 0, r = t.length; i < r; ++i) { | |
| for (a = 0, n = 0, s = H.RawDeflate.Lz77MinLength; n < s && i + n !== r; ++n) a = a << 8 | t[i + n]; | |
| if (void 0 === l[a] && (l[a] = []), o = l[a], g-- > 0) o.push(i); | |
| else { | |
| for (; o.length > 0 && i - o[0] > c;) o.shift(); | |
| if (i + H.RawDeflate.Lz77MinLength >= r) { | |
| for (f && e(f, -1), n = 0, s = r - i; n < s; ++n) u = t[i + n], d[p++] = u, ++y[u]; | |
| break | |
| } | |
| o.length > 0 ? (h = this.searchLongestMatch_(t, i, o), f ? f.length < h.length ? (u = t[i - 1], d[p++] = u, ++y[u], e(h, 0)) : e(f, -1) : h.length < w ? f = h : e(h, 0)) : f ? e(f, -1) : (u = t[i], d[p++] = u, ++y[u]), o.push(i) | |
| } | |
| } | |
| return d[p++] = 256, y[256]++, this.freqsLitLen = y, this.freqsDist = b, k ? d.subarray(0, p) : d | |
| }, H.RawDeflate.prototype.searchLongestMatch_ = function (t, e, i) { | |
| var r, n, s, a, o, h, f = 0, | |
| u = t.length; | |
| t: for (a = 0, h = i.length; a < h; a++) { | |
| if (r = i[h - a - 1], s = H.RawDeflate.Lz77MinLength, f > H.RawDeflate.Lz77MinLength) { | |
| for (o = f; o > H.RawDeflate.Lz77MinLength; o--) | |
| if (t[r + o - 1] !== t[e + o - 1]) continue t; | |
| s = f | |
| } | |
| for (; s < H.RawDeflate.Lz77MaxLength && e + s < u && t[r + s] === t[e + s];) ++s; | |
| if (s > f && (n = r, f = s), s === H.RawDeflate.Lz77MaxLength) break | |
| } | |
| return new H.RawDeflate.Lz77Match(f, e - n) | |
| }, H.RawDeflate.prototype.getTreeSymbols_ = function (t, e, i, r) { | |
| var n, s, a, o, h, f, u = new(k ? Uint32Array : Array)(t + i), | |
| l = new(k ? Uint32Array : Array)(316), | |
| c = new(k ? Uint8Array : Array)(19); | |
| for (s = 0, n = 0; n < t; n++) u[s++] = e[n]; | |
| for (n = 0; n < i; n++) u[s++] = r[n]; | |
| if (!k) | |
| for (n = 0, o = c.length; n < o; ++n) c[n] = 0; | |
| for (h = 0, n = 0, o = u.length; n < o; n += s) { | |
| for (s = 1; n + s < o && u[n + s] === u[n]; ++s); | |
| if (a = s, 0 === u[n]) | |
| if (a < 3) | |
| for (; a-- > 0;) l[h++] = 0, c[0]++; | |
| else | |
| for (; a > 0;) f = a < 138 ? a : 138, f > a - 3 && f < a && (f = a - 3), f <= 10 ? (l[h++] = 17, l[h++] = f - 3, c[17]++) : (l[h++] = 18, l[h++] = f - 11, c[18]++), a -= f; | |
| else if (l[h++] = u[n], c[u[n]]++, --a < 3) | |
| for (; a-- > 0;) l[h++] = u[n], c[u[n]]++; | |
| else | |
| for (; a > 0;) f = a < 6 ? a : 6, f > a - 3 && f < a && (f = a - 3), l[h++] = 16, l[h++] = f - 3, c[16]++, a -= f | |
| } | |
| return { | |
| codes: k ? l.subarray(0, h) : l.slice(0, h), | |
| freqs: c | |
| } | |
| }, H.RawDeflate.prototype.getLengths_ = function (t, e) { | |
| var i, r, n, s, a, o = t.length, | |
| h = new H.Heap(2 * H.RawDeflate.HUFMAX), | |
| f = new(k ? Uint8Array : Array)(o); | |
| if (!k) | |
| for (s = 0; s < o; s++) f[s] = 0; | |
| for (s = 0; s < o; ++s) t[s] > 0 && h.push(s, t[s]); | |
| if (i = new Array(h.length / 2), r = new(k ? Uint32Array : Array)(h.length / 2), 1 === i.length) return f[h.pop().index] = 1, f; | |
| for (s = 0, a = h.length / 2; s < a; ++s) i[s] = h.pop(), r[s] = i[s].value; | |
| for (n = this.reversePackageMerge_(r, r.length, e), s = 0, a = i.length; s < a; ++s) f[i[s].index] = n[s]; | |
| return f | |
| }, H.RawDeflate.prototype.reversePackageMerge_ = function (t, e, i) { | |
| function r(t) { | |
| var i = d[t][p[t]]; | |
| i === e ? (r(t + 1), r(t + 1)) : --l[i], ++p[t] | |
| } | |
| var n, s, a, o, h, f = new(k ? Uint16Array : Array)(i), | |
| u = new(k ? Uint8Array : Array)(i), | |
| l = new(k ? Uint8Array : Array)(e), | |
| c = new Array(i), | |
| d = new Array(i), | |
| p = new Array(i), | |
| g = (1 << i) - e, | |
| y = 1 << i - 1; | |
| for (f[i - 1] = e, s = 0; s < i; ++s) g < y ? u[s] = 0 : (u[s] = 1, g -= y), g <<= 1, f[i - 2 - s] = (f[i - 1 - s] / 2 | 0) + e; | |
| for (f[0] = u[0], c[0] = new Array(f[0]), d[0] = new Array(f[0]), s = 1; s < i; ++s) f[s] > 2 * f[s - 1] + u[s] && (f[s] = 2 * f[s - 1] + u[s]), c[s] = new Array(f[s]), d[s] = new Array(f[s]); | |
| for (n = 0; n < e; ++n) l[n] = i; | |
| for (a = 0; a < f[i - 1]; ++a) c[i - 1][a] = t[a], d[i - 1][a] = a; | |
| for (n = 0; n < i; ++n) p[n] = 0; | |
| for (1 === u[i - 1] && (--l[0], ++p[i - 1]), s = i - 2; s >= 0; --s) { | |
| for (n = 0, o = 0, h = p[s + 1], a = 0; a < f[s]; a++) o = c[s + 1][h] + c[s + 1][h + 1], o > t[n] ? (c[s][a] = o, d[s][a] = e, h += 2) : (c[s][a] = t[n], d[s][a] = n, ++n); | |
| p[s] = 0, 1 === u[s] && r(s) | |
| } | |
| return l | |
| }, H.RawDeflate.prototype.getCodesFromLengths_ = function (t) { | |
| var e, i, r, n, s = new(k ? Uint16Array : Array)(t.length), | |
| a = [], | |
| o = [], | |
| h = 0; | |
| for (e = 0, i = t.length; e < i; e++) a[t[e]] = 1 + (0 | a[t[e]]); | |
| for (e = 1, i = H.RawDeflate.MaxCodeLength; e <= i; e++) o[e] = h, h += 0 | a[e], h <<= 1; | |
| for (e = 0, i = t.length; e < i; e++) | |
| for (h = o[t[e]], o[t[e]] += 1, s[e] = 0, r = 0, n = t[e]; r < n; r++) s[e] = s[e] << 1 | 1 & h, h >>>= 1; | |
| return s | |
| }; | |
| var W = H.Huffman.buildHuffmanTable; | |
| H.RawInflate = function (t, e) { | |
| switch (this.buffer, this.blocks = [], this.bufferSize = ZLIB_RAW_INFLATE_BUFFER_SIZE, this.totalpos = 0, this.ip = 0, this.bitsbuf = 0, this.bitsbuflen = 0, this.input = k ? new Uint8Array(t) : t, this.output, this.op, this.bfinal = !1, this.bufferType = H.RawInflate.BufferType.ADAPTIVE, this.resize = !1, this.prev, !e && (e = {}) || (e.index && (this.ip = e.index), e.bufferSize && (this.bufferSize = e.bufferSize), e.bufferType && (this.bufferType = e.bufferType), e.resize && (this.resize = e.resize)), this.bufferType) { | |
| case H.RawInflate.BufferType.BLOCK: | |
| this.op = H.RawInflate.MaxBackwardLength, this.output = new(k ? Uint8Array : Array)(H.RawInflate.MaxBackwardLength + this.bufferSize + H.RawInflate.MaxCopyLength); | |
| break; | |
| case H.RawInflate.BufferType.ADAPTIVE: | |
| this.op = 0, this.output = new(k ? Uint8Array : Array)(this.bufferSize), this.expandBuffer = this.expandBufferAdaptive, this.concatBuffer = this.concatBufferDynamic, this.decodeHuffman = this.decodeHuffmanAdaptive; | |
| break; | |
| default: | |
| throw new Error("invalid inflate mode") | |
| } | |
| }, H.RawInflate.BufferType = { | |
| BLOCK: 0, | |
| ADAPTIVE: 1 | |
| }, H.RawInflate.prototype.decompress = function () { | |
| for (; !this.bfinal;) this.parseBlock(); | |
| return this.concatBuffer() | |
| }, H.RawInflate.MaxBackwardLength = 32768, H.RawInflate.MaxCopyLength = 258, H.RawInflate.Order = function (t) { | |
| return k ? new Uint16Array(t) : t | |
| }([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), H.RawInflate.LengthCodeTable = function (t) { | |
| return k ? new Uint16Array(t) : t | |
| }([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258]), H.RawInflate.LengthExtraTable = function (t) { | |
| return k ? new Uint8Array(t) : t | |
| }([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0]), H.RawInflate.DistCodeTable = function (t) { | |
| return k ? new Uint16Array(t) : t | |
| }([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577]), H.RawInflate.DistExtraTable = function (t) { | |
| return k ? new Uint8Array(t) : t | |
| }([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]), H.RawInflate.FixedLiteralLengthTable = function (t) { | |
| return t | |
| }(function () { | |
| var t, e, i = new(k ? Uint8Array : Array)(288); | |
| for (t = 0, e = i.length; t < e; ++t) i[t] = t <= 143 ? 8 : t <= 255 ? 9 : t <= 279 ? 7 : 8; | |
| return W(i) | |
| }()), H.RawInflate.FixedDistanceTable = function (t) { | |
| return t | |
| }(function () { | |
| var t, e, i = new(k ? Uint8Array : Array)(30); | |
| for (t = 0, e = i.length; t < e; ++t) i[t] = 5; | |
| return W(i) | |
| }()), H.RawInflate.prototype.parseBlock = function () { | |
| var t = this.readBits(3); | |
| switch (1 & t && (this.bfinal = !0), t >>>= 1) { | |
| case 0: | |
| this.parseUncompressedBlock(); | |
| break; | |
| case 1: | |
| this.parseFixedHuffmanBlock(); | |
| break; | |
| case 2: | |
| this.parseDynamicHuffmanBlock(); | |
| break; | |
| default: | |
| throw new Error("unknown BTYPE: " + t) | |
| } | |
| }, H.RawInflate.prototype.readBits = function (t) { | |
| for (var e, i = this.bitsbuf, r = this.bitsbuflen, n = this.input, s = this.ip, a = n.length; r < t;) { | |
| if (s >= a) throw new Error("input buffer is broken"); | |
| i |= n[s++] << r, r += 8 | |
| } | |
| return e = i & (1 << t) - 1, i >>>= t, r -= t, this.bitsbuf = i, this.bitsbuflen = r, this.ip = s, e | |
| }, H.RawInflate.prototype.readCodeByTable = function (t) { | |
| for (var e, i, r = this.bitsbuf, n = this.bitsbuflen, s = this.input, a = this.ip, o = s.length, h = t[0], f = t[1]; n < f && !(a >= o);) r |= s[a++] << n, n += 8; | |
| return e = h[r & (1 << f) - 1], i = e >>> 16, this.bitsbuf = r >> i, this.bitsbuflen = n - i, this.ip = a, 65535 & e | |
| }, H.RawInflate.prototype.parseUncompressedBlock = function () { | |
| var t, e, i, r = this.input, | |
| n = this.ip, | |
| s = this.output, | |
| a = this.op, | |
| o = r.length, | |
| h = s.length; | |
| if (this.bitsbuf = 0, this.bitsbuflen = 0, n + 1 >= o) throw new Error("invalid uncompressed block header: LEN"); | |
| if (t = r[n++] | r[n++] << 8, n + 1 >= o) throw new Error("invalid uncompressed block header: NLEN"); | |
| if (e = r[n++] | r[n++] << 8, t === ~e) throw new Error("invalid uncompressed block header: length verify"); | |
| if (n + t > r.length) throw new Error("input buffer is broken"); | |
| switch (this.bufferType) { | |
| case H.RawInflate.BufferType.BLOCK: | |
| for (; a + t > s.length;) { | |
| if (i = h - a, t -= i, k) s.set(r.subarray(n, n + i), a), a += i, n += i; | |
| else | |
| for (; i--;) s[a++] = r[n++]; | |
| this.op = a, s = this.expandBuffer(), a = this.op | |
| } | |
| break; | |
| case H.RawInflate.BufferType.ADAPTIVE: | |
| for (; a + t > s.length;) s = this.expandBuffer({ | |
| fixRatio: 2 | |
| }); | |
| break; | |
| default: | |
| throw new Error("invalid inflate mode") | |
| } | |
| if (k) s.set(r.subarray(n, n + t), a), a += t, n += t; | |
| else | |
| for (; t--;) s[a++] = r[n++]; | |
| this.ip = n, this.op = a, this.output = s | |
| }, H.RawInflate.prototype.parseFixedHuffmanBlock = function () { | |
| this.decodeHuffman(H.RawInflate.FixedLiteralLengthTable, H.RawInflate.FixedDistanceTable) | |
| }, H.RawInflate.prototype.parseDynamicHuffmanBlock = function () { | |
| function t(t, e, i) { | |
| var r, n, s, a = this.prev; | |
| for (s = 0; s < t;) switch (r = this.readCodeByTable(e)) { | |
| case 16: | |
| for (n = 3 + this.readBits(2); n--;) i[s++] = a; | |
| break; | |
| case 17: | |
| for (n = 3 + this.readBits(3); n--;) i[s++] = 0; | |
| a = 0; | |
| break; | |
| case 18: | |
| for (n = 11 + this.readBits(7); n--;) i[s++] = 0; | |
| a = 0; | |
| break; | |
| default: | |
| i[s++] = r, a = r | |
| } | |
| return this.prev = a, i | |
| } | |
| var e, i, r, n, s = this.readBits(5) + 257, | |
| a = this.readBits(5) + 1, | |
| o = this.readBits(4) + 4, | |
| h = new(k ? Uint8Array : Array)(H.RawInflate.Order.length); | |
| for (n = 0; n < o; ++n) h[H.RawInflate.Order[n]] = this.readBits(3); | |
| if (!k) | |
| for (n = o, o = h.length; n < o; ++n) h[H.RawInflate.Order[n]] = 0; | |
| e = W(h), i = new(k ? Uint8Array : Array)(s), r = new(k ? Uint8Array : Array)(a), this.prev = 0, this.decodeHuffman(W(t.call(this, s, e, i)), W(t.call(this, a, e, r))) | |
| }, H.RawInflate.prototype.decodeHuffman = function (t, e) { | |
| var i = this.output, | |
| r = this.op; | |
| this.currentLitlenTable = t; | |
| for (var n, s, a, o, h = i.length - H.RawInflate.MaxCopyLength; 256 !== (n = this.readCodeByTable(t));) | |
| if (n < 256) r >= h && (this.op = r, i = this.expandBuffer(), r = this.op), i[r++] = n; | |
| else | |
| for (s = n - 257, o = H.RawInflate.LengthCodeTable[s], H.RawInflate.LengthExtraTable[s] > 0 && (o += this.readBits(H.RawInflate.LengthExtraTable[s])), n = this.readCodeByTable(e), a = H.RawInflate.DistCodeTable[n], H.RawInflate.DistExtraTable[n] > 0 && (a += this.readBits(H.RawInflate.DistExtraTable[n])), r >= h && (this.op = r, i = this.expandBuffer(), r = this.op); o--;) i[r] = i[r++ - a]; | |
| for (; this.bitsbuflen >= 8;) this.bitsbuflen -= 8, this.ip--; | |
| this.op = r | |
| }, H.RawInflate.prototype.decodeHuffmanAdaptive = function (t, e) { | |
| var i = this.output, | |
| r = this.op; | |
| this.currentLitlenTable = t; | |
| for (var n, s, a, o, h = i.length; 256 !== (n = this.readCodeByTable(t));) | |
| if (n < 256) r >= h && (i = this.expandBuffer(), h = i.length), i[r++] = n; | |
| else | |
| for (s = n - 257, o = H.RawInflate.LengthCodeTable[s], H.RawInflate.LengthExtraTable[s] > 0 && (o += this.readBits(H.RawInflate.LengthExtraTable[s])), n = this.readCodeByTable(e), a = H.RawInflate.DistCodeTable[n], H.RawInflate.DistExtraTable[n] > 0 && (a += this.readBits(H.RawInflate.DistExtraTable[n])), r + o > h && (i = this.expandBuffer(), h = i.length); o--;) i[r] = i[r++ - a]; | |
| for (; this.bitsbuflen >= 8;) this.bitsbuflen -= 8, this.ip--; | |
| this.op = r | |
| }, H.RawInflate.prototype.expandBuffer = function (t) { | |
| var e, i, r = new(k ? Uint8Array : Array)(this.op - H.RawInflate.MaxBackwardLength), | |
| n = this.op - H.RawInflate.MaxBackwardLength, | |
| s = this.output; | |
| if (k) r.set(s.subarray(H.RawInflate.MaxBackwardLength, r.length)); | |
| else | |
| for (e = 0, i = r.length; e < i; ++e) r[e] = s[e + H.RawInflate.MaxBackwardLength]; | |
| if (this.blocks.push(r), this.totalpos += r.length, k) s.set(s.subarray(n, n + H.RawInflate.MaxBackwardLength)); | |
| else | |
| for (e = 0; e < H.RawInflate.MaxBackwardLength; ++e) s[e] = s[n + e]; | |
| return this.op = H.RawInflate.MaxBackwardLength, s | |
| }, H.RawInflate.prototype.expandBufferAdaptive = function (t) { | |
| var e, i, r, n, s = this.input.length / this.ip + 1 | 0, | |
| a = this.input, | |
| o = this.output; | |
| return t && ("number" == typeof t.fixRatio && (s = t.fixRatio), "number" == typeof t.addRatio && (s += t.addRatio)), s < 2 ? (i = (a.length - this.ip) / this.currentLitlenTable[2], n = i / 2 * 258 | 0, r = n < o.length ? o.length + n : o.length << 1) : r = o.length * s, k ? (e = new Uint8Array(r), e.set(o)) : e = o, this.output = e, this.output | |
| }, H.RawInflate.prototype.concatBuffer = function () { | |
| var t, e, i, r, n, s = 0, | |
| a = this.totalpos + (this.op - H.RawInflate.MaxBackwardLength), | |
| o = this.output, | |
| h = this.blocks, | |
| f = new(k ? Uint8Array : Array)(a); | |
| if (0 === h.length) return k ? this.output.subarray(H.RawInflate.MaxBackwardLength, this.op) : this.output.slice(H.RawInflate.MaxBackwardLength, this.op); | |
| for (e = 0, i = h.length; e < i; ++e) | |
| for (t = h[e], r = 0, n = t.length; r < n; ++r) f[s++] = t[r]; | |
| for (e = H.RawInflate.MaxBackwardLength, i = this.op; e < i; ++e) f[s++] = o[e]; | |
| return this.blocks = [], this.buffer = f, this.buffer | |
| }, H.RawInflate.prototype.concatBufferDynamic = function () { | |
| var t, e = this.op; | |
| return k ? this.resize ? (t = new Uint8Array(e), t.set(this.output.subarray(0, e))) : t = this.output.subarray(0, e) : (this.output.length > e && (this.output.length = e), t = this.output), this.buffer = t, this.buffer | |
| }, H.RawInflate = function (t, e) { | |
| switch (this.buffer, this.blocks = [], this.bufferSize = 32768, this.totalpos = 0, this.ip = 0, this.bitsbuf = 0, this.bitsbuflen = 0, this.input = k ? new Uint8Array(t) : t, this.output, this.op, this.bfinal = !1, this.bufferType = H.RawInflate.BufferType.ADAPTIVE, this.resize = !1, this.prev, !e && (e = {}) || (e.index && (this.ip = e.index), e.bufferSize && (this.bufferSize = e.bufferSize), e.bufferType && (this.bufferType = e.bufferType), e.resize && (this.resize = e.resize)), this.bufferType) { | |
| case H.RawInflate.BufferType.BLOCK: | |
| this.op = H.RawInflate.MaxBackwardLength, this.output = new(k ? Uint8Array : Array)(H.RawInflate.MaxBackwardLength + this.bufferSize + H.RawInflate.MaxCopyLength); | |
| break; | |
| case H.RawInflate.BufferType.ADAPTIVE: | |
| this.op = 0, this.output = new(k ? Uint8Array : Array)(this.bufferSize), this.expandBuffer = this.expandBufferAdaptive, this.concatBuffer = this.concatBufferDynamic, this.decodeHuffman = this.decodeHuffmanAdaptive | |
| } | |
| }, H.RawInflate.BufferType = { | |
| BLOCK: 0, | |
| ADAPTIVE: 1 | |
| }, H.RawInflate.prototype.decompress = function () { | |
| for (; !this.bfinal;) this.parseBlock(); | |
| return this.concatBuffer() | |
| }, H.RawInflate.MaxBackwardLength = 32768, H.RawInflate.MaxCopyLength = 258, H.RawInflate.Order = function (t) { | |
| return k ? new Uint16Array(t) : t | |
| }([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), H.RawInflate.LengthCodeTable = function (t) { | |
| return k ? new Uint16Array(t) : t | |
| }([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258]), H.RawInflate.LengthExtraTable = function (t) { | |
| return k ? new Uint8Array(t) : t | |
| }([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0]), H.RawInflate.DistCodeTable = function (t) { | |
| return k ? new Uint16Array(t) : t | |
| }([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577]), H.RawInflate.DistExtraTable = function (t) { | |
| return k ? new Uint8Array(t) : t | |
| }([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]), H.RawInflate.FixedLiteralLengthTable = function (t) { | |
| return t | |
| }(function () { | |
| var t, e, i = new(k ? Uint8Array : Array)(288); | |
| for (t = 0, e = i.length; t < e; ++t) i[t] = t <= 143 ? 8 : t <= 255 ? 9 : t <= 279 ? 7 : 8; | |
| return W(i) | |
| }()), H.RawInflate.FixedDistanceTable = function (t) { | |
| return t | |
| }(function () { | |
| var t, e, i = new(k ? Uint8Array : Array)(30); | |
| for (t = 0, e = i.length; t < e; ++t) i[t] = 5; | |
| return W(i) | |
| }()), H.RawInflate.prototype.parseBlock = function () { | |
| var t = this.readBits(3); | |
| switch (1 & t && (this.bfinal = !0), t >>>= 1) { | |
| case 0: | |
| this.parseUncompressedBlock(); | |
| break; | |
| case 1: | |
| this.parseFixedHuffmanBlock(); | |
| break; | |
| case 2: | |
| this.parseDynamicHuffmanBlock(); | |
| break; | |
| default: | |
| throw new Error("unknown BTYPE: " + t) | |
| } | |
| }, H.RawInflate.prototype.readBits = function (t) { | |
| for (var e, i = this.bitsbuf, r = this.bitsbuflen, n = this.input, s = this.ip, a = n.length; r < t;) { | |
| if (s >= a) throw new Error("input buffer is broken"); | |
| i |= n[s++] << r, r += 8 | |
| } | |
| return e = i & (1 << t) - 1, i >>>= t, r -= t, this.bitsbuf = i, this.bitsbuflen = r, this.ip = s, e | |
| }, H.RawInflate.prototype.readCodeByTable = function (t) { | |
| for (var e, i, r = this.bitsbuf, n = this.bitsbuflen, s = this.input, a = this.ip, o = s.length, h = t[0], f = t[1]; n < f && !(a >= o);) r |= s[a++] << n, n += 8; | |
| return e = h[r & (1 << f) - 1], i = e >>> 16, this.bitsbuf = r >> i, this.bitsbuflen = n - i, this.ip = a, 65535 & e | |
| }, H.RawInflate.prototype.parseUncompressedBlock = function () { | |
| var t, e, i, r = this.input, | |
| n = this.ip, | |
| s = this.output, | |
| a = this.op, | |
| o = r.length, | |
| h = s.length; | |
| if (this.bitsbuf = 0, this.bitsbuflen = 0, n + 1 >= o) throw new Error("invalid uncompressed block header: LEN"); | |
| if (t = r[n++] | r[n++] << 8, n + 1 >= o) throw new Error("invalid uncompressed block header: NLEN"); | |
| if (e = r[n++] | r[n++] << 8, t === ~e) throw new Error("invalid uncompressed block header: length verify"); | |
| if (n + t > r.length) throw new Error("input buffer is broken"); | |
| switch (this.bufferType) { | |
| case H.RawInflate.BufferType.BLOCK: | |
| for (; a + t > s.length;) { | |
| if (i = h - a, t -= i, k) s.set(r.subarray(n, n + i), a), a += i, n += i; | |
| else | |
| for (; i--;) s[a++] = r[n++]; | |
| this.op = a, s = this.expandBuffer(), a = this.op | |
| } | |
| break; | |
| case H.RawInflate.BufferType.ADAPTIVE: | |
| for (; a + t > s.length;) s = this.expandBuffer({ | |
| fixRatio: 2 | |
| }); | |
| break; | |
| default: | |
| throw new Error("invalid inflate mode") | |
| } | |
| if (k) s.set(r.subarray(n, n + t), a), a += t, n += t; | |
| else | |
| for (; t--;) s[a++] = r[n++]; | |
| this.ip = n, this.op = a, this.output = s | |
| }, H.RawInflate.prototype.parseFixedHuffmanBlock = function () { | |
| this.decodeHuffman(H.RawInflate.FixedLiteralLengthTable, H.RawInflate.FixedDistanceTable) | |
| }, H.RawInflate.prototype.parseDynamicHuffmanBlock = function () { | |
| function t(t, e, i) { | |
| var r, n, s, a = this.prev; | |
| for (s = 0; s < t;) switch (r = this.readCodeByTable(e)) { | |
| case 16: | |
| for (n = 3 + this.readBits(2); n--;) i[s++] = a; | |
| break; | |
| case 17: | |
| for (n = 3 + this.readBits(3); n--;) i[s++] = 0; | |
| a = 0; | |
| break; | |
| case 18: | |
| for (n = 11 + this.readBits(7); n--;) i[s++] = 0; | |
| a = 0; | |
| break; | |
| default: | |
| i[s++] = r, a = r | |
| } | |
| return this.prev = a, i | |
| } | |
| var e, i, r, n, s = this.readBits(5) + 257, | |
| a = this.readBits(5) + 1, | |
| o = this.readBits(4) + 4, | |
| h = new(k ? Uint8Array : Array)(H.RawInflate.Order.length); | |
| for (n = 0; n < o; ++n) h[H.RawInflate.Order[n]] = this.readBits(3); | |
| if (!k) | |
| for (n = o, o = h.length; n < o; ++n) h[H.RawInflate.Order[n]] = 0; | |
| e = W(h), i = new(k ? Uint8Array : Array)(s), r = new(k ? Uint8Array : Array)(a), this.prev = 0, this.decodeHuffman(W(t.call(this, s, e, i)), W(t.call(this, a, e, r))) | |
| }, H.RawInflate.prototype.decodeHuffman = function (t, e) { | |
| var i = this.output, | |
| r = this.op; | |
| this.currentLitlenTable = t; | |
| for (var n, s, a, o, h = i.length - H.RawInflate.MaxCopyLength; 256 !== (n = this.readCodeByTable(t));) | |
| if (n < 256) r >= h && (this.op = r, i = this.expandBuffer(), r = this.op), i[r++] = n; | |
| else | |
| for (s = n - 257, o = H.RawInflate.LengthCodeTable[s], H.RawInflate.LengthExtraTable[s] > 0 && (o += this.readBits(H.RawInflate.LengthExtraTable[s])), n = this.readCodeByTable(e), a = H.RawInflate.DistCodeTable[n], H.RawInflate.DistExtraTable[n] > 0 && (a += this.readBits(H.RawInflate.DistExtraTable[n])), r >= h && (this.op = r, i = this.expandBuffer(), r = this.op); o--;) i[r] = i[r++ - a]; | |
| for (; this.bitsbuflen >= 8;) this.bitsbuflen -= 8, this.ip--; | |
| this.op = r | |
| }, H.RawInflate.prototype.decodeHuffmanAdaptive = function (t, e) { | |
| var i = this.output, | |
| r = this.op; | |
| this.currentLitlenTable = t; | |
| for (var n, s, a, o, h = i.length; 256 !== (n = this.readCodeByTable(t));) | |
| if (n < 256) r >= h && (i = this.expandBuffer(), h = i.length), i[r++] = n; | |
| else | |
| for (s = n - 257, o = H.RawInflate.LengthCodeTable[s], H.RawInflate.LengthExtraTable[s] > 0 && (o += this.readBits(H.RawInflate.LengthExtraTable[s])), n = this.readCodeByTable(e), a = H.RawInflate.DistCodeTable[n], H.RawInflate.DistExtraTable[n] > 0 && (a += this.readBits(H.RawInflate.DistExtraTable[n])), r + o > h && (i = this.expandBuffer(), h = i.length); o--;) i[r] = i[r++ - a]; | |
| for (; this.bitsbuflen >= 8;) this.bitsbuflen -= 8, this.ip--; | |
| this.op = r | |
| }, H.RawInflate.prototype.expandBuffer = function (t) { | |
| var e, i, r = new(k ? Uint8Array : Array)(this.op - H.RawInflate.MaxBackwardLength), | |
| n = this.op - H.RawInflate.MaxBackwardLength, | |
| s = this.output; | |
| if (k) r.set(s.subarray(H.RawInflate.MaxBackwardLength, r.length)); | |
| else | |
| for (e = 0, i = r.length; e < i; ++e) r[e] = s[e + H.RawInflate.MaxBackwardLength]; | |
| if (this.blocks.push(r), this.totalpos += r.length, k) s.set(s.subarray(n, n + H.RawInflate.MaxBackwardLength)); | |
| else | |
| for (e = 0; e < H.RawInflate.MaxBackwardLength; ++e) s[e] = s[n + e]; | |
| return this.op = H.RawInflate.MaxBackwardLength, s | |
| }, H.RawInflate.prototype.expandBufferAdaptive = function (t) { | |
| var e, i, r, n, s = this.input.length / this.ip + 1 | 0, | |
| a = this.input, | |
| o = this.output; | |
| return t && ("number" == typeof t.fixRatio && (s = t.fixRatio), "number" == typeof t.addRatio && (s += t.addRatio)), s < 2 ? (i = (a.length - this.ip) / this.currentLitlenTable[2], n = i / 2 * 258 | 0, r = n < o.length ? o.length + n : o.length << 1) : r = o.length * s, k ? (e = new Uint8Array(r), e.set(o)) : e = o, this.output = e, this.output | |
| }, H.RawInflate.prototype.concatBuffer = function () { | |
| var t, e, i, r, n, s = 0, | |
| a = this.totalpos + (this.op - H.RawInflate.MaxBackwardLength), | |
| o = this.output, | |
| h = this.blocks, | |
| f = new(k ? Uint8Array : Array)(a); | |
| if (0 === h.length) return k ? this.output.subarray(H.RawInflate.MaxBackwardLength, this.op) : this.output.slice(H.RawInflate.MaxBackwardLength, this.op); | |
| for (e = 0, i = h.length; e < i; ++e) | |
| for (t = h[e], r = 0, n = t.length; r < n; ++r) f[s++] = t[r]; | |
| for (e = H.RawInflate.MaxBackwardLength, i = this.op; e < i; ++e) f[s++] = o[e]; | |
| return this.blocks = [], this.buffer = f, this.buffer | |
| }, H.RawInflate.prototype.concatBufferDynamic = function () { | |
| var t, e = this.op; | |
| return k ? this.resize ? (t = new Uint8Array(e), t.set(this.output.subarray(0, e))) : t = this.output.subarray(0, e) : (this.output.length > e && (this.output.length = e), t = this.output), this.buffer = t, this.buffer | |
| }; | |
| var K = function (t, e) { | |
| this.loadSuccess = new T.FSEvent, this.loadFailure = new T.FSEvent, this.st = document.createElement("script"), this.st.type = "text/javascript", this.st.src = t, e && (this.st.id = e), this.br = T.getBrowserInstance(), void 0 !== this.st.addEventListener ? this._loadOnOthers() : void 0 !== this.st.attachEvent && this._loadOnIE() | |
| }; | |
| K.prototype._loadOnIE = function () { | |
| var t = this, | |
| e = this.st; | |
| e.onreadystatechange = function () { | |
| 3 == e.readyState && (e.onreadystatechange = function () { | |
| t.loadSuccess.fire(e.src), t.loadFailure = null | |
| }, t.loadFailure && t.loadFailure.fire(e.src)) | |
| }, document.body.appendChild(e) | |
| }, K.prototype._loadOnOthers = function () { | |
| this.st.addEventListener("load", e.proxy(function () { | |
| this.loadSuccess.fire(this.st.src) | |
| }, this), !1), this.st.addEventListener("error", e.proxy(function () { | |
| this.loadFailure.fire(this.st.src) | |
| }, this), !1), document.body.appendChild(this.st) | |
| }, T.Async = function (t, e, i) { | |
| this.isParallel = !!t, this._queue = [], this.success = e, this.fail = i, this.isPending = !0 | |
| }, T.Async.prototype.enqueue = function (t) { | |
| this._queue.push({ | |
| fn: t, | |
| resolved: !1 | |
| }), (this.isParallel || 1 == this._queue.length) && t.apply(this, [{ | |
| resolve: e.proxy(function () { | |
| e.nextTick(e.proxy(function () { | |
| this.ctx.resolve(this.cb) | |
| }, this)) | |
| }, { | |
| cb: t, | |
| ctx: this | |
| }), | |
| error: e.proxy(function () { | |
| this.ctx.error(this.cb) | |
| }, { | |
| cb: t, | |
| ctx: this | |
| }) | |
| }]) | |
| }, T.Async.prototype.resolve = function (t) { | |
| if (this.isPending) { | |
| if (!t) throw new Error("Missing caller argument."); | |
| var i, r, n = !1; | |
| for (i = 0; i < this._queue.length; i++) r = this._queue[i], r.fn === t ? r.resolved = !0 : r.resolved || (n = !0); | |
| if (!this.isParallel && n) { | |
| var s; | |
| for (i = 0; i < this._queue.length; i++) | |
| if (r = this._queue[i], !1 === r.resolved) { | |
| s = r; | |
| break | |
| } if (s) return void s.fn.apply(this, [{ | |
| resolve: e.proxy(function () { | |
| this.ctx.resolve(this.cb) | |
| }, { | |
| cb: s.fn, | |
| ctx: this | |
| }), | |
| error: e.proxy(function () { | |
| this.ctx.error(this.cb) | |
| }, { | |
| cb: s.fn, | |
| ctx: this | |
| }) | |
| }]) | |
| } | |
| n || (this.isPending = !1, this.success.call(this)) | |
| } | |
| }, T.Async.prototype.error = function () { | |
| this.isPending = !1, this.fail && this.fail.call(this) | |
| }; | |
| var J = { | |
| _id: "", | |
| has: function () { | |
| try { | |
| return !!(window.s && e.isFunction(s.c_r) && s.c_r("s_vi").indexOf("[CE]") > -1) | |
| } catch (t) { | |
| return !1 | |
| } | |
| }, | |
| intervals: { | |
| uid: "", | |
| mcid: "" | |
| }, | |
| sgi: function (t) { | |
| return !(!t || "undefined" == typeof s_gi || !s_gi) && (Array.isArray(t) && 2 === t.length && (t = t.join(",")), s_gi(t)) | |
| }, | |
| uid: function (t, e) { | |
| var i, r, n = 0; | |
| clearInterval(this.intervals.uid), this.intervals.uid = setInterval(function () { | |
| i = this.sgi(t), n++ < 10 && i ? (i.visitorID ? r = { | |
| name: "OMTR_VID", | |
| value: i.visitorID | |
| } : i.analyticsVisitorID ? r = { | |
| name: "OMTR_VID", | |
| value: i.analyticsVisitorID | |
| } : i.fid && (r = { | |
| name: "OMTR_FID", | |
| value: i.fid | |
| }), r && (e(r), clearInterval(this.intervals.uid))) : clearInterval(this.intervals.uid) | |
| }.bind(this), 1e3) | |
| }, | |
| mcid: function (t, e) { | |
| var i, r, n = 0; | |
| clearInterval(this.intervals.mcid), this.intervals.mcid = setInterval(function () { | |
| i = this.sgi(t), n++ < 10 && i ? (i.marketingCloudVisitorID && (r = { | |
| name: "OMTR_MCID", | |
| value: i.marketingCloudVisitorID | |
| }), r && (e(r), clearInterval(this.intervals.mcid))) : clearInterval(this.intervals.mcid) | |
| }.bind(this), 1e3) | |
| }, | |
| beacon: function () { | |
| function t(t, e) { | |
| for (var i = "", r = e.split("&"), n = 0; n < r.length; n++) | |
| for (var s = r[n].split("="), a = 0; a < t.length; a++) | |
| if (t[a] == s[0]) { | |
| i += s[0] + "=" + s[1] + "&"; | |
| break | |
| } return "&" == i.substr(i.length - 1) && (i = i.substr(0, i.length - 1)), i | |
| } | |
| if (J._id) return J._id; | |
| var i, r, n, a, o = ["AQB", "mid", "aid", "vid", "fid", "AQE"], | |
| h = ""; | |
| for (var f in window) | |
| if ("s_i_" == f.substring(0, 4) && window[f].src && (i = window[f].src, i.indexOf("/b/ss/") >= 0)) { | |
| h = i; | |
| break | |
| } if (!h && window.s_c_il && window.s_c_il[0] && window.s_c_il[0].eb && (h = window.s_c_il[0].eb), !h && window.document.images) | |
| for (var u = 0; u < window.document.images.length; u++) | |
| if (i = window.document.images[u].src, i.indexOf("/b/ss/") >= 0) { | |
| h = i; | |
| break | |
| } if (h && e.isString(h)) { | |
| r = h.substring(0, h.indexOf("?")), n = h.substring(h.indexOf("?") + 1), a = t(o, n), window.s && s.trackingServerSecure && (r = "https://" + s.trackingServerSecure + h.substring(h.indexOf("/b/ss/"), h.indexOf("?")), n = h.substring(h.indexOf("?") + 1), a = t(o, n)); | |
| var l = r + "?" + a; | |
| return l.length < 3 ? l = null : J._id = l, l | |
| } | |
| } | |
| }; | |
| T.INT.OM = J; | |
| var V = { | |
| has: function () { | |
| var t = window.ga; | |
| return "function" == typeof t && t.getAll && t.getAll().length | |
| }, | |
| uid: function (t) { | |
| var i = e.nextTick; | |
| V.has() ? ga(function (e) { | |
| i(function () { | |
| if (e) t(e.get("clientId")); | |
| else try { | |
| t(ga.getAll()[0].get("clientId")) | |
| } catch (e) { | |
| t() | |
| } | |
| }) | |
| }) : i(function () { | |
| t() | |
| }) | |
| } | |
| }; | |
| T.INT.GA = V, T.addClass = function (t, i) { | |
| var r, n, s, a; | |
| for (e.isDefined(t.length) || (t = [t]), r = 0, n = t.length; r < n; r++) s = t[r], T.isElement(s) && (a = s.className || "", new RegExp("\\b" + i + "\\b").test(a) || (s.className = ("" === a ? "" : a + " ") + i)) | |
| }, T.removeClass = function (t, i) { | |
| var r, n, s; | |
| for (e.isDefined(t.length) || (t = [t]), r = 0, n = t.length; r < n; r++) s = t[r], T.isElement(s) && s.className && (s.className = s.className.replace(new RegExp("(\\s|^)" + i + "(\\s|$)"), " ").replace(/^\s+|\s+$/g, "")) | |
| }, T.hasClass = function (t, e) { | |
| return T.isElement(t) && t.classList && t.classList.contains(e) | |
| }, T.css = function (t, i, r) { | |
| if (t) { | |
| e.isDefined(t.length) || (t = [t]); | |
| for (var n = 0; n < t.length; n++) | |
| for (var s in i) s && (-1 == "zIndex".indexOf(s) && "number" == typeof i[s] && "opacity" != s && (i[s] += "px"), r ? t[n].style.cssText += ";" + s + ":" + i[s] + " !important" : t[n].style[s] = i[s]) | |
| } | |
| return t | |
| }, T.attr = function (t, i) { | |
| if (t) { | |
| e.isDefined(t.length) || (t = [t]); | |
| for (var r = 0; r < t.length; r++) | |
| for (var n in i) t[r].setAttribute(n, i[n]) | |
| } | |
| return t | |
| }, T.restrictFocus = function (t) { | |
| for (var e = document.querySelectorAll("a, input[type=text], textarea, button, input[type=radio], select, *[tabIndex]", t).sort(function (t, e) { | |
| return parseInt(t.tabIndex) > parseInt(e.tabIndex) | |
| }), i = 0; i < e.length; i++) { | |
| var r = e[i]; | |
| T.Unbind(r, "keydown"), T.Bind(r, "keydown", function (t) { | |
| return function (e) { | |
| var i, r; | |
| if (9 === e.keyCode) | |
| for (i = 0; i < t.length; i++) | |
| if (t[i] === e.target) { | |
| if (e.preventDefault ? e.preventDefault() : e.returnValue = !1, r = i, e.shiftKey) | |
| do { | |
| r = 0 === r ? t.length - 1 : r - 1 | |
| } while ((t[r].offsetLeft <= 0 || t[r].tabIndex < 0) && r != i); | |
| else | |
| do { | |
| r = (r + 1) % t.length | |
| } while ((t[r].offsetLeft <= 0 || t[r].tabIndex < 0) && r != i); | |
| t[r].focus(); | |
| break | |
| } | |
| } | |
| }(e)) | |
| } | |
| }, T.hideAll = function (t) { | |
| var e, i = document.body.querySelectorAll("*"); | |
| for (e = 0; e < i.length; e++) T.css(i[e], { | |
| display: "none" | |
| }) | |
| }, T.elindex = function (t) { | |
| for (var e, i = t.parentNode.childNodes, r = 0, n = 0; | |
| (e = i.item(r++)) && e != t;) 1 == e.nodeType && n++; | |
| return n | |
| }, T.isElement = function (t) { | |
| return t && t.nodeType && (1 == t.nodeType || 11 == t.nodeType || 9 == t.nodeType) | |
| }, T.decodeHTMLEntities = function (t) { | |
| return (new DOMParser).parseFromString(t, "text/html").documentElement.textContent | |
| }, T.WindowStorage = function (t, i) { | |
| t || (t = "STORAGE"), this.guid = "FSR_" + t.replace(/[- _.&]/g, "").toUpperCase(), this.storageLimit = 5e6, this.StorageFull = new T.FSEvent, this.kill(), this.sync(), e.isDefined(i) && !i || setTimeout(e.proxy(function () { | |
| T.Bind(window, "unload", e.proxy(function () { | |
| this.commit() | |
| }, this)) | |
| }, this), 100) | |
| }, T.WindowStorage.prototype.testStorageLimit = function () { | |
| return this.storageBytesObj + this.storageBytesBlob >= this.storageLimit && (this.StorageFull.fire(this), !0) | |
| }, T.WindowStorage.prototype.dispose = function (t) { | |
| this._data_obj[t] && (delete this._data_obj[t], this.storageBytesObj = JSON.stringify(this._data_obj).length) | |
| }, T.WindowStorage.prototype.kill = function () { | |
| this.storageBytesObj = 0, this.storageBytesBlob = 0, this._data_obj = {}, this._data_blob = "", this.isNewStorage = !0 | |
| }, | |
| T.WindowStorage.prototype.get = function (t) { | |
| return this._data_obj[t] | |
| }, T.WindowStorage.prototype.getBlob = function () { | |
| return this._data_blob | |
| }, T.WindowStorage.prototype.erase = function (t) { | |
| delete this._data_obj[t], this.storageBytesObj = JSON.stringify(this._data_obj).length, this.isNewStorage = !1, this.testStorageLimit() | |
| }, T.WindowStorage.prototype.set = function (t, e) { | |
| e && (this._data_obj[t] = e, this.storageBytesObj = JSON.stringify(this._data_obj).length, this.isNewStorage = !1, this.testStorageLimit()) | |
| }, T.WindowStorage.prototype.setBlob = function (t) { | |
| this._data_blob = t, this.storageBytesBlob = this._data_blob.length, this.isNewStorage = !1, this.testStorageLimit() | |
| }, T.WindowStorage.prototype.isNew = function () { | |
| return this.isNewStorage | |
| }, T.WindowStorage.initialize = function (t) { | |
| t.apply(T.WindowStorage) | |
| }, T.WindowStorage.isSupported = function () { | |
| return !0 | |
| }, T.WindowStorage.prototype.sync = function () { | |
| var t = T.nameBackup || window.name || "", | |
| e = this.guid + "_", | |
| i = "", | |
| r = t.indexOf(e + "BEGIN_OBJ"); | |
| r > -1 && (i = t.substr(r + (e + "BEGIN_OBJ").length, t.indexOf(e + "END_OBJ") - (r + (e + "BEGIN_OBJ").length))); | |
| try { | |
| i.length > 0 && (this._data_obj = JSON.parse(i), this.storageBytesObj = i.length, this.isNewStorage = !1) | |
| } catch (t) {} | |
| i = "", (r = t.indexOf(e + "BEGIN_BLOB")) > -1 && (i = t.substr(r + (e + "BEGIN_BLOB").length, t.indexOf(e + "END_BLOB") - (r + (e + "BEGIN_BLOB").length))); | |
| try { | |
| i.length > 0 && (this._data_blob = i, this.storageBytesBlob = i.length, this.isNewStorage = !1) | |
| } catch (t) {} | |
| }, T.WindowStorage.prototype.commit = function () { | |
| var t = window.name; | |
| e.isDefined(t) || (t = ""); | |
| var i = this.guid + "_", | |
| r = t.indexOf(i + "BEGIN_OBJ"), | |
| n = JSON.stringify(this._data_obj), | |
| s = i + "BEGIN_OBJ" + n + i + "END_OBJ"; | |
| r > -1 ? t = t.substr(0, r) + s + t.substr(t.indexOf(i + "END_OBJ") + (i + "END_OBJ").length) : t += s, r = t.indexOf(i + "BEGIN_BLOB"), s = i + "BEGIN_BLOB" + this._data_blob + i + "END_BLOB", r > -1 ? t = t.substr(0, r) + s + t.substr(t.indexOf(i + "END_BLOB") + (i + "END_BLOB").length) : t += s, window.name = T.nameBackup = t, this.storageBytes = window.name.length | |
| }, T.nameBackup = window.name, T.generateGUID = function () { | |
| return T.md5(T.now() + "" + navigator.userAgent + window.location + (new Date).getTimezoneOffset() + Math.random()) | |
| }, T.Journey = function (t, i, r, n, s) { | |
| this.threshold = s || 400, this.browser = n, e.isString(i) || (i = ""), this.cors = new T.AjaxTransport, this.url = e.config.analyticsUrl.replace(/^https?:/i, location.protocol), this.data = { | |
| customerId: t, | |
| appId: i, | |
| userId: r || "0000-0000-0000-0000-0000", | |
| deviceProfile: { | |
| fs_os: n.os.name, | |
| fs_osVersion: n.os.version, | |
| fs_sdkVersion: e.config.codeVer, | |
| fs_browserName: n.browser.name, | |
| fs_browserVersion: n.browser.version, | |
| fs_timezone: -(new Date).getTimezoneOffset(), | |
| fs_type: n.isMobile ? "Mobile" : n.isTablet ? "Tablet" : "Desktop", | |
| fs_productType: "web sdk" | |
| }, | |
| events: [] | |
| }, this.eventsDefault = { | |
| properties: { | |
| fs_pageUrl: [location.href] | |
| } | |
| } | |
| }, T.Journey.prototype.addEventsDefault = function (t, i) { | |
| if (!t || ["properties", "metrics", "data"].indexOf(t) < 0) return this.eventsDefault; | |
| if (!q(t, i)) return this.eventsDefault; | |
| for (var r in i) i.hasOwnProperty(r) && Array.isArray(i[r]) && i[r].length > 0 && (i[r] = i[r].filter(e.isDefined), i[r].length < 1 && delete i[r]); | |
| return this.eventsDefault = this.eventsDefault || {}, this.eventsDefault[t] = e.ext(this.eventsDefault[t], i), this.eventsDefault | |
| }, T.Journey.prototype.setKey = function (t, i) { | |
| return !!e.isObject(i) && (this.data[t] = i, this.data.events.length || this.addEventString("fs_setKey"), !0) | |
| }, T.Journey.prototype.addEvent = function (t) { | |
| var e = typeof t; | |
| switch (e) { | |
| case "string": | |
| this.addEventString(t); | |
| break; | |
| case "object": | |
| this.addEventObj(t); | |
| break; | |
| default: | |
| console.error("ForeSee: event is not a valid type: ", e) | |
| } | |
| }, T.Journey.prototype.addEventObj = function (t) { | |
| if (t.timestamp || (t.timestamp = (new Date).toISOString()), t.timezone || (t.timezone = (new Date).getTimezoneOffset()), !(t.name && t.name.length > 0 && q("properties", t.properties) && q("metrics", t.metrics) && q("data", t.data))) return void console.error("ForeSee: Invalid Event. For proper usage, please refer to http://developer.foresee.com/docs-articles/foresee-hosted-code/calling-api-methods/event-logging/"); | |
| t = _(t, this.eventsDefault), this.data.events.push(t), this.send() | |
| }, T.Journey.prototype.addEventString = function (t) { | |
| this.data.events.push(_({ | |
| name: t, | |
| timestamp: (new Date).toISOString(), | |
| timezone: (new Date).getTimezoneOffset() | |
| }, this.eventsDefault)), this.send() | |
| }, T.Journey.prototype.send = function (t) { | |
| t ? G(this) : this._svT || (this._svT = setTimeout(function () { | |
| G(this) | |
| }.bind(this), this.threshold)) | |
| }; | |
| var G = function (t) { | |
| if (t._svT = null, t.data.events.length > 0) { | |
| var i = e.ext({}, t.data); | |
| t.data.events = [], t.cors.send({ | |
| url: t.url, | |
| contentType: "application/json", | |
| headers: { | |
| "Request-API-Version": "1.0.0" | |
| }, | |
| data: i, | |
| method: "POST", | |
| failure: function () { | |
| t.data.events = i.events | |
| }.bind(t) | |
| }) | |
| } | |
| }, | |
| q = function (t, e) { | |
| var i; | |
| switch (t) { | |
| case "properties": | |
| if (e) | |
| for (i in e) | |
| if (!Array.isArray(e[i])) return console.error("ForeSee: Invalid properties"), !1; | |
| break; | |
| case "metrics": | |
| if (e) | |
| for (i in e) | |
| if (!T.isNumeric(e[i])) return console.error("ForeSee: Invalid metrics"), !1 | |
| } | |
| return !0 | |
| }; | |
| T.Browser = function (t) { | |
| var i = this, | |
| r = t || navigator.userAgent, | |
| n = e.toLowerCase(r); | |
| e.ext(i, { | |
| agent: r, | |
| os: { | |
| name: "", | |
| version: 0 | |
| }, | |
| browser: { | |
| name: "", | |
| version: 0, | |
| actualVersion: 0 | |
| }, | |
| isMobile: /iphone|ipad|ipod|android|kindle|silk|bntv|nook|blackberry|playbook|mini|windows\sce|windows\sphone|palm|bb10/i.test(r) || !!window.orientation, | |
| isTablet: /ipad|playbook|nook|bntv/i.test(r), | |
| isWinPhone: /Windows Phone/i.test(r), | |
| fp: "", | |
| supportsLocalStorage: !1, | |
| supportsPostMessage: !!window.postMessage, | |
| isIE: !1, | |
| isZoomable: !0, | |
| supportsSVG: document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"), | |
| isReady: !1, | |
| ready: new T.FSEvent, | |
| _internalReady: new T.FSEvent, | |
| isIos: !1, | |
| servUrl: location.protocol + "//device.4seeresults.com/detect?accessToken=" | |
| }); | |
| try { | |
| localStorage && (localStorage.setItem("a", "b"), localStorage.removeItem("a"), i.supportsLocalStorage = !0) | |
| } catch (t) {} | |
| try { | |
| sessionStorage && (sessionStorage.setItem("a", "b"), sessionStorage.removeItem("a"), i.supportsSessionStorage = !0) | |
| } catch (t) {} | |
| i._internalReady.subscribe(function () { | |
| i.fp = new L(i), i.fp.ready.subscribe(function () { | |
| i.fp = i.fp.sig, i.ready.fire(i) | |
| }, !0, !0) | |
| }), i.isMobile && /iphone|ipad|ipod/i.test(r) && !i.isWinPhone && (i.isIos = !0); | |
| var s = function (t) { | |
| return n.indexOf(e.toLowerCase(t)) > -1 | |
| }, | |
| a = function (t, e) { | |
| return "IE" != t ? e : e > 6 && e < 10 ? s("Trident") || 7 != e ? s("Trident/5.0") && e <= 9 ? 9 : s("Trident/4.0") && e < 9 ? s("WOW64") ? 8 : 7 == e ? e : 8 : e : 7 : e | |
| }, | |
| o = function (t, i) { | |
| return i ? s("Windows Phone") ? "Winphone" : s("iPod") ? "iPod" : s("iPad") ? "iPad" : s("iPhone") ? "iPhone" : (s("blackberry") || s("playbook") || s("BB10")) && s("applewebkit") ? "Blackberry" : s("Kindle") || s("Silk") ? "Kindle" : s("BNTV") || s("Nook") ? "Nook" : s("Android") ? "Android" : e.isDefined(window.orientation) ? "Mobile" : "Other" : s("Windows") ? "Windows" : s("OS X") ? "Mac" : s("Linux") || s("Googlebot") ? "Linux" : s("Mac") ? "Mac" : void 0 | |
| }, | |
| h = function (t, e) { | |
| for (; t >= e;) t /= 10; | |
| return t | |
| }, | |
| f = function (t, i) { | |
| var r, n, a, o, f, u; | |
| return s("windows phone") || !s("ipad") && !s("iphone") ? s("googlebot") ? 1 : s("mac os x") ? (r = /OS X ([0-9_]*)/gi.exec(t), n = r[1].split("_"), a = parseInt(n[0]), f = parseInt(n[1]), u = parseInt(n[2]), f += h(u, 1), a + h(f, 1)) : s("Windows NT") ? (r = /Windows NT ([0-9\.]*)/gi.exec(t), n = r[1].split("."), a = parseInt(n[0]), f = parseInt(n[1]), a + h(f, 1)) : (r = t.match(/Windows Phone OS[\/\s](\d+\.?\d+)/) || t.match(/Windows Phone[\/\s](\d+\.?\d+)/) || t.match(/Android[\/\s](\d+\.?\d+)/), a = e.isDefined(r) ? r[1] : 1, o = parseFloat(a), !isNaN(o) && o > 0 ? o : a) : (r = /OS ([0-9_]*) like/gi.exec(t), n = r[1].split("_"), a = parseInt(n[0]), f = parseInt(n[1]), a + h(f, 1)) | |
| }, | |
| u = function () { | |
| if ("Winphone" != i.os.name) { | |
| var t = document.querySelectorAll("head meta[name=viewport],head meta[name=VIEWPORT],head meta[name=Viewport]") || []; | |
| if (Array.isArray(t) || (t = [t]), t.length > 0) { | |
| for (var r = function (t, e) { | |
| var i = new RegExp("[\\w\\W]*" + e + "[\\s]*=[\\s]*([^\\s,;]*)[\\w\\W]*", "i"); | |
| return t ? t.match(i) : null | |
| }, n = 0; n < t.length; n++) { | |
| var s = t[n].content, | |
| a = r(s, "user-scalable"), | |
| o = r(s, "initial-scale"), | |
| h = r(s, "maximum-scale"); | |
| if (a && a.length > 1 && ("0" == a[1] || "no" == e.toLowerCase(a[1]))) return !1; | |
| if (o && h) return !(o.length > 1 && h.length > 1 && 1 == parseFloat(o[1]) && 1 == parseFloat(h[1])) | |
| } | |
| return !0 | |
| } | |
| return !0 | |
| } | |
| return !1 | |
| }, | |
| l = T._getBrowserNameAndVersion(r), | |
| c = function () { | |
| i.browser.name = l.name, i.browser.version = l.version, i.browser.actualVersion = a(i.browser.name, i.browser.version), i.os.name = o(0, i.isMobile), i.os.version = f(r, i.isMobile) | |
| }, | |
| d = function () { | |
| i.isZoomable = u(), i.isReady = !0, i._internalReady.fire() | |
| }, | |
| p = function () { | |
| c() | |
| }; | |
| if (i.isMobile) | |
| if (i.isIos || "" === i.servUrl || i.isTablet || i.isWinPhone) p(), d(); | |
| else { | |
| var g, y = function (t) { | |
| var e = JSON.parse(t); | |
| i.browser.name = e.browser.name, i.browser.version = i.browser.actualVersion = e.browser.version, i.os.name = e.os.name, i.os.version = parseFloat(e.os.version), i.isMobile = e.isMobile, i.isTablet = e.isTablet, d() | |
| }, | |
| b = this.supportsLocalStorage; | |
| if (b && !t && (g = sessionStorage.getItem("ACS_BROWSER")), g) y(g); | |
| else { | |
| var w = function (t) { | |
| b && sessionStorage.setItem("ACS_BROWSER", t), y(t) | |
| }, | |
| m = function () { | |
| p(), d() | |
| }, | |
| v = function () { | |
| var t = new Date, | |
| e = t.getFullYear().toString(), | |
| i = (t.getMonth() + 1).toString(), | |
| r = t.getDate().toString(); | |
| return e + (i[1] ? i : "0" + i[0]) + (r[1] ? r : "0" + r[0]) | |
| }, | |
| S = { | |
| method: "GET", | |
| url: i.servUrl + function () { | |
| var t = v() + "ForeSee" + (location.origin || "null"); | |
| return T.hashCode(t) | |
| }() + "&ua=" + r, | |
| type: "*/*", | |
| contentType: "application/x-www-form-urlencoded", | |
| success: w, | |
| failure: m | |
| }; | |
| new T.AjaxTransport(S, !0).send() | |
| } | |
| } | |
| else c(), i.isReady = !0, i.isIE = "IE" == i.browser.name, i._internalReady.fire() | |
| }, T.getBrowserInstance = function () { | |
| function t() { | |
| return e || (e = new T.Browser) | |
| } | |
| var e; | |
| return t | |
| }(), T._getBrowserNameAndVersion = function (t) { | |
| var e, i, r = "Unknown"; | |
| return null !== (i = t.match(/Opera[\/\s](\d+\.\d+)/)) ? r = "Opera" : null !== (i = t.match(/Edge\/([0-9\.]*)/)) ? r = "Edge" : null !== (i = t.match(/opr[\/\s](\d+\.\d+)/i)) ? r = "Opera" : null !== (i = t.match(/Windows Phone[\/\s](\d+\.\d+)/)) ? r = "IEMobile" : null !== (i = t.match(/MSIE (\d+\.\d+)/)) ? r = "IE" : null !== (i = t.match(/Navigator[\/\s](\d+\.\d+)/)) ? r = "Netscape" : null !== (i = t.match(/Chrome[\/\s](\d+\.\d+)/)) ? r = "Chrome" : null !== (i = t.match(/CriOS[\/\s](\d+\.\d+)/)) ? r = "Chrome" : null !== (i = t.match(/Version\/([0-9\.]*)[\w\W]*Safari/i)) ? r = "Safari" : null !== (i = t.match(/Firefox[\/\s](\d+\.\d+)/)) ? r = "Firefox" : null !== (i = t.match(/googlebot/gi)) ? (r = "Chrome", e = 44) : Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject && (r = "IE", e = 11), { | |
| name: r, | |
| version: e || (null !== i ? parseFloat(i[1]) : void 0) | |
| } | |
| }, T.ImageTransport = function (t) { | |
| var i = { | |
| data: {}, | |
| success: function () {}, | |
| failure: function () {} | |
| }; | |
| this.options = e.ext(i, t) | |
| }, T.ImageTransport.prototype.send = function (t) { | |
| var i = e.ext(this.options, t), | |
| r = new Image; | |
| r.onerror = i.failure, r.onload = function () { | |
| i.success({ | |
| width: r.width, | |
| height: r.height | |
| }) | |
| }, r.src = e.toQueryString(i.data, i.url, !1) | |
| }, T.imgInfo = function (t, i) { | |
| var r = function () {}; | |
| i = i || r; | |
| var n = new Image; | |
| n.onload = function () { | |
| i(n.width, n.height) | |
| }, n.onerror = function () {}, t.indexOf("//") > -1 ? n.src = t : n.src = e.makeURI("$" + t), n.width && (n.onload = n.onerror = r, i(n.width, n.height)) | |
| }, T.getHashParm = function (t) { | |
| var i = window.location.hash.toString(); | |
| if (i && i.length > 0) | |
| for (var r = i.split("&"), n = 0; n < r.length; n++) { | |
| var s = r[n].split("="), | |
| a = e.toLowerCase(s[0]).trim(); | |
| if (a == e.toLowerCase(t)) { | |
| if (s.length > 1) return decodeURIComponent(s[1]); | |
| break | |
| } | |
| } | |
| }, T.compile = function (t) { | |
| var e, i = [].constructor.constructor; | |
| return delete[].constructor.constructor, e = new [].constructor.constructor("var v = ''; try { v = " + t + "} catch(err) {}return v;"), [].constructor.constructor = i, e.call(window) | |
| }, T.retrieveNestedVariable = function (t, e) { | |
| for (var i = t || window, r = e.split("."), n = 0; n < r.length && i;) i = i[r[n++]]; | |
| return void 0 !== i && n === r.length ? i : void 0 | |
| }, e.nextTick = function (t) { | |
| setTimeout(t || function () {}, 0) | |
| }, T.randomRange = function (t, e) { | |
| return t + Math.random() * (e - t) | |
| }, T.isNumeric = function (t) { | |
| return !isNaN(parseFloat(t)) && isFinite(t) | |
| }, T.products = {}, T.productArr = [], T.registerProduct = function (t, e) { | |
| e = e || {}, T.products[t] = e, T.productArr.push(t) | |
| }, window.__fsJSONPCBr = {}, window.__fsJSONPCB = e.proxy(function (t) { | |
| if (t) { | |
| var e = t.filename, | |
| i = atob(t.contents); | |
| window.__fsJSONPCBr[e] && window.__fsJSONPCBr[e].fire(i) | |
| } | |
| }, this), T.JSONP = function (t) { | |
| this._expireTimeout = null, this._networkError = new T.FSEvent, this.opts = e.ext({ | |
| success: function () {}, | |
| failure: function () {}, | |
| timeout: 5e3 | |
| }, t) | |
| }, T.JSONP.prototype.get = function (t, i) { | |
| var r = t.indexOf("?") > -1 ? t.substr(t.indexOf("?") + 1) : "", | |
| n = t.substr(0, t.lastIndexOf("/") + 1), | |
| s = t.substr(t.lastIndexOf("/") + 1), | |
| a = window.__fsJSONPCBr; | |
| this._expireTimeout = setTimeout(e.proxy(function () { | |
| this._networkError.fire({ | |
| type: "timedout" | |
| }) | |
| }, this), this.opts.timeout), s.indexOf("?") > -1 && (s = s.substr(0, s.indexOf("?"))); | |
| var o = (i || "") + s; | |
| if (!a[o]) { | |
| a[o] = new T.FSEvent; | |
| var h = n + s.substr(0, s.lastIndexOf(".")) + "___" + s.substr(s.lastIndexOf(".") + 1) + ".js" + (r.length > 0 ? "?" + r : ""), | |
| f = new K(h, "_fscl" + o); | |
| f.loadFailure.subscribe(e.proxy(function () { | |
| this.el.parentNode.removeChild(this.el), this.ctx._networkError.fire({ | |
| type: "internalserror" | |
| }) | |
| }, { | |
| ctx: this, | |
| el: f.st | |
| })) | |
| } | |
| a[o].subscribe(e.proxy(function (t) { | |
| this.ctx.opts.success(t), clearTimeout(this.ctx._expireTimeout); | |
| var e = document.getElementById(this.tgId); | |
| e && e.parentNode.removeChild(e) | |
| }, { | |
| ctx: this, | |
| tgId: "_fscl" + o | |
| }), !0, !0), this._networkError.subscribe(e.proxy(function (t) { | |
| this.opts.failure(t), a[o].unsubscribeAll() | |
| }, this), !0, !0) | |
| }, T.sign = function (t) { | |
| var i = (new Date).getTime(), | |
| r = t.substr(t.indexOf("/rec/")), | |
| n = T.md5((r + i).toString()); | |
| return -1 == t.indexOf("?") ? t += "?" : t += "&", t + "token=" + i + "&sig=" + e.enc(n) | |
| }, T.dedupe = function (t) { | |
| var e, i; | |
| for (e = t.length - 1; e >= 0; e--) | |
| for (i = e - 1; i >= 0; i--) t[i] == t[e] && t.splice(e, 1); | |
| return t | |
| }, T.arrayIndexOf = function (t, e) { | |
| for (var i in e) | |
| if (e[i] === t) return i; | |
| return -1 | |
| }, T.inArray = function (t, e) { | |
| return -1 != T.arrayIndexOf(t, e) | |
| }; | |
| var X = {}, | |
| Y = 0; | |
| T.loadCSS = function (t, e, i, r) { | |
| if (!r) throw new Error("loadCSS missing browser instance"); | |
| var n = X[t]; | |
| if (n) { | |
| if (n.link.parentElement) return n.success.subscribe(e || function () {}, !0, !0), n.fail.subscribe(i || function () {}, !0, !0), n.link; | |
| delete X[t] | |
| } | |
| var s, a, o = !1; | |
| Y++, s = "fs-css-" + Y, a = document.createElement("link"), a.setAttribute("id", s), a.setAttribute("rel", "stylesheet"), a.setAttribute("type", "text/css"); | |
| var h = { | |
| link: a, | |
| url: t, | |
| didfail: !1, | |
| didsucceed: !1, | |
| success: new T.FSEvent, | |
| fail: new T.FSEvent | |
| }; | |
| h.success.subscribe(e, !0, !0), h.fail.subscribe(i, !0, !0), X[t] = h, a.addEventListener("load", function () { | |
| o = !0, h.didsucceed = !0, h.success.fire(a) | |
| }, !1), a.addEventListener("error", function () { | |
| h.didfail = !0, h.fail.fire(a) | |
| }, !1); | |
| var f = document.documentElement, | |
| u = document.getElementsByTagName("head"); | |
| return u && u.length > 0 && (f = u[0]), f.appendChild(a), a.setAttribute("href", t), a | |
| }, T.Cookie = function (t) { | |
| this.opts = t || {} | |
| }, T.Cookie.prototype.set = function (t, i, r) { | |
| var n, s = this.opts; | |
| r && (s = e.ext({}, s, r)), i = e.isDefined(s.encode) ? e.enc(i) : i, t = e.enc(t), "localhost" == s.domain && delete s.domain, e.config.cookieSecure && "false" !== e.config.cookieSecure && "false" !== e.hasSSL && (i += ";secure"); | |
| for (var a in s) | |
| if (s[a]) switch (n = s[a], i += ";" + ("duration" == a ? "expires" : a), a) { | |
| case "expires": | |
| i += "=" + (e.isDate(n) ? n.toUTCString() : n) + ";"; | |
| break; | |
| case "duration": | |
| i += "=" + new Date(T.now() + n * T.FULL_DAY).toUTCString() + ";"; | |
| break; | |
| default: | |
| i += "=" + n | |
| } | |
| document.cookie = t + "=" + i | |
| }, T.Cookie.prototype.get = function (t) { | |
| var e = document.cookie.match("(?:^|;)\\s*" + T.escapeRegExp(t) + "=([^;]*)"); | |
| return e ? decodeURIComponent(e[1]) : null | |
| }, T.Cookie.prototype.kill = function (t) { | |
| var e = new Date; | |
| e.setTime(e.getTime() - 9999), this.set(t, "", { | |
| expires: e.toUTCString() | |
| }) | |
| }, T.CPPS = function (t, e) { | |
| this.gs = t, this.onSet = new T.FSEvent, this._blCPP = [], this.exp = e || 864e5 | |
| }, T.CPPS.prototype = { | |
| addToBlacklist: function (t) { | |
| t = t || []; | |
| var e = this.all(); | |
| this._blCPP = this._blCPP.concat(t); | |
| for (var i = 0; i < t.length; i++) delete e[t[i]]; | |
| this.gs.set("cp", e) | |
| }, | |
| set: function (t, e) { | |
| if (-1 == this._blCPP.indexOf(t)) { | |
| var i = this.all(); | |
| i[t] = e + "", this.gs.set("cp", i, this.exp), this.onSet.fire(t, e) | |
| } | |
| }, | |
| get: function (t) { | |
| return this.all()[t] | |
| }, | |
| all: function () { | |
| return this.gs.get("cp") || {} | |
| }, | |
| toQueryString: function () { | |
| var t = [], | |
| i = this.all(); | |
| for (var r in i) t.push("cpp[" + e.enc(r) + "]=" + e.enc(i[r])); | |
| return t.join("&") | |
| }, | |
| erase: function (t) { | |
| var e = this.all(); | |
| delete e[t], this.gs.set("cp", e) | |
| }, | |
| save: function () { | |
| this.gs.save() | |
| }, | |
| append: function (t, e, i) { | |
| var r, n, s, a = this.gs.get("cp") || {}; - 1 == this._blCPP.indexOf(t) && (a[t] = (a[t] || "") + "," + e, i && (r = a[t].split(","), n = r.length - 1, s = r.length > i ? r.length - i : 0, a[t] = r.splice(s, n - s + 1).join()), this.gs.set("cp", a)) | |
| } | |
| }, T.defaultConfigs = { | |
| global: { | |
| storage: "COOKIE", | |
| alwaysOnLatest: 1, | |
| cookieSecure: !1, | |
| deferredLoading: !1, | |
| products: { | |
| trigger: !1, | |
| feedback: !1, | |
| record: !1 | |
| } | |
| }, | |
| survey: { | |
| devices: { | |
| overridesEnabled: !0, | |
| desktop: { | |
| icon: "aspark100.png", | |
| fbtype: "badge", | |
| surveytype: "popup", | |
| disabled: !0, | |
| size: "medium", | |
| fbsize: "medium" | |
| }, | |
| mobile: { | |
| icon: "aspark100.png", | |
| fbtype: "badge", | |
| surveytype: "popup", | |
| disabled: !0, | |
| size: "medium", | |
| fbsize: "medium" | |
| }, | |
| tablet: { | |
| icon: "aspark100.png", | |
| fbtype: "badge", | |
| surveytype: "popup", | |
| popup: !0, | |
| disabled: !0, | |
| fbsize: "medium", | |
| size: "medium", | |
| fbdirection: "horizontal", | |
| fblocation: "middleleft" | |
| } | |
| }, | |
| icon: "aspark100.png", | |
| delay: 0, | |
| template: "default", | |
| fblocation: "bottomleft", | |
| fbtype: "badge", | |
| disabled: !1, | |
| fbanimate: !1, | |
| fbfixed: !0, | |
| fbdirection: "horizontal", | |
| surveytype: "popup", | |
| replay: !0, | |
| fbcolor: "#f1c40f", | |
| isExistingSurveyDisabled: !0, | |
| saved: !0, | |
| whitelistActive: !1, | |
| blacklistActive: !1, | |
| whitelistData: [], | |
| blacklistData: [] | |
| } | |
| }, T.DomStorage = function (t, i, r, n) { | |
| this.isLocal = !!r, t || (t = "STORAGE"), this.guid = "FSR_" + t.replace(/[- _.&]/g, "").toUpperCase(), this.StorageFull = new T.FSEvent, this.storageLimit = 45e5, this.kill(), this.sync(), e.isDefined(i) && !i || setTimeout(e.proxy(function () { | |
| T.Bind(window, "unload", e.proxy(function () { | |
| this.commit() | |
| }, this)) | |
| }, this), 100) | |
| }, T.DomStorage.prototype.testStorageLimit = function () { | |
| return this.storageBytesObj + this.storageBytesBlob >= this.storageLimit && (this.StorageFull.fire(this), !0) | |
| }, T.DomStorage.prototype.dispose = function (t) { | |
| this._data_obj[t] && (delete this._data_obj[t], this.storageBytesObj = JSON.stringify(this._data_obj).length) | |
| }, T.DomStorage.prototype.kill = function () { | |
| this.storageBytesObj = 0, this.storageBytesBlob = 0, this._data_obj = {}, this._data_blob = "", this.isNewStorage = !0 | |
| }, T.DomStorage.prototype.get = function (t) { | |
| return this._data_obj[t] | |
| }, T.DomStorage.prototype.getBlob = function () { | |
| return this._data_blob | |
| }, T.DomStorage.prototype.erase = function (t) { | |
| delete this._data_obj[t], this.storageBytesObj = JSON.stringify(this._data_obj).length, this.isNewStorage = !1, this.testStorageLimit() | |
| }, T.DomStorage.prototype.set = function (t, e) { | |
| e && (this._data_obj[t] = e, this.storageBytesObj = JSON.stringify(this._data_obj).length, this.isNewStorage = !1, this.testStorageLimit()) | |
| }, T.DomStorage.prototype.setBlob = function (t) { | |
| this._data_blob = t, this.storageBytesBlob = this._data_blob.length, this.isNewStorage = !1, this.testStorageLimit() | |
| }, T.DomStorage.prototype.isNew = function () { | |
| var t; | |
| return window.opener && !this.get("isNew") && (t = !0, this.set("isNew", t)), t || this.isNewStorage | |
| }, T.DomStorage.initialize = function (t) { | |
| t.apply(T.DomStorage) | |
| }, T.DomStorage.isSupported = function () { | |
| return !!localStorage | |
| }, T.DomStorage.prototype.sync = function () { | |
| var t; | |
| try { | |
| t = localStorage.getObject(this.guid + "_OBJ"), t && t.length > 0 && (this._data_obj = JSON.parse(t), this.storageBytesObj = t.length, this.isNewStorage = !1) | |
| } catch (t) {} | |
| try { | |
| t = localStorage.getObject(this.guid + "_BLOB"), t && t.length > 0 && (this._data_blob = t, this.storageBytesBlob = t.length, this.isNewStorage = !1) | |
| } catch (t) {} | |
| }, T.DomStorage.prototype.commit = function () { | |
| try { | |
| localStorage.setItem(this.guid + "_OBJ", JSON.stringify(this._data_obj)), localStorage.setItem(this.guid + "_BLOB", this._data_blob) | |
| } catch (t) {} | |
| }; | |
| var $ = { | |
| byteArrayToString: function (t) { | |
| for (var e = "", i = 0; i < t.length; i++) e += String.fromCharCode(t[i]); | |
| return e | |
| }, | |
| stringToByteArray: function (t) { | |
| for (var e = [], i = 0; i < t.length; i++) e[e.length] = t.charCodeAt(i); | |
| return e | |
| }, | |
| _utf8_encode: function (t) { | |
| for (var e = "", i = 0; i < t.length; i++) { | |
| var r = t.charCodeAt(i); | |
| r < 128 ? e += String.fromCharCode(r) : r > 127 && r < 2048 ? (e += String.fromCharCode(r >> 6 | 192), e += String.fromCharCode(63 & r | 128)) : (e += String.fromCharCode(r >> 12 | 224), e += String.fromCharCode(r >> 6 & 63 | 128), e += String.fromCharCode(63 & r | 128)) | |
| } | |
| return e | |
| }, | |
| compress: function (t, i) { | |
| e.isFunction(i) || (i = $._utf8_encode); | |
| var r = i(t), | |
| n = $.stringToByteArray(r), | |
| s = new H.RawDeflate(n, { | |
| compressionType: 2 | |
| }).compress(); | |
| return btoa($.byteArrayToString(s)) | |
| }, | |
| fragmentAndCompress: function (t, e) { | |
| e = e || 1e5; | |
| for (var i = "", r = parseInt(t.length / e) + 1, n = 0; n < r; n++) { | |
| i += "_CMP_" + $.compress(t.substring(n * e, (n + 1) * e)) | |
| } | |
| return i | |
| }, | |
| decompress: function (t, i) { | |
| var r = $.stringToByteArray(atob(t)), | |
| n = new H.RawInflate(r, { | |
| index: 0, | |
| bufferSize: 41152, | |
| bufferType: H.RawInflate.BufferType.ADAPTIVE, | |
| resize: !0 | |
| }), | |
| s = $.byteArrayToString(n.decompress()); | |
| return e.isFunction(i) && (s = i(s)), s | |
| } | |
| }; | |
| return T.Compress = $, _fsNormalizeUrl = e.makeURI, T | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment