var __extends = this && this.__extends || function() {
    var a = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(a, b) {
        a.__proto__ = b;
    } || function(a, b) {
        for (var c in b) b.hasOwnProperty(c) && (a[c] = b[c]);
    };
    return function(b, c) {
        function d() {
            this.constructor = b;
        }
        a(b, c), b.prototype = null === c ? Object.create(c) : (d.prototype = c.prototype, new d());
    };
}(), RobustEventSource = function() {
    function a(a) {
        this._url = a, this._explictClosed = !1, this._listenerLists = Object.create(null), this._tryRecover = this._tryRecover.bind(this), this._tryRecover0 = this._tryRecover0.bind(this), 
        this._init();
    }
    return Object.defineProperty(a.prototype, "url", {
        get: function() {
            return this._backEnd.url;
        },
        enumerable: !0,
        configurable: !0
    }), Object.defineProperty(a.prototype, "withCredentials", {
        get: function() {
            return this._backEnd.withCredentials;
        },
        enumerable: !0,
        configurable: !0
    }), Object.defineProperty(a.prototype, "onopen", {
        get: function() {
            return this._backEnd.onopen;
        },
        set: function(a) {
            this._backEnd.onopen = a;
        },
        enumerable: !0,
        configurable: !0
    }), Object.defineProperty(a.prototype, "onmessage", {
        get: function() {
            return this._backEnd.onmessage;
        },
        set: function(a) {
            this._backEnd.onmessage = a;
        },
        enumerable: !0,
        configurable: !0
    }), Object.defineProperty(a.prototype, "onerror", {
        get: function() {
            return this._backEnd.onerror;
        },
        set: function(a) {
            this._backEnd.onerror = a;
        },
        enumerable: !0,
        configurable: !0
    }), Object.defineProperty(a.prototype, "readyState", {
        get: function() {
            return 2 != this._backEnd.readyState || this._explictClosed ? this._backEnd.readyState : 0;
        },
        enumerable: !0,
        configurable: !0
    }), a.prototype.addEventListener = function(a, b, c) {
        this._backEnd._addEventListener(a, b, c);
        var d = this._getListenerList(a, c);
        d.indexOf(b) >= 0 && d.push(b);
    }, a.prototype.dispatchEvent = function(a) {
        return this._backEnd.dispatchEvent(a);
    }, a.prototype.removeEventListener = function(a, b, c) {
        this._backEnd._removeEventListener(a, b, c);
        var d = this._getListenerList(a, c), e = d.indexOf(b);
        e >= 0 && d.splice(e, 1);
    }, a.prototype.close = function() {
        this._explictClosed || (this._explictClosed = !0, this._backEnd._close(), this._backEnd._removeEventListener("error", this._tryRecover), self.removeEventListener("online", this._tryRecover));
    }, a.prototype._init = function() {
        var a = this;
        this._backEnd = new EventSource(this._url), [ "close", "addEventListener", "removeEventListener" ].forEach(function(b) {
            a._backEnd["_" + b] = a._backEnd[b], a._backEnd[b] = a[b].bind(a);
        }), this._backEnd._addEventListener("error", this._tryRecover), self.addEventListener("online", this._tryRecover);
    }, a.prototype._tryRecover = function(a) {
        setTimeout(this._tryRecover0, 3e3);
    }, a.prototype._tryRecover0 = function(a) {
        var b = this;
        if (!this._explictClosed && 2 == this._backEnd.readyState) {
            var c = this._backEnd;
            this._init(), this._backEnd.onerror = c.onerror, this._backEnd.onmessage = c.onmessage, this._backEnd.onopen = c.onopen, [ "open", "message", "error" ].forEach(function(a) {
                [ !0, !1 ].forEach(function(c) {
                    b._getListenerList(a, c).forEach(function(d) {
                        b._backEnd.addEventListener(a, d, c);
                    });
                });
            });
        }
    }, a.prototype._getListenerList = function(a, b) {
        var c = a + ":" + !!b;
        return this._listenerLists[c] || (this._listenerLists[c] = []);
    }, a;
}(), mbe_ui;

