'use strict'; var _ctxstxt_CitrixCopyright = 'Copyright (c) Citrix Systems, Inc.'; window.CTXS = window.CTXS || {}; window.rdx = window.rdx || {}; rdx.base_view = function (element) { this.element = element; }; rdx.base_view.prototype.show = function () { if (this.element) this.element.hidden = false; }; rdx.base_view.prototype.hide = function () { if (this.element) this.element.hidden = true; }; rdx.utils = { get_view: function (id) { return new rdx.base_view(document.getElementById(id || 'login-form')); }, authentication: function (xml) { const document = new DOMParser().parseFromString(xml, 'application/xml'); const ns = 'http://citrix.com/authentication/response/1'; if (document.getElementsByTagName('parsererror').length || document.documentElement.localName !== 'AuthenticateResponse' || document.documentElement.namespaceURI !== ns) throw new Error('Invalid authentication response'); const text = name => document.getElementsByTagNameNS(ns, name)[0]?.textContent || ''; const errors = Array.from(document.getElementsByTagNameNS(ns, 'Label')) .filter(label => label.getElementsByTagNameNS(ns, 'Type')[0]?.textContent === 'error') .map(label => label.getElementsByTagNameNS(ns, 'Text')[0]?.textContent || ''); return { state: text('StateContext'), postback: text('PostBack'), errors }; } }; CTXS.core = { getView: rdx.utils.get_view };