UNPKG

@glance-networks/agent-plugin

Version:

Glance Networks Agent Plugin

899 lines 1.35 MB
import { jsx, jsxs, Fragment } from "react/jsx-runtime"; import * as React from "react"; import React__default, { useRef, useState, useEffect, useMemo, cloneElement, useLayoutEffect, useId, useCallback } from "react"; import { createPortal } from "react-dom"; const Cobrowse = (e) => /* @__PURE__ */ jsx( "iframe", { src: e.url, className: "glance-cobrowse-iframe", title: "Cobrowse", referrerPolicy: "no-referrer-when-downgrade", allowFullScreen: !0, allow: "camera *;microphone *" } ), baseurl = { dev: "dev-www.myglance.org", dw1: "dw1.myglance.org", dw2: "dw2.myglance.org", dw3: "dw3.myglance.org", dw4: "dw4.myglance.org", qa: "qa.myglance.org", staging: "www.myglance.net", beta: "beta.glance.net", production: "www.glance.net" }, translationsurl = { dev: "s3.amazonaws.com/devglancecdn", //It may change to devglancecdn.s3.amazonaws.com staging: "staging-cdn.myglance.net", production: "storage.glancecdn.net" }, DEFAULT_ENV = "production", Logo$1 = (e) => { const t = e.color || "#019ada"; return /* @__PURE__ */ jsxs( "svg", { className: "glance-logo", id: "uuid-3dcb1d1f-954e-41f3-87a8-da702614a98d", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 191 294", children: [ /* @__PURE__ */ jsx( "rect", { className: "uuid-872a4a21-0cac-4dba-9ba0-c09d2a317485", fill: t, x: "105", y: "105", width: "84", height: "84" } ), /* @__PURE__ */ jsx( "path", { className: "uuid-872a4a21-0cac-4dba-9ba0-c09d2a317485", fill: t, d: "m105,209h84c0,46.361-37.639,84-84,84h0v-84h0Z" } ), /* @__PURE__ */ jsx( "path", { className: "uuid-872a4a21-0cac-4dba-9ba0-c09d2a317485", fill: t, d: "m105,1h0c46.361,0,84,37.639,84,84h-84V1h0Z" } ), /* @__PURE__ */ jsx( "path", { className: "uuid-872a4a21-0cac-4dba-9ba0-c09d2a317485", fill: t, d: "m1,105h84v84h0C38.639,189,1,151.361,1,105h0Z" } ), /* @__PURE__ */ jsx( "path", { className: "uuid-872a4a21-0cac-4dba-9ba0-c09d2a317485", fill: t, d: "m1,209h84v84h0c-46.361,0-84-37.639-84-84h0Z" } ), /* @__PURE__ */ jsx( "path", { className: "uuid-872a4a21-0cac-4dba-9ba0-c09d2a317485", fill: t, d: "m85,1h0v84H1C1,38.639,38.639,1,85,1Z" } ) ] } ); }, sessionInvite = async (e, t) => { const n = `https://${e.baseUrl}/api/SessionInvitation/smsInvite?groupid=${e.groupId}`, r = { Authorization: `Bearer GKEY ${e.groupId}&${encodeURIComponent( e.puid )}&${e.loginKey}`, "Content-Type": "application/json" }, o = await fetch(n, { method: "POST", headers: r, body: JSON.stringify(t) }); if (o?.ok) return o.json(); { const i = new Error("ExternalServiceError"); if (o?.status) { const a = await o.json(); ["ExternalError", "InvalidParameter"].includes(a?.code) && (i.name = "ExternalServiceHandledError", i.message = a?.detail); } return new Promise((a, s) => { s(i); }); } }, GlanceAgent = function() { var goog = goog || {}; goog.global = this || self, goog.exportPath_ = function(e, t, n, r) { e = e.split("."), r = r || goog.global, e[0] in r || typeof r.execScript > "u" || r.execScript("var " + e[0]); for (var o; e.length && (o = e.shift()); ) if (e.length || t === void 0) r = r[o] && r[o] !== Object.prototype[o] ? r[o] : r[o] = {}; else if (!n && goog.isObject(t) && goog.isObject(r[o])) for (var i in t) t.hasOwnProperty(i) && (r[o][i] = t[i]); else r[o] = t; }, goog.define = function(e, t) { return t; }, goog.FEATURESET_YEAR = 2012, goog.DEBUG = !0, goog.LOCALE = "en", goog.TRUSTED_SITE = !0, goog.DISALLOW_TEST_ONLY_CODE = !goog.DEBUG, goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1, goog.provide = function(e) { if (goog.isInModuleLoader_()) throw Error("goog.provide cannot be used within a module."); goog.constructNamespace_(e); }, goog.constructNamespace_ = function(e, t, n) { goog.exportPath_(e, t, n); }, goog.getScriptNonce = function(e) { return e && e != goog.global ? goog.getScriptNonce_(e.document) : (goog.cspNonce_ === null && (goog.cspNonce_ = goog.getScriptNonce_(goog.global.document)), goog.cspNonce_); }, goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/, goog.cspNonce_ = null, goog.getScriptNonce_ = function(e) { return (e = e.querySelector && e.querySelector("script[nonce]")) && (e = e.nonce || e.getAttribute("nonce")) && goog.NONCE_PATTERN_.test(e) ? e : ""; }, goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/, goog.module = function(e) { if (typeof e != "string" || !e || e.search(goog.VALID_MODULE_RE_) == -1) throw Error("Invalid module identifier"); if (!goog.isInGoogModuleLoader_()) throw Error("Module " + e + " has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide."); if (goog.moduleLoaderState_.moduleName) throw Error("goog.module may only be called once per module."); goog.moduleLoaderState_.moduleName = e; }, goog.module.get = function(e) { return goog.module.getInternal_(e); }, goog.module.getInternal_ = function(e) { return null; }, goog.ModuleType = { ES6: "es6", GOOG: "goog" }, goog.moduleLoaderState_ = null, goog.isInModuleLoader_ = function() { return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_(); }, goog.isInGoogModuleLoader_ = function() { return !!goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.GOOG; }, goog.isInEs6ModuleLoader_ = function() { if (goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.ES6) return !0; var e = goog.global.$jscomp; return e ? typeof e.getCurrentModulePath != "function" ? !1 : !!e.getCurrentModulePath() : !1; }, goog.module.declareLegacyNamespace = function() { goog.moduleLoaderState_.declareLegacyNamespace = !0; }, goog.declareModuleId = function(e) { if (goog.moduleLoaderState_) goog.moduleLoaderState_.moduleName = e; else { var t = goog.global.$jscomp; if (!t || typeof t.getCurrentModulePath != "function") throw Error('Module with namespace "' + e + '" has been loaded incorrectly.'); t = t.require(t.getCurrentModulePath()), goog.loadedModules_[e] = { exports: t, type: goog.ModuleType.ES6, moduleId: e }; } }, goog.setTestOnly = function(e) { if (goog.DISALLOW_TEST_ONLY_CODE) throw e = e || "", Error("Importing test-only code into non-debug environment" + (e ? ": " + e : ".")); }, goog.forwardDeclare = function(e) { }, goog.getObjectByName = function(e, t) { e = e.split("."), t = t || goog.global; for (var n = 0; n < e.length; n++) if (t = t[e[n]], t == null) return null; return t; }, goog.addDependency = function(e, t, n, r) { }, goog.ENABLE_DEBUG_LOADER = !0, goog.logToConsole_ = function(e) { goog.global.console && goog.global.console.error(e); }, goog.require = function(e) { }, goog.requireType = function(e) { return {}; }, goog.basePath = "", goog.nullFunction = function() { }, goog.abstractMethod = function() { throw Error("unimplemented abstract method"); }, goog.addSingletonGetter = function(e) { e.instance_ = void 0, e.getInstance = function() { return e.instance_ ? e.instance_ : (goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = e), e.instance_ = new e()); }; }, goog.instantiatedSingletons_ = [], goog.LOAD_MODULE_USING_EVAL = !0, goog.SEAL_MODULE_EXPORTS = goog.DEBUG, goog.loadedModules_ = {}, goog.DEPENDENCIES_ENABLED = !1, goog.TRANSPILE = "detect", goog.ASSUME_ES_MODULES_TRANSPILED = !1, goog.TRANSPILE_TO_LANGUAGE = "", goog.TRANSPILER = "transpile.js", goog.hasBadLetScoping = null, goog.loadModule = function(e) { var t = goog.moduleLoaderState_; try { goog.moduleLoaderState_ = { moduleName: "", declareLegacyNamespace: !1, type: goog.ModuleType.GOOG }; var n = {}, r = n; if (typeof e == "function") r = e.call(void 0, r); else if (typeof e == "string") r = goog.loadModuleFromSource_.call(void 0, r, e); else throw Error("Invalid module definition"); var o = goog.moduleLoaderState_.moduleName; if (typeof o == "string" && o) goog.moduleLoaderState_.declareLegacyNamespace ? goog.constructNamespace_(o, r, n !== r) : goog.SEAL_MODULE_EXPORTS && Object.seal && typeof r == "object" && r != null && Object.seal(r), goog.loadedModules_[o] = { exports: r, type: goog.ModuleType.GOOG, moduleId: goog.moduleLoaderState_.moduleName }; else throw Error('Invalid module name "' + o + '"'); } finally { goog.moduleLoaderState_ = t; } }, goog.loadModuleFromSource_ = function($exports$$, $JSCompiler_OptimizeArgumentsArray_p0$$) { return eval(goog.CLOSURE_EVAL_PREFILTER_.createScript($JSCompiler_OptimizeArgumentsArray_p0$$)), $exports$$; }, goog.normalizePath_ = function(e) { e = e.split("/"); for (var t = 0; t < e.length; ) e[t] == "." ? e.splice(t, 1) : t && e[t] == ".." && e[t - 1] && e[t - 1] != ".." ? e.splice(--t, 2) : t++; return e.join("/"); }, goog.loadFileSync_ = function(e) { if (goog.global.CLOSURE_LOAD_FILE_SYNC) return goog.global.CLOSURE_LOAD_FILE_SYNC(e); try { var t = new goog.global.XMLHttpRequest(); return t.open("get", e, !1), t.send(), t.status == 0 || t.status == 200 ? t.responseText : null; } catch { return null; } }, goog.transpile_ = function(e, t, n) { var r = goog.global.$jscomp; r || (goog.global.$jscomp = r = {}); var o = r.transpile; if (!o) { var i = goog.basePath + goog.TRANSPILER, a = goog.loadFileSync_(i); if (a) { if (function() { (0, eval)(a + ` //# sourceURL=` + i); }.call(goog.global), goog.global.$gwtExport && goog.global.$gwtExport.$jscomp && !goog.global.$gwtExport.$jscomp.transpile) throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: ' + JSON.stringify(goog.global.$gwtExport)); goog.global.$jscomp.transpile = goog.global.$gwtExport.$jscomp.transpile, r = goog.global.$jscomp, o = r.transpile; } } return o || (o = r.transpile = function(s, l) { return goog.logToConsole_(l + " requires transpilation but no transpiler was found."), s; }), o(e, t, n); }, goog.typeOf = function(e) { var t = typeof e; return t != "object" ? t : e ? Array.isArray(e) ? "array" : t : "null"; }, goog.isArrayLike = function(e) { var t = goog.typeOf(e); return t == "array" || t == "object" && typeof e.length == "number"; }, goog.isDateLike = function(e) { return goog.isObject(e) && typeof e.getFullYear == "function"; }, goog.isObject = function(e) { var t = typeof e; return t == "object" && e != null || t == "function"; }, goog.getUid = function(e) { return Object.prototype.hasOwnProperty.call(e, goog.UID_PROPERTY_) && e[goog.UID_PROPERTY_] || (e[goog.UID_PROPERTY_] = ++goog.uidCounter_); }, goog.hasUid = function(e) { return !!e[goog.UID_PROPERTY_]; }, goog.removeUid = function(e) { e !== null && "removeAttribute" in e && e.removeAttribute(goog.UID_PROPERTY_); try { delete e[goog.UID_PROPERTY_]; } catch { } }, goog.UID_PROPERTY_ = "closure_uid_" + (1e9 * Math.random() >>> 0), goog.uidCounter_ = 0, goog.cloneObject = function(e) { var t = goog.typeOf(e); if (t == "object" || t == "array") { if (typeof e.clone == "function") return e.clone(); t = t == "array" ? [] : {}; for (var n in e) t[n] = goog.cloneObject(e[n]); return t; } return e; }, goog.bindNative_ = function(e, t, n) { return e.call.apply(e.bind, arguments); }, goog.bindJs_ = function(e, t, n) { if (!e) throw Error(); if (2 < arguments.length) { var r = Array.prototype.slice.call(arguments, 2); return function() { var o = Array.prototype.slice.call(arguments); return Array.prototype.unshift.apply(o, r), e.apply(t, o); }; } return function() { return e.apply(t, arguments); }; }, goog.bind = function(e, t, n) { return Function.prototype.bind && Function.prototype.bind.toString().indexOf("native code") != -1 ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_, goog.bind.apply(null, arguments); }, goog.partial = function(e, t) { var n = Array.prototype.slice.call(arguments, 1); return function() { var r = n.slice(); return r.push.apply(r, arguments), e.apply(this, r); }; }, goog.mixin = function(e, t) { for (var n in t) e[n] = t[n]; }, goog.now = function() { return Date.now(); }, goog.globalEval = function(e) { (0, eval)(e); }, goog.getCssName = function(e, t) { if (String(e).charAt(0) == ".") throw Error('className passed in goog.getCssName must not start with ".". You passed: ' + e); var n = function(o) { return goog.cssNameMapping_[o] || o; }, r = function(o) { o = o.split("-"); for (var i = [], a = 0; a < o.length; a++) i.push(n(o[a])); return i.join("-"); }; return r = goog.cssNameMapping_ ? goog.cssNameMappingStyle_ == "BY_WHOLE" ? n : r : function(o) { return o; }, e = t ? e + "-" + r(t) : r(e), goog.global.CLOSURE_CSS_NAME_MAP_FN ? goog.global.CLOSURE_CSS_NAME_MAP_FN(e) : e; }, goog.setCssNameMapping = function(e, t) { goog.cssNameMapping_ = e, goog.cssNameMappingStyle_ = t; }, goog.getMsg = function(e, t, n) { return n && n.html && (e = e.replace(/</g, "&lt;")), n && n.unescapeHtmlEntities && (e = e.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&apos;/g, "'").replace(/&quot;/g, '"').replace(/&amp;/g, "&")), t && (e = e.replace(/\{\$([^}]+)}/g, function(r, o) { return t != null && o in t ? t[o] : r; })), e; }, goog.getMsgWithFallback = function(e, t) { return e; }, goog.exportSymbol = function(e, t, n) { goog.exportPath_(e, t, !0, n); }, goog.exportProperty = function(e, t, n) { e[t] = n; }, goog.inherits = function(e, t) { function n() { } n.prototype = t.prototype, e.superClass_ = t.prototype, e.prototype = new n(), e.prototype.constructor = e, e.base = function(r, o, i) { for (var a = Array(arguments.length - 2), s = 2; s < arguments.length; s++) a[s - 2] = arguments[s]; return t.prototype[o].apply(r, a); }; }, goog.scope = function(e) { if (goog.isInModuleLoader_()) throw Error("goog.scope is not supported within a module."); e.call(goog.global); }, goog.defineClass = function(e, t) { var n = t.constructor, r = t.statics; return n && n != Object.prototype.constructor || (n = function() { throw Error("cannot instantiate an interface (no constructor defined)."); }), n = goog.defineClass.createSealingConstructor_(n, e), e && goog.inherits(n, e), delete t.constructor, delete t.statics, goog.defineClass.applyProperties_(n.prototype, t), r != null && (r instanceof Function ? r(n) : goog.defineClass.applyProperties_(n, r)), n; }, goog.defineClass.SEAL_CLASS_INSTANCES = goog.DEBUG, goog.defineClass.createSealingConstructor_ = function(e, t) { return goog.defineClass.SEAL_CLASS_INSTANCES ? function() { var n = e.apply(this, arguments) || this; return n[goog.UID_PROPERTY_] = n[goog.UID_PROPERTY_], n; } : e; }, goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "), goog.defineClass.applyProperties_ = function(e, t) { for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]); for (var r = 0; r < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; r++) n = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[r], Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]); }, goog.TRUSTED_TYPES_POLICY_NAME = "goog", goog.identity_ = function(e) { return e; }, goog.createTrustedTypesPolicy = function(e) { var t = null, n = goog.global.trustedTypes; if (!n || !n.createPolicy) return t; try { t = n.createPolicy(e, { createHTML: goog.identity_, createScript: goog.identity_, createScriptURL: goog.identity_ }); } catch (r) { goog.logToConsole_(r.message); } return t; }; var CONFIG = "Debug", GLANCE_VERSION = "7.6.0.0", GCommon = { Defs: {} }; GCommon.Defs.Version = GLANCE_VERSION.split(".").slice(0, 3).join("."), GCommon.Defs.Config = CONFIG, GCommon.Type = {}, GCommon.Domain = {}, GCommon.Domain.match = function(e, t) { return e.match(new RegExp("\\." + t + "$", "i")) !== null; }, GCommon.Domain.getGlanceDomain = function() { return document.domain.split(".").splice(-2).join("."); }, GCommon.Geometry = {}, GCommon.Geometry.Rect = function(e) { this.top = e.top, this.left = e.left, this.right = e.right, this.bottom = e.bottom; }, GCommon.Geometry.Rect.prototype.Union = function(e) { this.left = Math.min(this.left, e.left), this.top = Math.min(this.top, e.top), this.right = Math.max(this.right, e.right), this.bottom = Math.max(this.bottom, e.bottom); }, GCommon.Geometry.Rect.prototype.width = function() { return this.right - this.left; }, GCommon.Geometry.Rect.prototype.height = function() { return this.bottom - this.top; }, GCommon.Time = {}, GCommon.Time.UTCNow = function() { var e = /* @__PURE__ */ new Date(); return e.getUTCFullYear() + "/" + (e.getUTCMonth() + 1) + "/" + e.getUTCDate() + " " + GCommon.String.zeropad(e.getUTCHours(), 2) + ":" + GCommon.String.zeropad(e.getUTCMinutes(), 2) + ":" + GCommon.String.zeropad(e.getUTCSeconds(), 2); }, GCommon.Time.Timer = function() { this.set(); }, GCommon.Time.Timer.prototype.elapsed = function(e) { var t = (/* @__PURE__ */ new Date()).getTime(), n = t - this.t; return e && (this.t = t), n; }, GCommon.Time.Timer.prototype.set = function() { this.t = (/* @__PURE__ */ new Date()).getTime(); }, GCommon.String = {}, GCommon.String.zeropad = function(e, t) { for (e = e.toString(); e.length < t; ) e = "0" + e; return e; }, GCommon.String.queryStringParam = function(e, t) { return e = new RegExp("[\\?&]" + t + "=([^&#]*)").exec(e), e === null ? "" : e[1]; }, GCommon.String.queryString = function(e) { var t = []; return Object.keys(e).forEach(function(n) { t.push(n + "=" + e[n]); }), t.join("&"); }, GCommon.Url = window.URL || window.webkitURL, Uint8Array.prototype.slice || (Uint8Array.prototype.slice = function(e, t) { return new Uint8Array(this.subarray(e, t)); }), ArrayBuffer.prototype.slice || (ArrayBuffer.prototype.slice = function(e, t) { if (e === void 0 && (e = 0), t === void 0 && (t = this.byteLength), e = Math.floor(e), t = Math.floor(t), 0 > e && (e += this.byteLength), 0 > t && (t += this.byteLength), e = Math.min(Math.max(0, e), this.byteLength), t = Math.min(Math.max(0, t), this.byteLength), 0 >= t - e) return new ArrayBuffer(0); var n = new ArrayBuffer(t - e), r = new Uint8Array(n); return e = new Uint8Array(this, e, t - e), r.set(e), n; }), GCommon.Browser = function() { var e = navigator.userAgent.toLowerCase(), t = navigator.platform.toLowerCase(), n = e.match(/(edge)[\s\/:]([\w\d\.]+)?/) || e.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || e.match(/(rv):([\w\d\.]+)/) || [null, "unknown", 0]; return n[1] === "rv" && (n[1] = "ie"), { name: n[1] === "version" ? n[3] : n[1], version: n[1] === "ie" && document.documentMode || parseFloat(n[1] === "opera" && n[4] ? n[4] : n[2]), platform: e.match(/ip(?:ad|od|hone)/) ? "ios" : (e.match(/(?:webos|android)/) || t.match(/mac|win|linux/) || ["other"])[0] }; }(), GCommon.Elem = {}, GCommon.Elem.makeUnselectable = function(e) { e.on("selectstart dragstart", function(t) { return t.preventDefault(), !1; }); }, GCommon.PostRedirect = {}, GCommon.PostRedirect.post = function(e, t) { let n = document.createElement("form"); n.setAttribute("action", e), n.setAttribute("method", "POST"); for (let r in t) e = document.createElement("input"), e.setAttribute("id", r), e.setAttribute("value", t[r]), e.setAttribute("name", r), e.setAttribute("value", t[r]), e.setAttribute("type", "hidden"), n.appendChild(e); document.body.appendChild(n), n.submit(); }; var INFOLOG = GCommon.Defs.Config === "Debug" && !0; GCommon.Log = {}, GCommon.Log.logstring = function(e) { for (var t = "", n = 0; n < e.length; n++) t += (typeof e[n] == "object" ? JSON.stringify(e[n]) : e[n]) + " "; return t.replace(/[\r\n]/g, " ").replace("<", "&lt;").replace(">", "&gt;"); }, GCommon.Log.log = function(e) { window.console && window.console.log && (!window.GLANCE_COBROWSE || !window.GLANCE_COBROWSE.disableLogging) && window.console.log(GCommon.Log.logstring(arguments)); }, GCommon.Log.error = function(e) { window.console && window.console.error && window.console.error(GCommon.Log.logstring(arguments)); }, GCommon.Defs.Config === "Debug" && (GCommon.Log.debuglog = function(e, t) { t = Array.prototype.slice.call(t), t.unshift(e), window.console && window.console.log && window.console.log(GCommon.Log.logstring(t)); }), GCommon.Log.msglog = function(e) { }, GCommon.Log.commlog = function(e) { }, GCommon.Log.paintlog = function(e) { }, GCommon.Log.eventslog = function(e) { }, GCommon.Log.infolog = INFOLOG ? function(e) { GCommon.Log.debuglog("INFO:", arguments); } : function(e) { }, GCommon.Log.framelog = function(e) { }, GCommon.Log.drawlog = function(e) { }, GCommon.Log.rclog = function(e) { }, GCommon.Log.statslog = function(e) { }, GCommon.Diags = {}, GCommon.Diags.blobToString = function(e) { return new Promise(function(t, n) { n = new FileReader(), n.onload = function() { var r = new Uint8Array(this.result); t(r.toString()); }, n.readAsArrayBuffer(e); }); }, GCommon.assert = GCommon.Defs.Config === "Debug" ? function(e) { if (!e) throw Error("assert failed"); } : function(e) { }, GCommon.Stats = {}, GCommon.Stats.tracker = function(e, t, n) { this.stats = {}, this.statcounts = {}, this.stattypes = {}, this.interval = e, this.logfunc = t, this.notifyfunc = n; var r = this; 0 < e && window.setInterval(function() { r.report(); }, 1e3 * e); }, GCommon.Stats.tracker.statType = { STAT_AVERAGE: 0, STAT_PERSEC: 1, STAT_TOTAL: 2 }, GCommon.Stats.tracker.prototype.track = function(e, t, n) { this.stattypes[e] = n, this.stats[e] = this.stats[e] || 0, this.stats[e] += t, this.statcounts[e] = (this.statcounts[e] || 0) + 1; }, GCommon.Stats.tracker.prototype.report = function() { if (this.notifyfunc && this.notifyfunc(), this.logfunc) for (var e in this.stats) switch (this.stattypes[e]) { case GCommon.Stats.tracker.statType.STAT_AVERAGE: this.logfunc(Math.round(this.stats[e] / this.statcounts[e] * 100) / 100, "average", e); break; case GCommon.Stats.tracker.statType.STAT_PERSEC: this.logfunc(Math.round(this.stats[e] / this.interval * 100) / 100, e + "/sec"); break; case GCommon.Stats.tracker.statType.STAT_TOTAL: this.logfunc(Math.round(100 * this.stats[e]) / 100, e); } this.stats = {}, this.statcounts = {}; }, GCommon.EventListeners = function() { this._listeners = {}; }, GCommon.EventListeners.prototype.add = function(e, t) { this._listeners[e] = this._listeners[e] || [], this._listeners[e].push(t); }, GCommon.EventListeners.prototype.remove = function(e, t) { e = this._listeners[e], e !== void 0 && (t = e.indexOf(t), 0 <= t && e.splice(t, 1)); }, GCommon.EventListeners.prototype.fire = function(e, t) { GCommon.Log.eventslog("fire ", e, " ", t ? JSON.stringify(t) : ""); var n = this._listeners[e], r = !0; if (n === void 0) return !0; for (e = 0; e < n.length; e++) n[e](t) || (r = !1); return r; }; var GlanceLogger = { sanitize: function(e) { return e.replace(/[\r\n]/g, " ").replace("<", "&lt;"); }, _log: function(e, ...t) { !window.console || !window.console[e] || window.GLANCE_COBROWSE && window.GLANCE_COBROWSE.disableLogging || (t = t.map((n) => { if (typeof n == "object") try { n = JSON.stringify(n); } catch (r) { console.error(r), n = "unable to convert object to string"; } return typeof n == "string" ? GlanceLogger.sanitize(n) : n; }), window.console[e](...t)); }, log: function(...e) { GlanceLogger._log("log", ...e); }, error: function(...e) { GlanceLogger._log("error", ...e); } }, diffslog = function() { }, diffdetlog = function() { }, preslog = function(...e) { GlanceLogger.log("PRES:", ...e); }, scrolllog = function() { }, eventslog = function() { }, assert = function(e) { if (!e) if (GLANCE.MINIMIZED) GlanceLogger.error("ASSERT"); else throw Error("ASSERT"); }; function errorlog(...e) { GlanceLogger.error("GLANCE:", ...e); } var GLANCE = GLANCE || {}; GLANCE.Lib = GLANCE.Lib || {}, GLANCE.VERSION = "7.6.0.0", GLANCE.PATCH = "", window.GLANCE = window.GLANCE || {}, window.GLANCE.VERSION = GLANCE.VERSION, window.GLANCE.PATCH = GLANCE.PATCH, window.GLANCE.Lib = window.GLANCE.Lib || {}, GLANCE.Lib.KEYTYPE = { RANDOM: "GLANCE_KEYTYPE_RANDOM" }, GLANCE.Lib.KEYTYPE = { RANDOM: "GLANCE_KEYTYPE_RANDOM" }, GLANCE.Lib.MESSAGES = { GLANCE_INVOKE_MSG: "glance_invoke", GLANCE_SCREENSHARE: "glance_screenshare", GLANCE_SCREENSHAREPREVIEW: "glance_screensharepreview", GLANCE_VISITOR_SCREENSHAREPREVIEW: "glance_visitor_screensharepreview", GLANCE_AGENTVIDEO: "glance_agentvideo", GLANCE_VIDEOPREVIEW: "glance_videopreview" }, GLANCE.Lib.Const = { GID: "data-gid", GCID: "data-gcid", SDID: "data-sdid" }, GLANCE.Lib.APPLIED_CLASSES = ["glance_masked", "glance_controllable"], GLANCE.Lib.scriptId = function(e) { return ("glance_" + e).toLowerCase(); }, GLANCE.Lib.CallFlags = { None: 0, Reconnect: 1, Reverse: 2, Declined: 4, Rcrequested: 8, Closing: 16, Beta: 32, MultipleGuestsOk: 64, Anonymous: 128, Showback: 256, GuestNameRequired: 512, GuestEmailRequired: 1024, GuestPhoneRequired: 2048, GuestNameHidden: 4096, GuestEmailHidden: 8192, GuestPhoneHidden: 16384, GuestInfo: 32256, Encrypt: 32768, ForceAjax: 65536, Persist: 131072, PresenceStart: 262144, StagingSession: 524288, HDAgentVideoEnabled: 2097152 }, GLANCE.Lib.IntVersion = function() { var e = GLANCE.VERSION.split("."); return 1e6 * parseInt(e[0]) + 1e3 * parseInt(e[1]) + parseInt(e[2]); }(), GLANCE.Lib.VideoJoinURL = function(e, t, n, r) { return n = n || "clip", r = r || "{version}", URL.toString().includes("[native code]") ? new URL(e) : GLANCE.Lib.GElement.nativeInstance("URL", e), `https://${t}/videoplayer/VideoPlayer.aspx?offer=${e}&scaling=${n}&noendpage=1&guestid={guestid}&conntype={role}&version=${r}`; }, GLANCE.Lib.Browser = function() { var e = navigator.userAgent.toLowerCase(), t = navigator.platform.toLowerCase(), n = e.match(/(edge|edg)[\s\/:]([\w\d\.]+)?/) || e.match(/(opera|ie|firefox|chrome|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || e.match(/(rv):([\w\d\.]+)/) || [null, "unknown", 0]; return n[1] === "edg" && (n[1] = "edge"), n[1] === "crios" ? n[1] = "chrome" : n[1] === "rv" && (n[1] = "ie"), e = { extend: Function.prototype.extend, name: n[1] == "version" ? n[3] : n[1], version: n[1] == "ie" && document.documentMode || parseFloat(n[1] == "opera" && n[4] ? n[4] : n[2]), Platform: { name: e.match(/ip(?:ad|od|hone)/) || t.match(/mac/) && 0 < typeof navigator.maxTouchPoints ? "ios" : (e.match(/(?:webos|android)/) || t.match(/mac|win|linux/) || ["other"])[0] }, Features: { xpath: !!document.evaluate, air: !!window.runtime, query: !!document.querySelector, json: !!window.JSON }, Plugins: {}, isMobileDevice: function() { return this.Platform.name == "ios" || this.Platform.name == "android"; } }, document.documentMode && window.XDomainRequest ? (e.name = "ie", e.version = document.documentMode) : window.navigator && navigator.appVersion && navigator.appVersion.indexOf("MSIE 7.") != -1 && (e.name = "ie", e.version = "7"), e[e.name] = !0, e[e.name + parseInt(e.version, 10)] = !0, e.Platform[e.Platform.name] = !0, e; }(), GLANCE.Lib.isGuestScalingSupported = function() { return !(GLANCE.Lib.Browser.Platform.name == "ios" || GLANCE.Lib.Browser.Platform.name == "mac" && GLANCE.Lib.Browser.name == "safari"); }, GLANCE.Lib.getIframe = function(e, t) { return t = t || document, GLANCE.Lib.GElement.nativeMethod(t, "querySelector", "iframe[frameid='" + e + "']"); }, GLANCE.Lib.getIframeFromWindow = function(e) { return Array.from(GLANCE.Lib.GElement.nativeMethod(document, "querySelectorAll", "iframe")).find((t) => GLANCE.Lib.GElement.nativeGetProperty("contentWindow", t) === e); }, GLANCE.Lib.equal = function(e, t) { return GLANCE.Lib.JSONStringify(e) === GLANCE.Lib.JSONStringify(t); }, GLANCE.Lib.random = function(e) { for (e = String(Math.round(Math.random() * Math.pow(10, e))); 4 > e.length; ) e = "0" + e; return e; }, GLANCE.Lib.getScriptVersion = function() { let e = GLANCE.VERSION.split(".").slice(0, 3).join("."); return GLANCE.MINIMIZED && (e += "&min=true"), e; }, GLANCE.Lib.getCryptoToken = function(e) { e = new Uint32Array(Math.ceil(e / 32)), window.crypto.getRandomValues(e); let t = ""; return e.forEach((n) => { t += n.toString(36); }), t; }, GLANCE.Lib.getProperties = function(e, t) { var n = {}, r = new RegExp(t), o; for (o in e) o.match(r) && (n[o.substr(t.length)] = e[o]); return n; }, GLANCE.Lib.pointDistance = function(e, t) { return Math.max(Math.abs(e.x - t.x), Math.abs(e.y - t.y)); }, GLANCE.Lib.Url = {}, GLANCE.Lib.Url.isAbsolute = function(e) { return 0 <= e.indexOf("//") || e.indexOf("/") === 0; }, GLANCE.Lib.ExtendableTimer = function() { }, GLANCE.Lib.ExtendableTimer.prototype.set = function(e, t) { GLANCE.Lib.GElement.nativeMethod(window, "clearTimeout", this.timer); var n = this; this.timer = GLANCE.Lib.GElement.nativeMethod(window, "setTimeout", function() { delete n.timer, t && t(); }, e); }, GLANCE.Lib.ExtendableTimer.prototype.isSet = function() { return this.timer !== void 0; }, GLANCE.Lib.ExtendableTimer.prototype.clear = function() { GLANCE.Lib.GElement.nativeMethod(window, "clearTimeout", this.timer), delete this.timer; }, GLANCE.Lib.cleanArrays = function(e, t) { if (Array.isArray(e)) return new t.Array(...e).map((n) => GLANCE.Lib.cleanArrays(n, t)); if (e !== null && typeof e == "object") { const n = {}; return Object.entries(e).forEach(([r, o]) => n[r] = GLANCE.Lib.cleanArrays(o, t)), n; } return e; }, GLANCE.Lib.JSONStringify === void 0 && (GLANCE.Lib.JSONStringify = function(e) { return GLANCE.Lib.GElement.CleanContext ? (Array.prototype.toJSON && (e = GLANCE.Lib.cleanArrays(e, GLANCE.Lib.GElement.CleanContext.window)), GLANCE.Lib.GElement.CleanContext.window.JSON.stringify(e)) : JSON.stringify(e); }), GLANCE.Lib.cleanArrays = function(e, t) { if (Array.isArray(e)) return new t.Array(...e).map((n) => GLANCE.Lib.cleanArrays(n, t)); if (e !== null && typeof e == "object") { const n = {}; return Object.entries(e).forEach(([r, o]) => n[r] = GLANCE.Lib.cleanArrays(o, t)), n; } return e; }, GLANCE.Lib._enhanceSocket = function(e) { return e.pingInterval = 0, e.pingTimeout = 0, e.pingTimer = new GLANCE.Lib.ExtendableTimer(), e.pingTimeoutTimer = new GLANCE.Lib.ExtendableTimer(), e.onclose = function(t) { e.pingTimer.clear(), e.pingTimeoutTimer.clear(), e.on_close && e.on_close(t); }, e.onmessage = function(t) { t = JSON.parse(t.data), e.onreceiveobj && e.onreceiveobj(t), e.ping(); }, e.sendobj = function(t) { t = GLANCE.Lib.JSONStringify(t), e.readyState !== WebSocket.OPEN ? GLANCE.Lib.errlog(`Tried to send message on closed websocket: ${t}`) : e.send(t); }, e.getcode = function(t) { return t && t.code || 0; }, e.getreason = function(t) { return t && t.reason || ""; }, e.startpings = function(t, n) { this.pingInterval = t, this.pingTimeout = n, this.ping(); }, e.ping = function() { 0 < e.pingInterval && e.pingTimer.set(1e3 * e.pingInterval, () => e.sendobj({ mtype: "Ping" })), 0 < e.pingTimeout && e.pingTimeoutTimer.set(1e3 * e.pingTimeout, () => e.onerror(new Event("WS_PING_TIMEOUT"))); }, e; }, GLANCE.Lib.GWebSocket = function(e) { return e = new WebSocket(e), GLANCE.Lib._enhanceSocket(e), e; }, GLANCE.Lib.RequestProxy = { loaded: !1 }, GLANCE.Lib.RequestProxy.init = function(e) { if (GLANCE.Lib.RequestProxy.server = e, !document.getElementById("glance_request_proxy")) { var t = document.createElement("iframe"); t.id = "glance_request_proxy", t.width = "0px", t.height = "0px", t.style.border = "none", t.src = "https://" + e + "/RequestProxy.htm?1", t.onload = function() { GLANCE.Lib.RequestProxy.loaded = !0; }, document.body.appendChild(t); } GLANCE.Lib.RequestProxy.proxyframe = document.getElementById("glance_request_proxy").contentWindow; }, GLANCE.Lib.RequestProxy.postMessage = function(e, t) { var n = GLANCE.Lib.RequestProxy; n.loaded ? n.proxyframe.postMessage(e, t || "https://" + GLANCE.Lib.RequestProxy.server) : GLANCE.Lib.GElement.nativeMethod(window, "setTimeout", function() { n.postMessage(e, t); }, 100); }, GLANCE.Lib.nextGID = 1, GLANCE.Lib.compressObj = function(e) { return e == null ? e : (e = GLANCE.Lib.JSONStringify(e), { _c: GLANCE.Lib.compressToBase64(e) }); }, GLANCE.Lib.compressToBase64 = function(e) { e = new TextEncoder().encode(e); var t = new window.GLANCE.Lib.Zlib.RawDeflate(e).compress(); e = "", t = new Uint8Array(t); for (var n = t.byteLength, r = 0; r < n; r++) e += String.fromCharCode(t[r]); return window.btoa(e); }, GLANCE.Lib.decompressObj = function(e) { return e === null || e instanceof String && e.length === 0 ? null : e._c === void 0 ? e : (e = GLANCE.Lib.decompressFromBase64(e._c), JSON.parse(e)); }, GLANCE.Lib.decompressFromBase64 = function(e) { e = window.atob(e); for (var t = e.length, n = new Uint8Array(t), r = 0; r < t; r++) n[r] = e.charCodeAt(r); return e = new window.GLANCE.Lib.Zlib.RawInflate(n.buffer).decompress(), new TextDecoder().decode(e); }, GLANCE.Lib.pad = function(e, t, n) { return (e.length >= n ? "" : Array(1 + n - e.length >>> 0).join(t)) + e; }, GLANCE.Lib.hash = function(e) { var t = 0, n; if (e.length == 0) return t; for (n = 0; n < e.length; n++) { var r = e.charCodeAt(n); t = (t << 5) - t + r, t &= t; } return Math.abs(t); }, GLANCE.Lib.Params = {}, GLANCE.Lib.Params.copy = function(e, t, n) { if (e !== void 0) return n = n || Object.keys(e), n.forEach(function(r) { e[r] !== void 0 && (t[r] = e[r]); }), t; }, GLANCE.Lib.invokeFunction = function(e) { var t = e.func.split("."); if (2 > t.length) GLANCE.Lib.errlog("ERR_BADINVOKE:", e.func); else if (t[0] === "GLANCE" || t[0] === "GLANCE_COBROWSE" && t[1] === "Custom") { for (var n = window[t[0]], r = 1; r < t.length; r++) if (n = n[t[r]], !n) { GLANCE.Lib.errlog("ERR_UNDEFINVOKE:" + t[r]); return; } e.args = e.args || {}, e.args.remote = !0, n(e.args); } else GLANCE.Lib.errlog("ERR_BADINVOKE:" + t[0]); }, GLANCE.Lib.UTCNow = function() { function e(n, r) { for (n = n.toString(); n.length < r; ) n = "0" + n; return n; } var t = /* @__PURE__ */ new Date(); return t.getUTCFullYear() + "/" + (t.getUTCMonth() + 1) + "/" + t.getUTCDate() + " " + e(t.getUTCHours(), 2) + ":" + e(t.getUTCMinutes(), 2) + ":" + e(t.getUTCSeconds() + "." + e(t.getUTCMilliseconds(), 3), 2); }, GLANCE.Lib.Timer = function() { this.t = 0; }, GLANCE.Lib.Timer.prototype.elapsed = function() { return (/* @__PURE__ */ new Date()).getTime() - this.t; }, GLANCE.Lib.Timer.prototype.set = function() { this.t = (/* @__PURE__ */ new Date()).getTime(); }, GLANCE.Lib.Window = {}, GLANCE.Lib.Window.addEventListener = function(e, t, n) { GLANCE.Lib.GElement.nativeMethod(window, "addEventListener", e, t, n); }, GLANCE.Lib.Window.removeEventListener = function(e, t) { GLANCE.Lib.GElement.nativeMethod(window, "removeEventListener", e, t); }, GLANCE.Lib.Window.postWindowMessage = function(e, t, n, r) { var o = {}; o[t] = n, e.postMessage(o, r !== void 0 ? r : "*"); }, GLANCE.Lib.Window.onWindowMessage = function(e, t, n) { var r = function(o) { let i = o.data; i[e] !== void 0 && (n && !GLANCE.Lib.isAllowedOrigin(o.origin, n) ? GLANCE.Lib.errlog("UNTRUSTED_ORIGIN:" + o.origin + " allowed:" + n + " message:" + JSON.stringify(i)) : t(o.source, i[e])); }; return GLANCE.Lib.GElement.nativeMethod(window, "addEventListener", "message", r), r; }, GLANCE.Lib.Window.POPUP_WINDOW = "location=no,menubar=0,titlebar=0,status=0,toolbar=0", GLANCE.Lib.Window.onPageHide = function(e) { GLANCE.Lib.Window.addEventListener(window.onpagehide !== void 0 ? "pagehide" : "unload", e); }, GLANCE.Lib.Window.onPageShow = function(e) { window.onpageshow !== void 0 && GLANCE.Lib.Window.addEventListener("pageshow", e); }, GLANCE.Lib.Window.DOMEvents = "DOMAttrModified DOMAttributeNameChanged DOMCharacterDataModified DOMElementNameChanged DOMNodeInserted DOMNodeInsertedIntoDocument DOMNodeRemoved DOMNodeRemovedFromDocument DOMSubtreeModified".split(" "), GLANCE.Lib.Window.listenForDOMChanges = function(e) { let t = window.MutationObserver && window.MutationObserver.toString().includes("native code") ? window.MutationObserver : GLANCE.Lib.GElement.CleanContext.MutationObserver; GLANCE.Lib.Window.mutationObserver = new t(e), GLANCE.Lib.Window.mutationObserver.observe(document, { childList: !0, characterData: !0, attributes: !0, subtree: !0 }); }, GLANCE.Lib.Window.stopListenForDOMChanges = function() { GLANCE.Lib.Window.mutationObserver && GLANCE.Lib.Window.mutationObserver.disconnect(), delete GLANCE.Lib.Window.mutationObserver; }, GLANCE.Lib.cleanObj = function(e) { function t(r) { if (!(r instanceof Array || r instanceof String)) { for (var o in r) if (typeof r[o] == "object") { t(r[o]); e: { var i = void 0, a = r[o]; if (a instanceof Array || a instanceof String) i = !1; else { for (i in a) if (a.hasOwnProperty(i)) { i = !1; break e; } i = !0; } } i && delete r[o]; } } } function n(r) { if (!(r instanceof Array || r instanceof String)) for (var o in r) r[o] === void 0 ? delete r[o] : typeof r[o] == "object" && n(r[o]); } n(e), t(e); }, GLANCE.Lib.compareObjects = function(e, t) { return JSON.stringify(e) === JSON.stringify(t); }, GLANCE.Lib.compareVersions = function(e, t) { e = String(e).split("."); var n = String(t).split("."); for (e.push([0, 0, 0, 0]), n.push([0, 0, 0, 0]), t = 0; 4 > t; t++) { if (isNaN(e[t]) && (e[t] = 0), isNaN(n[t]) && (n[t] = 0), Number(e[t]) < Number(n[t])) return -1; if (Number(e[t]) > Number(n[t])) return 1; } return 0; }, GLANCE.Lib.AppendUrlParams = function(e, t) { var n = e.indexOf("#"); return 0 > n ? e + (e.indexOf("?") === -1 ? "?" : "&") + t : GLANCE.Lib.AppendUrlParams(e.substring(0, n), t) + e.substring(n); }, GLANCE.Lib.XMLDoc = function(e) { this.ownerDoc = e.ownerDocument; }, GLANCE.Lib.XMLDoc.prototype.getElementText = function(e) { return (e = this.ownerDoc.querySelector(e)) ? e.textContent : null; }, GLANCE.Lib.JSONFetch = async function(e, t) { return new Promise(async (n, r) => { t.headers = { "Content-Type": "application/json" }, typeof t.body == "object" && (t.body = JSON.stringify(t.body)); let o; try { o = await fetch(e, t); } catch (a) { GLANCE.Lib.errlog(`JSON request to ${e} failed: ${a.message}`), r("connection"); return; } if (o.ok) { try { var i = await o.json(); } catch (a) { GLANCE.Lib.errlog(`JSON request to ${e} reponse parse failed`, a), r("error"); } n(i); } else GLANCE.Lib.errlog(`JSON request to ${e} failed status: ${o.status}`), n = await o.text(), GLANCE.Lib.errlog(n), r(o.status === 401 || o.status === 403 ? "authorization" : "error"); }); }, GLANCE.Lib.Request = function(e) { GLANCE.Lib.useIFrameProxy ? this.ifproxy = new GLANCE.Lib.Request.IFrameProxyRequest(e) : this.xmlhttp = this.getXmlHttp(), this.response = null, this.type = e; }, GLANCE.Lib.Request.prototype.setAuthorizer = function(e) { this.authorizer = e; }, GLANCE.Lib.Request.prototype.setAuthorizationToken = function(e) { this.authorizationToken = e; }, GLANCE.Lib.Request.prototype.getXmlHttp = function() { return new window.XMLHttpRequest(); }, GLANCE.Lib.Request.prototype.abort = function() { this.ifproxy ? this.ifproxy.abort() : this.xmlhttp.abort(); }, GLANCE.Lib.Request.prototype.onreadystatechange = function() { if (this.xmlhttp.readyState == 4) { GLANCE.Lib.GElement.nativeMethod(window, "clearTimeout", this.requesttimeout), delete this.requesttimeout; var e = "error"; if (this.xmlhttp.status == 0) GLANCE.Lib.log(this.method + " to " + this.url + " failed: network"), this.onfailure(!0, "connection", this.xmlhttp.status); else if (this.xmlhttp.status !== 200) GLANCE.Lib.errlog(this.method + " to " + this.url + " failed with status: " + this.xmlhttp.status), this.xmlhttp.responseType === "text" && this.xmlhttp.responseText !== null && GLANCE.Lib.log(this.xmlhttp.responseText), (this.xmlhttp.status === 401 || this.xmlhttp.status === 403) && (e = "authorization", this.authorizer && this.authorizer.clearToken()), this.onfailure(!1, e, this.xmlhttp.status); else { if (this.xmlhttp.response !== "") { if (this.accept === "XML") this.response = this.xmlhttp.responseXML && this.xmlhttp.responseXML.documentElement, this.response === null && GLANCE.Lib.errlog("Invalid XML response: " + this.xmlhttp.responseText); else if (this.IE11BinaryWorkaround) { for (var t = new Uint8Array(this.xmlhttp.responseText.length), n = 0; n < this.xmlhttp.responseText.length; n++) t[n] = this.xmlhttp.responseText.charCodeAt(n) & 255; this.response = new Blob([t], { type: this.xmlhttp.getResponseHeader("Content-Type") }); } else if (this.xmlhttp.responseType === "blob") this.response = this.xmlhttp.response; else if (this.xmlhttp.responseXML) this.response = this.parsejson(this.xmlhttp.responseXML.childNodes[0].childNodes[0].nodeValue); else if (this.accept === "HTML" || this.accept === "TEXT") this.response = this.xmlhttp.responseText; else if (this.response = this.parsejson(this.xmlhttp.responseText), this.response === null) { GLANCE.Lib.log(this.method + " to " + this.url + " failed - can't parse response " + this.xmlhttp.responseText), this.onfailure(!1, e); return; } if (this.response.err !== void 0 && this.response.msg !== void 0) { GLANCE.Lib.log(this.method + " to " + this.url + " failed with error:" + this.response.err + " " + this.response.msg), this.onfailure(!1, e); return; } } this.onsuccess(this.response); } } }, GLANCE.Lib.Request.prototype.parsejson = function(e) { var t = null; try { t = JSON.parse(e); } catch (n) { return GLANCE.Lib.log("JSON parse failed with error: " + n.toString() + " parsing: " + e), null; } return t; }, GLANCE.Lib.Request.prototype.getResponseHeader = function(e) { return this.xmlhttp.getResponseHeader(e); }, GLANCE.Lib.Request.prototype.setAccept = function(e) { this.accept = e, e === "XML" ? this.acceptheader = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" : e === "JSON" ? this.acceptheader = "application/json, text/javascript, */*; q=0.01" : e === "HTML" ? this.acceptheader = "text/html" : e === "TEXT" ? this.acceptheader = "text/*" : e === "IMAGE" ? this.acceptheader = "image/*" : e === "BINARY" && (this.acceptheader = "*/*"), (e === "IMAGE" || e === "BINARY") && (this.xmlhttp.responseType = "blob"); }, GLANCE.Lib.Request.appendQueryStringParams = function(e, t) { return e + "?" + Object.keys(t).map(function(n) { return n + "=" + t[n]; }).join("&"); }, GLANCE.Lib.Request.prototype.get = function(e, t, n, r, o) { this.method = "GET", this.post(e, null, t, n, r, o); }, GLANCE.Lib.Request.formUrlEncode = function(e) { var t = [], n; for (n in e) e.hasOwnProperty(n) && t.push(encodeURIComponent(n) + "=" + encodeURIComponent(e[n])); return t.join("&"); }, GLANCE.Lib.Request.prototype.post = function(e, t, n, r, o, i) { if (this.url = e, this.onsuccess = o !== void 0 ? o : function() { }, this.onfailure = i !== void 0 ? i : function() { }, this.method = this.method || "POST", this.ifproxy) this.ifproxy.post(e, t, n, r, o, i); else { if (o = this.contenttype || (this.type === "JSON" ? "application/json; charset=utf-8" : "application/x-www-form-urlencoded; charset=utf-8"), typeof t == "string") var a = t; else t instanceof Blob ? (o = t.type, a = t) : t && (a = this.type === "JSON" ? GLANCE.Lib.JSONStringify(t) : "data=" + GLANCE.Lib.JSONStringify(t)); var s = this; GLANCE.Lib.Browser.safari && this.safaritimeout && (this.requesttimeout = GLANCE.Lib.GElement.nativeMethod(window, "setTimeout", function() { GLANCE.Lib.log(this.method + " to " + this.url + " failed - timedout (Safari)"), this.onfailure(!1, "timedout"); }.bind(this), this.safaritimeout)), this.xmlhttp.onreadystatechange = function() { s.onreadystatechange(); }; try { this.xmlhttp.open(this.method, e, n), this.acceptheader !== void 0 && this.xmlhttp.setRequestHeader("Accept", this.acceptheader), this.xmlhttp.setRequestHeader !== void 0 && this.method !== "GET" && this.xmlhttp.setRequestHeader("Content-type", o), this.authorizer && this.authorizer.getToken() ? this.xmlhttp.setRequestHeader("Authorization", "Bearer " + this.authorizer.getToken()) : this.authorizationToken && this.xmlhttp.setRequestHeader( "Authorization", "Bearer " + this.authorizationToken ), this.xmlhttp.withCredentials = r, this.xmlhttp.send(a); } catch (l) { GLANCE.Lib.log(this.method + " to " + e + " failed with: " + l.toString()), this.onfailure(!1, l.toString()); } } }, GLANCE.Lib.Request.IFrameProxyRequest = function(e) { this.type = e, GLANCE.Lib.Request.IFrameProxyRequest.currentRequest = this; }, GLANCE.Lib.Request.IFrameProxyRequest.init = function(e) { GLANCE.Lib.RequestProxy.init(e), GLANCE.Lib.Window.addEventListener("message", GLANCE.Lib.Request.IFrameProxyRequest.handleMessage, !1); }, GLANCE.Lib.Request.IFrameProxyRequest.prototype.post = function(e, t, n, r, o, i) { this.onsuccess = o, this.onfailure = i, GLANCE.Lib.RequestProxy.postMessage({ from: "IFrameProxyRequest", type: this.type, url: e, obj: t, async: n, withcred: r }); }, GLANCE.Lib.Request.IFrameProxyRequest.prototype.abort = function() { GLANCE.Lib.Request.IFrameProxyRequest.postMessage({ from: "IFrameProxyRequest", abort: !0 }); }, GLANCE.Lib.Request.IFrameProxyRequest.handleMessage = function(e) { GLANCE.Lib.getDomain(e.origin) === GLANCE.Lib.getDomain(GLANCE.Lib.RequestProxy.server) && typeof e.data.to < "u" && e.data.to == "IFrameProxyRequest" && (e.data.success ? GLANCE.Lib.Request.IFrameProxyRequest.currentRequest.onsuccess(e.data.response) : GLANCE.Lib.Request.IFrameProxyRequest.currentRequest.onfailure()); }, GLANCE.Lib.Cookie = function(e, t) { this.name = e, this.domain = t || new GLANCE.Lib.Page(window).getDomain(); }, GLANCE.Lib.Cookie.prototype.setObj = function(e, t) { var n = /* @__PURE__ */ new Date(); n.setUTCHours(n.getUTCHours() + 8), document.cookie = this.name + "=" + encodeURIComponent(GLANCE.Lib.JSONStringify(e)) + "; expires=" + n.toGMTString() + "; domain=" + this.domain + "; path=/" + (t || e.secure ? ";secure" : ""); }, GLANCE.Lib.Cookie.prototype.getObj = function() { var e = this.get()