!function(a) {
    function b(a, b, d, e, f) {
        if (!c(d, e)) {
            if (Array.isArray(d)) for (var g = 0, h = d.length; h > g; g++) a.removeEventListener(b, d[g], f); else d && a.removeEventListener(b, d, f);
            if (Array.isArray(e)) for (var g = 0, h = e.length; h > g; g++) e[g] && a.addEventListener(b, e[g], f); else e && a.addEventListener(b, e, f);
        }
    }
    function c(a, b) {
        if (a === b) return !0;
        if (!Array.isArray(a) || !Array.isArray(b) || a.length != b.length) return !1;
        for (var c = 0, d = a.length; d > c; c++) if (a[c] !== b[c]) return !1;
        return !0;
    }
    var d = function() {
        function a(a) {
            this._doc = a && a.doc || document, this._bookkeeper = a && a.bookkeeper || "_domerBookkeeper";
        }
        return a.prototype.render = function(a, b) {
            return this._render(a, b);
        }, a.prototype.onBeforeRender = function(a, b) {
            return a;
        }, a.prototype.onAttached = function(a, b) {}, a.prototype.onRendered = function(a, b) {}, a.prototype.onBeforeRemove = function(a) {}, a.prototype.inferNamespace = function(b) {
            switch (b) {
              case "svg":
                return a.NS_SVG;

              case "math":
                return a.NS_MATHML;

              default:
                return a.NS_UNKNOWN;
            }
        }, a.prototype._render = function(a, b, c) {
            var d, e = b && b.parentNode;
            if ("string" == typeof a) b && b.nodeType === Node.TEXT_NODE ? b.data = a : d = this._doc.createTextNode(a); else {
                var f = this.onBeforeRender(a, b);
                if (f === !1) return b;
                if (null == f) return console.warn("Domer.render: onBeforeRender returned null/undefined, abort!"), null;
                var g = b ? b.localName : null, h = ("?" === f.Name ? g : f.Name) || "div";
                if (!b || h !== g) {
                    var i, j = this.inferNamespace(h);
                    if ("number" == typeof j) {
                        var k = c || e;
                        i = k ? k.namespaceURI : this._doc.documentElement.namespaceURI;
                    } else i = j;
                    d = this._doc.createElementNS(i, h);
                }
                var l = d || b, m = !l[this._bookkeeper];
                f.Terminal || this._assignChildren(f.Kids, l), this._assginProps(f, l), m && this.onAttached(f, l), this.onRendered(f, l);
            }
            return d && e && (b.nodeType === Node.ELEMENT_NODE && this.onBeforeRemove(b), b.parentNode.replaceChild(d, b)), d || b;
        }, a.prototype._assginProps = function(a, c) {
            if (a) {
                var d = this._bookkeeper, l = c[d] || (c[d] = {});
                for (var m in l) if (null !== l[m] && null == a[m]) {
                    var n = 0 | m.charCodeAt(0);
                    switch (n) {
                      case e:
                        c.removeAttribute(m.slice(1));
                        break;

                      case f:
                        c.style.removeProperty(m.slice(1));
                        break;

                      case g:
                        c.classList.remove(m.slice(1));
                        break;

                      case h:
                      case i:
                        b(c, m.slice(1), l[m], void 0, n === i);
                        break;

                      default:
                        var o = j[m];
                        o ? c.removeAttribute(o) : (c[m] = null, "null" === c[m] && (c[m] = ""));
                    }
                    l[m] = null;
                }
                for (var m in a) {
                    var p = a[m];
                    if ((p !== l[m] || k[m]) && null != p) {
                        var n = 0 | m.charCodeAt(0);
                        switch (n) {
                          case e:
                            c.setAttribute(m.slice(1), p);
                            break;

                          case f:
                            c.style.setProperty(m.slice(1), p);
                            break;

                          case g:
                            var q = c.classList;
                            p ? q.add(m.slice(1)) : q.remove(m.slice(1));
                            break;

                          case h:
                          case i:
                            b(c, m.slice(1), l[m], p, n === i);
                            break;

                          default:
                            c[m] = p;
                        }
                        l[m] = p;
                    }
                }
            }
        }, a.prototype._assignChildren = function(a, b) {
            var c = b.childNodes;
            if (a && a.length) for (var d = 0, e = Math.max(a.length, c.length); e > d; d++) {
                var f = a[d], g = c[d];
                if (g) {
                    if (null == f) {
                        for (var h; h = g.nextSibling; ) this.onBeforeRemove(h), b.removeChild(h);
                        return void b.removeChild(g);
                    }
                    this._render(f, g, b);
                } else null != f && b.appendChild(this._render(f, null, b));
            } else for (var i; i = b.lastChild; ) this.onBeforeRemove(i), b.removeChild(i);
        }, a.NS_HTML = "http://www.w3.org/1999/xhtml", a.NS_SVG = "http://www.w3.org/2000/svg", a.NS_MATHML = "http://www.w3.org/1998/Math/MathML", a.NS_UNKNOWN = 0, a;
    }();
    a.Domer = d;
    var e = 64, f = 45, g = 46, h = 42, i = 33, j = {
        id: "id",
        className: "class",
        title: "title",
        src: "src",
        href: "href",
        __proto__: null
    }, k = {
        value: !0,
        checked: !0,
        __proto__: null
    };
}(mbe_ui || (mbe_ui = {}));

