PageSourceSearch

https://us.eufy.com/cdn/shop/t/2/assets/esw.min.js?v=126653714999477415571678344607

js eufy.com collected 2026-10-01 11:47:08 UTC 37,244 bytes, 765 lines download raw bytes

1(function (l) {
2  function d() {
3    var a = !1,
4      b;
5    this.settings = {
6      appendHelpButton: !0,
7      displayHelpButton: !0,
8      isExternalPage: !0,
9      devMode: !1,
10      targetElement: document.body,
11      elementForOnlineDisplay: void 0,
12      elementForOfflineDisplay: void 0,
13      defaultMinimizedText: "",
14      disabledMinimizedText: "",
15      defaultAssistiveText: "",
16      loadingText: "Loading",
17      showIcon: void 0,
18      enabledFeatures: [],
19      entryFeature: "FieldService",
20      storageDomain: document.domain,
21      language: void 0,
22      linkAction: {
23        feature: void 0,
24        name: void 0,
25        valid: !1
26      },
27      linkActionParameters: {},
28      useCustomAuthentication: !1,
29      allowGuestUsers: !1,
30      requireSLDS: !1,
31      hasBottomTabBar: !1
32    };
33    this.auth = {};
34    this.validLinkActions = {};
35    this.alwaysWarnOnBeforeUnload = !1;
36    Object.defineProperty(this.auth, "oauthToken", {
37      get: function () {
38        return b
39      },
40      set: function (c) {
41        this.validateHeaderValue(c) ? (b = c) ? (this.setSessionData("ESW_OAUTH_TOKEN", c), this.checkAuthentication()) : this.deleteSessionData("ESW_OAUTH_TOKEN") : this.error('"' + c + '" is not a valid OAuth token.')
42      }.bind(this)
43    });
44    this.featureScripts = {};
45    this.storedEventHandlers = {};
46    this.messageHandlers = {};
47    this.storageKeys = ["ESW_BODY_SCROLL_POSITION", "ESW_IS_MINIMIZED", "ESW_MINIMIZED_TEXT", "ESW_OAUTH_TOKEN"];
48    this.defaultSettings = {};
49    this.snippetSettingsFile = {};
50    this.eswFrame = void 0;
51    this.availableFeatures = ["script", "session"];
52    this.outboundMessagesAwaitingIframeLoad = [];
53    this.pendingMessages = {};
54    this.iframeScriptsToLoad = [];
55    this.isAuthenticationRequired = this.isIframeReady = this.hasSessionDataLoaded = this.componentInitInProgress = this.domInitInProgress = !1;
56    this.loginPendingSerializedData = void 0;
57    this.componentLoaded = !1;
58    Object.defineProperty(this,
59      "isButtonDisabled", {
60        get: function () {
61          return a
62        },
63        set: function (c) {
64          a = c;
65          this.onButtonStatusChange()
66        }.bind(this),
67        configurable: !0
68      });
69    this.setupMessageListener();
70    this.getLinkActionData()
71  }
72  var m = [".salesforce.com", ".force.com", ".sfdc.net", ".site.com", ".salesforce-sites.com"],
73    n = "liveagent.chatCanceledOnDifferentTab liveagent.fileTransfer.resetFileSelector liveagent.fileTransfer.uploadFile session.deletedSessionData session.onLoad session.sessionData session.updateMaster".split(" ");
74  d.prototype.getLightningOutParamsObj =
75    function () {
76      var a = {};
77      embedded_svc.config && embedded_svc.config.additionalSettings && embedded_svc.config.additionalSettings.labelsLanguage ? a = {
78        guestUserLang: embedded_svc.config.additionalSettings.labelsLanguage
79      } : embedded_svc.settings.language && "" !== embedded_svc.settings.language.trim() && (a = {
80        guestUserLang: embedded_svc.settings.language
81      });
82      a.eswConfigDeveloperName = embedded_svc.settings.eswConfigDevName;
83      return a
84    };
85  d.prototype.adjustCommunityStorageDomain = function () {
86    this.isCommunityDomain(this.settings.storageDomain) &&
87      this.settings.storageDomain === document.domain && (this.settings.storageDomain = this.settings.storageDomain + "/" + window.location.pathname.split("/")[1])
88  };
89  d.prototype.loadLightningOutScripts = function (a) {
90    if ("function" !== typeof Promise) this.loadScriptFromDirectory("common", "promisepolyfill", function () {
91      return this.loadLightningOutScripts(a)
92    }.bind(this), !0);
93    else return new Promise(function (b, c) {
94      try {
95        var e = a && a.baseCoreURL ? a.baseCoreURL : embedded_svc.settings.baseCoreURL;
96        if (window.$Lightning) b("Lightning Out is already loaded on this page.");
97        else if (embedded_svc.utils.isCommunityOrSite()) b("Communities context does not require Lightning Out to use Embedded Service.");
98        else if (e) {
99          var f = document.createElement("script");
100          f.type = "text/javascript";
101          f.src = e + "/lightning/lightning.out.js";
102          f.onload = function () {
103            b("Lightning Out scripts loaded.")
104          };
105          document.getElementsByTagName("head")[0].appendChild(f)
106        }
107      } catch (h) {
108        c(h)
109      }
110    })
111  };
112  d.prototype.instantiateLightningOutApplication = function (a) {
113    if ("function" !== typeof Promise) this.loadScriptFromDirectory("common", "promisepolyfill",
114      function () {
115        return this.instantiateLightningOutApplication(a)
116      }.bind(this), !0);
117    else return new Promise(function (b, c) {
118      try {
119        var e = a && a.communityEndpointURL ? a.communityEndpointURL : embedded_svc.settings.communityEndpointURL;
120        var f = a && a.oauthToken ? a.oauthToken : embedded_svc.settings.oauthToken;
121        var h = a && a.paramsObj ? a.paramsObj : embedded_svc.getLightningOutParamsObj() || void 0;
122        embedded_svc.utils.isCommunityOrSite() ? b("Communities context already has an Aura context.") : window.$Lightning && $Lightning.use("embeddedService:sidebarApp",
123          function () {
124            b("Lightning Out application request complete.")
125          }, e, f, h)
126      } catch (g) {
127        c(g)
128      }
129    })
130  };
131  d.prototype.createEmbeddedServiceComponent = function (a) {
132    if ("function" !== typeof Promise) this.loadScriptFromDirectory("common", "promisepolyfill", function () {
133      return this.createEmbeddedServiceComponent(a)
134    }.bind(this), !0);
135    else return new Promise(function (b, c) {
136      var e = a && a.chatAPISettings ? embedded_svc.validateStartChatAttributes(a.chatAPISettings) : {};
137      try {
138        var f = a && a.attributes ? a.attributes : {
139          configurationData: embedded_svc.settings,
140          chatAPISettings: e
141        };
142        var h = a && a.locator ? a.locator : embedded_svc.settings.targetElement;
143        embedded_svc.preparePageForSidebar();
144        window.$Lightning && !document.querySelector(".embeddedServiceSidebar") ? $Lightning.ready($Lightning.createComponent.bind(this, "embeddedService:sidebar", f, h, function (g, k, p) {
145          "SUCCESS" === k ? embedded_svc.utils.addEventHandler("afterInitialization", function () {
146            b("Embedded Service component created.")
147          }) : c(p)
148        })) : embedded_svc.utils.isCommunityOrSite() ? window.dispatchEvent(new CustomEvent("embeddedServiceCreateSidebar", {
149          detail: {
150            componentAttributes: f,
151            resolve: b,
152            reject: c
153          }
154        })) : "undefined" === typeof window.$Lightning ? b("Lightning Out should be loaded on this page before creating the Embedded Service component.") : b("Embedded Service component already exists.")
155      } catch (g) {
156        c(g)
157      }
158    })
159  };
160  d.prototype.bootstrapEmbeddedService = function (a) {
161    if ("function" !== typeof Promise) this.loadScriptFromDirectory("common", "promisepolyfill", function () {
162      return embedded_svc.bootstrapEmbeddedService(a)
163    }, !0);
164    else return new Promise(function (b, c) {
165      try {
166        embedded_svc.loadLightningOutScripts(a).then(function () {
167          embedded_svc.instantiateLightningOutApplication(a).then(function () {
168            embedded_svc.createEmbeddedServiceComponent(a).then(function () {
169              window.requestAnimationFrame(function () {
170                embedded_svc.hideHelpButton();
171                b("Embedded Service application and component bootstrapped.")
172              })
173            })
174          })
175        })
176      } catch (e) {
177        c(e)
178      }
179    })
180  };
181  d.prototype.validateStartChatAttributes = function (a) {
182    var b = (a = a ? a : {}) && a.prepopulatedPrechatFields ? a.prepopulatedPrechatFields : {},
183      c = a && a.extraPrechatInfo ? a.extraPrechatInfo : [],
184      e = a && a.extraPrechatFormDetails ? a.extraPrechatFormDetails : [],
185      f = a && a.fallbackRouting ? a.fallbackRouting : [],
186      h = a && a.directToButtonRouting ? a.directToButtonRouting : void 0,
187      g = {
188        buttonId: a && a.buttonId ? a.buttonId : void 0,
189        userId: a && a.userId ? a.userId : void 0,
190        fallback: a && "boolean" === typeof a.fallback ? a.fallback : void 0
191      };
192    if ("object" === typeof b) a.prepopulatedPrechatFields = b;
193    else throw Error("Validation failed for prepopulatedPrechatFields, received: " + b);
194    if (Array.isArray(e)) a.extraPrechatFormDetails = e;
195    else throw Error("Validation failed for extraPrechatFormDetails, received: " + e);
196    if (Array.isArray(c)) a.extraPrechatInfo = c;
197    else throw Error("Validation failed for extraPrechatInfo, received: " + c);
198    if (Array.isArray(f)) a.fallbackRouting = f;
199    else throw Error("Validation failed for fallbackRouting, received: " +
200      f);
201    "function" === typeof h ? a.directToButtonRouting = h : embedded_svc.log("Did n
201ot receive an actionable parameter for directToButtonRouting, received: " + h);
202    if ("object" === typeof g)
203      if (a.directToAgentRouting = g, g.buttonId)
204        if ("string" === typeof g.buttonId && g.buttonId.trim().length) a.directToAgentRouting.buttonId = g.buttonId.trim(), a.directToAgentRouting.fallback = g.fallback, g.userId && ("string" === typeof g.userId && g.userId.trim().length ? a.directToAgentRouting.userId = g.userId.trim() : embedded_svc.log("Did not receive an actionable parameter for directToAgentRouting's userId, received: " +
205          g.userId));
206        else throw Error("Validation failed for directToAgentRouting's buttonId, received: " + g.buttonId);
207    else embedded_svc.log("Did not receive an actionable parameter for directToAgentRouting's buttonId, received: " + g.buttonId);
208    else throw Error("Validation failed for directToAgentRouting, received: " + g);
209    return a
210  };
211  d.prototype.isInternetExplorer = function () {
212    return "ActiveXObject" in window
213  };
214  d.prototype.outputToConsole = function (a, b, c) {
215    if ((c || this.settings.devMode) && console && console[a]) console[a]("[Snap-ins] " +
216      (Array.isArray(b) ? b.join(", ") : b))
217  };
218  d.prototype.log = function () {
219    this.outputToConsole("log", [].slice.apply(arguments))
220  };
221  d.prototype.error = function (a, b) {
222    a ? this.outputToConsole("error", a, b) : this.outputToConsole("error", "esw responed with an unspecified error.", b);
223    embedded_svc.utils.fireEvent("error")
224  };
225  d.prototype.warning = function (a, b) {
226    a ? this.outputToConsole("warn", "Warning: " + a, b) : this.outputToConsole("warn", "esw sent an anonymous warning.", b)
227  };
228  d.prototype.deprecated = function (a) {
229    this.warning(a + " is deprecated in version " +
230      Number("5.0").toFixed(1) + " and will be removed in version " + (Number("5.0") + 1).toFixed(1))
231  };
232  d.prototype.getCookie = function (a) {
233    var b = document.cookie;
234    if (b) {
235      var c = b.indexOf(a + "=");
236      if (-1 !== c) return c += (a + "=").length, a = b.indexOf(";", c), -1 === a && (a = b.length), b.substring(c, a)
237    }
238  };
239  d.prototype.setCookie = function (a, b, c) {
240    a = a + "=" + b + ";";
241    c && (c = new Date, c.setFullYear(c.getFullYear() + 10), a += "expires=" + c.toUTCString() + ";");
242    document.cookie = a + "path=/;"
243  };
244  d.prototype.mergeSettings = function (a) {
245    Object.keys(a).forEach(function (b) {
246      void 0 ===
247        this.settings[b] && (this.settings[b] = a[b])
248    }.bind(this))
249  };
250  d.prototype.loadFeatureScript = function (a, b) {
251    var c = decodeURI(a).toLowerCase(); - 1 === a.indexOf("..") ? this.loadScriptFromDirectory("client", c + ".esw", function () {
252      this.featureScripts[a](this);
253      this.availableFeatures.push(c);
254      embedded_svc.utils.fireEvent("featureLoaded", void 0, a);
255      b && b();
256      this.processPendingMessages(c)
257    }.bind(this)) : this.error('"' + a + '" is not a valid feature name.')
258  };
259  d.prototype.fireEvent = function (a, b) {
260    var c = [].slice.apply(arguments).slice(2);
261    if (window.embedded_svc && embedded_svc.utils) return embedded_svc.utils.fireEvent(a, b, c);
262    this.error("fireEvent should not be called before calling init!");
263    return !0
264  };
265  d.prototype.isValidEntityId = function (a) {
266    return "string" === typeof a && (18 === a.length || 15 === a.length)
267  };
268  d.prototype.getKeyPrefix = function (a) {
269    if (this.isValidEntityId(a)) return a.substr(0, 3)
270  };
271  d.prototype.isOrganizationId = function (a) {
272    return "00D" === this.getKeyPrefix(a)
273  };
274  d.prototype.getESWFrame = function () {
275    if (!this.eswFrame) {
276      var a = document.getElementById("esw_storage_iframe");
277      a && a.contentWindow && (this.eswFrame = a.contentWindow)
278    }
279    return this.eswFrame
280  };
281  d.prototype.isFrameStorageEnabled = function () {
282    this.deprecated("isFrameStorageEnabled");
283    return !0
284  };
285  d.prototype.processPendingMessages = function (a) {
286    this.pendingMessages[a] && (this.pendingMessages[a].forEach(function (b) {
287      this.handleMessage(b.payload)
288    }.bind(this)), this.pendingMessages[a] = void 0)
289  };
290  d.prototype.loadCSS = function () {
291    var a = document.createElement("link");
292    a.href = (this.settings.gslbBaseURL ? this.settings.gslbBaseURL : this.settings.baseCoreURL) +
293      "/embeddedservice/" + this.settings.releaseVersion + "/esw" + (this.settings.devMode ? "" : ".min") + ".css";
294    a.type = "text/css";
295    a.rel = "stylesheet";
296    document.getElementsByTagName("head")[0].appendChild(a)
297  };
298  d.prototype.appendHelpButton = function (a) {
299    var b = document.createElement("div"),
300      c = "";
301    b.className = "embeddedServiceHelpButton";
302    this.isLanguageRtl(this.settings.language) && this.isDesktop() && (c = 'dir="rtl"');
303    b.innerHTML = '<div class="helpButton"' + c + '><button class="helpButtonEnabled uiButton" href="javascript:void(0)"><span class="embeddedServiceIcon" aria-hidden="true" data-icon="&#59648;"></span>
303<span class="helpButtonLabel" id="helpButtonSpan" aria-live="polite" aria-atomic="true"><span class="assistiveText">' +
304      (this.settings.defaultAssistiveText || "") + '</span><span class="message"></span></span></button></div>';
305    a || (b.style.display = "none");
306    this.settings.hasBottomTabBar && b.classList.add("embeddedServiceBottomTabBar");
307    this.settings.targetElement.appendChild(b);
308    this.setHelpButtonText(this.settings.defaultMinimizedText);
309    "ontouchstart" in document.documentElement && [].slice.apply(document.querySelectorAll(".embeddedServiceHelpButton .uiButton")).forEach(function (e) {
310      e.classList.add("no-hover")
311    });
312    this.onButtonStatusChange()
313  };
314  d.prototype.appendIFrame = function () {
315    var a = document.createElement("iframe"),
316      b = {};
317    a.id = "esw_storage_iframe";
318    a.src = this.settings.iframeURL;
319    a.style.display = "none";
320    a.title = "Live Chat Metadata";
321    a.onload = function () {
322      var c = this.getESWFrame();
323      this.outboundMessagesAwaitingIframeLoad.forEach(function (e) {
324        c.postMessage(e, this.settings.iframeURL)
325      }.bind(this));
326      this.outboundMessagesAwaitingIframeLoad = [];
327      this.iframeScriptsToLoad.forEach(function (e) {
328        this.loadStorageScript(e)
329      }.bind(this));
330      b.deploymentId = this.settings.deploymentId;
331      b.isSamePageNavigation = this.isSamePageNavigation();
332      b.isRefresh = 1 === window.performance.navigation.type;
333      this.postMessage("session.updateStorage", b);
334      this.iframeScriptsToLoad = []
335    }.bind(this);
336    this.settings.targetElement.appendChild(a);
337    window.addEventListener("beforeunload", function (c) {
338      this.isInternetExplorer() && (a.src = "about:blank");
339      if (this.warnOnBeforeUnload && this.componentLoaded)
340        if (embedded_svc.utils.fireEvent("snapinsCloseSessionWarning"), this.settings.closeSessionWarning && "function" === typeof this.settings.closeSessionWarning) this.settings.closeSessionWarning();
341        else return (c || window.event).returnValue = "You might lose the active chat session if you close this tab. Are you sure?"
342    }.bind(this), !1)
343  };
344  d.prototype.preparePageForSidebar = function () {
345    document.getElementById("snapins_invite") && embedded_svc.inviteAPI && embedded_svc.inviteAPI.inviteButton.setOnlineState(!1);
346    embedded_svc.utils.fireEvent("beforeCreate");
347    Object.keys(this.settings).forEach(function (a) {}.bind(this));
348    this.mergeSettings(this.defaultSettings)
349  };
350  d.prototype.createLightningComponent = function (a) {
351    this.preparePageForSidebar();
352    this.createEmbeddedServiceComponent({
353      attributes: {
354        configurationData: this.settings,
355        serializedSessionData: a
356      },
357      locator: this.settings.targetElement
358    }).then(function () {
359      this.hideHelpButton();
360      this.componentInitInProgress = !1;
361      this.componentLoaded = !0;
362      embedded_svc && embedded_svc.liveAgentAPI && embedded_svc.liveAgentAPI.ping();
363      embedded_svc.utils.fireEvent("ready")
364    }.bind(this))
365  };
366  d.prototype.loadLightningApp = function (a) {
367    var b;
368    if (this.settings.isExternalPage && "string" !== typeof this.settings.communityEndpointURL) throw Error("communityEndpointURL String property not set");
369    if (b = document.getElementsByClassName("helpButton")[0]) {
370      var c = b.getBoundingClientRect().width;
371      0 < c && (b.style.width = c + "px")
372    }
373    this.setHelpButtonText(this.settings.loadingText, !1);
374    this.instantiateLightningOutApplication({
375      communityEndpointURL: this.settings.communityEndpointURL,
376      oauthToken: this.auth.oauthToken
377    }).then(this.createLightningComponent.bind(this, a))
378  };
379  d.prototype.initLightningOut = function (a) {
380    this.hasSessionDataLoaded && ("function" !== typeof Promise ? this.loadScriptFromDirectory("common", "promisepolyfill",
381      function () {
382        this.initLightningOut(a)
383      }.bind(this), !0) : this.loadLightningOutScripts().then(this.loadLightningApp.bind(this, a)))
384  };
385  d.prototype.setHelpButtonText = function (a, b) {
386    var c = void 0 === this.settings.showIcon ? !0 : this.settings.showIcon;
387    b = void 0 === b ? c : b;
388    c = document.getElementById("helpButtonSpan");
389    if (c) {
390      var e = c.querySelector(".message");
391      e.innerHTML = a;
392      if (a = c.parentElement.querySelector(".embeddedServiceIcon")) a.style.display = b ? "inline-block" : "none"
393    }
394  };
395  d.prototype.prepareDOM = function () {
396    this.domInitInProgress ||
397      (this.domInitInProgress = !0, this.appendIFrame())
398  };
399  d.prototype.addSessionHandlers = function () {
400    this.addMessageHandler("session.onLoad", function () {
401      this.postMessage("session.get", this.storageKeys)
402    }.bind(this));
403    this.addMessageHandler("session.sessionData", function (a) {
404      this.alwaysWarnOnBeforeUnload = !a;
405      this.resumeInitWithSessionData(a || {})
406    }.bind(this));
407    this.addMessageHandler("session.deletedSessionData", function (a) {
408      -1 < a.indexOf("CHASITOR_SERIALIZED_KEY") && (this.loginPendingSerializedData = void 0)
409    }.bind(this));
410    this.addMessageHandler("session.updatePrimary", function (a) {
411      a && (a.isPrimary ? sessionStorage.setItem(this.settings.storageDomain + "MASTER_DEPLOYMENT_ID", this.settings.deploymentId) : sessionStorage.removeItem(this.settings.storageDomain + "MASTER_DEPLOYMENT_ID"), this.warnOnBeforeUnload = this.alwaysWarnOnBeforeUnload || 1 < a.activeChatSessions && a.isPrimary, embedded_svc && embedded_svc.liveAgentAPI && (embedded_svc.liveAgentAPI.browserSessionInfo = a))
412    }.bind(this));
413    this.addMessageHandler("session.frameReady", function (a) {
414      this.isIframeReady = !0
415    }.bind(this))
416  };
417  d.prototype.addMetaTag = function (a, b) {
418    var c = document.createElement("meta");
419    c.name = a;
420    c.content = b;
421    document.head.appendChild(c)
422  };
423  d.prototype.init = function (a, b, c, e, f, h) {
424    this.settings.baseCoreURL = a;
425    this.settings.communityEndpointURL = b;
426    this.settings.gslbBaseURL = c ? c : a;
427    this.settings.orgId = e;
428    this.settings.releaseVersion = "5.0";
429    this.settings.eswConfigDevName = f;
430    this.mergeSettings(h || {});
431    this.adjustCommunityStorageDomain();
432    if ("string" !== typeof this.settings.baseCoreURL) throw Error("Base core URL value must be a string.");
433    if (!this.isOrganizationId(this.settings.orgId)) throw Error("Invalid OrganizationId Parameter Value: " + this.settings.orgId);
434    embedded_svc.utils ? this.finishInit() : this.loadScriptFromDirectory("utils", "common", this.finishInit.bind(this))
435  };
436  d.prototype.finishInit = function () {
437    this.storedEventHandlers && (Object.getOwnPropertyNames(this.storedEventHandlers).forEac
437h(function (a) {
438      this.storedEventHandlers[a].forEach(function (b) {
439        embedded_svc.utils.addEventHandler(a, b)
440      })
441    }.bind(this)), this.storedEventHandlers = {});
442    if (!embedded_svc.utils.fireEvent("validateInit", function (a) {
443        return -1 !== a.indexOf(!1)
444      }, this.settings)) {
445      this.checkForNativeFunctionOverrides();
446      this.settings.appendHelpButton && this.loadCSS();
447      if (!this.settings.targetElement) throw Error("No targetElement specified");
448      this.settings.iframeURL = this.settings.gslbBaseURL + "/embeddedservice/" + this.settings.releaseVersion + (this.settings.devMode ? "/eswDev.html" : "/esw.html") + "?parent=" + document.location.href;
449      this.addSessionHandlers();
450      this.loadFeatures(this.onFeatureScriptsLoaded.bind(this));
451      this.settings.hasBottomTabBar = embedded_svc.utils.isUseriOS15plusSafari();
452      embedded_svc.utils.fireEvent("afterInit", void 0, this.settings)
453    }
454  };
455  d.prototype.onFeatureScriptsLoaded = function () {
456    "complete" === document.readyState ? setTimeout(this.prepareDOM.bind(this), 1) : document.addEventListener ? (document.addEventListener("DOMContentLoaded", this.prepareDOM.bind(this), !1), window.addEventListener("load", this.prepareDOM.bind(this), !1)) : window.attachEvent ? window.attachEvent("onload", this.prepareDOM.bind(this)) : this.log("No available event model. Exiting.")
457  };
458  d.prototype.checkForNativeFunctionOverrides = function () {
459    [{
460      name: "document",
461      object: document,
462      functions: "addEventListener createAttribute createComment createDocumentFragment createElementNS createTextNode createRange getElementById getElementsByTagName getElementsByClassName querySelector querySelectorAll removeEventListener".split(" ")
463    }, {
464      name: "window",
465      object: window,
466      functions: "addEventListener clearTimeout dispatchEvent open removeEventListener requestAnimationFrame setInterval setTimeout".split(" ")
467    }].forEach(function (a) {
468      a.functions.forEach(function (b) {
469        b in
470          a.object && !this.isNativeFunction(a.object, b) && this.warning("Embedded Service Chat may not function correctly with this native JS function modified: " + a.name + "." + b, !0)
471      }.bind(this))
472    }.bind(this))
473  };
474  d.prototype.isNativeFunction = function (a, b) {
475    return Function.prototype.toString.call(a[b]).match(/\[native code\]/)
476  };
477  d.prototype.onHelpButtonClick = function () {
478    if (!this.componentInitInProgress && !document.getElementsByClassName("embeddedServiceSidebar").length) {
479      this.componentInitInProgress = !0;
480      try {
481        embedded_svc.utils.isCommunityOrSite() &&
482          0 < Object.keys(embedded_svc.liveAgentAPI.inviteButton).length ? window.dispatchEvent(new CustomEvent("onStartChatFromInvitation"), {
483            detail: {
484              bubbles: !0,
485              composed: !1
486            }
487          }) : (this.checkAuthentication(), embedded_svc.utils.fireEvent("onHelpButtonClick"))
488      } catch (a) {
489        throw this.componentInitInProgress = !1, a;
490      }
491    }
492  };
493  d.prototype.resumeInitWithSessionData = function (a) {
494    var b = embedded_svc.utils.fireEvent("sessionDataRetrieved", function (f) {
495        return -1 !== f.indexOf(!0)
496      }, a),
497      c = !1,
498      e = !1;
499    this.settings.linkAction.valid ? c = !0 : b ? (this.log("Existing session found. Continuing with data: " +
500      a), e = c = !0, embedded_svc.menu && embedded_svc.menu.hideTopContainer()) : this.componentInitInProgress && (c = !0);
501    this.hasSessionDataLoaded = !0;
502    a.ESW_OAUTH_TOKEN && (this.auth.oauthToken = a.ESW_OAUTH_TOKEN);
503    this.loginPendingSerializedData = e ? a : void 0;
504    c && (this.componentInitInProgress = !0, this.checkAuthentication());
505    this.settings.appendHelpButton && this.appendHelpButton(this.settings.displayHelpButton && !b)
506  };
507  d.prototype.checkAuthentication = function () {
508    this.isAuthenticationRequired && !this.settings.allowGuestUsers ? this.auth.oauthToken ?
509      (this.loginButtonPressed || this.componentInitInProgress) && this.initLightningOut(this.loginPendingSerializedData) : embedded_svc.utils.fireEvent("requireauth") : (this.loginButtonPressed || this.componentInitInProgress) && this.initLightningOut(this.loginPendingSerializedData)
510  };
511  d.prototype.postMessage = function (a, b) {
512    a = {
513      domain: this.settings.storageDomain,
514      data: b,
515      method: a
516    };
517    (b = this.getESWFrame()) ? b.postMessage(a, this.settings.iframeURL): this.outboundMessagesAwaitingIframeLoad.push(a)
518  };
519  d.prototype.setSessionData =
520    function (a, b) {
521      if ("object" === typeof a) var c = a;
522      else c = {}, c[a] = b;
523      this.postMessage("session.set", c)
524    };
525  d.prototype.deleteSessionData = function (a) {
526    a = Array.isArray(a) ? a : [a];
527    this.postMessage("session.delete", a)
528  };
529  d.prototype.defineFeature = function (a, b) {
530    this.featureScripts[a] = b
531  };
532  d.prototype.registerStorageKeys = function (a) {
533    "string" === typeof a ? this.storageKeys.push(a) : a.forEach(function (b) {
534      this.storageKeys.push(b)
535    }.bind(this))
536  };
537  d.prototype.addMessageHandler = function (a, b) {
538    this.messageHandlers[a] || (this.messageHandlers[a] = []);
539    this.messageHandlers[a].push(b)
540  };
541  d.prototype.clearMessageHandlers = function () {
542    Object.keys(this.messageHandlers).filter(function (a) {
543      return -1 === n.indexOf(a)
544    }).forEach(function (a) {
545      this.messageHandlers[a] = []
546    }.bind(this))
547  };
548  d.prototype.loadStorageScript = function (a) {
549    this.isIframeReady ? this.postMessage("script.load", a) : this.iframeScriptsToLoad.push(a)
550  };
551  d.prototype.loadScriptFromDirectory = function (a, b, c, e) {
552    b = b.toLowerCase();
553    var f = document.createElement("script"),
554      h = this.settings.gslbBaseURL,
555      g = b.replace(".",
556        "-") + "-script";
557    f.id = g;
558    f.type = "text/javascript";
559    f.src = [h, "embeddedservice", e ? void 0 : this.settings.releaseVersion, a, b + (this.settings.devMode ? "" : ".min") + ".js"].filter(function (k) {
560      return !!k
561    }).join("/");
562    c && (f.onload = c);
563    document.body.appendChild(f)
564  };
565  d.prototype.loadFeatures = function (a) {
566    this.settings.enabledFeatures.forEach(function (b) {
567      "base" !== b && -1 === this.availableFeatures.indexOf(b.toLowerCase()) && this.loadFeatureScript(b, a)
568    }.bind(this))
569  };
570  d.prototype.addEventHandler = function (a, b) {
571    window.embedded_svc &&
572      embedded_svc.utils ? embedded_svc.utils.addEventHandler(a, b) : (this.storedEventHandlers[a] || (this.storedEventHandlers[a] = []), this.storedEventHandlers[a].push(b))
573  };
574  d.prototype.setupMessageListener = function () {
575    window.addEventListener("message", function (a) {
576      var b = a.data,
577        c = a.origin !== "null" ? a.origin.split(":")[1].replace("//", "") : "",
578        e = embedded_svc.utils ? embedded_svc.utils.isProtocolHttpOrHttps(a.origin) : !1,
579        f = embedded_svc.utils ? embedded_svc.utils.getHostnameFromUrl(this.settings.iframeURL) : void 0;
580      if (b && b.method && embedded_svc.isMessageFromSalesforceDomain(c) &&
581        e && a.source === this.getESWFrame()) {
582        if (c !== f)
583          if ("session.frameReady" === b.method) this.settings.iframeURL = this.settings.iframeURL.replace(f, c);
584          else return;
585        a = b.method.split(".")[0].toLowerCase(); - 1 === this.availableFeatures.indexOf(a) ? (this.pendingMessages[a] || (this.pendingMessages[a] = []), this.pendingMessages[a].push({
586          direction: "incoming",
587          payload: b
588        })) : this.handleMessage(b)
589      }
590    }.bind(this), !1)
591  };
592  d.prototype.handleMessage = function (a) {
593    var b = this.messageHandlers[a.method];
594    b ? b.forEach(function (c) {
595      c(a.data)
596    }) : this.log("Unregistered method " +
597      a.method + " received.")
598  };
599  d.prototype.isMessageFromSalesforceDomain = function (a) {
600    if (embedded_svc.utils.isCommunityOrSite() && a === document.domain) return !0;
601    var b = function (c, e) {
602      return -1 !== c.indexOf(e, c.length - e.length)
603    };
604    return m.some(function (c) {
605      return b(a, c)
606    })
607  };
608  d.prototype.isCommunityDomain = function (a) {
609    return ".force.com" === a.substr(-10)
610  };
611  d.prototype.isSamePageNavigation = function () {
612    var a = document.domain;
613    if (this.isCommunityDomain(document.domain)) {
614      var b = a + "/" + window.location.pathname.split("/")[1];
615      b === this.settings.storageDomain &&
616        (a = b)
617    }
618    return a.substr(-this.settings.storageDomain.length) === this.settings.storageDomain
619  };
620  d.prototype.addDefaultSetting = function (a, b) {
621    this.defaultSettings[a] = b
622  };
623  d.prototype.onButtonStatusChange = function () {
624    var a = document.querySelector(".embeddedServiceHelpButton button"),
625      b;
626    if (embedded_svc.menu) embedded_svc.menu.onAgentAvailabilityChange();
627    a && (b = a.querySelector(".message")) && (this.isButtonDisabled ? (a.onclick = function () {}, a.classList.remove("helpButtonEnabled"), a.classList.add("helpButtonDisabled"),
628      b.innerHTML = this.settings.disabledMinimizedText) : (a.onclick = this.onHelpButtonClick.bind(this), a.classList.remove("helpButtonDisabled"), a.classList.add("helpButtonEnabled"), b.innerHTML = this.settings.defaultMinimizedText))
629  };
630  d.prototype.hideHelpButton = function () {
631    var a = document.querySelector(".embeddedServiceHelpButton");
632    a && (a.style.display = "none")
633  };
634  d.prototype.showHelpButton = function () {
635    var a = document.querySelector(".embeddedServiceHelpButton");
636    a && (a.style.display = "")
637  };
638  d.prototype.setDefaultButtonText =
639    function (a, b, c, e) {
640      this.settings.entryFeature === a && (this.settings.defaultMinimizedText = this.settings.defaultMinimizedText || b, this.settings.disabledMinimizedText = this.settings.disabledMinimizedText || c, this.settings.defaultAssistiveText = this.settings.defaultAssistiveText || e || "")
641    };
642  d.prototype.setDefaultShowIcon = function (a, b) {
643    this.settings.entryFeature === a && void 0 === this.settings.showIcon && (this.settings.showIcon = b)
644  };
645  d.prototype.registerLinkAction = function (a, b) {
646    var c = this.settings.linkAction;
647    this.validLinkActions[a] ||
648      (this.validLinkActions[a] = []); - 1 === this.validLinkActions[a].indexOf(b) && this.validLinkActions[a].push(b);
649    c.feature && c.name && c.feature.toLowerCase() === a.toLowerCase() && c.name.toLowerCase() === b.toLowerCase() && (c.valid = !0, c.feature = a, this.settings.entryFeature = a)
650  };
651  d.prototype.setLinkAction = function (a, b, c) {
652    var e = Object.keys(this.validLinkActions).filter(function (f) {
653      return f.toLowerCase() === a.toLowerCase()
654    })[0];
655    e ? (this.settings.linkAction.feature = e, this.settings.linkAction.name = this.validLinkActions[e].filter(function (f) {
656      return f.toLowerCase() ===
657        b.toLowerCase()
658    })[0], this.settings.linkAction.valid = void 0 !== this.settings.linkAction.name, this.settings.linkActionParameters = c) : this.settings.linkAction.valid = !1
659  };
660  d.prototype.getLinkActionData = function () {
661    window.location.search.replace(/([a-zA-Z0-9._]+)=([^&\s]+)/g, function (a, b, c) {
662      a = b.toLowerCase();
663      0 === a.indexOf("snapins.") && (a = a.replace("snapins.", ""), "action" === a ? (c = c.split("."), 2 === c.length && (this.settings.linkAction.feature = c[0], this.settings.linkAction.name = c[1])) : this.settings.linkActionParameters[a.toLowerCase()] =
664        c)
665    }.bind(this))
666  };
667  d.prototype.requireAuthentication = function () {
668    var a = document.createElement("script"),
669      b = document.createElement("style"),
670      c = document.querySelector(this.settings.loginTargetQuerySelector);
671    this.isAuthenticationRequired = !0;
672    if ("https:" !== window.location.protocol && !this.settings.devMode) throw this.settings.displayHelpButton = !1, Error("Snap-in authentication requires HTTPS.");
673    if (!this.settings.useCustomAuthentication) {
674      if (!this.settings.loginClientId || !this.settings.loginRedirectURL || !this.settings.loginTargetQuerySelector) throw Error("Authentication in Snap-ins requires these valid settings params: loginCl
674ientId, loginRedirectURL, loginTargetQuerySelector.");
675      if (c) this.loginButtonPressed = !1, c.addEventListener("click", function () {
676        this.loginButtonPressed = !0
677      }.bind(this));
678      else throw Error("loginTargetQuerySelector is not a valid DOM element.");
679      this.addMetaTag("salesforce-community", this.settings.communityEndpointURL);
680      this.addMetaTag("salesforce-client-id", this.settings.loginClientId);
681      this.addMetaTag("salesforce-redirect-uri", this.settings.loginRedirectURL);
682      this.addMetaTag("salesforce-mode", "popup");
683      this.addMetaTag("salesforce-target", this.settings.loginTargetQuerySelector);
684      this.addMetaTag("salesforce-login-handler", "__snapinsLoginCallback");
685      this.addMetaTag("salesforce-logout-handler", "__snapinsLogoutCallback");
686      embedded_svc.utils.addEventHandler("requireauth", function () {
687        var e = setInterval(function () {
688          window.SFIDWidget && (clearInterval(e), window.SFIDWidget.openid_response ? window.__snapinsLoginCallback() : window.SFIDWidget.login())
689        }, 100)
690      });
691      embedded_svc.utils.addEventHandler("autherror", function (e) {
692        if (window.SFIDWidget) {
693          this.loginButtonPressed = !0;
694          window.SFIDWidget.logout();
695          var f = setInterval(function () {
696            window.SFIDWidget.config && (clearInterval(f), embedded_svc.utils.fireEvent("requireauth"))
697          }.bind(this, f), 100)
698        }
699      }.bind(this));
700      window.__snapinsLoginCallback = function () {
701        var e = document.querySelector(this.settings.loginTargetQuerySelector),
702          f = document.createElement("button");
703        if (this.loginButtonPressed || this.componentInitInProgress) e.innerHTML = "";
704        f.className = "authenticationStart";
705        f.innerHTML = this.settings.authenticationStartLabel;
706        f.addEventListener("click", this.onHelpButtonClick.bind(this));
707        e.appendChild(f);
708        this.auth.oauthToken = window.SFIDWidget.openid_response.access_token
709      }.bind(this);
710      window.__snapinsLogoutCallback = function () {
711        this.auth.oauthToken = void 0;
712        window.SFIDWidget.init()
713      }.bind(this);
714      document.head.appendChild(b);
715      b.sheet.insertRule(".sfid-logout { display: none; }", 0);
716      a.type = "text/javascript";
717      a.src = this.settings.communityEndpointURL + "/servlet/servlet.loginwidgetcontroller?type=javascript_widget" + (embedded_svc.settings.devMode ? "&min=false" : "");
718      document.head.appendChild(a)
719    }
720  };
721  d.prototype.requireSLDS =
722    function () {
723      this.settings.requireSLDS = !0;
724      if (this.settings.targetElement === document.body) {
725        var a = document.createElement("div");
726        a.id = "esw-snapin-target";
727        document.body.appendChild(a);
728        this.settings.targetElement = a
729      }
730      this.settings.targetElement.classList.add("slds-scope");
731      a = document.createElement("link");
732      a.href = (this.settings.gslbBaseURL ? this.settings.gslbBaseURL : this.settings.baseCoreURL) + "/embeddedservice/" + this.settings.releaseVersion + "/esw-slds" + (this.settings.devMode ? "" : ".min") + ".css";
733      a.type = "text/css";
734      a.rel = "stylesheet";
735      document.getElementsByTagName("head")[0].appendChild(a)
736    };
737  d.prototype.validateHeaderValue = function (a) {
738    return /^[0-9a-zA-Z!#$%&'*+-.^_`|~" ]*$/g.test(a)
739  };
740  d.prototype.isLanguageRtl = function (a) {
741    if (a && "" !== a.trim()) switch (a.substring(0, 2)) {
742      case "ar":
743      case "fa":
744      case "he":
745      case "iw":
746      case "ji":
747      case "ur":
748      case "yi":
749        return !0;
750      default:
751        return !1
752    }
753  };
754  d.prototype.isDesktop = function () {
755    return -1 === navigator.userAgent.indexOf("Mobi")
756  };
757  window.embedded_svc = new d;
758  Object.getOwnPropertyNames(l).forEach(function (a) {
759    var b =
760      l[a];
761    "object" === b ? (window.embedded_svc[a] = {}, Object.keys(b).forEach(function (c) {
762      window.embedded_svc[a][c] = b[c]
763    })) : window.embedded_svc[a] = b
764  })
765})(window.embedded_svc || {});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.