var mbe_ui;

!function(a) {
    var b = function() {
        function a() {
            this.hasPendingUpdate = !1;
        }
        return a.prototype.getView = function() {
            return this.settings;
        }, a.prototype.update = function() {
            this.element && this.renderer.render(this.settings, this.element);
        }, a.prototype.updateLater = function() {
            var a = this;
            this.hasPendingUpdate || (this.hasPendingUpdate = !0, requestAnimationFrame(function() {
                return a.hasPendingUpdate && a.update();
            }));
        }, a.prototype.shouldPreventUpdate = function() {
            return !1;
        }, a.prototype.onAttached = function() {}, a.prototype.onRendered = function() {}, a.prototype.onBeforeRemove = function() {}, a;
    }();
    a.Component = b;
}(mbe_ui || (mbe_ui = {}));

var mbe_ui;

!function(a) {
    var b = function(a) {
        function b() {
            return null !== a && a.apply(this, arguments) || this;
        }
        return __extends(b, a), b.prototype.onBeforeRender = function(a, b) {
            var c = a && a.Class;
            if (c) {
                var d;
                b && (b.Class === c ? d = b.Component : b.Component && this._finalize(b.Component)), d || (d = new c(), d.renderer = this), d.settings = a, d.hasPendingUpdate = !1;
                try {
                    if (d.shouldPreventUpdate()) return !1;
                    a = d.getView();
                } catch (e) {
                    return this._onError(e), null;
                }
                a.Class = c, a.Component = d;
            } else b && b.Component && this._finalize(b.Component);
            return a;
        }, b.prototype.onAttached = function(a, b) {
            b.Component && (b.Component.element = b, b.Component.onAttached());
        }, b.prototype.onRendered = function(a, b) {
            if (b.Component) if (b.Component.element === b) b.Component.onRendered(); else {
                if (b.Component.element) throw new Error("UIDomer.onRendered(): unexpected");
                b.Component.element = b, b.Component.onAttached();
            }
        }, b.prototype.onBeforeRemove = function(a) {
            for (var b = a.firstElementChild; b; b = b.nextElementSibling) this.onBeforeRemove(b);
            a.Component && this._finalize(a.Component);
        }, b.prototype.onError = function(a) {
            console.error(a);
        }, b.prototype._onError = function(a) {
            try {
                this.onError && this.onError(a);
            } catch (a) {
                console.error(a);
            }
        }, b.prototype._finalize = function(a) {
            try {
                a.onBeforeRemove();
            } catch (b) {
                this._onError(b);
            } finally {
                var c = a.element;
                c && (a.hasPendingUpdate = !1, a.element = null, c.Component = null, c.Class = null);
            }
        }, b;
    }(a.Domer);
    a.UIDomer = b;
}(mbe_ui || (mbe_ui = {}));

var mbcr;

!function(a) {
    function b(a, b) {
        return fetch(a, {
            method: "POST",
            body: JSON.stringify(b),
            headers: {
                "Content-Type": "application/json"
            }
        });
    }
    function c() {
        a.app = new e(document.getElementById("mbcr-root"));
    }
    var d = {
        "class-view": {
            type: "ScreenCapture",
            on: !0,
            fps: .25,
            maxWidth: 250,
            maxHeight: 150
        },
        "hd-view": {
            type: "ScreenCapture",
            on: !0,
            ignoreScreenBroadcast: !0,
            fps: 1,
            maxWidth: 1280,
            maxHeight: 1280
        },
        "detail-view": {
            type: "ScreenCapture",
            on: !0,
            ignoreScreenBroadcast: !0,
            fps: 1,
            maxWidth: 640,
            maxHeight: 640
        }
    }, e = function() {
        function c(a) {
            var b = this;
            this.root = a, this.classInfo = {
                className: "",
                students: [],
                teams: []
            }, this.students = Object.create(null), this.pongs = Object.create(null), this.pingStart = 0, this.pingEnd = 0, this.pingPaused = !1, this.classroomState = {
                screenCapture: {
                    type: "ScreenCapture",
                    on: !1
                },
                screenBroadcast: {
                    type: "ScreenBroadcast",
                    on: !1
                },
                lockScreen: {
                    type: "LockScreen",
                    on: !1
                },
                receiveFiles: {
                    type: "ReceiveFiles",
                    tasks: [],
                    urlTasks: []
                },
                race: {
                    type: "Race",
                    on: !1
                },
                quiz: {
                    type: "Quiz",
                    on: !1
                },
                createTeams: {
                    type: "CreateTeams",
                    on: !1
                },
                ping: {
                    type: "Ping",
                    on: !1
                },
                presenter: {
                    type: "Presenter",
                    id: ""
                },
                teams: {
                    type: "Teams",
                    teams: []
                },
                countDown: {
                    type: "CountDown",
                    on: !1
                },
                selectStudent: {
                    type: "SelectStudent",
                    on: !1
                },
                lessonRecord: {
                    type: "LessonRecord",
                    on: !1,
                    data: null
                }
            }, this.screenCaptures = {}, this.selectedStudents = {}, this._viewMode = "class-view", this._showStudentName = !0, this._renderer = new mbe_ui.UIDomer(), this._screenBroadcastTransition = !1, 
            this.sn = 0, this.refresh = this.refresh.bind(this), this.onKeyDown = this.onKeyDown.bind(this), window.addEventListener("resize", this.refresh), a.ownerDocument.addEventListener("keydown", this.onKeyDown), 
            setInterval(this.refresh, 1e4), fetch("/classInfo").then(function(a) {
                if (!a.ok) throw "加载 /classInfo 失败";
                return a.json();
            }).then(function(a) {
                console.log("加载 /classInfo ok"), b.classInfo = a, b.classInfo.students.forEach(function(a) {
                    return b.students[a.uid] = a;
                }), b.events = new RobustEventSource("/messages/admin"), b.events.onmessage = function(a) {
                    console.log("[" + Date.now() + "] sse: ", a.data);
                    var c = JSON.parse(a.data);
                    switch (c.type) {
                      case "UpdateScreenCapture":
                        var d = c.uid, e = b.screenCaptures[d] || (b.screenCaptures[d] = {}), f = b.students[d];
                        f.status = c.status, e.date = new Date(), f.status || (e.url = "/screenCapture/" + d + "?sn=" + b.sn, b.sn = (b.sn + 1) % 1e7, console.log("[" + Date.now() + "] UpdateScreenCapture:url=" + e.url));
                        break;

                      case "ScreenCapture":
                        var g = b.classroomState.screenCapture = c;
                        b.classroomState.screenCapture.on || (b.screenCaptures = {});
                        var h = "class-view";
                        g.uids && (b.selectedStudents = {}, g.uids.forEach(function(a) {
                            return b.selectStudent(a, !0);
                        }), g.on && (h = 1 === g.uids.length ? "detail-view" : "hd-view")), b.changeViewMode(h);
                        break;

                      case "ScreenBroadcast":
                        b.classroomState.screenBroadcast = c, b._screenBroadcastTransition = !1;
                        break;

                      case "LockScreen":
                        b.classroomState.lockScreen = c;
                        break;

                      case "Join":
                        b.students[c.uid] && (b.students[c.uid].connected = !0);
                        break;

                      case "Leave":
                        b.students[c.uid] && (b.students[c.uid].connected = !1);
                        break;

                      case "Pong":
                        b.pingPaused || (b.pongs[c.uid] = c, b.pingEnd = Date.now());
                        break;

                      case "Ping":
                        b.classroomState.ping = c, b.pongs = Object.create(null), b.pingPaused = !1, b.pingStart = b.pingEnd = Date.now();
                    }
                    b.refresh();
                }, b.events.onerror = function(a) {
                    b.error = "SSE 连接本地服务器失败，互联课堂将无法使用", b.refresh();
                }, b.events.onopen = function() {
                    b.error && location.reload();
                };
            })["catch"](function(a) {
                b.error = "连接本地服务器失败，互联课堂将无法使用", console.error(a), b.refresh();
            }), this.refresh();
        }
        return c.prototype.selectStudent = function(a, b) {
            b ? this.selectedStudents[a] = this.students[a] : delete this.selectedStudents[a], this.refresh();
        }, Object.defineProperty(c.prototype, "viewMode", {
            get: function() {
                return this._viewMode;
            },
            set: function(a) {
                this.changeViewMode(a);
                var c = d[a];
                if ("class-view" !== a) {
                    var e = Object.keys(this.selectedStudents);
                    c.uids = e.length ? e : void 0;
                }
                b("/classroomControl/", c);
            },
            enumerable: !0,
            configurable: !0
        }), Object.defineProperty(c.prototype, "showStudentName", {
            get: function() {
                return this._showStudentName;
            },
            set: function(a) {
                this._showStudentName = a, this.refresh();
            },
            enumerable: !0,
            configurable: !0
        }), Object.defineProperty(c.prototype, "screenBroadcastTransition", {
            get: function() {
                return this._screenBroadcastTransition;
            },
            enumerable: !0,
            configurable: !0
        }), c.prototype.setScreenBroadcast = function(a, c) {
            this._screenBroadcastTransition = !0;
            var d = Object.assign({}, this.classroomState.screenBroadcast);
            d.on = a, "boolean" == typeof c && (d.disableMrdp = c), b("/classroomControl/", d), this.refresh();
        }, c.prototype.changeViewMode = function(a) {
            this._viewMode = a, "class-view" === a ? this.root.ownerDocument.exitFullscreen() : this.root.requestFullscreen(), this.refresh();
        }, c.prototype.refresh = function() {
            var b = "class-view" === this._viewMode ? a.ClassView : a.DetailView;
            this.root.Component && this.root.Component instanceof b ? this.root.Component.updateLater() : this._renderer.render({
                Class: b,
                _app: this
            }, this.root);
        }, c.prototype.onKeyDown = function(a) {
            80 !== a.keyCode || !a.altKey || a.shiftKey || a.ctrlKey ? 77 !== a.keyCode || !a.altKey || a.shiftKey || a.ctrlKey || this.setScreenBroadcast(!0, !this.classroomState.screenBroadcast.disableMrdp) : this.classroomState.ping.on ? this.pingPaused ? b("/classroomControl", {
                type: "Ping",
                on: !1
            }) : (this.pingPaused = !0, this.refresh(), this.savePongResult()) : b("/classroomControl", {
                type: "Ping",
                on: !0
            });
        }, c.prototype.savePongResult = function() {
            var a = [ "用户名	IP	总数	响应数	错误率	平均响应时间	最大响应时间\r\n" ];
            for (var b in this.students) {
                var c = this.pongs[b];
                c && a.push(this.students[b].uname + "	" + c.ipAddress + "	" + c.pingCount + "	" + c.okCount + "	" + c.errorCount / (c.errorCount + c.okCount) + "	" + c.sumTime / c.okCount + "	" + c.maxTime + "\r\n");
            }
            var d = new Blob(a, {
                type: "text/plain"
            }), e = document.createElement("a");
            e.href = URL.createObjectURL(d), e.download = "Ping测试结果-" + new Date().toLocaleString() + ".txt", document.body.appendChild(e), e.onclick = function() {
                setTimeout(function() {
                    e.remove(), URL.revokeObjectURL(e.href);
                }, 10);
            }, e.click();
        }, c;
    }();
    a.ClassroomConsoleApp = e, a.main = c, Element.prototype.requestFullscreen || (Element.prototype.requestFullscreen = Element.prototype.webkitRequestFullscreen), 
    Document.prototype.exitFullscreen || (Document.prototype.exitFullscreen = Document.prototype.webkitCancelFullScreen || Document.prototype.webkitExitFullscreen);
}(mbcr || (mbcr = {}));

var mbcr;

!function(a) {
    function b(a) {
        var b = [], c = a.classroomState;
        return c.lockScreen.on && b.push("锁屏"), c.screenCapture.on && b.push("屏幕监视"), c.screenBroadcast.on && b.push("屏幕广播" + (c.screenBroadcast.disableMrdp ? "" : "（多播）")), 
        {
            className: "classroom-state mbe-widget-divider",
            Kids: [ "课堂状态：" + (b.length ? b.join("，") : "-") ]
        };
    }
    function c(a) {
        return g[a] || a;
    }
    function d(a) {
        var b = "", d = "", e = a._info, f = a._pong;
        if (e.connected) {
            var g = a._app.screenCaptures[e.uid], h = e.status;
            if (h) b = c(h), d = "invisible" === h ? "masked-dark" : "masked-light"; else if (g) {
                var i = Math.round((Date.now() - g.date.valueOf()) / 1e3);
                i >= 7 && (b = "截屏延迟：" + i + "s", d = "masked-dark");
            } else b = "无截屏可用", d = "masked-dark";
        } else b = "未连接", d = "masked-dark";
        return f && (d = "masked-dark", b += "\nping：" + f.pingCount + "，接收：" + f.okCount + "，丢失：" + f.errorCount + "/" + Math.round(1e3 * f.errorCount / (f.errorCount + f.okCount)) + "‰，平均/最大：" + Math.round(f.sumTime / f.okCount) + "/" + f.maxTime + "ms" + (f.error ? "，错误：" + f.error : "") + "\n" + f.ipAddress), 
        {
            text: b,
            className: d
        };
    }
    var e = mbe_ui.Component, f = function(a) {
        function c() {
            return null !== a && a.apply(this, arguments) || this;
        }
        return __extends(c, a), c.prototype.getView = function() {
            var a = this.settings;
            "class-view" !== a._app.viewMode;
            for (var c = Object.keys(a._app.selectedStudents).length, d = 0, e = a._app.classInfo.students.length, f = [], g = [], i = 0, j = a._app.classInfo.students; i < j.length; i++) {
                var k = j[i];
                if (k.connected) {
                    d++;
                    a._app.screenCaptures[k.uid];
                    "invisible" === k.status && g.push(k.uname);
                } else f.push(k.uname);
            }
            var l = 0, m = 0, n = 0;
            for (var o in a._app.pongs) {
                var p = a._app.pongs[o];
                l += p.sumTime, m += p.okCount, n += p.errorCount;
            }
            return {
                __proto__: a,
                className: "class-view",
                Kids: [ {
                    className: "class-title",
                    Kids: [ a._app.error ? {
                        Name: "p",
                        Kids: [ "错误：" + a._app.error ],
                        "-color": "red"
                    } : "", {
                        Name: "p",
                        Kids: [ "当前班级：" + a._app.classInfo.className, {
                            Name: "span",
                            "-margin-left": "2em",
                            Kids: [ "已连接：" + d + "/" + e ]
                        } ]
                    }, d !== e ? {
                        Name: "p",
                        Kids: [ "未连接的学生： " + f.join(", ") ]
                    } : "", g.length ? {
                        Name: "p",
                        Kids: [ "离开学生端的学生： " + g.join(", ") ]
                    } : "", a._app.classroomState.ping.on ? {
                        Name: "p",
                        Kids: [ "ping 平均响应时间：" + Math.round(l / m) + "ms，响应数：" + m + "，丢失：" + Math.round(1e3 * n / (n + m)) + "‰，已运行：" + Math.round((a._app.pingEnd - a._app.pingStart) / 1e3) + "s" + (a._app.pingPaused ? "（已暂停）" : "") ]
                    } : "" ]
                }, {
                    className: "student-list",
                    Kids: a._app.classInfo.students.map(function(b) {
                        return {
                            Class: h,
                            _app: a._app,
                            _info: b,
                            _pong: a._app.pongs[b.uid]
                        };
                    })
                }, {
                    className: "error-status"
                }, {
                    className: "tool-bar  mbe-widget-container",
                    Kids: [ b(a._app), {
                        Name: "button",
                        Kids: [ "投屏显示 / 对比分析" ],
                        disabled: !a._app.classroomState.screenCapture.on || !c,
                        onclick: function() {
                            console.log("[" + Date.now() + "] 投屏显示 / 对比分析 onclick"), a._app.showStudentName = !1, a._app.viewMode = c > 1 ? "detail-view" : "hd-view";
                        }
                    }, {
                        className: "mbe-widget-divider"
                    } ]
                } ]
            };
        }, c;
    }(e);
    a.ClassView = f;
    var g = {
        __proto__: null,
        invisible: "离开学生端",
        lockScreen: "锁屏中",
        screenBroadcast: "屏幕广播中"
    }, h = function(a) {
        function b() {
            return null !== a && a.apply(this, arguments) || this;
        }
        return __extends(b, a), b.prototype.getView = function() {
            var a = this.settings, b = a._app.screenCaptures[a._info.uid], c = d(a);
            return {
                __proto__: a,
                className: "student-summary",
                Name: "div",
                Kids: [ {
                    className: "student-screen",
                    Kids: [ b ? {
                        Name: "img",
                        src: b.url
                    } : "", {
                        className: c.className,
                        Kids: [ {
                            ".student-screen-status": !0,
                            Kids: [ c.text ]
                        } ]
                    } ]
                }, {
                    Name: "label",
                    className: "student-summary-tool-bar",
                    Kids: [ {
                        Kids: [ a._info.uname ]
                    }, {
                        Name: "input",
                        type: "checkbox",
                        checked: !!a._app.selectedStudents[a._info.uid],
                        onchange: function(b) {
                            a._app.selectStudent(a._info.uid, b.target.checked);
                        }
                    } ]
                } ]
            };
        }, b;
    }(e), i = 70, j = 0, k = 10, l = 1.6, m = 1.85, n = 4 / 3, o = function(a) {
        function c() {
            return null !== a && a.apply(this, arguments) || this;
        }
        return __extends(c, a), c.prototype.getView = function() {
            var a = innerHeight - i - 2 * j, c = this.settings, d = c._app.selectedStudents, e = Object.keys(d).sort(function(a, b) {
                var c = d[a].uname, e = d[b].uname;
                return e > c ? -1 : c > e ? 1 : 0;
            }), f = 1 === e.length, g = e.length > 2, h = f ? m : g ? l : n, o = Math.max(150, f ? innerWidth : (innerWidth - k) / 2), q = Math.max(150, g ? (a - k) / 2 : a), r = q > o / h, s = Math.max(r ? o : q * h, innerWidth / 3), t = s / h;
            return {
                __proto__: c,
                className: "detail-view",
                Kids: [ {
                    ".student-list": !0,
                    ".single": f,
                    ".many": g,
                    "-margin-top": j + "px",
                    "-margin-bottom": j + "px",
                    Kids: e.map(function(a, b) {
                        return {
                            Class: p,
                            _app: c._app,
                            _info: d[a],
                            _pong: c._app.pongs[a],
                            "-width": s + "px",
                            "-height": t + "px",
                            "-margin-bottom": (f || 2 * Math.ceil(e.length / 2) - b <= 2 ? 0 : k) + "px",
                            "-margin-right": (b % 2 === 1 || f ? 0 : k) + "px",
                            id: "" + b
                        };
                    })
                }, {
                    className: "tool-bar mbe-widget-container",
                    "-height": i + "px",
                    Kids: [ b(c._app), {
                        Name: "button",
                        Kids: [ c._app.classroomState.screenBroadcast.on ? "结束广播" : "屏幕广播" ],
                        disabled: c._app.screenBroadcastTransition || c._app.classroomState.lockScreen.on,
                        onclick: function() {
                            return c._app.setScreenBroadcast(!c._app.classroomState.screenBroadcast.on);
                        }
                    }, {
                        Name: "button",
                        Kids: [ c._app.showStudentName ? "隐藏姓名" : "显示姓名" ],
                        onclick: function() {
                            return c._app.showStudentName = !c._app.showStudentName;
                        }
                    }, {
                        Name: "button",
                        Kids: [ "关闭" ],
                        onclick: function() {
                            return c._app.viewMode = "class-view";
                        }
                    }, {
                        className: "mbe-widget-divider"
                    } ]
                } ]
            };
        }, c;
    }(e);
    a.DetailView = o;
    var p = function(a) {
        function b() {
            return null !== a && a.apply(this, arguments) || this;
        }
        return __extends(b, a), b.prototype.getView = function() {
            var a = this.settings, b = a._app.screenCaptures[a._info.uid], c = d(a);
            return console.log("[" + Date.now() + "] StudentDetail:getView(), url=" + (b && b.url)), {
                __proto__: a,
                Name: "div",
                className: "student-detail",
                Kids: [ {
                    className: "student-screen",
                    Kids: [ b ? {
                        Name: "img",
                        src: b.url,
                        onload: function(a) {
                            console.log("[" + Date.now() + "] StudentDetail:img.onload(), url=" + b.url + ",w=" + a.target.naturalWidth);
                        }
                    } : "", {
                        className: c.className,
                        Kids: [ {
                            ".student-screen-status": !0,
                            Kids: [ c.text ]
                        }, {
                            ".student-info": !0,
                            hidden: !a._app.showStudentName,
                            Kids: [ a._info.uname ]
                        } ]
                    } ]
                } ]
            };
        }, b;
    }(e);
}(mbcr || (mbcr = {}));
//# sourceMappingURL=ClassroomConsoleApp.js.map