@openuverse/rdesign 0.0.0-stage → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/dist/_plugin-vue_export-helper-BA5b-u6G.cjs +13 -0
- package/dist/_plugin-vue_export-helper-Dm0LCMqW.js +1320 -0
- package/dist/font.woff2 +0 -0
- package/dist/http-live-player-C_ZWcEpn.cjs +54 -0
- package/dist/http-live-player-DyiocXCZ.js +18278 -0
- package/dist/icons.cjs.js +1 -0
- package/dist/icons.es.js +256521 -0
- package/dist/rdesign.cjs.js +2275 -0
- package/dist/rdesign.es.js +59054 -0
- package/dist/style.css +1 -0
- package/dist/types/icons.d.ts +2 -0
- package/dist/types/rdesign.d.ts +6 -0
- package/dist/types/src/App.vue.d.ts +4 -0
- package/dist/types/src/components/RAffix/index.d.ts +128 -0
- package/dist/types/src/components/RAlert/index.d.ts +171 -0
- package/dist/types/src/components/RAnchor/index.d.ts +298 -0
- package/dist/types/src/components/RAutoComplete/index.d.ts +431 -0
- package/dist/types/src/components/RAvatar/index.d.ts +260 -0
- package/dist/types/src/components/RBackTop/index.d.ts +215 -0
- package/dist/types/src/components/RBadge/index.d.ts +176 -0
- package/dist/types/src/components/RBreadcrumb/index.d.ts +324 -0
- package/dist/types/src/components/RButton/index.d.ts +295 -0
- package/dist/types/src/components/RCalendar/index.d.ts +291 -0
- package/dist/types/src/components/RCard/index.d.ts +351 -0
- package/dist/types/src/components/RCascader/index.d.ts +1433 -0
- package/dist/types/src/components/RCheckbox/index.d.ts +403 -0
- package/dist/types/src/components/RCollapse/index.d.ts +291 -0
- package/dist/types/src/components/RColorPicker/index.d.ts +577 -0
- package/dist/types/src/components/RComment/index.d.ts +104 -0
- package/dist/types/src/components/RConfigProvider/index.d.ts +19 -0
- package/dist/types/src/components/RDatePicker/index.d.ts +1720 -0
- package/dist/types/src/components/RDescriptions/index.d.ts +271 -0
- package/dist/types/src/components/RDialog/index.d.ts +906 -0
- package/dist/types/src/components/RDivider/index.d.ts +112 -0
- package/dist/types/src/components/RDrawer/index.d.ts +398 -0
- package/dist/types/src/components/RDropdown/index.d.ts +621 -0
- package/dist/types/src/components/REmpty/index.d.ts +129 -0
- package/dist/types/src/components/RForm/index.d.ts +569 -0
- package/dist/types/src/components/RGrid/index.d.ts +659 -0
- package/dist/types/src/components/RGuide/index.d.ts +266 -0
- package/dist/types/src/components/RIcon/index.d.ts +3 -0
- package/dist/types/src/components/RImage/index.d.ts +270 -0
- package/dist/types/src/components/RImageViewer/index.d.ts +357 -0
- package/dist/types/src/components/RInput/index.d.ts +555 -0
- package/dist/types/src/components/RInputAdornment/index.d.ts +44 -0
- package/dist/types/src/components/RInputNumber/RInputNumber.vue.d.ts +41 -0
- package/dist/types/src/components/RInputNumber/index.d.ts +53 -0
- package/dist/types/src/components/RLayout/index.d.ts +176 -0
- package/dist/types/src/components/RLink/index.d.ts +228 -0
- package/dist/types/src/components/RList/index.d.ts +513 -0
- package/dist/types/src/components/RLoading/index.d.ts +220 -0
- package/dist/types/src/components/RMenu/index.d.ts +1423 -0
- package/dist/types/src/components/RMessage/index.d.ts +140 -0
- package/dist/types/src/components/RNotification/index.d.ts +174 -0
- package/dist/types/src/components/RPagination/index.d.ts +529 -0
- package/dist/types/src/components/RPopconfirm/index.d.ts +262 -0
- package/dist/types/src/components/RPopup/index.d.ts +308 -0
- package/dist/types/src/components/RProgress/index.d.ts +169 -0
- package/dist/types/src/components/RQRCode/index.d.ts +238 -0
- package/dist/types/src/components/RRadio/index.d.ts +605 -0
- package/dist/types/src/components/RRangeInput/index.d.ts +538 -0
- package/dist/types/src/components/RRate/index.d.ts +230 -0
- package/dist/types/src/components/RScpiAutoComplete/RScpiAutoComplete.vue.d.ts +13 -0
- package/dist/types/src/components/RScpiAutoComplete/index.d.ts +15 -0
- package/dist/types/src/components/RScpiAutoComplete/scpiAutoCompleteEngine.d.ts +60 -0
- package/dist/types/src/components/RScpiAutoComplete/scpiSegmentMatch.d.ts +15 -0
- package/dist/types/src/components/RScpiAutoComplete/types.d.ts +8 -0
- package/dist/types/src/components/RScpiAutoComplete/useScpiAutoComplete.d.ts +31 -0
- package/dist/types/src/components/RScpiTree/RScpiTree.vue.d.ts +14 -0
- package/dist/types/src/components/RScpiTree/RScpiTreeNode.vue.d.ts +9 -0
- package/dist/types/src/components/RScpiTree/index.d.ts +17 -0
- package/dist/types/src/components/RScpiTree/scpiTreeContext.d.ts +3 -0
- package/dist/types/src/components/RScpiTree/types.d.ts +25 -0
- package/dist/types/src/components/RScroller/index.d.ts +95 -0
- package/dist/types/src/components/RSelect/index.d.ts +887 -0
- package/dist/types/src/components/RSelectInput/index.d.ts +497 -0
- package/dist/types/src/components/RSkeleton/index.d.ts +143 -0
- package/dist/types/src/components/RSlider/index.d.ts +404 -0
- package/dist/types/src/components/RSpace/index.d.ts +107 -0
- package/dist/types/src/components/RSplitView/RSplitView.vue.d.ts +196 -0
- package/dist/types/src/components/RSplitView/composables/defaultSizes.d.ts +3 -0
- package/dist/types/src/components/RSplitView/composables/useSplitLayoutStrategy.d.ts +28 -0
- package/dist/types/src/components/RSplitView/composables/useSplitPanes.d.ts +14 -0
- package/dist/types/src/components/RSplitView/composables/useSplitViewState.d.ts +66 -0
- package/dist/types/src/components/RSplitView/index.d.ts +147 -0
- package/dist/types/src/components/RSplitView/layouts/RSplitComplexLayout.vue.d.ts +53 -0
- package/dist/types/src/components/RSplitView/layouts/RSplitDoubleLayout.vue.d.ts +33 -0
- package/dist/types/src/components/RSplitView/layouts/RSplitQuadLayout.vue.d.ts +43 -0
- package/dist/types/src/components/RSplitView/layouts/RSplitSingleLayout.vue.d.ts +27 -0
- package/dist/types/src/components/RSplitView/splitViewContext.d.ts +13 -0
- package/dist/types/src/components/RSplitView/types.d.ts +53 -0
- package/dist/types/src/components/RStatistic/index.d.ts +222 -0
- package/dist/types/src/components/RSteps/index.d.ts +340 -0
- package/dist/types/src/components/RStickyTool/index.d.ts +363 -0
- package/dist/types/src/components/RSwiper/index.d.ts +676 -0
- package/dist/types/src/components/RSwitch/index.d.ts +175 -0
- package/dist/types/src/components/RTable/index.d.ts +4634 -0
- package/dist/types/src/components/RTabs/index.d.ts +357 -0
- package/dist/types/src/components/RTag/index.d.ts +517 -0
- package/dist/types/src/components/RTagInput/index.d.ts +464 -0
- package/dist/types/src/components/RTextarea/index.d.ts +278 -0
- package/dist/types/src/components/RTimePicker/index.d.ts +1007 -0
- package/dist/types/src/components/RTimeline/index.d.ts +238 -0
- package/dist/types/src/components/RTooltip/index.d.ts +352 -0
- package/dist/types/src/components/RTransfer/index.d.ts +383 -0
- package/dist/types/src/components/RTree/index.d.ts +738 -0
- package/dist/types/src/components/RTreeSelect/index.d.ts +563 -0
- package/dist/types/src/components/RUpload/index.d.ts +774 -0
- package/dist/types/src/components/RWatermark/index.d.ts +277 -0
- package/dist/types/src/components/RWebControl/RWebControl.vue.d.ts +7 -0
- package/dist/types/src/components/RWebControl/WebControlForAndroid.vue.d.ts +21 -0
- package/dist/types/src/components/RWebControl/WebControlForH5.vue.d.ts +14 -0
- package/dist/types/src/components/RWebControl/WebControlForLinux.vue.d.ts +15 -0
- package/dist/types/src/components/RWebControl/WebControlForRIGOLOS.vue.d.ts +16 -0
- package/dist/types/src/components/RWebControl/WebControlForRIGOLQT.vue.d.ts +15 -0
- package/dist/types/src/components/RWebControl/WebControlOverlay.vue.d.ts +17 -0
- package/dist/types/src/components/RWebControl/index.d.ts +10 -0
- package/dist/types/src/components/RWebControl/types.d.ts +9 -0
- package/dist/types/src/components/RWebControl/useWebControlLocale.d.ts +2 -0
- package/dist/types/src/components/scpi/types.d.ts +19 -0
- package/dist/types/src/components/webcontrol/cbor.d.ts +21 -0
- package/dist/types/src/components/webcontrol/loadWSAvcPlayer.d.ts +6 -0
- package/dist/types/src/components/webcontrol/locale.d.ts +8 -0
- package/dist/types/src/components/webcontrol/logger.d.ts +5 -0
- package/dist/types/src/components/webcontrol/types.d.ts +71 -0
- package/dist/types/src/components/webcontrol/webcontrolContext.d.ts +6 -0
- package/dist/types/src/core/common.d.ts +5 -0
- package/dist/types/src/core/component-list.d.ts +17 -0
- package/dist/types/src/core/components.d.ts +80 -0
- package/dist/types/src/core/index.d.ts +9 -0
- package/dist/types/src/core/styles.d.ts +0 -0
- package/dist/types/src/icons/index.d.ts +6 -0
- package/dist/types/src/index.d.ts +30 -0
- package/dist/types/src/locale/ar_KW.d.ts +242 -0
- package/dist/types/src/locale/de_DE.d.ts +265 -0
- package/dist/types/src/locale/en_US.d.ts +266 -0
- package/dist/types/src/locale/es_ES.d.ts +265 -0
- package/dist/types/src/locale/fr_FR.d.ts +265 -0
- package/dist/types/src/locale/id_ID.d.ts +265 -0
- package/dist/types/src/locale/index.d.ts +31 -0
- package/dist/types/src/locale/it_IT.d.ts +266 -0
- package/dist/types/src/locale/ja_JP.d.ts +266 -0
- package/dist/types/src/locale/ko_KR.d.ts +266 -0
- package/dist/types/src/locale/pl_PL.d.ts +265 -0
- package/dist/types/src/locale/pt_BR.d.ts +265 -0
- package/dist/types/src/locale/ru_RU.d.ts +266 -0
- package/dist/types/src/locale/th_TH.d.ts +265 -0
- package/dist/types/src/locale/zh_CN.d.ts +266 -0
- package/dist/types/src/locale/zh_TW.d.ts +266 -0
- package/dist/types/src/main.d.ts +0 -0
- package/dist/types/src/types/component.d.ts +38 -0
- package/dist/types/src/utils/index.d.ts +2 -0
- package/dist/types/src/webcontrol/index.d.ts +1 -0
- package/dist/types/vite.config.d.ts +7 -0
- package/dist/types/webcontrol.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/dist/webcontrol.cjs.js +4 -0
- package/dist/webcontrol.es.js +4617 -0
- package/package.json +118 -4
|
@@ -0,0 +1,4617 @@
|
|
|
1
|
+
import { inject as je, defineComponent as Ce, computed as fe, createElementBlock as ve, openBlock as re, Fragment as nt, createCommentVNode as be, createElementVNode as te, toDisplayString as Re, ref as K, onMounted as ke, nextTick as Fe, onUnmounted as Ae, normalizeStyle as he, createVNode as Oe, watch as rt, normalizeClass as at, unref as me, provide as ot, createBlock as _e } from "vue";
|
|
2
|
+
import { a1 as Ee, Q as it, a0 as st } from "./_plugin-vue_export-helper-Dm0LCMqW.js";
|
|
3
|
+
function lt(r) {
|
|
4
|
+
if (!r)
|
|
5
|
+
return;
|
|
6
|
+
if (r.webControl)
|
|
7
|
+
return r;
|
|
8
|
+
const e = r.locale;
|
|
9
|
+
if (e != null && e.webControl)
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
function ut(r) {
|
|
13
|
+
if (!(r != null && r.webControl))
|
|
14
|
+
throw new Error(
|
|
15
|
+
"[RWebControl] Missing locale.webControl in global ConfigProvider locale"
|
|
16
|
+
);
|
|
17
|
+
return r.webControl;
|
|
18
|
+
}
|
|
19
|
+
var xe = /* @__PURE__ */ ((r) => (r.ANDROID = "ANDROID", r.TINA_LINUX = "TINA_LINUX", r.RIGOL_OS = "RIGOL_OS", r.RAW_H5 = "RAW_H5", r.RIGOL_QT = "RIGOL_QT", r.URL = "URL", r.UNKNOWN = "UNKNOWN", r))(xe || {});
|
|
20
|
+
function $t(r) {
|
|
21
|
+
if (!r)
|
|
22
|
+
return { width: void 0, height: void 0 };
|
|
23
|
+
try {
|
|
24
|
+
const e = JSON.parse(r), t = e.width != null ? Number(e.width) : void 0, l = e.height != null ? Number(e.height) : void 0;
|
|
25
|
+
return {
|
|
26
|
+
width: t != null && !Number.isNaN(t) ? t : void 0,
|
|
27
|
+
height: l != null && !Number.isNaN(l) ? l : void 0
|
|
28
|
+
};
|
|
29
|
+
} catch {
|
|
30
|
+
return { width: void 0, height: void 0 };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const Ze = Symbol("webControlContext");
|
|
34
|
+
let Me = null;
|
|
35
|
+
function ct(r) {
|
|
36
|
+
const e = r.default;
|
|
37
|
+
if (typeof e == "function")
|
|
38
|
+
return e;
|
|
39
|
+
if (typeof r.WSAvcPlayer == "function")
|
|
40
|
+
return r.WSAvcPlayer;
|
|
41
|
+
}
|
|
42
|
+
function ft() {
|
|
43
|
+
return typeof window > "u" ? Promise.reject(
|
|
44
|
+
new Error("WSAvcPlayer can only be loaded in a browser environment")
|
|
45
|
+
) : window.WSAvcPlayer ? Promise.resolve(window.WSAvcPlayer) : (Me || (Me = import("./http-live-player-DyiocXCZ.js").then((r) => {
|
|
46
|
+
if (!window.WSAvcPlayer) {
|
|
47
|
+
const e = ct(
|
|
48
|
+
r
|
|
49
|
+
);
|
|
50
|
+
e && (window.WSAvcPlayer = e);
|
|
51
|
+
}
|
|
52
|
+
if (!window.WSAvcPlayer)
|
|
53
|
+
throw new Error(
|
|
54
|
+
"WSAvcPlayer export not found after loading decoder script"
|
|
55
|
+
);
|
|
56
|
+
return window.WSAvcPlayer;
|
|
57
|
+
}).catch((r) => {
|
|
58
|
+
throw Me = null, r;
|
|
59
|
+
})), Me);
|
|
60
|
+
}
|
|
61
|
+
const Ge = "[RWebControl]", Y = {
|
|
62
|
+
info: (...r) => console.info(Ge, ...r),
|
|
63
|
+
warn: (...r) => console.warn(Ge, ...r),
|
|
64
|
+
error: (...r) => console.error(Ge, ...r)
|
|
65
|
+
};
|
|
66
|
+
function Le() {
|
|
67
|
+
const r = je(Ze);
|
|
68
|
+
if (!(r != null && r.locale))
|
|
69
|
+
throw new Error(
|
|
70
|
+
"[RWebControl] Missing provided webControl locale. Ensure RWebControl is wrapped by ConfigProvider with locale.webControl configured."
|
|
71
|
+
);
|
|
72
|
+
return r.locale;
|
|
73
|
+
}
|
|
74
|
+
const dt = {
|
|
75
|
+
key: 0,
|
|
76
|
+
class: "loading-overlay"
|
|
77
|
+
}, vt = { class: "loading-text" }, ht = {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: "error-overlay"
|
|
80
|
+
}, pt = { class: "error-text" }, gt = /* @__PURE__ */ Ce({
|
|
81
|
+
__name: "WebControlOverlay",
|
|
82
|
+
props: {
|
|
83
|
+
isConnecting: { type: Boolean, default: !1 },
|
|
84
|
+
connectionError: { default: "" },
|
|
85
|
+
loadingText: { default: "" },
|
|
86
|
+
reconnectText: { default: "" }
|
|
87
|
+
},
|
|
88
|
+
emits: ["retry"],
|
|
89
|
+
setup(r, { emit: e }) {
|
|
90
|
+
const t = r, l = e, u = Le(), i = fe(
|
|
91
|
+
() => t.loadingText || u.loading.connectingToRemote
|
|
92
|
+
), v = fe(
|
|
93
|
+
() => t.reconnectText || u.loading.reconnect
|
|
94
|
+
), p = () => {
|
|
95
|
+
l("retry");
|
|
96
|
+
};
|
|
97
|
+
return (d, c) => (re(), ve(nt, null, [
|
|
98
|
+
r.isConnecting ? (re(), ve("div", dt, [
|
|
99
|
+
c[0] || (c[0] = te("div", { class: "loading-spinner" }, null, -1)),
|
|
100
|
+
te("div", vt, Re(i.value), 1)
|
|
101
|
+
])) : be("", !0),
|
|
102
|
+
r.connectionError ? (re(), ve("div", ht, [
|
|
103
|
+
c[1] || (c[1] = te("div", { class: "error-icon" }, "⚠️", -1)),
|
|
104
|
+
te("div", pt, Re(r.connectionError), 1),
|
|
105
|
+
te("button", {
|
|
106
|
+
class: "retry-button",
|
|
107
|
+
type: "button",
|
|
108
|
+
onClick: p
|
|
109
|
+
}, Re(v.value), 1)
|
|
110
|
+
])) : be("", !0)
|
|
111
|
+
], 64));
|
|
112
|
+
}
|
|
113
|
+
}), Pe = /* @__PURE__ */ Ee(gt, [["__scopeId", "data-v-3e2b1bd4"]]), Ke = 20, yt = 1e3, Ve = 2, Ft = /* @__PURE__ */ Ce({
|
|
114
|
+
__name: "WebControlForAndroid",
|
|
115
|
+
props: {
|
|
116
|
+
baseUrl: { default: void 0 },
|
|
117
|
+
encoderSize: { default: "1024x600" },
|
|
118
|
+
encoderRate: { default: "2000000" },
|
|
119
|
+
deviceScreenWidth: { default: 1024 },
|
|
120
|
+
deviceScreenHeight: { default: 600 }
|
|
121
|
+
},
|
|
122
|
+
setup(r) {
|
|
123
|
+
const e = Le(), t = r;
|
|
124
|
+
Y.info("🚀 WebControlForAndroid props:", t);
|
|
125
|
+
const l = K(), u = K(), i = K(), v = K(), p = K(), d = K(!0), c = K(!1), F = K(""), I = K(0), E = K(0), T = K({}), L = K({});
|
|
126
|
+
let M = 1, k = 1, m = 0, g = 0;
|
|
127
|
+
fe(() => ({
|
|
128
|
+
width: T.value.width || "100%"
|
|
129
|
+
})), fe(() => d.value ? e.connection.connecting : c.value ? e.connection.connected : F.value ? e.connection.connectionFailed : e.connection.disconnected), fe(() => d.value ? "connecting" : c.value ? "connected" : F.value ? "error" : "disconnected");
|
|
130
|
+
const s = fe(
|
|
131
|
+
() => t.baseUrl || `ws://${window.location.hostname}`
|
|
132
|
+
), f = K(!1);
|
|
133
|
+
async function y() {
|
|
134
|
+
f.value = !1;
|
|
135
|
+
try {
|
|
136
|
+
const N = new URL(s.value.replace(/\/+$/, ""));
|
|
137
|
+
N.protocol = N.protocol === "wss:" ? "https:" : "http:", N.pathname = "/webcontrol/schema", N.search = "", N.hash = "";
|
|
138
|
+
const X = await fetch(N.toString(), { method: "GET" });
|
|
139
|
+
if (!X.ok) return;
|
|
140
|
+
const q = await X.json();
|
|
141
|
+
(q == null ? void 0 : q.version) === "v2" && (f.value = !0);
|
|
142
|
+
} catch (N) {
|
|
143
|
+
Y.warn("webcontrol schema request failed, using legacy ws ports:", N);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const S = fe(() => {
|
|
147
|
+
const N = s.value.replace(/\/+$/, "");
|
|
148
|
+
return f.value ? `${N}/ws/display` : `${N}:9001`;
|
|
149
|
+
}), C = fe(() => {
|
|
150
|
+
const N = s.value.replace(/\/+$/, "");
|
|
151
|
+
return f.value ? `${N}/ws/control` : `${N}:9002`;
|
|
152
|
+
});
|
|
153
|
+
let _ = null, x = null;
|
|
154
|
+
const O = () => {
|
|
155
|
+
if (_)
|
|
156
|
+
try {
|
|
157
|
+
const N = _.ws;
|
|
158
|
+
N && (N.readyState === WebSocket.OPEN || N.readyState === WebSocket.CONNECTING) && N.close();
|
|
159
|
+
} catch (N) {
|
|
160
|
+
Y.warn("Error closing WSAvcPlayer WebSocket:", N);
|
|
161
|
+
} finally {
|
|
162
|
+
_ = null;
|
|
163
|
+
}
|
|
164
|
+
}, a = () => {
|
|
165
|
+
if (x)
|
|
166
|
+
try {
|
|
167
|
+
(x.readyState === WebSocket.OPEN || x.readyState === WebSocket.CONNECTING) && x.close(1e3, "Component unmounted");
|
|
168
|
+
} catch (N) {
|
|
169
|
+
Y.warn("Error closing control event WebSocket:", N);
|
|
170
|
+
} finally {
|
|
171
|
+
x = null;
|
|
172
|
+
}
|
|
173
|
+
}, o = K(!1);
|
|
174
|
+
let h = Ke * 3, b = null, P = 0, A = null, D = null, R = !1, w = 0;
|
|
175
|
+
const W = () => {
|
|
176
|
+
h = Ke;
|
|
177
|
+
}, B = (N, X) => {
|
|
178
|
+
Y.info("📺 Video size changed:", N, "x", X);
|
|
179
|
+
try {
|
|
180
|
+
I.value = N, E.value = X, p.value && (p.value.width = N, p.value.height = X);
|
|
181
|
+
const q = t.deviceScreenWidth, j = t.deviceScreenHeight;
|
|
182
|
+
M = N / q, k = X / j, M < k ? (g = (X - j * N / q) / 2, m = 0, k = M) : (m = (N - q * X / j) / 2, g = 0, M = k), Y.info("🔧 Coordinate transform:", {
|
|
183
|
+
videoSize: `${N}x${X}`,
|
|
184
|
+
deviceScreen: `${q}x${j}`,
|
|
185
|
+
scale: { scale_w: M, scale_h: k },
|
|
186
|
+
offset: { offset_w: m, offset_h: g }
|
|
187
|
+
}), ne();
|
|
188
|
+
} catch (q) {
|
|
189
|
+
Y.error("Error handling size change:", q);
|
|
190
|
+
}
|
|
191
|
+
}, z = () => {
|
|
192
|
+
var N;
|
|
193
|
+
if (Y.info("WSAvcPlayer socket connected"), d.value = !1, c.value = !0, F.value = "", R && (P = 0), ((N = _ == null ? void 0 : _.ws) == null ? void 0 : N.readyState) === WebSocket.OPEN) {
|
|
194
|
+
const X = {
|
|
195
|
+
type: "SET_ENCODER",
|
|
196
|
+
size: t.encoderSize,
|
|
197
|
+
rate: t.encoderRate
|
|
198
|
+
};
|
|
199
|
+
_.ws.send(JSON.stringify(X)), Y.info("Sent encoder config:", X);
|
|
200
|
+
}
|
|
201
|
+
Fe(ne);
|
|
202
|
+
}, U = () => {
|
|
203
|
+
W();
|
|
204
|
+
}, H = () => {
|
|
205
|
+
Y.info("WSAvcPlayer socket closed"), c.value = !1, ie(e.connection.connectionError);
|
|
206
|
+
}, Q = async (N) => {
|
|
207
|
+
if (!p.value) {
|
|
208
|
+
Y.error("Canvas element not found");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const X = await ft();
|
|
213
|
+
if (N !== w) return;
|
|
214
|
+
Y.info("Initializing WSAvcPlayer..."), _ = new X(p.value, "webgl", 1, 35), _.setSizeChangedCallback(B), _.setSocketConnectCallback(z), _.setSocketMessageCallback(U);
|
|
215
|
+
const q = _;
|
|
216
|
+
_.setSocketClosedCallback(() => {
|
|
217
|
+
q === _ && H();
|
|
218
|
+
}), _.connect(S.value), Y.info(
|
|
219
|
+
"WSAvcPlayer initialized and connecting to:",
|
|
220
|
+
S.value
|
|
221
|
+
);
|
|
222
|
+
} catch (X) {
|
|
223
|
+
Y.error("Failed to initialize WSAvcPlayer:", X), F.value = e.decoder.initFailed, d.value = !1;
|
|
224
|
+
}
|
|
225
|
+
}, J = () => {
|
|
226
|
+
try {
|
|
227
|
+
Y.info("Initializing control event socket...");
|
|
228
|
+
const N = new WebSocket(C.value);
|
|
229
|
+
x = N, N.onopen = () => {
|
|
230
|
+
Y.info("Control event WebSocket connected"), R = !0, c.value && (P = 0);
|
|
231
|
+
}, N.onmessage = (X) => {
|
|
232
|
+
Y.info("Control event message:", X.data);
|
|
233
|
+
}, N.onerror = (X) => {
|
|
234
|
+
N === x && (Y.error("Control event WebSocket error:", X), ie(e.control.controlDisconnected));
|
|
235
|
+
}, N.onclose = (X) => {
|
|
236
|
+
Y.info("Control event WebSocket closed:", X.code, X.reason), N === x && (c.value = !1, ie(e.control.controlDisconnected));
|
|
237
|
+
};
|
|
238
|
+
} catch (N) {
|
|
239
|
+
Y.error("Failed to initialize control event socket:", N);
|
|
240
|
+
}
|
|
241
|
+
}, Z = () => {
|
|
242
|
+
h--, h <= 0 && (c.value = !1, ie(e.connection.connectionTimeout));
|
|
243
|
+
}, ne = () => {
|
|
244
|
+
var $e;
|
|
245
|
+
if (!l.value || !p.value) return;
|
|
246
|
+
const N = I.value || t.deviceScreenWidth, X = E.value || t.deviceScreenHeight;
|
|
247
|
+
if (N === 0 || X === 0) return;
|
|
248
|
+
const q = l.value.parentElement;
|
|
249
|
+
if (!q) return;
|
|
250
|
+
const j = q.getBoundingClientRect(), de = window.getComputedStyle(q), we = parseFloat(de.paddingLeft) || 0, Te = parseFloat(de.paddingRight) || 0, De = parseFloat(de.paddingTop) || 0, Ne = parseFloat(de.paddingBottom) || 0, Xe = (($e = u.value) == null ? void 0 : $e.offsetHeight) || 0, Ue = j.width - we - Te, We = j.height - De - Ne - Xe;
|
|
251
|
+
if (Ue === 0 || We === 0) return;
|
|
252
|
+
const et = Ue / N, tt = We / X, Be = Math.min(et, tt), ze = N * Be, He = X * Be;
|
|
253
|
+
Y.info("📐 Layout:", {
|
|
254
|
+
parentSize: `${Ue}x${We}`,
|
|
255
|
+
displaySize: `${N}x${X}`,
|
|
256
|
+
usingFallback: I.value === 0,
|
|
257
|
+
canvasSize: `${ze}x${He}`,
|
|
258
|
+
scale: Be
|
|
259
|
+
}), L.value = {
|
|
260
|
+
width: `${ze}px`,
|
|
261
|
+
height: `${He + Xe}px`
|
|
262
|
+
}, T.value = {
|
|
263
|
+
width: `${ze}px`,
|
|
264
|
+
height: `${He}px`
|
|
265
|
+
};
|
|
266
|
+
}, ee = (N, X) => {
|
|
267
|
+
if (!p.value) return { x: 0, y: 0 };
|
|
268
|
+
const q = p.value.getBoundingClientRect(), j = p.value.width, de = p.value.height, we = N / q.width * j, Te = X / q.height * de, De = (we - m) / M, Ne = (Te - g) / k;
|
|
269
|
+
return {
|
|
270
|
+
x: Math.round(De),
|
|
271
|
+
y: Math.round(Ne)
|
|
272
|
+
};
|
|
273
|
+
}, ae = (N, X) => {
|
|
274
|
+
if (!p.value) return !1;
|
|
275
|
+
const q = p.value.getBoundingClientRect(), j = p.value.width, de = p.value.height, we = N / q.width * j, Te = X / q.height * de;
|
|
276
|
+
return we > m && we < j - m && Te > g && Te < de - g;
|
|
277
|
+
}, le = (N) => {
|
|
278
|
+
if (Y.info("onmousedown, button:", N.button), N.button !== 0) return;
|
|
279
|
+
N.preventDefault();
|
|
280
|
+
const X = N.offsetX, q = N.offsetY;
|
|
281
|
+
if (ae(X, q)) {
|
|
282
|
+
o.value = !0;
|
|
283
|
+
const j = ee(X, q);
|
|
284
|
+
Y.info("👆 Mouse down at:", { offsetX: X, offsetY: q }, "→ device:", j), G("onmousedown", j.x, j.y);
|
|
285
|
+
}
|
|
286
|
+
}, pe = (N) => {
|
|
287
|
+
if (Y.info("onmouseup, button:", N.button), N.button !== 0) return;
|
|
288
|
+
N.preventDefault(), o.value = !1;
|
|
289
|
+
const X = N.offsetX, q = N.offsetY;
|
|
290
|
+
if (ae(X, q)) {
|
|
291
|
+
const j = ee(X, q);
|
|
292
|
+
Y.info("👆 Mouse up at:", { offsetX: X, offsetY: q }, "→ device:", j), G("onmouseup", j.x, j.y);
|
|
293
|
+
}
|
|
294
|
+
}, Se = (N) => {
|
|
295
|
+
if (N.button !== 0 || !o.value) return;
|
|
296
|
+
N.preventDefault();
|
|
297
|
+
const X = N.offsetX, q = N.offsetY;
|
|
298
|
+
if (ae(X, q)) {
|
|
299
|
+
const j = ee(X, q);
|
|
300
|
+
G("onmousemove", j.x, j.y);
|
|
301
|
+
}
|
|
302
|
+
}, ue = (N) => {
|
|
303
|
+
if (Y.info("onmouseleave, isDown:", o.value), o.value) {
|
|
304
|
+
o.value = !1;
|
|
305
|
+
const X = N.offsetX, q = N.offsetY, j = ee(X, q);
|
|
306
|
+
Y.info("👆 Mouse leave, sending mouseup at:", j), G("onmouseup", j.x, j.y);
|
|
307
|
+
}
|
|
308
|
+
}, G = (N, X, q) => {
|
|
309
|
+
if ((x == null ? void 0 : x.readyState) === WebSocket.OPEN) {
|
|
310
|
+
const j = {
|
|
311
|
+
type: N,
|
|
312
|
+
clientX: X,
|
|
313
|
+
clientY: q
|
|
314
|
+
};
|
|
315
|
+
x.send(JSON.stringify(j)), Y.info(`📤 Sent ${N}: [${X}, ${q}]`);
|
|
316
|
+
} else
|
|
317
|
+
Y.warn("⚠️ Control WebSocket not connected, cannot send event");
|
|
318
|
+
}, $ = async (N) => (await y(), N !== w || (await Q(N), N !== w) ? !1 : (J(), !0)), V = () => {
|
|
319
|
+
se();
|
|
320
|
+
const N = w;
|
|
321
|
+
$(N).then((X) => {
|
|
322
|
+
!X || N !== w || (h = Ke * 3, b = window.setInterval(Z, 100), Fe(ne));
|
|
323
|
+
});
|
|
324
|
+
}, oe = () => {
|
|
325
|
+
A && (clearTimeout(A), A = null), D && (clearTimeout(D), D = null);
|
|
326
|
+
}, ie = (N) => {
|
|
327
|
+
if (!A) {
|
|
328
|
+
if (se(), P >= Ve) {
|
|
329
|
+
d.value = !1, c.value = !1, F.value = N;
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
A = window.setTimeout(() => {
|
|
333
|
+
A = null, P++, Y.info(
|
|
334
|
+
`Auto reconnecting (${P}/${Ve})`
|
|
335
|
+
), V();
|
|
336
|
+
}, yt);
|
|
337
|
+
}
|
|
338
|
+
}, ge = () => {
|
|
339
|
+
oe(), P = 0, F.value = "", d.value = !0, se(), D = window.setTimeout(() => {
|
|
340
|
+
D = null, V();
|
|
341
|
+
}, 500);
|
|
342
|
+
};
|
|
343
|
+
let ye = null;
|
|
344
|
+
const se = () => {
|
|
345
|
+
w++, b && (clearInterval(b), b = null), R = !1, O(), a();
|
|
346
|
+
}, ce = () => {
|
|
347
|
+
oe(), se(), ye && (ye.disconnect(), ye = null);
|
|
348
|
+
};
|
|
349
|
+
return ke(async () => {
|
|
350
|
+
var N;
|
|
351
|
+
await Fe(), ne(), (N = l.value) != null && N.parentElement && (ye = new ResizeObserver(() => {
|
|
352
|
+
ne();
|
|
353
|
+
}), ye.observe(l.value.parentElement)), window.addEventListener("resize", ne), V();
|
|
354
|
+
}), Ae(() => {
|
|
355
|
+
window.removeEventListener("resize", ne), ce();
|
|
356
|
+
}), (N, X) => (re(), ve("div", {
|
|
357
|
+
ref_key: "webControlRef",
|
|
358
|
+
ref: l,
|
|
359
|
+
class: "web-control-android",
|
|
360
|
+
style: he(L.value)
|
|
361
|
+
}, [
|
|
362
|
+
be("", !0),
|
|
363
|
+
te("div", {
|
|
364
|
+
ref_key: "screenContainerRef",
|
|
365
|
+
ref: i,
|
|
366
|
+
class: "screen-container"
|
|
367
|
+
}, [
|
|
368
|
+
te("div", {
|
|
369
|
+
ref_key: "screenRef",
|
|
370
|
+
ref: v,
|
|
371
|
+
class: "screen"
|
|
372
|
+
}, [
|
|
373
|
+
te("canvas", {
|
|
374
|
+
ref_key: "canvasRef",
|
|
375
|
+
ref: p,
|
|
376
|
+
class: "screen-canvas",
|
|
377
|
+
style: he(T.value),
|
|
378
|
+
onMousedown: le,
|
|
379
|
+
onMouseup: pe,
|
|
380
|
+
onMousemove: Se,
|
|
381
|
+
onMouseleave: ue
|
|
382
|
+
}, null, 36),
|
|
383
|
+
Oe(Pe, {
|
|
384
|
+
"is-connecting": d.value,
|
|
385
|
+
"connection-error": F.value,
|
|
386
|
+
onRetry: ge
|
|
387
|
+
}, null, 8, ["is-connecting", "connection-error"])
|
|
388
|
+
], 512)
|
|
389
|
+
], 512)
|
|
390
|
+
], 4));
|
|
391
|
+
}
|
|
392
|
+
}), wt = /* @__PURE__ */ Ee(Ft, [["__scopeId", "data-v-1cb370f7"]]), mt = ["src"], St = /* @__PURE__ */ Ce({
|
|
393
|
+
__name: "WebControlForH5",
|
|
394
|
+
props: {
|
|
395
|
+
src: { default: void 0 },
|
|
396
|
+
width: { default: 1042 },
|
|
397
|
+
height: { default: 680 }
|
|
398
|
+
},
|
|
399
|
+
setup(r) {
|
|
400
|
+
const e = r, t = K(), l = K(), u = K({}), i = K({}), v = () => {
|
|
401
|
+
if (!t.value) return;
|
|
402
|
+
const d = t.value.parentElement;
|
|
403
|
+
if (!d) return;
|
|
404
|
+
const c = d.getBoundingClientRect(), F = window.getComputedStyle(d), I = parseFloat(F.paddingLeft) || 0, E = parseFloat(F.paddingRight) || 0, T = parseFloat(F.paddingTop) || 0, L = parseFloat(F.paddingBottom) || 0, M = c.width - I - E, k = c.height - T - L;
|
|
405
|
+
M === 0 || k === 0 || (u.value = {
|
|
406
|
+
width: `${M}px`,
|
|
407
|
+
height: `${k}px`
|
|
408
|
+
}, i.value = {
|
|
409
|
+
width: `${M}px`,
|
|
410
|
+
height: `${k}px`
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
let p = null;
|
|
414
|
+
return ke(async () => {
|
|
415
|
+
var d;
|
|
416
|
+
await Fe(), v(), (d = t.value) != null && d.parentElement && (p = new ResizeObserver(() => {
|
|
417
|
+
v();
|
|
418
|
+
}), p.observe(t.value.parentElement)), window.addEventListener("resize", v);
|
|
419
|
+
}), Ae(() => {
|
|
420
|
+
window.removeEventListener("resize", v), p && (p.disconnect(), p = null);
|
|
421
|
+
}), (d, c) => (re(), ve("div", {
|
|
422
|
+
ref_key: "webControlRef",
|
|
423
|
+
ref: t,
|
|
424
|
+
class: "web-control-h5",
|
|
425
|
+
style: he(u.value)
|
|
426
|
+
}, [
|
|
427
|
+
te("iframe", {
|
|
428
|
+
ref_key: "iframeRef",
|
|
429
|
+
ref: l,
|
|
430
|
+
src: e.src,
|
|
431
|
+
style: he(i.value),
|
|
432
|
+
class: "h5-iframe",
|
|
433
|
+
frameborder: "0"
|
|
434
|
+
}, null, 12, mt)
|
|
435
|
+
], 4));
|
|
436
|
+
}
|
|
437
|
+
}), xt = /* @__PURE__ */ Ee(St, [["__scopeId", "data-v-88b09ebf"]]), Ct = 5960464477539063e-23, Ye = 4294967296, qe = 9007199254740992;
|
|
438
|
+
function Qe(r) {
|
|
439
|
+
let e = new ArrayBuffer(256), t = new DataView(e), l = 0, u = 0;
|
|
440
|
+
function i(m) {
|
|
441
|
+
let g = e.byteLength;
|
|
442
|
+
const s = u + m;
|
|
443
|
+
for (; g < s; )
|
|
444
|
+
g <<= 1;
|
|
445
|
+
if (g !== e.byteLength) {
|
|
446
|
+
const f = t;
|
|
447
|
+
e = new ArrayBuffer(g), t = new DataView(e);
|
|
448
|
+
const y = u + 3 >> 2;
|
|
449
|
+
for (let S = 0; S < y; ++S)
|
|
450
|
+
t.setUint32(S << 2, f.getUint32(S << 2));
|
|
451
|
+
}
|
|
452
|
+
return l = m, t;
|
|
453
|
+
}
|
|
454
|
+
function v() {
|
|
455
|
+
u += l;
|
|
456
|
+
}
|
|
457
|
+
function p(m) {
|
|
458
|
+
i(8).setFloat64(u, m), v();
|
|
459
|
+
}
|
|
460
|
+
function d(m) {
|
|
461
|
+
i(1).setUint8(u, m), v();
|
|
462
|
+
}
|
|
463
|
+
function c(m) {
|
|
464
|
+
const g = i(m.length);
|
|
465
|
+
for (let s = 0; s < m.length; ++s)
|
|
466
|
+
g.setUint8(u + s, m[s]);
|
|
467
|
+
v();
|
|
468
|
+
}
|
|
469
|
+
function F(m) {
|
|
470
|
+
i(2).setUint16(u, m), v();
|
|
471
|
+
}
|
|
472
|
+
function I(m) {
|
|
473
|
+
i(4).setUint32(u, m), v();
|
|
474
|
+
}
|
|
475
|
+
function E(m) {
|
|
476
|
+
const g = m % Ye, s = (m - g) / Ye, f = i(8);
|
|
477
|
+
f.setUint32(u, s), f.setUint32(u + 4, g), v();
|
|
478
|
+
}
|
|
479
|
+
function T(m, g) {
|
|
480
|
+
g < 24 ? d(m << 5 | g) : g < 256 ? (d(m << 5 | 24), d(g)) : g < 65536 ? (d(m << 5 | 25), F(g)) : g < 4294967296 ? (d(m << 5 | 26), I(g)) : (d(m << 5 | 27), E(g));
|
|
481
|
+
}
|
|
482
|
+
function L(m) {
|
|
483
|
+
if (m === !1) {
|
|
484
|
+
d(244);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (m === !0) {
|
|
488
|
+
d(245);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (m === null) {
|
|
492
|
+
d(246);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
if (m === void 0) {
|
|
496
|
+
d(247);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
switch (typeof m) {
|
|
500
|
+
case "number":
|
|
501
|
+
if (Math.floor(m) === m) {
|
|
502
|
+
if (0 <= m && m <= qe) {
|
|
503
|
+
T(0, m);
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (-qe <= m && m < 0) {
|
|
507
|
+
T(1, -(m + 1));
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
d(251), p(m);
|
|
512
|
+
return;
|
|
513
|
+
case "string": {
|
|
514
|
+
const g = [];
|
|
515
|
+
for (let s = 0; s < m.length; ++s) {
|
|
516
|
+
let f = m.charCodeAt(s);
|
|
517
|
+
f < 128 ? g.push(f) : f < 2048 ? (g.push(192 | f >> 6), g.push(128 | f & 63)) : f < 55296 ? (g.push(224 | f >> 12), g.push(128 | f >> 6 & 63), g.push(128 | f & 63)) : (f = (f & 1023) << 10 | m.charCodeAt(++s) & 1023, f += 65536, g.push(240 | f >> 18), g.push(128 | f >> 12 & 63), g.push(128 | f >> 6 & 63), g.push(128 | f & 63));
|
|
518
|
+
}
|
|
519
|
+
T(3, g.length), c(g);
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
default:
|
|
523
|
+
if (Array.isArray(m)) {
|
|
524
|
+
const g = m.length;
|
|
525
|
+
T(4, g);
|
|
526
|
+
for (let s = 0; s < g; ++s)
|
|
527
|
+
L(m[s]);
|
|
528
|
+
} else if (m instanceof Uint8Array)
|
|
529
|
+
T(2, m.length), c(m);
|
|
530
|
+
else {
|
|
531
|
+
const g = Object.keys(m), s = g.length;
|
|
532
|
+
T(5, s);
|
|
533
|
+
for (let f = 0; f < s; ++f) {
|
|
534
|
+
const y = g[f];
|
|
535
|
+
L(y), L(m[y]);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (L(r), "slice" in e)
|
|
541
|
+
return e.slice(0, u);
|
|
542
|
+
const M = new ArrayBuffer(u), k = new DataView(M);
|
|
543
|
+
for (let m = 0; m < u; ++m)
|
|
544
|
+
k.setUint8(m, t.getUint8(m));
|
|
545
|
+
return M;
|
|
546
|
+
}
|
|
547
|
+
function Et(r, e, t) {
|
|
548
|
+
const l = new DataView(r);
|
|
549
|
+
let u = 0;
|
|
550
|
+
const i = e || ((S) => S), v = t || (() => {
|
|
551
|
+
});
|
|
552
|
+
function p(S, C) {
|
|
553
|
+
return u += S, C;
|
|
554
|
+
}
|
|
555
|
+
function d(S) {
|
|
556
|
+
return p(S, new Uint8Array(r, u, S));
|
|
557
|
+
}
|
|
558
|
+
function c() {
|
|
559
|
+
const S = new ArrayBuffer(4), C = new DataView(S), _ = T(), x = _ & 32768;
|
|
560
|
+
let O = _ & 31744;
|
|
561
|
+
const a = _ & 1023;
|
|
562
|
+
if (O === 31744)
|
|
563
|
+
O = 261120;
|
|
564
|
+
else if (O !== 0)
|
|
565
|
+
O += 114688;
|
|
566
|
+
else if (a !== 0)
|
|
567
|
+
return (x ? -1 : 1) * a * Ct;
|
|
568
|
+
return C.setUint32(
|
|
569
|
+
0,
|
|
570
|
+
x << 16 | O << 13 | a << 13
|
|
571
|
+
), C.getFloat32(0);
|
|
572
|
+
}
|
|
573
|
+
function F() {
|
|
574
|
+
return p(4, l.getFloat32(u));
|
|
575
|
+
}
|
|
576
|
+
function I() {
|
|
577
|
+
return p(8, l.getFloat64(u));
|
|
578
|
+
}
|
|
579
|
+
function E() {
|
|
580
|
+
return p(1, l.getUint8(u));
|
|
581
|
+
}
|
|
582
|
+
function T() {
|
|
583
|
+
return p(2, l.getUint16(u));
|
|
584
|
+
}
|
|
585
|
+
function L() {
|
|
586
|
+
return p(4, l.getUint32(u));
|
|
587
|
+
}
|
|
588
|
+
function M() {
|
|
589
|
+
return L() * Ye + L();
|
|
590
|
+
}
|
|
591
|
+
function k() {
|
|
592
|
+
return l.getUint8(u) !== 255 ? !1 : (u += 1, !0);
|
|
593
|
+
}
|
|
594
|
+
function m(S) {
|
|
595
|
+
if (S < 24)
|
|
596
|
+
return S;
|
|
597
|
+
if (S === 24)
|
|
598
|
+
return E();
|
|
599
|
+
if (S === 25)
|
|
600
|
+
return T();
|
|
601
|
+
if (S === 26)
|
|
602
|
+
return L();
|
|
603
|
+
if (S === 27)
|
|
604
|
+
return M();
|
|
605
|
+
if (S === 31)
|
|
606
|
+
return -1;
|
|
607
|
+
throw new Error("Invalid length encoding");
|
|
608
|
+
}
|
|
609
|
+
function g(S) {
|
|
610
|
+
const C = E();
|
|
611
|
+
if (C === 255)
|
|
612
|
+
return -1;
|
|
613
|
+
const _ = m(C & 31);
|
|
614
|
+
if (_ < 0 || C >> 5 !== S)
|
|
615
|
+
throw new Error("Invalid indefinite length element");
|
|
616
|
+
return _;
|
|
617
|
+
}
|
|
618
|
+
function s(S, C) {
|
|
619
|
+
for (let _ = 0; _ < C; ++_) {
|
|
620
|
+
let x = E();
|
|
621
|
+
x & 128 && (x < 224 ? (x = (x & 31) << 6 | E() & 63, C -= 1) : x < 240 ? (x = (x & 15) << 12 | (E() & 63) << 6 | E() & 63, C -= 2) : (x = (x & 15) << 18 | (E() & 63) << 12 | (E() & 63) << 6 | E() & 63, C -= 3)), x < 65536 ? S.push(x) : (x -= 65536, S.push(55296 | x >> 10), S.push(56320 | x & 1023));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
function f() {
|
|
625
|
+
const S = E(), C = S >> 5, _ = S & 31;
|
|
626
|
+
if (C === 7)
|
|
627
|
+
switch (_) {
|
|
628
|
+
case 25:
|
|
629
|
+
return c();
|
|
630
|
+
case 26:
|
|
631
|
+
return F();
|
|
632
|
+
case 27:
|
|
633
|
+
return I();
|
|
634
|
+
}
|
|
635
|
+
let x = m(_);
|
|
636
|
+
if (x < 0 && (C < 2 || 6 < C))
|
|
637
|
+
throw new Error("Invalid length");
|
|
638
|
+
switch (C) {
|
|
639
|
+
case 0:
|
|
640
|
+
return x;
|
|
641
|
+
case 1:
|
|
642
|
+
return -1 - x;
|
|
643
|
+
case 2: {
|
|
644
|
+
if (x < 0) {
|
|
645
|
+
const O = [];
|
|
646
|
+
let a = 0;
|
|
647
|
+
for (; (x = g(C)) >= 0; )
|
|
648
|
+
a += x, O.push(d(x));
|
|
649
|
+
const o = new Uint8Array(a);
|
|
650
|
+
let h = 0;
|
|
651
|
+
for (let b = 0; b < O.length; ++b)
|
|
652
|
+
o.set(O[b], h), h += O[b].length;
|
|
653
|
+
return o;
|
|
654
|
+
}
|
|
655
|
+
return d(x);
|
|
656
|
+
}
|
|
657
|
+
case 3: {
|
|
658
|
+
const O = [];
|
|
659
|
+
if (x < 0)
|
|
660
|
+
for (; (x = g(C)) >= 0; )
|
|
661
|
+
s(O, x);
|
|
662
|
+
else
|
|
663
|
+
s(O, x);
|
|
664
|
+
return String.fromCharCode(...O);
|
|
665
|
+
}
|
|
666
|
+
case 4: {
|
|
667
|
+
let O;
|
|
668
|
+
if (x < 0)
|
|
669
|
+
for (O = []; !k(); )
|
|
670
|
+
O.push(f());
|
|
671
|
+
else {
|
|
672
|
+
O = new Array(x);
|
|
673
|
+
for (let a = 0; a < x; ++a)
|
|
674
|
+
O[a] = f();
|
|
675
|
+
}
|
|
676
|
+
return O;
|
|
677
|
+
}
|
|
678
|
+
case 5: {
|
|
679
|
+
const O = {};
|
|
680
|
+
for (let a = 0; a < x || x < 0 && !k(); ++a) {
|
|
681
|
+
const o = f();
|
|
682
|
+
O[o] = f();
|
|
683
|
+
}
|
|
684
|
+
return O;
|
|
685
|
+
}
|
|
686
|
+
case 6:
|
|
687
|
+
return i(f(), x);
|
|
688
|
+
case 7:
|
|
689
|
+
switch (x) {
|
|
690
|
+
case 20:
|
|
691
|
+
return !1;
|
|
692
|
+
case 21:
|
|
693
|
+
return !0;
|
|
694
|
+
case 22:
|
|
695
|
+
return null;
|
|
696
|
+
case 23:
|
|
697
|
+
return;
|
|
698
|
+
default:
|
|
699
|
+
return v(x);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
const y = f();
|
|
704
|
+
if (u !== r.byteLength)
|
|
705
|
+
throw new Error("Remaining bytes");
|
|
706
|
+
return y;
|
|
707
|
+
}
|
|
708
|
+
const Tt = 100, bt = 10, _t = 30, It = 50, Rt = /* @__PURE__ */ Ce({
|
|
709
|
+
__name: "WebControlForLinux",
|
|
710
|
+
props: {
|
|
711
|
+
wsUrl: { default: void 0 },
|
|
712
|
+
canvasWidth: { default: 480 },
|
|
713
|
+
canvasHeight: { default: 272 }
|
|
714
|
+
},
|
|
715
|
+
setup(r) {
|
|
716
|
+
const e = Le(), t = r, l = K(), u = K(), i = K(), v = K(null), p = K(!1), d = K(!1), c = K(""), F = K(null), I = K({}), E = K({}), T = K(0), L = K(performance.now()), M = K(0), k = K(/* @__PURE__ */ new Map()), m = K([]), g = K(!1), s = K({
|
|
717
|
+
received: 0,
|
|
718
|
+
processed: 0,
|
|
719
|
+
dropped: 0,
|
|
720
|
+
outOfOrder: 0,
|
|
721
|
+
duplicates: 0
|
|
722
|
+
}), f = K(!1), y = K(!1), S = K({ x: 0, y: 0 }), C = K(!1), _ = K(null), x = K(!1), O = () => {
|
|
723
|
+
if (!l.value || !i.value) return;
|
|
724
|
+
const G = l.value.parentElement;
|
|
725
|
+
if (!G) return;
|
|
726
|
+
const $ = G.getBoundingClientRect(), V = window.getComputedStyle(G), oe = parseFloat(V.paddingLeft) || 0, ie = parseFloat(V.paddingRight) || 0, ge = parseFloat(V.paddingTop) || 0, ye = parseFloat(V.paddingBottom) || 0, se = $.width - oe - ie, ce = $.height - ge - ye;
|
|
727
|
+
if (se === 0 || ce === 0) return;
|
|
728
|
+
const N = ce, X = se / t.canvasWidth, q = N / t.canvasHeight, j = Math.min(X, q), de = t.canvasWidth * j, we = t.canvasHeight * j;
|
|
729
|
+
I.value = {
|
|
730
|
+
width: `${se}px`,
|
|
731
|
+
height: `${ce}px`
|
|
732
|
+
}, E.value = {
|
|
733
|
+
width: `${de}px`,
|
|
734
|
+
height: `${we}px`
|
|
735
|
+
};
|
|
736
|
+
}, a = () => {
|
|
737
|
+
var G;
|
|
738
|
+
if (((G = v.value) == null ? void 0 : G.readyState) !== WebSocket.OPEN) {
|
|
739
|
+
p.value = !0, c.value = "";
|
|
740
|
+
try {
|
|
741
|
+
const $ = t.wsUrl || `ws://${window.location.hostname}/ws/connect`;
|
|
742
|
+
Y.info(`[WebControlLinux] Connecting to ${$}`), v.value = new WebSocket($), v.value.onopen = () => {
|
|
743
|
+
Y.info("[WebControlLinux] WebSocket connected"), p.value = !1, d.value = !0, J(), pe(), b();
|
|
744
|
+
}, v.value.onmessage = async (V) => {
|
|
745
|
+
await o(V);
|
|
746
|
+
}, v.value.onclose = (V) => {
|
|
747
|
+
Y.info(
|
|
748
|
+
"[WebControlLinux] WebSocket closed:",
|
|
749
|
+
V.code,
|
|
750
|
+
V.reason
|
|
751
|
+
), d.value = !1, p.value = !1, P(), J();
|
|
752
|
+
}, v.value.onerror = (V) => {
|
|
753
|
+
Y.error("[WebControlLinux] WebSocket error:", V), p.value = !1, c.value = e.connection.connectionError;
|
|
754
|
+
};
|
|
755
|
+
} catch ($) {
|
|
756
|
+
Y.error("[WebControlLinux] Failed to create WebSocket:", $), p.value = !1, c.value = e.connection.cannotCreateConnection;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}, o = async (G) => {
|
|
760
|
+
if (G.data instanceof Blob)
|
|
761
|
+
try {
|
|
762
|
+
const $ = await G.data.arrayBuffer(), V = Et($);
|
|
763
|
+
if (!V)
|
|
764
|
+
return;
|
|
765
|
+
if (V.type === "screen/update") {
|
|
766
|
+
D(V);
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
Y.info("[WebControlLinux] Received message:", V.type);
|
|
770
|
+
} catch ($) {
|
|
771
|
+
Y.error("[WebControlLinux] Failed to decode CBOR data:", $);
|
|
772
|
+
}
|
|
773
|
+
else
|
|
774
|
+
Y.info("[WebControlLinux] Text message:", G.data);
|
|
775
|
+
}, h = () => {
|
|
776
|
+
c.value = "", a();
|
|
777
|
+
}, b = () => {
|
|
778
|
+
x.value || (x.value = !0, Y.info("[WebControlLinux] Watchdog activated"), _.value = window.setInterval(() => {
|
|
779
|
+
A();
|
|
780
|
+
}, 6e4), A());
|
|
781
|
+
}, P = () => {
|
|
782
|
+
x.value && (x.value = !1, Y.info("[WebControlLinux] Watchdog deactivated"), _.value && (clearInterval(_.value), _.value = null));
|
|
783
|
+
}, A = async () => {
|
|
784
|
+
window.authManager && await window.authManager.updateLastAccess() && Y.info("[WebControlLinux] Session activity updated (watchdog)");
|
|
785
|
+
}, D = (G) => {
|
|
786
|
+
const $ = G.frameSeq || 0;
|
|
787
|
+
if (s.value.received++, $ < M.value) {
|
|
788
|
+
s.value.duplicates++;
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
if ($ === M.value)
|
|
792
|
+
w(G), M.value++, R();
|
|
793
|
+
else {
|
|
794
|
+
if (s.value.outOfOrder++, k.value.size >= bt) {
|
|
795
|
+
const V = Math.min(...k.value.keys());
|
|
796
|
+
k.value.delete(V), s.value.dropped++;
|
|
797
|
+
}
|
|
798
|
+
k.value.set($, G), setTimeout(() => {
|
|
799
|
+
if (k.value.has($)) {
|
|
800
|
+
const V = k.value.get($);
|
|
801
|
+
k.value.delete($), w(V), M.value = $ + 1, R();
|
|
802
|
+
}
|
|
803
|
+
}, Tt);
|
|
804
|
+
}
|
|
805
|
+
}, R = () => {
|
|
806
|
+
for (; k.value.has(M.value); ) {
|
|
807
|
+
const G = k.value.get(M.value);
|
|
808
|
+
k.value.delete(M.value), w(G), M.value++;
|
|
809
|
+
}
|
|
810
|
+
}, w = (G) => {
|
|
811
|
+
m.value.length >= _t && (m.value.shift(), s.value.dropped++), m.value.push(G), W();
|
|
812
|
+
}, W = async () => {
|
|
813
|
+
if (!(g.value || m.value.length === 0)) {
|
|
814
|
+
if (document.hidden) {
|
|
815
|
+
H();
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
for (g.value = !0; m.value.length > 0 && !document.hidden; ) {
|
|
819
|
+
const G = m.value.shift();
|
|
820
|
+
await B(G);
|
|
821
|
+
}
|
|
822
|
+
g.value = !1;
|
|
823
|
+
}
|
|
824
|
+
}, B = async (G) => new Promise(($) => {
|
|
825
|
+
requestAnimationFrame(() => {
|
|
826
|
+
try {
|
|
827
|
+
z(G), s.value.processed++;
|
|
828
|
+
} catch (V) {
|
|
829
|
+
Y.error("[WebControlLinux] Error rendering frame:", V);
|
|
830
|
+
}
|
|
831
|
+
$(null);
|
|
832
|
+
});
|
|
833
|
+
}), z = (G) => {
|
|
834
|
+
if (!i.value || !F.value) {
|
|
835
|
+
Y.warn("[WebControlLinux] Canvas not ready");
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
const $ = G.x1 ?? G.x1 ?? 0, V = G.y1 ?? G.y1 ?? 0, oe = G.x2 ?? G.x2 ?? t.canvasWidth - 1, ie = G.y2 ?? G.y2 ?? t.canvasHeight - 1, ge = oe - $ + 1, ye = ie - V + 1, se = F.value.createImageData(ge, ye), ce = new Uint8Array(G.data || G.data);
|
|
839
|
+
if (!ce || ce.length === 0) {
|
|
840
|
+
Y.warn("[WebControlLinux] No pixel data in frame");
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
for (let N = 0; N < ce.length; N += 3) {
|
|
844
|
+
const X = N / 3 * 4;
|
|
845
|
+
se.data[X] = ce[N], se.data[X + 1] = ce[N + 1], se.data[X + 2] = ce[N + 2], se.data[X + 3] = 255;
|
|
846
|
+
}
|
|
847
|
+
F.value.putImageData(se, $, V), U();
|
|
848
|
+
}, U = () => {
|
|
849
|
+
const G = performance.now();
|
|
850
|
+
G - L.value >= 1e3 && (T.value = 0, L.value = G), T.value++;
|
|
851
|
+
}, H = () => {
|
|
852
|
+
const G = m.value.length;
|
|
853
|
+
m.value = [], g.value = !1, G > 0 && (s.value.dropped += G);
|
|
854
|
+
}, Q = () => {
|
|
855
|
+
const G = k.value.size;
|
|
856
|
+
k.value.clear(), M.value = 0, G > 0 && Y.info(
|
|
857
|
+
`[WebControlLinux] Frame sequencing reset, cleared ${G} buffered frames`
|
|
858
|
+
);
|
|
859
|
+
}, J = () => {
|
|
860
|
+
k.value.clear(), m.value = [], M.value = 0, g.value = !1, s.value = {
|
|
861
|
+
received: 0,
|
|
862
|
+
processed: 0,
|
|
863
|
+
dropped: 0,
|
|
864
|
+
outOfOrder: 0,
|
|
865
|
+
duplicates: 0
|
|
866
|
+
};
|
|
867
|
+
}, Z = (G) => {
|
|
868
|
+
if (!i.value || !d.value || f.value) return;
|
|
869
|
+
f.value = !0, y.value = !1;
|
|
870
|
+
const $ = i.value.getBoundingClientRect();
|
|
871
|
+
S.value.x = G.clientX - $.left, S.value.y = G.clientY - $.top;
|
|
872
|
+
const V = Math.floor(S.value.x / $.width * t.canvasWidth), oe = Math.floor(S.value.y / $.height * t.canvasHeight);
|
|
873
|
+
le("down", V, oe);
|
|
874
|
+
}, ne = (G) => {
|
|
875
|
+
if (!i.value || !d.value || !f.value) return;
|
|
876
|
+
const $ = i.value.getBoundingClientRect(), V = G.clientX - $.left, oe = G.clientY - $.top;
|
|
877
|
+
if (!y.value && (Math.abs(V - S.value.x) > 5 || Math.abs(oe - S.value.y) > 5) && (y.value = !0), y.value && !C.value) {
|
|
878
|
+
const ie = Math.floor(V / $.width * t.canvasWidth), ge = Math.floor(oe / $.height * t.canvasHeight);
|
|
879
|
+
le("drag", ie, ge), C.value = !0, setTimeout(() => {
|
|
880
|
+
C.value = !1;
|
|
881
|
+
}, It);
|
|
882
|
+
}
|
|
883
|
+
}, ee = (G) => {
|
|
884
|
+
if (!i.value || !d.value || !f.value) return;
|
|
885
|
+
f.value = !1;
|
|
886
|
+
const $ = i.value.getBoundingClientRect(), V = G.clientX - $.left, oe = G.clientY - $.top, ie = Math.floor(V / $.width * t.canvasWidth), ge = Math.floor(oe / $.height * t.canvasHeight);
|
|
887
|
+
le("up", ie, ge), y.value = !1;
|
|
888
|
+
}, ae = () => {
|
|
889
|
+
if (f.value && d.value && i.value) {
|
|
890
|
+
const G = i.value.getBoundingClientRect(), $ = Math.floor(S.value.x / G.width * t.canvasWidth), V = Math.floor(
|
|
891
|
+
S.value.y / G.height * t.canvasHeight
|
|
892
|
+
);
|
|
893
|
+
le("up", $, V);
|
|
894
|
+
}
|
|
895
|
+
f.value = !1, y.value = !1;
|
|
896
|
+
}, le = (G, $, V) => {
|
|
897
|
+
if (!v.value || v.value.readyState !== WebSocket.OPEN) return;
|
|
898
|
+
const oe = { type: `mouse/${G}`, x: $, y: V }, ie = Qe(oe);
|
|
899
|
+
v.value.send(ie);
|
|
900
|
+
}, pe = () => {
|
|
901
|
+
if (!v.value || v.value.readyState !== WebSocket.OPEN) return;
|
|
902
|
+
const $ = Qe({ type: "screen/refresh" });
|
|
903
|
+
v.value.send($);
|
|
904
|
+
}, Se = () => {
|
|
905
|
+
document.addEventListener("visibilitychange", () => {
|
|
906
|
+
var G;
|
|
907
|
+
document.hidden ? H() : (Q(), ((G = v.value) == null ? void 0 : G.readyState) === WebSocket.OPEN && pe());
|
|
908
|
+
});
|
|
909
|
+
};
|
|
910
|
+
let ue = null;
|
|
911
|
+
return ke(async () => {
|
|
912
|
+
var G;
|
|
913
|
+
await Fe(), i.value && (i.value.width = t.canvasWidth, i.value.height = t.canvasHeight, F.value = i.value.getContext("2d"), F.value && (F.value.fillStyle = "#000000", F.value.fillRect(0, 0, t.canvasWidth, t.canvasHeight))), O(), (G = l.value) != null && G.parentElement && (ue = new ResizeObserver(() => {
|
|
914
|
+
O();
|
|
915
|
+
}), ue.observe(l.value.parentElement)), window.addEventListener("resize", O), Se(), a();
|
|
916
|
+
}), Ae(() => {
|
|
917
|
+
window.removeEventListener("resize", O), ue && (ue.disconnect(), ue = null), P(), v.value && (v.value.close(1e3), v.value = null);
|
|
918
|
+
}), (G, $) => (re(), ve("div", {
|
|
919
|
+
ref_key: "webControlRef",
|
|
920
|
+
ref: l,
|
|
921
|
+
class: "web-control-linux",
|
|
922
|
+
style: he(I.value)
|
|
923
|
+
}, [
|
|
924
|
+
te("div", {
|
|
925
|
+
ref_key: "screenContainerRef",
|
|
926
|
+
ref: u,
|
|
927
|
+
class: "screen-container"
|
|
928
|
+
}, [
|
|
929
|
+
te("canvas", {
|
|
930
|
+
id: "stream-canvas",
|
|
931
|
+
ref_key: "canvasRef",
|
|
932
|
+
ref: i,
|
|
933
|
+
class: "screen-canvas",
|
|
934
|
+
style: he(E.value),
|
|
935
|
+
onMousedown: Z,
|
|
936
|
+
onMouseup: ee,
|
|
937
|
+
onMousemove: ne,
|
|
938
|
+
onMouseleave: ae
|
|
939
|
+
}, null, 36),
|
|
940
|
+
Oe(Pe, {
|
|
941
|
+
"is-connecting": p.value,
|
|
942
|
+
"connection-error": c.value,
|
|
943
|
+
onRetry: h
|
|
944
|
+
}, null, 8, ["is-connecting", "connection-error"])
|
|
945
|
+
], 512)
|
|
946
|
+
], 4));
|
|
947
|
+
}
|
|
948
|
+
}), kt = /* @__PURE__ */ Ee(Rt, [["__scopeId", "data-v-0348b4f7"]]);
|
|
949
|
+
var n = n || {};
|
|
950
|
+
n.ArrayBufferReader = function(r) {
|
|
951
|
+
var e = this;
|
|
952
|
+
r.onblob = function(t) {
|
|
953
|
+
for (var l = window.atob(t), u = new ArrayBuffer(l.length), i = new Uint8Array(u), v = 0; v < l.length; v++)
|
|
954
|
+
i[v] = l.charCodeAt(v);
|
|
955
|
+
e.ondata && e.ondata(u);
|
|
956
|
+
}, r.onend = function() {
|
|
957
|
+
e.onend && e.onend();
|
|
958
|
+
}, this.ondata = null, this.onend = null;
|
|
959
|
+
};
|
|
960
|
+
var n = n || {};
|
|
961
|
+
n.ArrayBufferWriter = function(r) {
|
|
962
|
+
var e = this;
|
|
963
|
+
r.onack = function(l) {
|
|
964
|
+
e.onack && e.onack(l);
|
|
965
|
+
};
|
|
966
|
+
function t(l) {
|
|
967
|
+
for (var u = "", i = 0; i < l.byteLength; i++)
|
|
968
|
+
u += String.fromCharCode(l[i]);
|
|
969
|
+
r.sendBlob(window.btoa(u));
|
|
970
|
+
}
|
|
971
|
+
this.blobLength = n.ArrayBufferWriter.DEFAULT_BLOB_LENGTH, this.sendData = function(l) {
|
|
972
|
+
var u = new Uint8Array(l);
|
|
973
|
+
if (u.length <= e.blobLength)
|
|
974
|
+
t(u);
|
|
975
|
+
else
|
|
976
|
+
for (var i = 0; i < u.length; i += e.blobLength)
|
|
977
|
+
t(u.subarray(i, i + e.blobLength));
|
|
978
|
+
}, this.sendEnd = function() {
|
|
979
|
+
r.sendEnd();
|
|
980
|
+
}, this.onack = null;
|
|
981
|
+
};
|
|
982
|
+
n.ArrayBufferWriter.DEFAULT_BLOB_LENGTH = 6048;
|
|
983
|
+
var n = n || {};
|
|
984
|
+
n.AudioContextFactory = {
|
|
985
|
+
/**
|
|
986
|
+
* A singleton instance of a Web Audio API AudioContext object, or null if
|
|
987
|
+
* no instance has yes been created. This property may be manually set if
|
|
988
|
+
* you wish to supply your own AudioContext instance, but care must be
|
|
989
|
+
* taken to do so as early as possible. Assignments to this property will
|
|
990
|
+
* not retroactively affect the value returned by previous calls to
|
|
991
|
+
* getAudioContext().
|
|
992
|
+
*
|
|
993
|
+
* @type {AudioContext}
|
|
994
|
+
*/
|
|
995
|
+
singleton: null,
|
|
996
|
+
/**
|
|
997
|
+
* Returns a singleton instance of a Web Audio API AudioContext object.
|
|
998
|
+
*
|
|
999
|
+
* @return {AudioContext}
|
|
1000
|
+
* A singleton instance of a Web Audio API AudioContext object, or null
|
|
1001
|
+
* if the Web Audio API is not supported.
|
|
1002
|
+
*/
|
|
1003
|
+
getAudioContext: function() {
|
|
1004
|
+
var e = window.AudioContext || window.webkitAudioContext;
|
|
1005
|
+
if (e)
|
|
1006
|
+
try {
|
|
1007
|
+
return n.AudioContextFactory.singleton || (n.AudioContextFactory.singleton = new e()), n.AudioContextFactory.singleton;
|
|
1008
|
+
} catch {
|
|
1009
|
+
}
|
|
1010
|
+
return null;
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
var n = n || {};
|
|
1014
|
+
n.AudioPlayer = function() {
|
|
1015
|
+
this.sync = function() {
|
|
1016
|
+
};
|
|
1017
|
+
};
|
|
1018
|
+
n.AudioPlayer.isSupportedType = function(e) {
|
|
1019
|
+
return n.RawAudioPlayer.isSupportedType(e);
|
|
1020
|
+
};
|
|
1021
|
+
n.AudioPlayer.getSupportedTypes = function() {
|
|
1022
|
+
return n.RawAudioPlayer.getSupportedTypes();
|
|
1023
|
+
};
|
|
1024
|
+
n.AudioPlayer.getInstance = function(e, t) {
|
|
1025
|
+
return n.RawAudioPlayer.isSupportedType(t) ? new n.RawAudioPlayer(e, t) : null;
|
|
1026
|
+
};
|
|
1027
|
+
n.RawAudioPlayer = function(e, t) {
|
|
1028
|
+
var l = n.RawAudioFormat.parse(t), u = n.AudioContextFactory.getAudioContext(), i = u.currentTime, v = new n.ArrayBufferReader(e), p = 0.02, d = 0.3, c = l.bytesPerSample === 1 ? window.Int8Array : window.Int16Array, F = l.bytesPerSample === 1 ? 128 : 32768, I = [], E = function(g) {
|
|
1029
|
+
if (g.length <= 1)
|
|
1030
|
+
return g[0];
|
|
1031
|
+
var s = 0;
|
|
1032
|
+
g.forEach(function(C) {
|
|
1033
|
+
s += C.length;
|
|
1034
|
+
});
|
|
1035
|
+
var f = 0, y = new c(s);
|
|
1036
|
+
return g.forEach(function(C) {
|
|
1037
|
+
y.set(C, f), f += C.length;
|
|
1038
|
+
}), y;
|
|
1039
|
+
}, T = function(g) {
|
|
1040
|
+
for (var s = Number.MAX_VALUE, f = g.length, y = Math.floor(g.length / l.channels), S = Math.floor(l.rate * p), C = Math.max(
|
|
1041
|
+
l.channels * S,
|
|
1042
|
+
l.channels * (y - S)
|
|
1043
|
+
), _ = C; _ < g.length; _ += l.channels) {
|
|
1044
|
+
for (var x = 0, O = 0; O < l.channels; O++)
|
|
1045
|
+
x += Math.abs(g[_ + O]);
|
|
1046
|
+
x <= s && (f = _ + l.channels, s = x);
|
|
1047
|
+
}
|
|
1048
|
+
return f === g.length ? [g] : [
|
|
1049
|
+
new c(g.buffer.slice(0, f * l.bytesPerSample)),
|
|
1050
|
+
new c(g.buffer.slice(f * l.bytesPerSample))
|
|
1051
|
+
];
|
|
1052
|
+
}, L = function(g) {
|
|
1053
|
+
I.push(new c(g));
|
|
1054
|
+
}, M = function() {
|
|
1055
|
+
var g = E(I);
|
|
1056
|
+
return g ? (I = T(g), g = I.shift(), g) : null;
|
|
1057
|
+
}, k = function(g) {
|
|
1058
|
+
var s = g.length / l.channels, f = u.currentTime;
|
|
1059
|
+
i < f && (i = f);
|
|
1060
|
+
for (var y = u.createBuffer(l.channels, s, l.rate), S = 0; S < l.channels; S++)
|
|
1061
|
+
for (var C = y.getChannelData(S), _ = S, x = 0; x < s; x++)
|
|
1062
|
+
C[x] = g[_] / F, _ += l.channels;
|
|
1063
|
+
return y;
|
|
1064
|
+
};
|
|
1065
|
+
v.ondata = function(g) {
|
|
1066
|
+
L(new c(g));
|
|
1067
|
+
var s = M();
|
|
1068
|
+
if (s) {
|
|
1069
|
+
var f = u.currentTime;
|
|
1070
|
+
i < f && (i = f);
|
|
1071
|
+
var y = u.createBufferSource();
|
|
1072
|
+
y.connect(u.destination), y.start || (y.start = y.noteOn), y.buffer = k(s), y.start(i), i += s.length / l.channels / l.rate;
|
|
1073
|
+
}
|
|
1074
|
+
}, this.sync = function() {
|
|
1075
|
+
var g = u.currentTime;
|
|
1076
|
+
i = Math.min(i, g + d);
|
|
1077
|
+
};
|
|
1078
|
+
};
|
|
1079
|
+
n.RawAudioPlayer.prototype = new n.AudioPlayer();
|
|
1080
|
+
n.RawAudioPlayer.isSupportedType = function(e) {
|
|
1081
|
+
return n.AudioContextFactory.getAudioContext() ? n.RawAudioFormat.parse(e) !== null : !1;
|
|
1082
|
+
};
|
|
1083
|
+
n.RawAudioPlayer.getSupportedTypes = function() {
|
|
1084
|
+
return n.AudioContextFactory.getAudioContext() ? [
|
|
1085
|
+
"audio/L8",
|
|
1086
|
+
"audio/L16"
|
|
1087
|
+
] : [];
|
|
1088
|
+
};
|
|
1089
|
+
var n = n || {};
|
|
1090
|
+
n.AudioRecorder = function() {
|
|
1091
|
+
this.onclose = null, this.onerror = null;
|
|
1092
|
+
};
|
|
1093
|
+
n.AudioRecorder.isSupportedType = function(e) {
|
|
1094
|
+
return n.RawAudioRecorder.isSupportedType(e);
|
|
1095
|
+
};
|
|
1096
|
+
n.AudioRecorder.getSupportedTypes = function() {
|
|
1097
|
+
return n.RawAudioRecorder.getSupportedTypes();
|
|
1098
|
+
};
|
|
1099
|
+
n.AudioRecorder.getInstance = function(e, t) {
|
|
1100
|
+
return n.RawAudioRecorder.isSupportedType(t) ? new n.RawAudioRecorder(e, t) : null;
|
|
1101
|
+
};
|
|
1102
|
+
n.RawAudioRecorder = function(e, t) {
|
|
1103
|
+
var l = this, u = 2048, i = 3, v = n.RawAudioFormat.parse(t), p = n.AudioContextFactory.getAudioContext();
|
|
1104
|
+
navigator.mediaDevices || (navigator.mediaDevices = {}), navigator.mediaDevices.getUserMedia || (navigator.mediaDevices.getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia).bind(navigator));
|
|
1105
|
+
var d = new n.ArrayBufferWriter(e), c = v.bytesPerSample === 1 ? window.Int8Array : window.Int16Array, F = v.bytesPerSample === 1 ? 128 : 32768, I = 0, E = 0, T = null, L = null, M = null, k = function(x) {
|
|
1106
|
+
if (x === 0)
|
|
1107
|
+
return 1;
|
|
1108
|
+
var O = Math.PI * x;
|
|
1109
|
+
return Math.sin(O) / O;
|
|
1110
|
+
}, m = function(x, O) {
|
|
1111
|
+
return -O < x && x < O ? k(x) * k(x / O) : 0;
|
|
1112
|
+
}, g = function(x, O) {
|
|
1113
|
+
for (var a = (x.length - 1) * O, o = Math.floor(a) - i + 1, h = Math.floor(a) + i, b = 0, P = o; P <= h; P++)
|
|
1114
|
+
b += (x[P] || 0) * m(a - P, i);
|
|
1115
|
+
return b;
|
|
1116
|
+
}, s = function(x) {
|
|
1117
|
+
var O = x.length;
|
|
1118
|
+
I += O;
|
|
1119
|
+
var a = Math.round(I * v.rate / x.sampleRate), o = a - E;
|
|
1120
|
+
E += o;
|
|
1121
|
+
for (var h = new c(o * v.channels), b = 0; b < v.channels; b++)
|
|
1122
|
+
for (var P = x.getChannelData(b), A = b, D = 0; D < o; D++)
|
|
1123
|
+
h[A] = g(P, D / (o - 1)) * F, A += v.channels;
|
|
1124
|
+
return h;
|
|
1125
|
+
}, f = function(x) {
|
|
1126
|
+
M = p.createScriptProcessor(u, v.channels, v.channels), M.connect(p.destination), M.onaudioprocess = function(a) {
|
|
1127
|
+
d.sendData(s(a.inputBuffer).buffer);
|
|
1128
|
+
}, L = p.createMediaStreamSource(x), L.connect(M), p.state === "suspended" && p.resume(), T = x;
|
|
1129
|
+
}, y = function() {
|
|
1130
|
+
d.sendEnd(), l.onerror && l.onerror();
|
|
1131
|
+
}, S = function() {
|
|
1132
|
+
var x = navigator.mediaDevices.getUserMedia({
|
|
1133
|
+
audio: !0
|
|
1134
|
+
}, f, y);
|
|
1135
|
+
x && x.then && x.then(f, y);
|
|
1136
|
+
}, C = function() {
|
|
1137
|
+
if (L && L.disconnect(), M && M.disconnect(), T)
|
|
1138
|
+
for (var x = T.getTracks(), O = 0; O < x.length; O++)
|
|
1139
|
+
x[O].stop();
|
|
1140
|
+
M = null, L = null, T = null, d.sendEnd();
|
|
1141
|
+
};
|
|
1142
|
+
d.onack = function(x) {
|
|
1143
|
+
x.code === n.Status.Code.SUCCESS && !T ? S() : (C(), d.onack = null, x.code === n.Status.Code.RESOURCE_CLOSED ? l.onclose && l.onclose() : l.onerror && l.onerror());
|
|
1144
|
+
};
|
|
1145
|
+
};
|
|
1146
|
+
n.RawAudioRecorder.prototype = new n.AudioRecorder();
|
|
1147
|
+
n.RawAudioRecorder.isSupportedType = function(e) {
|
|
1148
|
+
return n.AudioContextFactory.getAudioContext() ? n.RawAudioFormat.parse(e) !== null : !1;
|
|
1149
|
+
};
|
|
1150
|
+
n.RawAudioRecorder.getSupportedTypes = function() {
|
|
1151
|
+
return n.AudioContextFactory.getAudioContext() ? [
|
|
1152
|
+
"audio/L8",
|
|
1153
|
+
"audio/L16"
|
|
1154
|
+
] : [];
|
|
1155
|
+
};
|
|
1156
|
+
var n = n || {};
|
|
1157
|
+
n.BlobReader = function(r, e) {
|
|
1158
|
+
var t = this, l = 0, u;
|
|
1159
|
+
window.BlobBuilder ? u = new BlobBuilder() : window.WebKitBlobBuilder ? u = new WebKitBlobBuilder() : window.MozBlobBuilder ? u = new MozBlobBuilder() : u = new function() {
|
|
1160
|
+
var i = [];
|
|
1161
|
+
this.append = function(v) {
|
|
1162
|
+
i.push(new Blob([v], { type: e }));
|
|
1163
|
+
}, this.getBlob = function() {
|
|
1164
|
+
return new Blob(i, { type: e });
|
|
1165
|
+
};
|
|
1166
|
+
}(), r.onblob = function(i) {
|
|
1167
|
+
for (var v = window.atob(i), p = new ArrayBuffer(v.length), d = new Uint8Array(p), c = 0; c < v.length; c++)
|
|
1168
|
+
d[c] = v.charCodeAt(c);
|
|
1169
|
+
u.append(p), l += p.byteLength, t.onprogress && t.onprogress(p.byteLength), r.sendAck("OK", 0);
|
|
1170
|
+
}, r.onend = function() {
|
|
1171
|
+
t.onend && t.onend();
|
|
1172
|
+
}, this.getLength = function() {
|
|
1173
|
+
return l;
|
|
1174
|
+
}, this.getBlob = function() {
|
|
1175
|
+
return u.getBlob();
|
|
1176
|
+
}, this.onprogress = null, this.onend = null;
|
|
1177
|
+
};
|
|
1178
|
+
var n = n || {};
|
|
1179
|
+
n.BlobWriter = function(e) {
|
|
1180
|
+
var t = this, l = new n.ArrayBufferWriter(e);
|
|
1181
|
+
l.onack = function(i) {
|
|
1182
|
+
t.onack && t.onack(i);
|
|
1183
|
+
};
|
|
1184
|
+
var u = function(v, p, d) {
|
|
1185
|
+
var c = (v.slice || v.webkitSlice || v.mozSlice).bind(v), F = d - p;
|
|
1186
|
+
if (F !== d) {
|
|
1187
|
+
var I = c(p, F);
|
|
1188
|
+
if (I.size === F)
|
|
1189
|
+
return I;
|
|
1190
|
+
}
|
|
1191
|
+
return c(p, d);
|
|
1192
|
+
};
|
|
1193
|
+
this.sendBlob = function(v) {
|
|
1194
|
+
var p = 0, d = new FileReader(), c = function() {
|
|
1195
|
+
if (p >= v.size) {
|
|
1196
|
+
t.oncomplete && t.oncomplete(v);
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
var I = u(v, p, p + l.blobLength);
|
|
1200
|
+
p += l.blobLength, d.readAsArrayBuffer(I);
|
|
1201
|
+
};
|
|
1202
|
+
d.onload = function() {
|
|
1203
|
+
l.sendData(d.result), l.onack = function(E) {
|
|
1204
|
+
t.onack && t.onack(E), !E.isError() && (t.onprogress && t.onprogress(v, p - l.blobLength), c());
|
|
1205
|
+
};
|
|
1206
|
+
}, d.onerror = function() {
|
|
1207
|
+
t.onerror && t.onerror(v, p, d.error);
|
|
1208
|
+
}, c();
|
|
1209
|
+
}, this.sendEnd = function() {
|
|
1210
|
+
l.sendEnd();
|
|
1211
|
+
}, this.onack = null, this.onerror = null, this.onprogress = null, this.oncomplete = null;
|
|
1212
|
+
};
|
|
1213
|
+
var n = n || {};
|
|
1214
|
+
n.Client = function(r) {
|
|
1215
|
+
var e = this, t = n.Client.State.IDLE, l = 0, u = 5e3, i = null, v = 0, p = {
|
|
1216
|
+
0: "butt",
|
|
1217
|
+
1: "round",
|
|
1218
|
+
2: "square"
|
|
1219
|
+
}, d = {
|
|
1220
|
+
0: "bevel",
|
|
1221
|
+
1: "miter",
|
|
1222
|
+
2: "round"
|
|
1223
|
+
}, c = new n.Display(), F = {}, I = {}, E = [], T = [], L = [], M = new n.IntegerPool(), k = [];
|
|
1224
|
+
function m(a) {
|
|
1225
|
+
a != t && (t = a, e.onstatechange && e.onstatechange(t));
|
|
1226
|
+
}
|
|
1227
|
+
function g() {
|
|
1228
|
+
return t == n.Client.State.CONNECTED || t == n.Client.State.WAITING;
|
|
1229
|
+
}
|
|
1230
|
+
this.exportState = function(o) {
|
|
1231
|
+
var h = {
|
|
1232
|
+
currentState: t,
|
|
1233
|
+
currentTimestamp: l,
|
|
1234
|
+
layers: {}
|
|
1235
|
+
}, b = {};
|
|
1236
|
+
for (var P in F)
|
|
1237
|
+
b[P] = F[P];
|
|
1238
|
+
c.flush(function() {
|
|
1239
|
+
for (var D in b) {
|
|
1240
|
+
var R = parseInt(D), w = b[D], W = w.toCanvas(), B = {
|
|
1241
|
+
width: w.width,
|
|
1242
|
+
height: w.height
|
|
1243
|
+
};
|
|
1244
|
+
w.width && w.height && (B.url = W.toDataURL("image/png")), R > 0 && (B.x = w.x, B.y = w.y, B.z = w.z, B.alpha = w.alpha, B.matrix = w.matrix, B.parent = f(w.parent)), h.layers[D] = B;
|
|
1245
|
+
}
|
|
1246
|
+
o(h);
|
|
1247
|
+
});
|
|
1248
|
+
}, this.importState = function(o, h) {
|
|
1249
|
+
var b, P;
|
|
1250
|
+
t = o.currentState, l = o.currentTimestamp, c.cancel();
|
|
1251
|
+
for (b in F)
|
|
1252
|
+
P = parseInt(b), P > 0 && F[b].dispose();
|
|
1253
|
+
F = {};
|
|
1254
|
+
for (b in o.layers) {
|
|
1255
|
+
P = parseInt(b);
|
|
1256
|
+
var A = o.layers[b], D = s(P);
|
|
1257
|
+
if (c.resize(D, A.width, A.height), A.url && (c.setChannelMask(D, n.Layer.SRC), c.draw(D, 0, 0, A.url)), P > 0 && A.parent >= 0) {
|
|
1258
|
+
var R = s(A.parent);
|
|
1259
|
+
c.move(D, R, A.x, A.y, A.z), c.shade(D, A.alpha);
|
|
1260
|
+
var w = A.matrix;
|
|
1261
|
+
c.distort(
|
|
1262
|
+
D,
|
|
1263
|
+
w[0],
|
|
1264
|
+
w[1],
|
|
1265
|
+
w[2],
|
|
1266
|
+
w[3],
|
|
1267
|
+
w[4],
|
|
1268
|
+
w[5]
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
c.flush(h);
|
|
1273
|
+
}, this.getDisplay = function() {
|
|
1274
|
+
return c;
|
|
1275
|
+
}, this.sendSize = function(a, o) {
|
|
1276
|
+
g() && r.sendMessage("size", a, o);
|
|
1277
|
+
}, this.sendKeyEvent = function(a, o) {
|
|
1278
|
+
g() && r.sendMessage("key", o, a);
|
|
1279
|
+
}, this.sendMouseState = function(o, h) {
|
|
1280
|
+
if (g()) {
|
|
1281
|
+
var b = o.x, P = o.y;
|
|
1282
|
+
h && (b /= c.getScale(), P /= c.getScale()), c.moveCursor(
|
|
1283
|
+
Math.floor(b),
|
|
1284
|
+
Math.floor(P)
|
|
1285
|
+
);
|
|
1286
|
+
var A = 0;
|
|
1287
|
+
o.left && (A |= 1), o.middle && (A |= 2), o.right && (A |= 4), o.up && (A |= 8), o.down && (A |= 16), r.sendMessage("mouse", Math.floor(b), Math.floor(P), A);
|
|
1288
|
+
}
|
|
1289
|
+
}, this.sendTouchState = function(o, h) {
|
|
1290
|
+
if (g()) {
|
|
1291
|
+
var b = o.x, P = o.y;
|
|
1292
|
+
h && (b /= c.getScale(), P /= c.getScale()), r.sendMessage(
|
|
1293
|
+
"touch",
|
|
1294
|
+
o.id,
|
|
1295
|
+
Math.floor(b),
|
|
1296
|
+
Math.floor(P),
|
|
1297
|
+
Math.floor(o.radiusX),
|
|
1298
|
+
Math.floor(o.radiusY),
|
|
1299
|
+
o.angle,
|
|
1300
|
+
o.force
|
|
1301
|
+
);
|
|
1302
|
+
}
|
|
1303
|
+
}, this.createOutputStream = function() {
|
|
1304
|
+
var o = M.next(), h = k[o] = new n.OutputStream(e, o);
|
|
1305
|
+
return h;
|
|
1306
|
+
}, this.createAudioStream = function(a) {
|
|
1307
|
+
var o = e.createOutputStream();
|
|
1308
|
+
return r.sendMessage("audio", o.index, a), o;
|
|
1309
|
+
}, this.createFileStream = function(a, o) {
|
|
1310
|
+
var h = e.createOutputStream();
|
|
1311
|
+
return r.sendMessage("file", h.index, a, o), h;
|
|
1312
|
+
}, this.createPipeStream = function(a, o) {
|
|
1313
|
+
var h = e.createOutputStream();
|
|
1314
|
+
return r.sendMessage("pipe", h.index, a, o), h;
|
|
1315
|
+
}, this.createClipboardStream = function(a) {
|
|
1316
|
+
var o = e.createOutputStream();
|
|
1317
|
+
return r.sendMessage("clipboard", o.index, a), o;
|
|
1318
|
+
}, this.createArgumentValueStream = function(o, h) {
|
|
1319
|
+
var b = e.createOutputStream();
|
|
1320
|
+
return r.sendMessage("argv", b.index, o, h), b;
|
|
1321
|
+
}, this.createObjectOutputStream = function(o, h, b) {
|
|
1322
|
+
var P = e.createOutputStream();
|
|
1323
|
+
return r.sendMessage("put", o, P.index, h, b), P;
|
|
1324
|
+
}, this.requestObjectInputStream = function(o, h) {
|
|
1325
|
+
g() && r.sendMessage("get", o, h);
|
|
1326
|
+
}, this.sendAck = function(a, o, h) {
|
|
1327
|
+
g() && r.sendMessage("ack", a, o, h);
|
|
1328
|
+
}, this.sendBlob = function(a, o) {
|
|
1329
|
+
g() && r.sendMessage("blob", a, o);
|
|
1330
|
+
}, this.endStream = function(a) {
|
|
1331
|
+
g() && (r.sendMessage("end", a), k[a] && (M.free(a), delete k[a]));
|
|
1332
|
+
}, this.onstatechange = null, this.onname = null, this.onerror = null, this.onmsg = null, this.onjoin = null, this.onleave = null, this.onaudio = null, this.onvideo = null, this.onmultitouch = null, this.onargv = null, this.onclipboard = null, this.onfile = null, this.onfilesystem = null, this.onpipe = null, this.onrequired = null, this.onsync = null;
|
|
1333
|
+
var s = function(o) {
|
|
1334
|
+
var h = F[o];
|
|
1335
|
+
return h || (o === 0 ? h = c.getDefaultLayer() : o > 0 ? h = c.createLayer() : h = c.createBuffer(), F[o] = h), h;
|
|
1336
|
+
}, f = function(o) {
|
|
1337
|
+
if (!o)
|
|
1338
|
+
return null;
|
|
1339
|
+
for (var h in F)
|
|
1340
|
+
if (o === F[h])
|
|
1341
|
+
return parseInt(h);
|
|
1342
|
+
return null;
|
|
1343
|
+
};
|
|
1344
|
+
function y(a) {
|
|
1345
|
+
var o = E[a];
|
|
1346
|
+
return o == null && (o = E[a] = new n.Parser(), o.oninstruction = r.oninstruction), o;
|
|
1347
|
+
}
|
|
1348
|
+
var S = {
|
|
1349
|
+
"miter-limit": function(a, o) {
|
|
1350
|
+
c.setMiterLimit(a, parseFloat(o));
|
|
1351
|
+
},
|
|
1352
|
+
"multi-touch": function(o, h) {
|
|
1353
|
+
e.onmultitouch && o instanceof n.Display.VisibleLayer && e.onmultitouch(o, parseInt(h));
|
|
1354
|
+
}
|
|
1355
|
+
}, C = {
|
|
1356
|
+
ack: function(a) {
|
|
1357
|
+
var o = parseInt(a[0]), h = a[1], b = parseInt(a[2]), P = k[o];
|
|
1358
|
+
P && (P.onack && P.onack(new n.Status(b, h)), b >= 256 && k[o] === P && (M.free(o), delete k[o]));
|
|
1359
|
+
},
|
|
1360
|
+
arc: function(a) {
|
|
1361
|
+
var o = s(parseInt(a[0])), h = parseInt(a[1]), b = parseInt(a[2]), P = parseInt(a[3]), A = parseFloat(a[4]), D = parseFloat(a[5]), R = parseInt(a[6]);
|
|
1362
|
+
c.arc(o, h, b, P, A, D, R != 0);
|
|
1363
|
+
},
|
|
1364
|
+
argv: function(a) {
|
|
1365
|
+
var o = parseInt(a[0]), h = a[1], b = a[2];
|
|
1366
|
+
if (e.onargv) {
|
|
1367
|
+
var P = T[o] = new n.InputStream(e, o);
|
|
1368
|
+
e.onargv(P, h, b);
|
|
1369
|
+
} else
|
|
1370
|
+
e.sendAck(o, "Receiving argument values unsupported", 256);
|
|
1371
|
+
},
|
|
1372
|
+
audio: function(a) {
|
|
1373
|
+
var o = parseInt(a[0]), h = a[1], b = T[o] = new n.InputStream(e, o), P = null;
|
|
1374
|
+
e.onaudio && (P = e.onaudio(b, h)), P || (P = n.AudioPlayer.getInstance(b, h)), P ? (I[o] = P, e.sendAck(o, "OK", 0)) : e.sendAck(o, "BAD TYPE", 783);
|
|
1375
|
+
},
|
|
1376
|
+
blob: function(a) {
|
|
1377
|
+
var o = parseInt(a[0]), h = a[1], b = T[o];
|
|
1378
|
+
b && b.onblob && b.onblob(h);
|
|
1379
|
+
},
|
|
1380
|
+
body: function(o) {
|
|
1381
|
+
var h = parseInt(o[0]), b = L[h], P = parseInt(o[1]), A = o[2], D = o[3];
|
|
1382
|
+
if (b && b.onbody) {
|
|
1383
|
+
var R = T[P] = new n.InputStream(e, P);
|
|
1384
|
+
b.onbody(R, A, D);
|
|
1385
|
+
} else
|
|
1386
|
+
e.sendAck(P, "Receipt of body unsupported", 256);
|
|
1387
|
+
},
|
|
1388
|
+
cfill: function(a) {
|
|
1389
|
+
var o = parseInt(a[0]), h = s(parseInt(a[1])), b = parseInt(a[2]), P = parseInt(a[3]), A = parseInt(a[4]), D = parseInt(a[5]);
|
|
1390
|
+
c.setChannelMask(h, o), c.fillColor(h, b, P, A, D);
|
|
1391
|
+
},
|
|
1392
|
+
clip: function(a) {
|
|
1393
|
+
var o = s(parseInt(a[0]));
|
|
1394
|
+
c.clip(o);
|
|
1395
|
+
},
|
|
1396
|
+
clipboard: function(a) {
|
|
1397
|
+
var o = parseInt(a[0]), h = a[1];
|
|
1398
|
+
if (e.onclipboard) {
|
|
1399
|
+
var b = T[o] = new n.InputStream(e, o);
|
|
1400
|
+
e.onclipboard(b, h);
|
|
1401
|
+
} else
|
|
1402
|
+
e.sendAck(o, "Clipboard unsupported", 256);
|
|
1403
|
+
},
|
|
1404
|
+
close: function(a) {
|
|
1405
|
+
var o = s(parseInt(a[0]));
|
|
1406
|
+
c.close(o);
|
|
1407
|
+
},
|
|
1408
|
+
copy: function(a) {
|
|
1409
|
+
var o = s(parseInt(a[0])), h = parseInt(a[1]), b = parseInt(a[2]), P = parseInt(a[3]), A = parseInt(a[4]), D = parseInt(a[5]), R = s(parseInt(a[6])), w = parseInt(a[7]), W = parseInt(a[8]);
|
|
1410
|
+
c.setChannelMask(R, D), c.copy(
|
|
1411
|
+
o,
|
|
1412
|
+
h,
|
|
1413
|
+
b,
|
|
1414
|
+
P,
|
|
1415
|
+
A,
|
|
1416
|
+
R,
|
|
1417
|
+
w,
|
|
1418
|
+
W
|
|
1419
|
+
);
|
|
1420
|
+
},
|
|
1421
|
+
cstroke: function(a) {
|
|
1422
|
+
var o = parseInt(a[0]), h = s(parseInt(a[1])), b = p[parseInt(a[2])], P = d[parseInt(a[3])], A = parseInt(a[4]), D = parseInt(a[5]), R = parseInt(a[6]), w = parseInt(a[7]), W = parseInt(a[8]);
|
|
1423
|
+
c.setChannelMask(h, o), c.strokeColor(h, b, P, A, D, R, w, W);
|
|
1424
|
+
},
|
|
1425
|
+
cursor: function(a) {
|
|
1426
|
+
var o = parseInt(a[0]), h = parseInt(a[1]), b = s(parseInt(a[2])), P = parseInt(a[3]), A = parseInt(a[4]), D = parseInt(a[5]), R = parseInt(a[6]);
|
|
1427
|
+
c.setCursor(
|
|
1428
|
+
o,
|
|
1429
|
+
h,
|
|
1430
|
+
b,
|
|
1431
|
+
P,
|
|
1432
|
+
A,
|
|
1433
|
+
D,
|
|
1434
|
+
R
|
|
1435
|
+
);
|
|
1436
|
+
},
|
|
1437
|
+
curve: function(a) {
|
|
1438
|
+
var o = s(parseInt(a[0])), h = parseInt(a[1]), b = parseInt(a[2]), P = parseInt(a[3]), A = parseInt(a[4]), D = parseInt(a[5]), R = parseInt(a[6]);
|
|
1439
|
+
c.curveTo(o, h, b, P, A, D, R);
|
|
1440
|
+
},
|
|
1441
|
+
disconnect: function(o) {
|
|
1442
|
+
e.disconnect();
|
|
1443
|
+
},
|
|
1444
|
+
dispose: function(a) {
|
|
1445
|
+
var o = parseInt(a[0]);
|
|
1446
|
+
if (o > 0) {
|
|
1447
|
+
var h = s(o);
|
|
1448
|
+
c.dispose(h), delete F[o];
|
|
1449
|
+
} else o < 0 && delete F[o];
|
|
1450
|
+
},
|
|
1451
|
+
distort: function(a) {
|
|
1452
|
+
var o = parseInt(a[0]), h = parseFloat(a[1]), b = parseFloat(a[2]), P = parseFloat(a[3]), A = parseFloat(a[4]), D = parseFloat(a[5]), R = parseFloat(a[6]);
|
|
1453
|
+
if (o >= 0) {
|
|
1454
|
+
var w = s(o);
|
|
1455
|
+
c.distort(w, h, b, P, A, D, R);
|
|
1456
|
+
}
|
|
1457
|
+
},
|
|
1458
|
+
error: function(a) {
|
|
1459
|
+
var o = a[0], h = parseInt(a[1]);
|
|
1460
|
+
e.onerror && e.onerror(new n.Status(h, o)), e.disconnect();
|
|
1461
|
+
},
|
|
1462
|
+
end: function(a) {
|
|
1463
|
+
var o = parseInt(a[0]), h = T[o];
|
|
1464
|
+
h && (h.onend && h.onend(), delete T[o]);
|
|
1465
|
+
},
|
|
1466
|
+
file: function(a) {
|
|
1467
|
+
var o = parseInt(a[0]), h = a[1], b = a[2];
|
|
1468
|
+
if (e.onfile) {
|
|
1469
|
+
var P = T[o] = new n.InputStream(e, o);
|
|
1470
|
+
e.onfile(P, h, b);
|
|
1471
|
+
} else
|
|
1472
|
+
e.sendAck(o, "File transfer unsupported", 256);
|
|
1473
|
+
},
|
|
1474
|
+
filesystem: function(o) {
|
|
1475
|
+
var h = parseInt(o[0]), b = o[1];
|
|
1476
|
+
if (e.onfilesystem) {
|
|
1477
|
+
var P = L[h] = new n.Object(e, h);
|
|
1478
|
+
e.onfilesystem(P, b);
|
|
1479
|
+
}
|
|
1480
|
+
},
|
|
1481
|
+
identity: function(a) {
|
|
1482
|
+
var o = s(parseInt(a[0]));
|
|
1483
|
+
c.setTransform(o, 1, 0, 0, 1, 0, 0);
|
|
1484
|
+
},
|
|
1485
|
+
img: function(a) {
|
|
1486
|
+
var o = parseInt(a[0]), h = parseInt(a[1]), b = s(parseInt(a[2])), P = a[3], A = parseInt(a[4]), D = parseInt(a[5]), R = T[o] = new n.InputStream(e, o);
|
|
1487
|
+
c.setChannelMask(b, h), c.drawStream(b, A, D, R, P);
|
|
1488
|
+
},
|
|
1489
|
+
jpeg: function(a) {
|
|
1490
|
+
var o = parseInt(a[0]), h = s(parseInt(a[1])), b = parseInt(a[2]), P = parseInt(a[3]), A = a[4];
|
|
1491
|
+
c.setChannelMask(h, o), c.draw(h, b, P, "data:image/jpeg;base64," + A);
|
|
1492
|
+
},
|
|
1493
|
+
lfill: function(a) {
|
|
1494
|
+
var o = parseInt(a[0]), h = s(parseInt(a[1])), b = s(parseInt(a[2]));
|
|
1495
|
+
c.setChannelMask(h, o), c.fillLayer(h, b);
|
|
1496
|
+
},
|
|
1497
|
+
line: function(a) {
|
|
1498
|
+
var o = s(parseInt(a[0])), h = parseInt(a[1]), b = parseInt(a[2]);
|
|
1499
|
+
c.lineTo(o, h, b);
|
|
1500
|
+
},
|
|
1501
|
+
lstroke: function(a) {
|
|
1502
|
+
var o = parseInt(a[0]), h = s(parseInt(a[1])), b = s(parseInt(a[2]));
|
|
1503
|
+
c.setChannelMask(h, o), c.strokeLayer(h, b);
|
|
1504
|
+
},
|
|
1505
|
+
mouse: function(o) {
|
|
1506
|
+
var h = parseInt(o[0]), b = parseInt(o[1]);
|
|
1507
|
+
c.showCursor(!0), c.moveCursor(h, b);
|
|
1508
|
+
},
|
|
1509
|
+
move: function(a) {
|
|
1510
|
+
var o = parseInt(a[0]), h = parseInt(a[1]), b = parseInt(a[2]), P = parseInt(a[3]), A = parseInt(a[4]);
|
|
1511
|
+
if (o > 0 && h >= 0) {
|
|
1512
|
+
var D = s(o), R = s(h);
|
|
1513
|
+
c.move(D, R, b, P, A);
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1516
|
+
msg: function(a) {
|
|
1517
|
+
var o, h, b = !0, P = parseInt(a[0]);
|
|
1518
|
+
if (e.onmsg && (b = e.onmsg(P, a.slice(1)), b === void 0 && (b = !0)), b)
|
|
1519
|
+
switch (P) {
|
|
1520
|
+
case n.Client.Message.USER_JOINED:
|
|
1521
|
+
o = a[1], h = a[2], e.onjoin && e.onjoin(o, h);
|
|
1522
|
+
break;
|
|
1523
|
+
case n.Client.Message.USER_LEFT:
|
|
1524
|
+
o = a[1], h = a[2], e.onleave && e.onleave(o, h);
|
|
1525
|
+
break;
|
|
1526
|
+
}
|
|
1527
|
+
},
|
|
1528
|
+
name: function(a) {
|
|
1529
|
+
e.onname && e.onname(a[0]);
|
|
1530
|
+
},
|
|
1531
|
+
nest: function(a) {
|
|
1532
|
+
var o = y(parseInt(a[0]));
|
|
1533
|
+
o.receive(a[1]);
|
|
1534
|
+
},
|
|
1535
|
+
pipe: function(a) {
|
|
1536
|
+
var o = parseInt(a[0]), h = a[1], b = a[2];
|
|
1537
|
+
if (e.onpipe) {
|
|
1538
|
+
var P = T[o] = new n.InputStream(e, o);
|
|
1539
|
+
e.onpipe(P, h, b);
|
|
1540
|
+
} else
|
|
1541
|
+
e.sendAck(o, "Named pipes unsupported", 256);
|
|
1542
|
+
},
|
|
1543
|
+
png: function(a) {
|
|
1544
|
+
var o = parseInt(a[0]), h = s(parseInt(a[1])), b = parseInt(a[2]), P = parseInt(a[3]), A = a[4];
|
|
1545
|
+
c.setChannelMask(h, o), c.draw(h, b, P, "data:image/png;base64," + A);
|
|
1546
|
+
},
|
|
1547
|
+
pop: function(a) {
|
|
1548
|
+
var o = s(parseInt(a[0]));
|
|
1549
|
+
c.pop(o);
|
|
1550
|
+
},
|
|
1551
|
+
push: function(a) {
|
|
1552
|
+
var o = s(parseInt(a[0]));
|
|
1553
|
+
c.push(o);
|
|
1554
|
+
},
|
|
1555
|
+
rect: function(a) {
|
|
1556
|
+
var o = s(parseInt(a[0])), h = parseInt(a[1]), b = parseInt(a[2]), P = parseInt(a[3]), A = parseInt(a[4]);
|
|
1557
|
+
c.rect(o, h, b, P, A);
|
|
1558
|
+
},
|
|
1559
|
+
required: function(o) {
|
|
1560
|
+
e.onrequired && e.onrequired(o);
|
|
1561
|
+
},
|
|
1562
|
+
reset: function(a) {
|
|
1563
|
+
var o = s(parseInt(a[0]));
|
|
1564
|
+
c.reset(o);
|
|
1565
|
+
},
|
|
1566
|
+
set: function(a) {
|
|
1567
|
+
var o = s(parseInt(a[0])), h = a[1], b = a[2], P = S[h];
|
|
1568
|
+
P && P(o, b);
|
|
1569
|
+
},
|
|
1570
|
+
shade: function(a) {
|
|
1571
|
+
var o = parseInt(a[0]), h = parseInt(a[1]);
|
|
1572
|
+
if (o >= 0) {
|
|
1573
|
+
var b = s(o);
|
|
1574
|
+
c.shade(b, h);
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
size: function(a) {
|
|
1578
|
+
var o = parseInt(a[0]), h = s(o), b = parseInt(a[1]), P = parseInt(a[2]);
|
|
1579
|
+
c.resize(h, b, P);
|
|
1580
|
+
},
|
|
1581
|
+
start: function(a) {
|
|
1582
|
+
var o = s(parseInt(a[0])), h = parseInt(a[1]), b = parseInt(a[2]);
|
|
1583
|
+
c.moveTo(o, h, b);
|
|
1584
|
+
},
|
|
1585
|
+
sync: function(a) {
|
|
1586
|
+
var o = parseInt(a[0]), h = a[1] ? parseInt(a[1]) : 0;
|
|
1587
|
+
c.flush(function() {
|
|
1588
|
+
for (var P in I) {
|
|
1589
|
+
var A = I[P];
|
|
1590
|
+
A && A.sync();
|
|
1591
|
+
}
|
|
1592
|
+
o !== l && (r.sendMessage("sync", o), l = o);
|
|
1593
|
+
}, o, h), t === n.Client.State.WAITING && m(n.Client.State.CONNECTED), e.onsync && e.onsync(o, h);
|
|
1594
|
+
},
|
|
1595
|
+
transfer: function(a) {
|
|
1596
|
+
var o = s(parseInt(a[0])), h = parseInt(a[1]), b = parseInt(a[2]), P = parseInt(a[3]), A = parseInt(a[4]), D = parseInt(a[5]), R = s(parseInt(a[6])), w = parseInt(a[7]), W = parseInt(a[8]);
|
|
1597
|
+
D === 3 ? c.put(
|
|
1598
|
+
o,
|
|
1599
|
+
h,
|
|
1600
|
+
b,
|
|
1601
|
+
P,
|
|
1602
|
+
A,
|
|
1603
|
+
R,
|
|
1604
|
+
w,
|
|
1605
|
+
W
|
|
1606
|
+
) : D !== 5 && c.transfer(
|
|
1607
|
+
o,
|
|
1608
|
+
h,
|
|
1609
|
+
b,
|
|
1610
|
+
P,
|
|
1611
|
+
A,
|
|
1612
|
+
R,
|
|
1613
|
+
w,
|
|
1614
|
+
W,
|
|
1615
|
+
n.Client.DefaultTransferFunction[D]
|
|
1616
|
+
);
|
|
1617
|
+
},
|
|
1618
|
+
transform: function(a) {
|
|
1619
|
+
var o = s(parseInt(a[0])), h = parseFloat(a[1]), b = parseFloat(a[2]), P = parseFloat(a[3]), A = parseFloat(a[4]), D = parseFloat(a[5]), R = parseFloat(a[6]);
|
|
1620
|
+
c.transform(o, h, b, P, A, D, R);
|
|
1621
|
+
},
|
|
1622
|
+
undefine: function(o) {
|
|
1623
|
+
var h = parseInt(o[0]), b = L[h];
|
|
1624
|
+
b && b.onundefine && b.onundefine();
|
|
1625
|
+
},
|
|
1626
|
+
video: function(a) {
|
|
1627
|
+
var o = parseInt(a[0]), h = s(parseInt(a[1])), b = a[2], P = T[o] = new n.InputStream(e, o), A = null;
|
|
1628
|
+
e.onvideo && (A = e.onvideo(P, h, b)), A || (A = n.VideoPlayer.getInstance(P, h, b)), A ? e.sendAck(o, "OK", 0) : e.sendAck(o, "BAD TYPE", 783);
|
|
1629
|
+
}
|
|
1630
|
+
}, _ = function() {
|
|
1631
|
+
r.sendMessage("nop"), v = (/* @__PURE__ */ new Date()).getTime();
|
|
1632
|
+
}, x = function() {
|
|
1633
|
+
window.clearTimeout(i);
|
|
1634
|
+
var o = (/* @__PURE__ */ new Date()).getTime(), h = Math.max(v + u - o, 0);
|
|
1635
|
+
h > 0 ? i = window.setTimeout(_, h) : _();
|
|
1636
|
+
}, O = function() {
|
|
1637
|
+
window.clearTimeout(i);
|
|
1638
|
+
};
|
|
1639
|
+
r.oninstruction = function(a, o) {
|
|
1640
|
+
var h = C[a];
|
|
1641
|
+
h && h(o), x();
|
|
1642
|
+
}, this.disconnect = function() {
|
|
1643
|
+
t != n.Client.State.DISCONNECTED && t != n.Client.State.DISCONNECTING && (m(n.Client.State.DISCONNECTING), O(), r.sendMessage("disconnect"), r.disconnect(), m(n.Client.State.DISCONNECTED));
|
|
1644
|
+
}, this.connect = function(a) {
|
|
1645
|
+
m(n.Client.State.CONNECTING);
|
|
1646
|
+
try {
|
|
1647
|
+
r.connect(a);
|
|
1648
|
+
} catch (o) {
|
|
1649
|
+
throw m(n.Client.State.IDLE), o;
|
|
1650
|
+
}
|
|
1651
|
+
x(), m(n.Client.State.WAITING);
|
|
1652
|
+
};
|
|
1653
|
+
};
|
|
1654
|
+
n.Client.State = {
|
|
1655
|
+
/**
|
|
1656
|
+
* The client is idle, with no active connection.
|
|
1657
|
+
*
|
|
1658
|
+
* @type number
|
|
1659
|
+
*/
|
|
1660
|
+
IDLE: 0,
|
|
1661
|
+
/**
|
|
1662
|
+
* The client is in the process of establishing a connection.
|
|
1663
|
+
*
|
|
1664
|
+
* @type {!number}
|
|
1665
|
+
*/
|
|
1666
|
+
CONNECTING: 1,
|
|
1667
|
+
/**
|
|
1668
|
+
* The client is waiting on further information or a remote server to
|
|
1669
|
+
* establish the connection.
|
|
1670
|
+
*
|
|
1671
|
+
* @type {!number}
|
|
1672
|
+
*/
|
|
1673
|
+
WAITING: 2,
|
|
1674
|
+
/**
|
|
1675
|
+
* The client is actively connected to a remote server.
|
|
1676
|
+
*
|
|
1677
|
+
* @type {!number}
|
|
1678
|
+
*/
|
|
1679
|
+
CONNECTED: 3,
|
|
1680
|
+
/**
|
|
1681
|
+
* The client is in the process of disconnecting from the remote server.
|
|
1682
|
+
*
|
|
1683
|
+
* @type {!number}
|
|
1684
|
+
*/
|
|
1685
|
+
DISCONNECTING: 4,
|
|
1686
|
+
/**
|
|
1687
|
+
* The client has completed the connection and is no longer connected.
|
|
1688
|
+
*
|
|
1689
|
+
* @type {!number}
|
|
1690
|
+
*/
|
|
1691
|
+
DISCONNECTED: 5
|
|
1692
|
+
};
|
|
1693
|
+
n.Client.DefaultTransferFunction = {
|
|
1694
|
+
/* BLACK */
|
|
1695
|
+
0: function(r, e) {
|
|
1696
|
+
e.red = e.green = e.blue = 0;
|
|
1697
|
+
},
|
|
1698
|
+
/* WHITE */
|
|
1699
|
+
15: function(r, e) {
|
|
1700
|
+
e.red = e.green = e.blue = 255;
|
|
1701
|
+
},
|
|
1702
|
+
/* SRC */
|
|
1703
|
+
3: function(r, e) {
|
|
1704
|
+
e.red = r.red, e.green = r.green, e.blue = r.blue, e.alpha = r.alpha;
|
|
1705
|
+
},
|
|
1706
|
+
/* DEST (no-op) */
|
|
1707
|
+
5: function(r, e) {
|
|
1708
|
+
},
|
|
1709
|
+
/* Invert SRC */
|
|
1710
|
+
12: function(r, e) {
|
|
1711
|
+
e.red = 255 & ~r.red, e.green = 255 & ~r.green, e.blue = 255 & ~r.blue, e.alpha = r.alpha;
|
|
1712
|
+
},
|
|
1713
|
+
/* Invert DEST */
|
|
1714
|
+
10: function(r, e) {
|
|
1715
|
+
e.red = 255 & ~e.red, e.green = 255 & ~e.green, e.blue = 255 & ~e.blue;
|
|
1716
|
+
},
|
|
1717
|
+
/* AND */
|
|
1718
|
+
1: function(r, e) {
|
|
1719
|
+
e.red = r.red & e.red, e.green = r.green & e.green, e.blue = r.blue & e.blue;
|
|
1720
|
+
},
|
|
1721
|
+
/* NAND */
|
|
1722
|
+
14: function(r, e) {
|
|
1723
|
+
e.red = 255 & ~(r.red & e.red), e.green = 255 & ~(r.green & e.green), e.blue = 255 & ~(r.blue & e.blue);
|
|
1724
|
+
},
|
|
1725
|
+
/* OR */
|
|
1726
|
+
7: function(r, e) {
|
|
1727
|
+
e.red = r.red | e.red, e.green = r.green | e.green, e.blue = r.blue | e.blue;
|
|
1728
|
+
},
|
|
1729
|
+
/* NOR */
|
|
1730
|
+
8: function(r, e) {
|
|
1731
|
+
e.red = 255 & ~(r.red | e.red), e.green = 255 & ~(r.green | e.green), e.blue = 255 & ~(r.blue | e.blue);
|
|
1732
|
+
},
|
|
1733
|
+
/* XOR */
|
|
1734
|
+
6: function(r, e) {
|
|
1735
|
+
e.red = r.red ^ e.red, e.green = r.green ^ e.green, e.blue = r.blue ^ e.blue;
|
|
1736
|
+
},
|
|
1737
|
+
/* XNOR */
|
|
1738
|
+
9: function(r, e) {
|
|
1739
|
+
e.red = 255 & ~(r.red ^ e.red), e.green = 255 & ~(r.green ^ e.green), e.blue = 255 & ~(r.blue ^ e.blue);
|
|
1740
|
+
},
|
|
1741
|
+
/* AND inverted source */
|
|
1742
|
+
4: function(r, e) {
|
|
1743
|
+
e.red = 255 & (~r.red & e.red), e.green = 255 & (~r.green & e.green), e.blue = 255 & (~r.blue & e.blue);
|
|
1744
|
+
},
|
|
1745
|
+
/* OR inverted source */
|
|
1746
|
+
13: function(r, e) {
|
|
1747
|
+
e.red = 255 & (~r.red | e.red), e.green = 255 & (~r.green | e.green), e.blue = 255 & (~r.blue | e.blue);
|
|
1748
|
+
},
|
|
1749
|
+
/* AND inverted destination */
|
|
1750
|
+
2: function(r, e) {
|
|
1751
|
+
e.red = 255 & (r.red & ~e.red), e.green = 255 & (r.green & ~e.green), e.blue = 255 & (r.blue & ~e.blue);
|
|
1752
|
+
},
|
|
1753
|
+
/* OR inverted destination */
|
|
1754
|
+
11: function(r, e) {
|
|
1755
|
+
e.red = 255 & (r.red | ~e.red), e.green = 255 & (r.green | ~e.green), e.blue = 255 & (r.blue | ~e.blue);
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1758
|
+
n.Client.Message = {
|
|
1759
|
+
/**
|
|
1760
|
+
* A client message that indicates that a user has joined an existing
|
|
1761
|
+
* connection. This message expects a single additional argument - the
|
|
1762
|
+
* name of the user who has joined the connection.
|
|
1763
|
+
*
|
|
1764
|
+
* @type {!number}
|
|
1765
|
+
*/
|
|
1766
|
+
USER_JOINED: 1,
|
|
1767
|
+
/**
|
|
1768
|
+
* A client message that indicates that a user has left an existing
|
|
1769
|
+
* connection. This message expects a single additional argument - the
|
|
1770
|
+
* name of the user who has left the connection.
|
|
1771
|
+
*
|
|
1772
|
+
* @type {!number}
|
|
1773
|
+
*/
|
|
1774
|
+
USER_LEFT: 2
|
|
1775
|
+
};
|
|
1776
|
+
var n = n || {};
|
|
1777
|
+
n.DataURIReader = function(r, e) {
|
|
1778
|
+
var t = this, l = "data:" + e + ";base64,";
|
|
1779
|
+
r.onblob = function(i) {
|
|
1780
|
+
l += i;
|
|
1781
|
+
}, r.onend = function() {
|
|
1782
|
+
t.onend && t.onend();
|
|
1783
|
+
}, this.getURI = function() {
|
|
1784
|
+
return l;
|
|
1785
|
+
}, this.onend = null;
|
|
1786
|
+
};
|
|
1787
|
+
var n = n || {};
|
|
1788
|
+
n.Display = function() {
|
|
1789
|
+
var r = this, e = 0, t = 0, l = 1, u = document.createElement("div");
|
|
1790
|
+
u.style.position = "relative", u.style.width = e + "px", u.style.height = t + "px", u.style.transformOrigin = u.style.webkitTransformOrigin = u.style.MozTransformOrigin = u.style.OTransformOrigin = u.style.msTransformOrigin = "0 0";
|
|
1791
|
+
var i = new n.Display.VisibleLayer(e, t), v = new n.Display.VisibleLayer(0, 0);
|
|
1792
|
+
v.setChannelMask(n.Layer.SRC), u.appendChild(i.getElement()), u.appendChild(v.getElement());
|
|
1793
|
+
var p = document.createElement("div");
|
|
1794
|
+
p.style.position = "relative", p.style.width = e * l + "px", p.style.height = t * l + "px", p.appendChild(u), this.cursorHotspotX = 0, this.cursorHotspotY = 0, this.cursorX = 0, this.cursorY = 0, this.statisticWindow = 0, this.onresize = null, this.oncursor = null, this.onstatistics = null;
|
|
1795
|
+
var d = [], c = [], F = null, I = function() {
|
|
1796
|
+
for (var f = 0, y = 0, S = 0, C = 0; C < c.length; ) {
|
|
1797
|
+
var _ = c[C];
|
|
1798
|
+
if (!_.isReady())
|
|
1799
|
+
break;
|
|
1800
|
+
_.flush(), f = _.localTimestamp, y = _.remoteTimestamp, S += _.logicalFrames, C++;
|
|
1801
|
+
}
|
|
1802
|
+
c.splice(0, C), C && L(f, y, S);
|
|
1803
|
+
}, E = function() {
|
|
1804
|
+
var f = function y() {
|
|
1805
|
+
if (F = null, !!c.length) {
|
|
1806
|
+
if (c[0].isReady()) {
|
|
1807
|
+
var S = c.shift();
|
|
1808
|
+
S.flush(), L(S.localTimestamp, S.remoteTimestamp, S.logicalFrames);
|
|
1809
|
+
}
|
|
1810
|
+
c.length && (F = window.requestAnimationFrame(y));
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
F || (F = window.requestAnimationFrame(f));
|
|
1814
|
+
}, T = [], L = function(f, y, S) {
|
|
1815
|
+
if (r.statisticWindow) {
|
|
1816
|
+
for (var C = (/* @__PURE__ */ new Date()).getTime(), _ = 0; _ < T.length && !(C - T[_].timestamp <= r.statisticWindow); _++)
|
|
1817
|
+
;
|
|
1818
|
+
T.splice(0, _ - 1), T.push({
|
|
1819
|
+
localTimestamp: f,
|
|
1820
|
+
remoteTimestamp: y,
|
|
1821
|
+
timestamp: C,
|
|
1822
|
+
frames: S
|
|
1823
|
+
});
|
|
1824
|
+
var x = (T[T.length - 1].timestamp - T[0].timestamp) / 1e3, O = (T[T.length - 1].remoteTimestamp - T[0].remoteTimestamp) / 1e3, a = T.length, o = T.reduce(function(A, D) {
|
|
1825
|
+
return A + D.frames;
|
|
1826
|
+
}, 0), h = T.reduce(function(A, D) {
|
|
1827
|
+
return A + Math.max(0, D.frames - 1);
|
|
1828
|
+
}, 0), b = new n.Display.Statistics({
|
|
1829
|
+
processingLag: C - f,
|
|
1830
|
+
desktopFps: O && o ? o / O : null,
|
|
1831
|
+
clientFps: x ? a / x : null,
|
|
1832
|
+
serverFps: O ? a / O : null,
|
|
1833
|
+
dropRate: O ? h / O : null
|
|
1834
|
+
});
|
|
1835
|
+
r.onstatistics && r.onstatistics(b);
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
1838
|
+
window.addEventListener("blur", function() {
|
|
1839
|
+
F && !document.hasFocus() && (window.cancelAnimationFrame(F), F = null, I());
|
|
1840
|
+
}, !0);
|
|
1841
|
+
function M() {
|
|
1842
|
+
window.requestAnimationFrame && document.hasFocus() ? E() : I();
|
|
1843
|
+
}
|
|
1844
|
+
var k = function(f, y, S, C) {
|
|
1845
|
+
this.localTimestamp = (/* @__PURE__ */ new Date()).getTime(), this.remoteTimestamp = S || this.localTimestamp, this.logicalFrames = C || 0, this.cancel = function() {
|
|
1846
|
+
f = null, y.forEach(function(O) {
|
|
1847
|
+
O.cancel();
|
|
1848
|
+
}), y = [];
|
|
1849
|
+
}, this.isReady = function() {
|
|
1850
|
+
for (var _ = 0; _ < y.length; _++)
|
|
1851
|
+
if (y[_].blocked)
|
|
1852
|
+
return !1;
|
|
1853
|
+
return !0;
|
|
1854
|
+
}, this.flush = function() {
|
|
1855
|
+
for (var _ = 0; _ < y.length; _++)
|
|
1856
|
+
y[_].execute();
|
|
1857
|
+
f && f();
|
|
1858
|
+
};
|
|
1859
|
+
};
|
|
1860
|
+
function m(s, f) {
|
|
1861
|
+
var y = this;
|
|
1862
|
+
this.blocked = f, this.cancel = function() {
|
|
1863
|
+
y.blocked = !1, s = null;
|
|
1864
|
+
}, this.unblock = function() {
|
|
1865
|
+
y.blocked && (y.blocked = !1, M());
|
|
1866
|
+
}, this.execute = function() {
|
|
1867
|
+
s && s();
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
function g(s, f) {
|
|
1871
|
+
var y = new m(s, f);
|
|
1872
|
+
return d.push(y), y;
|
|
1873
|
+
}
|
|
1874
|
+
this.getElement = function() {
|
|
1875
|
+
return p;
|
|
1876
|
+
}, this.getWidth = function() {
|
|
1877
|
+
return e;
|
|
1878
|
+
}, this.getHeight = function() {
|
|
1879
|
+
return t;
|
|
1880
|
+
}, this.getDefaultLayer = function() {
|
|
1881
|
+
return i;
|
|
1882
|
+
}, this.getCursorLayer = function() {
|
|
1883
|
+
return v;
|
|
1884
|
+
}, this.createLayer = function() {
|
|
1885
|
+
var s = new n.Display.VisibleLayer(e, t);
|
|
1886
|
+
return s.move(i, 0, 0, 0), s;
|
|
1887
|
+
}, this.createBuffer = function() {
|
|
1888
|
+
var s = new n.Layer(0, 0);
|
|
1889
|
+
return s.autosize = 1, s;
|
|
1890
|
+
}, this.flush = function(s, f, y) {
|
|
1891
|
+
c.push(new k(s, d, f, y)), d = [], M();
|
|
1892
|
+
}, this.cancel = function() {
|
|
1893
|
+
c.forEach(function(y) {
|
|
1894
|
+
y.cancel();
|
|
1895
|
+
}), c = [], d.forEach(function(y) {
|
|
1896
|
+
y.cancel();
|
|
1897
|
+
}), d = [];
|
|
1898
|
+
}, this.setCursor = function(s, f, y, S, C, _, x) {
|
|
1899
|
+
g(function() {
|
|
1900
|
+
r.cursorHotspotX = s, r.cursorHotspotY = f, v.resize(_, x), v.copy(y, S, C, _, x, 0, 0), r.moveCursor(r.cursorX, r.cursorY), r.oncursor && r.oncursor(v.toCanvas(), s, f);
|
|
1901
|
+
});
|
|
1902
|
+
}, this.showCursor = function(s) {
|
|
1903
|
+
var f = v.getElement(), y = f.parentNode;
|
|
1904
|
+
s === !1 ? y && y.removeChild(f) : y !== u && u.appendChild(f);
|
|
1905
|
+
}, this.moveCursor = function(s, f) {
|
|
1906
|
+
v.translate(
|
|
1907
|
+
s - r.cursorHotspotX,
|
|
1908
|
+
f - r.cursorHotspotY
|
|
1909
|
+
), r.cursorX = s, r.cursorY = f;
|
|
1910
|
+
}, this.resize = function(s, f, y) {
|
|
1911
|
+
g(function() {
|
|
1912
|
+
s.resize(f, y), s === i && (e = f, t = y, u.style.width = e + "px", u.style.height = t + "px", p.style.width = e * l + "px", p.style.height = t * l + "px", r.onresize && r.onresize(f, y));
|
|
1913
|
+
});
|
|
1914
|
+
}, this.drawImage = function(s, f, y, S) {
|
|
1915
|
+
g(function() {
|
|
1916
|
+
s.drawImage(f, y, S);
|
|
1917
|
+
});
|
|
1918
|
+
}, this.drawBlob = function(s, f, y, S) {
|
|
1919
|
+
var C;
|
|
1920
|
+
if (window.createImageBitmap) {
|
|
1921
|
+
var _;
|
|
1922
|
+
C = g(function() {
|
|
1923
|
+
s.drawImage(f, y, _);
|
|
1924
|
+
}, !0), window.createImageBitmap(S).then(function(o) {
|
|
1925
|
+
_ = o, C.unblock();
|
|
1926
|
+
});
|
|
1927
|
+
} else {
|
|
1928
|
+
var x = URL.createObjectURL(S);
|
|
1929
|
+
C = g(function() {
|
|
1930
|
+
O.width && O.height && s.drawImage(f, y, O), URL.revokeObjectURL(x);
|
|
1931
|
+
}, !0);
|
|
1932
|
+
var O = new Image();
|
|
1933
|
+
O.onload = C.unblock, O.onerror = C.unblock, O.src = x;
|
|
1934
|
+
}
|
|
1935
|
+
}, this.drawStream = function(f, y, S, C, _) {
|
|
1936
|
+
if (window.createImageBitmap) {
|
|
1937
|
+
var x = new n.BlobReader(C, _);
|
|
1938
|
+
x.onend = function() {
|
|
1939
|
+
r.drawBlob(f, y, S, x.getBlob());
|
|
1940
|
+
};
|
|
1941
|
+
} else {
|
|
1942
|
+
var x = new n.DataURIReader(C, _);
|
|
1943
|
+
x.onend = function() {
|
|
1944
|
+
r.draw(f, y, S, x.getURI());
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1947
|
+
}, this.draw = function(s, f, y, S) {
|
|
1948
|
+
var C = g(function() {
|
|
1949
|
+
_.width && _.height && s.drawImage(f, y, _);
|
|
1950
|
+
}, !0), _ = new Image();
|
|
1951
|
+
_.onload = C.unblock, _.onerror = C.unblock, _.src = S;
|
|
1952
|
+
}, this.play = function(s, f, y, S) {
|
|
1953
|
+
var C = document.createElement("video");
|
|
1954
|
+
C.type = f, C.src = S, C.addEventListener("play", function() {
|
|
1955
|
+
function _() {
|
|
1956
|
+
s.drawImage(0, 0, C), C.ended || window.setTimeout(_, 20);
|
|
1957
|
+
}
|
|
1958
|
+
_();
|
|
1959
|
+
}, !1), g(C.play);
|
|
1960
|
+
}, this.transfer = function(s, f, y, S, C, _, x, O, a) {
|
|
1961
|
+
g(function() {
|
|
1962
|
+
_.transfer(s, f, y, S, C, x, O, a);
|
|
1963
|
+
});
|
|
1964
|
+
}, this.put = function(s, f, y, S, C, _, x, O) {
|
|
1965
|
+
g(function() {
|
|
1966
|
+
_.put(s, f, y, S, C, x, O);
|
|
1967
|
+
});
|
|
1968
|
+
}, this.copy = function(s, f, y, S, C, _, x, O) {
|
|
1969
|
+
g(function() {
|
|
1970
|
+
_.copy(s, f, y, S, C, x, O);
|
|
1971
|
+
});
|
|
1972
|
+
}, this.moveTo = function(s, f, y) {
|
|
1973
|
+
g(function() {
|
|
1974
|
+
s.moveTo(f, y);
|
|
1975
|
+
});
|
|
1976
|
+
}, this.lineTo = function(s, f, y) {
|
|
1977
|
+
g(function() {
|
|
1978
|
+
s.lineTo(f, y);
|
|
1979
|
+
});
|
|
1980
|
+
}, this.arc = function(s, f, y, S, C, _, x) {
|
|
1981
|
+
g(function() {
|
|
1982
|
+
s.arc(f, y, S, C, _, x);
|
|
1983
|
+
});
|
|
1984
|
+
}, this.curveTo = function(s, f, y, S, C, _, x) {
|
|
1985
|
+
g(function() {
|
|
1986
|
+
s.curveTo(f, y, S, C, _, x);
|
|
1987
|
+
});
|
|
1988
|
+
}, this.close = function(s) {
|
|
1989
|
+
g(function() {
|
|
1990
|
+
s.close();
|
|
1991
|
+
});
|
|
1992
|
+
}, this.rect = function(s, f, y, S, C) {
|
|
1993
|
+
g(function() {
|
|
1994
|
+
s.rect(f, y, S, C);
|
|
1995
|
+
});
|
|
1996
|
+
}, this.clip = function(s) {
|
|
1997
|
+
g(function() {
|
|
1998
|
+
s.clip();
|
|
1999
|
+
});
|
|
2000
|
+
}, this.strokeColor = function(s, f, y, S, C, _, x, O) {
|
|
2001
|
+
g(function() {
|
|
2002
|
+
s.strokeColor(f, y, S, C, _, x, O);
|
|
2003
|
+
});
|
|
2004
|
+
}, this.fillColor = function(s, f, y, S, C) {
|
|
2005
|
+
g(function() {
|
|
2006
|
+
s.fillColor(f, y, S, C);
|
|
2007
|
+
});
|
|
2008
|
+
}, this.strokeLayer = function(s, f, y, S, C) {
|
|
2009
|
+
g(function() {
|
|
2010
|
+
s.strokeLayer(f, y, S, C);
|
|
2011
|
+
});
|
|
2012
|
+
}, this.fillLayer = function(s, f) {
|
|
2013
|
+
g(function() {
|
|
2014
|
+
s.fillLayer(f);
|
|
2015
|
+
});
|
|
2016
|
+
}, this.push = function(s) {
|
|
2017
|
+
g(function() {
|
|
2018
|
+
s.push();
|
|
2019
|
+
});
|
|
2020
|
+
}, this.pop = function(s) {
|
|
2021
|
+
g(function() {
|
|
2022
|
+
s.pop();
|
|
2023
|
+
});
|
|
2024
|
+
}, this.reset = function(s) {
|
|
2025
|
+
g(function() {
|
|
2026
|
+
s.reset();
|
|
2027
|
+
});
|
|
2028
|
+
}, this.setTransform = function(s, f, y, S, C, _, x) {
|
|
2029
|
+
g(function() {
|
|
2030
|
+
s.setTransform(f, y, S, C, _, x);
|
|
2031
|
+
});
|
|
2032
|
+
}, this.transform = function(s, f, y, S, C, _, x) {
|
|
2033
|
+
g(function() {
|
|
2034
|
+
s.transform(f, y, S, C, _, x);
|
|
2035
|
+
});
|
|
2036
|
+
}, this.setChannelMask = function(s, f) {
|
|
2037
|
+
g(function() {
|
|
2038
|
+
s.setChannelMask(f);
|
|
2039
|
+
});
|
|
2040
|
+
}, this.setMiterLimit = function(s, f) {
|
|
2041
|
+
g(function() {
|
|
2042
|
+
s.setMiterLimit(f);
|
|
2043
|
+
});
|
|
2044
|
+
}, this.dispose = function(f) {
|
|
2045
|
+
g(function() {
|
|
2046
|
+
f.dispose();
|
|
2047
|
+
});
|
|
2048
|
+
}, this.distort = function(f, y, S, C, _, x, O) {
|
|
2049
|
+
g(function() {
|
|
2050
|
+
f.distort(y, S, C, _, x, O);
|
|
2051
|
+
});
|
|
2052
|
+
}, this.move = function(f, y, S, C, _) {
|
|
2053
|
+
g(function() {
|
|
2054
|
+
f.move(y, S, C, _);
|
|
2055
|
+
});
|
|
2056
|
+
}, this.shade = function(f, y) {
|
|
2057
|
+
g(function() {
|
|
2058
|
+
f.shade(y);
|
|
2059
|
+
});
|
|
2060
|
+
}, this.scale = function(s) {
|
|
2061
|
+
u.style.transform = u.style.WebkitTransform = u.style.MozTransform = u.style.OTransform = u.style.msTransform = "scale(" + s + "," + s + ")", l = s, p.style.width = e * l + "px", p.style.height = t * l + "px";
|
|
2062
|
+
}, this.getScale = function() {
|
|
2063
|
+
return l;
|
|
2064
|
+
}, this.flatten = function() {
|
|
2065
|
+
var s = document.createElement("canvas");
|
|
2066
|
+
s.width = i.width, s.height = i.height;
|
|
2067
|
+
var f = s.getContext("2d");
|
|
2068
|
+
function y(C) {
|
|
2069
|
+
var _ = [];
|
|
2070
|
+
for (var x in C.children)
|
|
2071
|
+
_.push(C.children[x]);
|
|
2072
|
+
return _.sort(function(a, o) {
|
|
2073
|
+
var h = a.z - o.z;
|
|
2074
|
+
if (h !== 0)
|
|
2075
|
+
return h;
|
|
2076
|
+
var b = a.getElement(), P = o.getElement(), A = P.compareDocumentPosition(b);
|
|
2077
|
+
return A & Node.DOCUMENT_POSITION_PRECEDING ? -1 : A & Node.DOCUMENT_POSITION_FOLLOWING ? 1 : 0;
|
|
2078
|
+
}), _;
|
|
2079
|
+
}
|
|
2080
|
+
function S(C, _, x) {
|
|
2081
|
+
if (C.width > 0 && C.height > 0) {
|
|
2082
|
+
var O = f.globalAlpha;
|
|
2083
|
+
f.globalAlpha *= C.alpha / 255, f.drawImage(C.getCanvas(), _, x);
|
|
2084
|
+
for (var a = y(C), o = 0; o < a.length; o++) {
|
|
2085
|
+
var h = a[o];
|
|
2086
|
+
S(h, _ + h.x, x + h.y);
|
|
2087
|
+
}
|
|
2088
|
+
f.globalAlpha = O;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
return S(i, 0, 0), s;
|
|
2092
|
+
};
|
|
2093
|
+
};
|
|
2094
|
+
n.Display.VisibleLayer = function(r, e) {
|
|
2095
|
+
n.Layer.apply(this, [r, e]);
|
|
2096
|
+
var t = this;
|
|
2097
|
+
this.__unique_id = n.Display.VisibleLayer.__next_id++, this.alpha = 255, this.x = 0, this.y = 0, this.z = 0, this.matrix = [1, 0, 0, 1, 0, 0], this.parent = null, this.children = {};
|
|
2098
|
+
var l = t.getCanvas();
|
|
2099
|
+
l.style.position = "absolute", l.style.left = "0px", l.style.top = "0px";
|
|
2100
|
+
var u = document.createElement("div");
|
|
2101
|
+
u.appendChild(l), u.style.width = r + "px", u.style.height = e + "px", u.style.position = "absolute", u.style.left = "0px", u.style.top = "0px", u.style.overflow = "hidden";
|
|
2102
|
+
var i = this.resize;
|
|
2103
|
+
this.resize = function(d, c) {
|
|
2104
|
+
u.style.width = d + "px", u.style.height = c + "px", i(d, c);
|
|
2105
|
+
}, this.getElement = function() {
|
|
2106
|
+
return u;
|
|
2107
|
+
};
|
|
2108
|
+
var v = "translate(0px, 0px)", p = "matrix(1, 0, 0, 1, 0, 0)";
|
|
2109
|
+
this.translate = function(d, c) {
|
|
2110
|
+
t.x = d, t.y = c, v = "translate(" + d + "px," + c + "px)", u.style.transform = u.style.WebkitTransform = u.style.MozTransform = u.style.OTransform = u.style.msTransform = v + " " + p;
|
|
2111
|
+
}, this.move = function(d, c, F, I) {
|
|
2112
|
+
if (t.parent !== d) {
|
|
2113
|
+
t.parent && delete t.parent.children[t.__unique_id], t.parent = d, d.children[t.__unique_id] = t;
|
|
2114
|
+
var E = d.getElement();
|
|
2115
|
+
E.appendChild(u);
|
|
2116
|
+
}
|
|
2117
|
+
t.translate(c, F), t.z = I, u.style.zIndex = I;
|
|
2118
|
+
}, this.shade = function(d) {
|
|
2119
|
+
t.alpha = d, u.style.opacity = d / 255;
|
|
2120
|
+
}, this.dispose = function() {
|
|
2121
|
+
t.parent && (delete t.parent.children[t.__unique_id], t.parent = null), u.parentNode && u.parentNode.removeChild(u);
|
|
2122
|
+
}, this.distort = function(d, c, F, I, E, T) {
|
|
2123
|
+
t.matrix = [d, c, F, I, E, T], p = /* a c e
|
|
2124
|
+
* b d f
|
|
2125
|
+
* 0 0 1
|
|
2126
|
+
*/
|
|
2127
|
+
"matrix(" + d + "," + c + "," + F + "," + I + "," + E + "," + T + ")", u.style.transform = u.style.WebkitTransform = u.style.MozTransform = u.style.OTransform = u.style.msTransform = v + " " + p;
|
|
2128
|
+
};
|
|
2129
|
+
};
|
|
2130
|
+
n.Display.VisibleLayer.__next_id = 0;
|
|
2131
|
+
n.Display.Statistics = function(e) {
|
|
2132
|
+
e = e || {}, this.processingLag = e.processingLag, this.desktopFps = e.desktopFps, this.serverFps = e.serverFps, this.clientFps = e.clientFps, this.dropRate = e.dropRate;
|
|
2133
|
+
};
|
|
2134
|
+
var n = n || {};
|
|
2135
|
+
n.Event = function(e) {
|
|
2136
|
+
this.type = e, this.timestamp = (/* @__PURE__ */ new Date()).getTime(), this.getAge = function() {
|
|
2137
|
+
return (/* @__PURE__ */ new Date()).getTime() - this.timestamp;
|
|
2138
|
+
}, this.invokeLegacyHandler = function(l) {
|
|
2139
|
+
};
|
|
2140
|
+
};
|
|
2141
|
+
n.Event.DOMEvent = function(e, t) {
|
|
2142
|
+
n.Event.call(this, e), t = t || [], Array.isArray(t) || (t = [t]), this.preventDefault = function() {
|
|
2143
|
+
t.forEach(function(i) {
|
|
2144
|
+
i.preventDefault && i.preventDefault(), i.returnValue = !1;
|
|
2145
|
+
});
|
|
2146
|
+
}, this.stopPropagation = function() {
|
|
2147
|
+
t.forEach(function(i) {
|
|
2148
|
+
i.stopPropagation();
|
|
2149
|
+
});
|
|
2150
|
+
};
|
|
2151
|
+
};
|
|
2152
|
+
n.Event.DOMEvent.cancelEvent = function(e) {
|
|
2153
|
+
e.stopPropagation(), e.preventDefault && e.preventDefault(), e.returnValue = !1;
|
|
2154
|
+
};
|
|
2155
|
+
n.Event.Target = function() {
|
|
2156
|
+
var e = {};
|
|
2157
|
+
this.on = function(l, u) {
|
|
2158
|
+
var i = e[l];
|
|
2159
|
+
i || (e[l] = i = []), i.push(u);
|
|
2160
|
+
}, this.onEach = function(l, u) {
|
|
2161
|
+
l.forEach(function(v) {
|
|
2162
|
+
this.on(v, u);
|
|
2163
|
+
}, this);
|
|
2164
|
+
}, this.dispatch = function(l) {
|
|
2165
|
+
l.invokeLegacyHandler(this);
|
|
2166
|
+
var u = e[l.type];
|
|
2167
|
+
if (u)
|
|
2168
|
+
for (var i = 0; i < u.length; i++)
|
|
2169
|
+
u[i](l, this);
|
|
2170
|
+
}, this.off = function(l, u) {
|
|
2171
|
+
var i = e[l];
|
|
2172
|
+
if (!i)
|
|
2173
|
+
return !1;
|
|
2174
|
+
for (var v = 0; v < i.length; v++)
|
|
2175
|
+
if (i[v] === u)
|
|
2176
|
+
return i.splice(v, 1), !0;
|
|
2177
|
+
return !1;
|
|
2178
|
+
}, this.offEach = function(l, u) {
|
|
2179
|
+
var i = !1;
|
|
2180
|
+
return l.forEach(function(p) {
|
|
2181
|
+
i |= this.off(p, u);
|
|
2182
|
+
}, this), i;
|
|
2183
|
+
};
|
|
2184
|
+
};
|
|
2185
|
+
var n = n || {};
|
|
2186
|
+
n.InputSink = function() {
|
|
2187
|
+
var e = this, t = document.createElement("textarea");
|
|
2188
|
+
t.style.position = "fixed", t.style.outline = "none", t.style.border = "none", t.style.margin = "0", t.style.padding = "0", t.style.height = "0", t.style.width = "0", t.style.left = "0", t.style.bottom = "0", t.style.resize = "none", t.style.background = "transparent", t.style.color = "transparent", t.addEventListener("keypress", function(u) {
|
|
2189
|
+
t.value = "";
|
|
2190
|
+
}, !1), t.addEventListener("compositionend", function(u) {
|
|
2191
|
+
u.data && (t.value = "");
|
|
2192
|
+
}, !1), t.addEventListener("input", function(u) {
|
|
2193
|
+
u.data && !u.isComposing && (t.value = "");
|
|
2194
|
+
}, !1), t.addEventListener("focus", function() {
|
|
2195
|
+
window.setTimeout(function() {
|
|
2196
|
+
t.click(), t.select();
|
|
2197
|
+
}, 0);
|
|
2198
|
+
}, !0), this.focus = function() {
|
|
2199
|
+
window.setTimeout(function() {
|
|
2200
|
+
t.focus();
|
|
2201
|
+
}, 0);
|
|
2202
|
+
}, this.getElement = function() {
|
|
2203
|
+
return t;
|
|
2204
|
+
}, document.addEventListener("keydown", function(u) {
|
|
2205
|
+
var i = document.activeElement;
|
|
2206
|
+
if (i && i !== document.body) {
|
|
2207
|
+
var v = i.getBoundingClientRect();
|
|
2208
|
+
if (v.left + v.width > 0 && v.top + v.height > 0)
|
|
2209
|
+
return;
|
|
2210
|
+
}
|
|
2211
|
+
e.focus();
|
|
2212
|
+
}, !0);
|
|
2213
|
+
};
|
|
2214
|
+
var n = n || {};
|
|
2215
|
+
n.InputStream = function(r, e) {
|
|
2216
|
+
var t = this;
|
|
2217
|
+
this.index = e, this.onblob = null, this.onend = null, this.sendAck = function(l, u) {
|
|
2218
|
+
r.sendAck(t.index, l, u);
|
|
2219
|
+
};
|
|
2220
|
+
};
|
|
2221
|
+
var n = n || {};
|
|
2222
|
+
n.IntegerPool = function() {
|
|
2223
|
+
var r = this, e = [];
|
|
2224
|
+
this.next_int = 0, this.next = function() {
|
|
2225
|
+
return e.length > 0 ? e.shift() : r.next_int++;
|
|
2226
|
+
}, this.free = function(t) {
|
|
2227
|
+
e.push(t);
|
|
2228
|
+
};
|
|
2229
|
+
};
|
|
2230
|
+
var n = n || {};
|
|
2231
|
+
n.JSONReader = function(e) {
|
|
2232
|
+
var t = this, l = new n.StringReader(e), u = "";
|
|
2233
|
+
this.getLength = function() {
|
|
2234
|
+
return u.length;
|
|
2235
|
+
}, this.getJSON = function() {
|
|
2236
|
+
return JSON.parse(u);
|
|
2237
|
+
}, l.ontext = function(v) {
|
|
2238
|
+
u += v, t.onprogress && t.onprogress(v.length);
|
|
2239
|
+
}, l.onend = function() {
|
|
2240
|
+
t.onend && t.onend();
|
|
2241
|
+
}, this.onprogress = null, this.onend = null;
|
|
2242
|
+
};
|
|
2243
|
+
var n = n || {};
|
|
2244
|
+
n.Keyboard = function(e) {
|
|
2245
|
+
var t = this, l = n.Keyboard._nextID++, u = "_GUAC_KEYBOARD_HANDLED_BY_" + l;
|
|
2246
|
+
this.onkeydown = null, this.onkeyup = null;
|
|
2247
|
+
var i = {
|
|
2248
|
+
/**
|
|
2249
|
+
* Whether keyup events are universally unreliable.
|
|
2250
|
+
*
|
|
2251
|
+
* @type {!boolean}
|
|
2252
|
+
*/
|
|
2253
|
+
keyupUnreliable: !1,
|
|
2254
|
+
/**
|
|
2255
|
+
* Whether the Alt key is actually a modifier for typable keys and is
|
|
2256
|
+
* thus never used for keyboard shortcuts.
|
|
2257
|
+
*
|
|
2258
|
+
* @type {!boolean}
|
|
2259
|
+
*/
|
|
2260
|
+
altIsTypableOnly: !1,
|
|
2261
|
+
/**
|
|
2262
|
+
* Whether we can rely on receiving a keyup event for the Caps Lock
|
|
2263
|
+
* key.
|
|
2264
|
+
*
|
|
2265
|
+
* @type {!boolean}
|
|
2266
|
+
*/
|
|
2267
|
+
capsLockKeyupUnreliable: !1
|
|
2268
|
+
};
|
|
2269
|
+
navigator && navigator.platform && (navigator.platform.match(/ipad|iphone|ipod/i) ? i.keyupUnreliable = !0 : navigator.platform.match(/^mac/i) && (i.altIsTypableOnly = !0, i.capsLockKeyupUnreliable = !0));
|
|
2270
|
+
var v = function(w) {
|
|
2271
|
+
var W = this;
|
|
2272
|
+
this.keyCode = w ? w.which || w.keyCode : 0, this.keyIdentifier = w && w.keyIdentifier, this.key = w && w.key, this.location = w ? A(w) : 0, this.modifiers = w ? n.Keyboard.ModifierState.fromKeyboardEvent(w) : new n.Keyboard.ModifierState(), this.timestamp = (/* @__PURE__ */ new Date()).getTime(), this.defaultPrevented = !1, this.keysym = null, this.reliable = !1, this.getAge = function() {
|
|
2273
|
+
return (/* @__PURE__ */ new Date()).getTime() - W.timestamp;
|
|
2274
|
+
};
|
|
2275
|
+
}, p = function(w) {
|
|
2276
|
+
v.call(this, w), this.keysym = y(this.key, this.location) || _(this.keyCode, this.location), this.keyupReliable = !i.keyupUnreliable, this.keysym && !f(this.keysym) && (this.reliable = !0), !this.keysym && x(this.keyCode, this.keyIdentifier) && (this.keysym = y(this.keyIdentifier, this.location, this.modifiers.shift)), this.modifiers.meta && this.keysym !== 65511 && this.keysym !== 65512 ? this.keyupReliable = !1 : this.keysym === 65509 && i.capsLockKeyupUnreliable && (this.keyupReliable = !1);
|
|
2277
|
+
var W = !this.modifiers.ctrl && !i.altIsTypableOnly, B = !this.modifiers.alt;
|
|
2278
|
+
(B && this.modifiers.ctrl || W && this.modifiers.alt || this.modifiers.meta || this.modifiers.hyper) && (this.reliable = !0), k[this.keyCode] = this.keysym;
|
|
2279
|
+
};
|
|
2280
|
+
p.prototype = new v();
|
|
2281
|
+
var d = function(w) {
|
|
2282
|
+
v.call(this, w), this.keysym = C(this.keyCode), this.reliable = !0;
|
|
2283
|
+
};
|
|
2284
|
+
d.prototype = new v();
|
|
2285
|
+
var c = function(w) {
|
|
2286
|
+
v.call(this, w), this.keysym = _(this.keyCode, this.location) || y(this.key, this.location), t.pressed[this.keysym] || (this.keysym = k[this.keyCode] || this.keysym), this.reliable = !0;
|
|
2287
|
+
};
|
|
2288
|
+
c.prototype = new v();
|
|
2289
|
+
var F = [], I = {
|
|
2290
|
+
8: [65288],
|
|
2291
|
+
// backspace
|
|
2292
|
+
9: [65289],
|
|
2293
|
+
// tab
|
|
2294
|
+
12: [65291, 65291, 65291, 65461],
|
|
2295
|
+
// clear / KP 5
|
|
2296
|
+
13: [65293],
|
|
2297
|
+
// enter
|
|
2298
|
+
16: [65505, 65505, 65506],
|
|
2299
|
+
// shift
|
|
2300
|
+
17: [65507, 65507, 65508],
|
|
2301
|
+
// ctrl
|
|
2302
|
+
18: [65513, 65513, 65027],
|
|
2303
|
+
// alt
|
|
2304
|
+
19: [65299],
|
|
2305
|
+
// pause/break
|
|
2306
|
+
20: [65509],
|
|
2307
|
+
// caps lock
|
|
2308
|
+
27: [65307],
|
|
2309
|
+
// escape
|
|
2310
|
+
32: [32],
|
|
2311
|
+
// space
|
|
2312
|
+
33: [65365, 65365, 65365, 65465],
|
|
2313
|
+
// page up / KP 9
|
|
2314
|
+
34: [65366, 65366, 65366, 65459],
|
|
2315
|
+
// page down / KP 3
|
|
2316
|
+
35: [65367, 65367, 65367, 65457],
|
|
2317
|
+
// end / KP 1
|
|
2318
|
+
36: [65360, 65360, 65360, 65463],
|
|
2319
|
+
// home / KP 7
|
|
2320
|
+
37: [65361, 65361, 65361, 65460],
|
|
2321
|
+
// left arrow / KP 4
|
|
2322
|
+
38: [65362, 65362, 65362, 65464],
|
|
2323
|
+
// up arrow / KP 8
|
|
2324
|
+
39: [65363, 65363, 65363, 65462],
|
|
2325
|
+
// right arrow / KP 6
|
|
2326
|
+
40: [65364, 65364, 65364, 65458],
|
|
2327
|
+
// down arrow / KP 2
|
|
2328
|
+
45: [65379, 65379, 65379, 65456],
|
|
2329
|
+
// insert / KP 0
|
|
2330
|
+
46: [65535, 65535, 65535, 65454],
|
|
2331
|
+
// delete / KP decimal
|
|
2332
|
+
91: [65511],
|
|
2333
|
+
// left windows/command key (meta_l)
|
|
2334
|
+
92: [65512],
|
|
2335
|
+
// right window/command key (meta_r)
|
|
2336
|
+
93: [65383],
|
|
2337
|
+
// menu key
|
|
2338
|
+
96: [65456],
|
|
2339
|
+
// KP 0
|
|
2340
|
+
97: [65457],
|
|
2341
|
+
// KP 1
|
|
2342
|
+
98: [65458],
|
|
2343
|
+
// KP 2
|
|
2344
|
+
99: [65459],
|
|
2345
|
+
// KP 3
|
|
2346
|
+
100: [65460],
|
|
2347
|
+
// KP 4
|
|
2348
|
+
101: [65461],
|
|
2349
|
+
// KP 5
|
|
2350
|
+
102: [65462],
|
|
2351
|
+
// KP 6
|
|
2352
|
+
103: [65463],
|
|
2353
|
+
// KP 7
|
|
2354
|
+
104: [65464],
|
|
2355
|
+
// KP 8
|
|
2356
|
+
105: [65465],
|
|
2357
|
+
// KP 9
|
|
2358
|
+
106: [65450],
|
|
2359
|
+
// KP multiply
|
|
2360
|
+
107: [65451],
|
|
2361
|
+
// KP add
|
|
2362
|
+
109: [65453],
|
|
2363
|
+
// KP subtract
|
|
2364
|
+
110: [65454],
|
|
2365
|
+
// KP decimal
|
|
2366
|
+
111: [65455],
|
|
2367
|
+
// KP divide
|
|
2368
|
+
112: [65470],
|
|
2369
|
+
// f1
|
|
2370
|
+
113: [65471],
|
|
2371
|
+
// f2
|
|
2372
|
+
114: [65472],
|
|
2373
|
+
// f3
|
|
2374
|
+
115: [65473],
|
|
2375
|
+
// f4
|
|
2376
|
+
116: [65474],
|
|
2377
|
+
// f5
|
|
2378
|
+
117: [65475],
|
|
2379
|
+
// f6
|
|
2380
|
+
118: [65476],
|
|
2381
|
+
// f7
|
|
2382
|
+
119: [65477],
|
|
2383
|
+
// f8
|
|
2384
|
+
120: [65478],
|
|
2385
|
+
// f9
|
|
2386
|
+
121: [65479],
|
|
2387
|
+
// f10
|
|
2388
|
+
122: [65480],
|
|
2389
|
+
// f11
|
|
2390
|
+
123: [65481],
|
|
2391
|
+
// f12
|
|
2392
|
+
144: [65407],
|
|
2393
|
+
// num lock
|
|
2394
|
+
145: [65300],
|
|
2395
|
+
// scroll lock
|
|
2396
|
+
225: [65027]
|
|
2397
|
+
// altgraph (iso_level3_shift)
|
|
2398
|
+
}, E = {
|
|
2399
|
+
Again: [65382],
|
|
2400
|
+
AllCandidates: [65341],
|
|
2401
|
+
Alphanumeric: [65328],
|
|
2402
|
+
Alt: [65513, 65513, 65027],
|
|
2403
|
+
Attn: [64782],
|
|
2404
|
+
AltGraph: [65027],
|
|
2405
|
+
ArrowDown: [65364],
|
|
2406
|
+
ArrowLeft: [65361],
|
|
2407
|
+
ArrowRight: [65363],
|
|
2408
|
+
ArrowUp: [65362],
|
|
2409
|
+
Backspace: [65288],
|
|
2410
|
+
CapsLock: [65509],
|
|
2411
|
+
Cancel: [65385],
|
|
2412
|
+
Clear: [65291],
|
|
2413
|
+
Convert: [65313],
|
|
2414
|
+
Copy: [64789],
|
|
2415
|
+
Crsel: [64796],
|
|
2416
|
+
CrSel: [64796],
|
|
2417
|
+
CodeInput: [65335],
|
|
2418
|
+
Compose: [65312],
|
|
2419
|
+
Control: [65507, 65507, 65508],
|
|
2420
|
+
ContextMenu: [65383],
|
|
2421
|
+
Delete: [65535],
|
|
2422
|
+
Down: [65364],
|
|
2423
|
+
End: [65367],
|
|
2424
|
+
Enter: [65293],
|
|
2425
|
+
EraseEof: [64774],
|
|
2426
|
+
Escape: [65307],
|
|
2427
|
+
Execute: [65378],
|
|
2428
|
+
Exsel: [64797],
|
|
2429
|
+
ExSel: [64797],
|
|
2430
|
+
F1: [65470],
|
|
2431
|
+
F2: [65471],
|
|
2432
|
+
F3: [65472],
|
|
2433
|
+
F4: [65473],
|
|
2434
|
+
F5: [65474],
|
|
2435
|
+
F6: [65475],
|
|
2436
|
+
F7: [65476],
|
|
2437
|
+
F8: [65477],
|
|
2438
|
+
F9: [65478],
|
|
2439
|
+
F10: [65479],
|
|
2440
|
+
F11: [65480],
|
|
2441
|
+
F12: [65481],
|
|
2442
|
+
F13: [65482],
|
|
2443
|
+
F14: [65483],
|
|
2444
|
+
F15: [65484],
|
|
2445
|
+
F16: [65485],
|
|
2446
|
+
F17: [65486],
|
|
2447
|
+
F18: [65487],
|
|
2448
|
+
F19: [65488],
|
|
2449
|
+
F20: [65489],
|
|
2450
|
+
F21: [65490],
|
|
2451
|
+
F22: [65491],
|
|
2452
|
+
F23: [65492],
|
|
2453
|
+
F24: [65493],
|
|
2454
|
+
Find: [65384],
|
|
2455
|
+
GroupFirst: [65036],
|
|
2456
|
+
GroupLast: [65038],
|
|
2457
|
+
GroupNext: [65032],
|
|
2458
|
+
GroupPrevious: [65034],
|
|
2459
|
+
FullWidth: null,
|
|
2460
|
+
HalfWidth: null,
|
|
2461
|
+
HangulMode: [65329],
|
|
2462
|
+
Hankaku: [65321],
|
|
2463
|
+
HanjaMode: [65332],
|
|
2464
|
+
Help: [65386],
|
|
2465
|
+
Hiragana: [65317],
|
|
2466
|
+
HiraganaKatakana: [65319],
|
|
2467
|
+
Home: [65360],
|
|
2468
|
+
Hyper: [65517, 65517, 65518],
|
|
2469
|
+
Insert: [65379],
|
|
2470
|
+
JapaneseHiragana: [65317],
|
|
2471
|
+
JapaneseKatakana: [65318],
|
|
2472
|
+
JapaneseRomaji: [65316],
|
|
2473
|
+
JunjaMode: [65336],
|
|
2474
|
+
KanaMode: [65325],
|
|
2475
|
+
KanjiMode: [65313],
|
|
2476
|
+
Katakana: [65318],
|
|
2477
|
+
Left: [65361],
|
|
2478
|
+
Meta: [65511, 65511, 65512],
|
|
2479
|
+
ModeChange: [65406],
|
|
2480
|
+
NumLock: [65407],
|
|
2481
|
+
PageDown: [65366],
|
|
2482
|
+
PageUp: [65365],
|
|
2483
|
+
Pause: [65299],
|
|
2484
|
+
Play: [64790],
|
|
2485
|
+
PreviousCandidate: [65342],
|
|
2486
|
+
PrintScreen: [65377],
|
|
2487
|
+
Redo: [65382],
|
|
2488
|
+
Right: [65363],
|
|
2489
|
+
RomanCharacters: null,
|
|
2490
|
+
Scroll: [65300],
|
|
2491
|
+
Select: [65376],
|
|
2492
|
+
Separator: [65452],
|
|
2493
|
+
Shift: [65505, 65505, 65506],
|
|
2494
|
+
SingleCandidate: [65340],
|
|
2495
|
+
Super: [65515, 65515, 65516],
|
|
2496
|
+
Tab: [65289],
|
|
2497
|
+
UIKeyInputDownArrow: [65364],
|
|
2498
|
+
UIKeyInputEscape: [65307],
|
|
2499
|
+
UIKeyInputLeftArrow: [65361],
|
|
2500
|
+
UIKeyInputRightArrow: [65363],
|
|
2501
|
+
UIKeyInputUpArrow: [65362],
|
|
2502
|
+
Up: [65362],
|
|
2503
|
+
Undo: [65381],
|
|
2504
|
+
Win: [65511, 65511, 65512],
|
|
2505
|
+
Zenkaku: [65320],
|
|
2506
|
+
ZenkakuHankaku: [65322]
|
|
2507
|
+
}, T = {
|
|
2508
|
+
65027: !0,
|
|
2509
|
+
// ISO Level 3 Shift (AltGr)
|
|
2510
|
+
65505: !0,
|
|
2511
|
+
// Left shift
|
|
2512
|
+
65506: !0,
|
|
2513
|
+
// Right shift
|
|
2514
|
+
65507: !0,
|
|
2515
|
+
// Left ctrl
|
|
2516
|
+
65508: !0,
|
|
2517
|
+
// Right ctrl
|
|
2518
|
+
65509: !0,
|
|
2519
|
+
// Caps Lock
|
|
2520
|
+
65511: !0,
|
|
2521
|
+
// Left meta
|
|
2522
|
+
65512: !0,
|
|
2523
|
+
// Right meta
|
|
2524
|
+
65513: !0,
|
|
2525
|
+
// Left alt
|
|
2526
|
+
65514: !0,
|
|
2527
|
+
// Right alt
|
|
2528
|
+
65515: !0,
|
|
2529
|
+
// Left super/hyper
|
|
2530
|
+
65516: !0
|
|
2531
|
+
// Right super/hyper
|
|
2532
|
+
};
|
|
2533
|
+
this.modifiers = new n.Keyboard.ModifierState(), this.pressed = {};
|
|
2534
|
+
var L = {}, M = {}, k = {}, m = null, g = null, s = function(w, W) {
|
|
2535
|
+
return w ? w[W] || w[0] : null;
|
|
2536
|
+
}, f = function(w) {
|
|
2537
|
+
return w >= 0 && w <= 255 || (w & 4294901760) === 16777216;
|
|
2538
|
+
};
|
|
2539
|
+
function y(R, w, W) {
|
|
2540
|
+
if (!R)
|
|
2541
|
+
return null;
|
|
2542
|
+
var B, z = R.indexOf("U+");
|
|
2543
|
+
if (z >= 0) {
|
|
2544
|
+
var U = R.substring(z + 2);
|
|
2545
|
+
B = String.fromCharCode(parseInt(U, 16));
|
|
2546
|
+
} else if (R.length === 1 && w !== 3)
|
|
2547
|
+
B = R;
|
|
2548
|
+
else
|
|
2549
|
+
return s(E[R], w);
|
|
2550
|
+
W === !0 ? B = B.toUpperCase() : W === !1 && (B = B.toLowerCase());
|
|
2551
|
+
var H = B.charCodeAt(0);
|
|
2552
|
+
return C(H);
|
|
2553
|
+
}
|
|
2554
|
+
function S(R) {
|
|
2555
|
+
return R <= 31 || R >= 127 && R <= 159;
|
|
2556
|
+
}
|
|
2557
|
+
function C(R) {
|
|
2558
|
+
return S(R) ? 65280 | R : R >= 0 && R <= 255 ? R : R >= 256 && R <= 1114111 ? 16777216 | R : null;
|
|
2559
|
+
}
|
|
2560
|
+
function _(R, w) {
|
|
2561
|
+
return s(I[R], w);
|
|
2562
|
+
}
|
|
2563
|
+
var x = function(w, W) {
|
|
2564
|
+
if (!W)
|
|
2565
|
+
return !1;
|
|
2566
|
+
var B = W.indexOf("U+");
|
|
2567
|
+
if (B === -1)
|
|
2568
|
+
return !0;
|
|
2569
|
+
var z = parseInt(W.substring(B + 2), 16);
|
|
2570
|
+
return w !== z || w >= 65 && w <= 90 || w >= 48 && w <= 57;
|
|
2571
|
+
};
|
|
2572
|
+
this.press = function(R) {
|
|
2573
|
+
if (R !== null) {
|
|
2574
|
+
if (!t.pressed[R] && (t.pressed[R] = !0, t.onkeydown)) {
|
|
2575
|
+
var w = t.onkeydown(R);
|
|
2576
|
+
return M[R] = w, window.clearTimeout(m), window.clearInterval(g), T[R] || (m = window.setTimeout(function() {
|
|
2577
|
+
g = window.setInterval(function() {
|
|
2578
|
+
t.onkeyup(R), t.onkeydown(R);
|
|
2579
|
+
}, 50);
|
|
2580
|
+
}, 500)), w;
|
|
2581
|
+
}
|
|
2582
|
+
return M[R] || !1;
|
|
2583
|
+
}
|
|
2584
|
+
}, this.release = function(R) {
|
|
2585
|
+
t.pressed[R] && (delete t.pressed[R], delete L[R], window.clearTimeout(m), window.clearInterval(g), R !== null && t.onkeyup && t.onkeyup(R));
|
|
2586
|
+
}, this.type = function(w) {
|
|
2587
|
+
for (var W = 0; W < w.length; W++) {
|
|
2588
|
+
var B = w.codePointAt ? w.codePointAt(W) : w.charCodeAt(W), z = C(B);
|
|
2589
|
+
t.press(z), t.release(z);
|
|
2590
|
+
}
|
|
2591
|
+
}, this.reset = function() {
|
|
2592
|
+
for (var R in t.pressed)
|
|
2593
|
+
t.release(parseInt(R));
|
|
2594
|
+
F = [];
|
|
2595
|
+
};
|
|
2596
|
+
var O = function(w, W, B) {
|
|
2597
|
+
var z = B.modifiers[w], U = t.modifiers[w], H;
|
|
2598
|
+
if (W.indexOf(B.keysym) === -1) {
|
|
2599
|
+
if (U && z === !1)
|
|
2600
|
+
for (H = 0; H < W.length; H++)
|
|
2601
|
+
t.release(W[H]);
|
|
2602
|
+
else if (!U && z) {
|
|
2603
|
+
for (H = 0; H < W.length; H++)
|
|
2604
|
+
if (t.pressed[W[H]])
|
|
2605
|
+
return;
|
|
2606
|
+
var Q = W[0];
|
|
2607
|
+
B.keysym && (L[Q] = !0), t.press(Q);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
}, a = function(w) {
|
|
2611
|
+
O("alt", [
|
|
2612
|
+
65513,
|
|
2613
|
+
// Left alt
|
|
2614
|
+
65514,
|
|
2615
|
+
// Right alt
|
|
2616
|
+
65027
|
|
2617
|
+
// AltGr
|
|
2618
|
+
], w), O("shift", [
|
|
2619
|
+
65505,
|
|
2620
|
+
// Left shift
|
|
2621
|
+
65506
|
|
2622
|
+
// Right shift
|
|
2623
|
+
], w), O("ctrl", [
|
|
2624
|
+
65507,
|
|
2625
|
+
// Left ctrl
|
|
2626
|
+
65508
|
|
2627
|
+
// Right ctrl
|
|
2628
|
+
], w), O("meta", [
|
|
2629
|
+
65511,
|
|
2630
|
+
// Left meta
|
|
2631
|
+
65512
|
|
2632
|
+
// Right meta
|
|
2633
|
+
], w), O("hyper", [
|
|
2634
|
+
65515,
|
|
2635
|
+
// Left super/hyper
|
|
2636
|
+
65516
|
|
2637
|
+
// Right super/hyper
|
|
2638
|
+
], w), t.modifiers = w.modifiers;
|
|
2639
|
+
}, o = function() {
|
|
2640
|
+
for (var w in t.pressed)
|
|
2641
|
+
if (!L[w])
|
|
2642
|
+
return !1;
|
|
2643
|
+
return !0;
|
|
2644
|
+
};
|
|
2645
|
+
function h() {
|
|
2646
|
+
var R = P();
|
|
2647
|
+
if (!R)
|
|
2648
|
+
return !1;
|
|
2649
|
+
var w;
|
|
2650
|
+
do
|
|
2651
|
+
w = R, R = P();
|
|
2652
|
+
while (R !== null);
|
|
2653
|
+
return o() && t.reset(), w.defaultPrevented;
|
|
2654
|
+
}
|
|
2655
|
+
var b = function(w) {
|
|
2656
|
+
!t.modifiers.ctrl || !t.modifiers.alt || w >= 65 && w <= 90 || w >= 97 && w <= 122 || (w <= 255 || (w & 4278190080) === 16777216) && (t.release(65507), t.release(65508), t.release(65513), t.release(65514));
|
|
2657
|
+
}, P = function() {
|
|
2658
|
+
var w = F[0];
|
|
2659
|
+
if (!w)
|
|
2660
|
+
return null;
|
|
2661
|
+
if (w instanceof p) {
|
|
2662
|
+
var W = null, B = [];
|
|
2663
|
+
if (w.keysym === 65511 || w.keysym === 65512) {
|
|
2664
|
+
if (F.length === 1)
|
|
2665
|
+
return null;
|
|
2666
|
+
if (F[1].keysym !== w.keysym) {
|
|
2667
|
+
if (!F[1].modifiers.meta)
|
|
2668
|
+
return F.shift();
|
|
2669
|
+
} else if (F[1] instanceof p)
|
|
2670
|
+
return F.shift();
|
|
2671
|
+
}
|
|
2672
|
+
if (w.reliable ? (W = w.keysym, B = F.splice(0, 1)) : F[1] instanceof d ? (W = F[1].keysym, B = F.splice(0, 2)) : F[1] && (W = w.keysym, B = F.splice(0, 1)), B.length > 0) {
|
|
2673
|
+
if (a(w), W) {
|
|
2674
|
+
b(W);
|
|
2675
|
+
var z = !t.press(W);
|
|
2676
|
+
k[w.keyCode] = W, w.keyupReliable || t.release(W);
|
|
2677
|
+
for (var U = 0; U < B.length; U++)
|
|
2678
|
+
B[U].defaultPrevented = z;
|
|
2679
|
+
}
|
|
2680
|
+
return w;
|
|
2681
|
+
}
|
|
2682
|
+
} else if (w instanceof c && !i.keyupUnreliable) {
|
|
2683
|
+
var W = w.keysym;
|
|
2684
|
+
if (W)
|
|
2685
|
+
t.release(W), delete k[w.keyCode], w.defaultPrevented = !0;
|
|
2686
|
+
else
|
|
2687
|
+
return t.reset(), w;
|
|
2688
|
+
return a(w), F.shift();
|
|
2689
|
+
} else
|
|
2690
|
+
return F.shift();
|
|
2691
|
+
return null;
|
|
2692
|
+
}, A = function(w) {
|
|
2693
|
+
return "location" in w ? w.location : "keyLocation" in w ? w.keyLocation : 0;
|
|
2694
|
+
}, D = function(w) {
|
|
2695
|
+
return w[u] ? !1 : (w[u] = !0, !0);
|
|
2696
|
+
};
|
|
2697
|
+
this.listenTo = function(w) {
|
|
2698
|
+
w.addEventListener("keydown", function(z) {
|
|
2699
|
+
if (t.onkeydown && D(z)) {
|
|
2700
|
+
var U = new p(z);
|
|
2701
|
+
U.keyCode !== 229 && (F.push(U), h() && z.preventDefault());
|
|
2702
|
+
}
|
|
2703
|
+
}, !0), w.addEventListener("keypress", function(z) {
|
|
2704
|
+
!t.onkeydown && !t.onkeyup || D(z) && (F.push(new d(z)), h() && z.preventDefault());
|
|
2705
|
+
}, !0), w.addEventListener("keyup", function(z) {
|
|
2706
|
+
t.onkeyup && D(z) && (z.preventDefault(), F.push(new c(z)), h());
|
|
2707
|
+
}, !0);
|
|
2708
|
+
var W = function(U) {
|
|
2709
|
+
!t.onkeydown && !t.onkeyup || D(U) && U.data && !U.isComposing && (w.removeEventListener("compositionend", B, !1), t.type(U.data));
|
|
2710
|
+
}, B = function(U) {
|
|
2711
|
+
!t.onkeydown && !t.onkeyup || D(U) && U.data && (w.removeEventListener("input", W, !1), t.type(U.data));
|
|
2712
|
+
};
|
|
2713
|
+
w.addEventListener("input", W, !1), w.addEventListener("compositionend", B, !1);
|
|
2714
|
+
}, e && t.listenTo(e);
|
|
2715
|
+
};
|
|
2716
|
+
n.Keyboard._nextID = 0;
|
|
2717
|
+
n.Keyboard.ModifierState = function() {
|
|
2718
|
+
this.shift = !1, this.ctrl = !1, this.alt = !1, this.meta = !1, this.hyper = !1;
|
|
2719
|
+
};
|
|
2720
|
+
n.Keyboard.ModifierState.fromKeyboardEvent = function(r) {
|
|
2721
|
+
var e = new n.Keyboard.ModifierState();
|
|
2722
|
+
return e.shift = r.shiftKey, e.ctrl = r.ctrlKey, e.alt = r.altKey, e.meta = r.metaKey, r.getModifierState && (e.hyper = r.getModifierState("OS") || r.getModifierState("Super") || r.getModifierState("Hyper") || r.getModifierState("Win")), e;
|
|
2723
|
+
};
|
|
2724
|
+
var n = n || {};
|
|
2725
|
+
n.Layer = function(r, e) {
|
|
2726
|
+
var t = this, l = 64, u = document.createElement("canvas"), i = u.getContext("2d");
|
|
2727
|
+
i.save();
|
|
2728
|
+
var v = !0, p = !0, d = 0, c = {
|
|
2729
|
+
/* 0x0 NOT IMPLEMENTED */
|
|
2730
|
+
1: "destination-in",
|
|
2731
|
+
2: "destination-out",
|
|
2732
|
+
/* 0x3 NOT IMPLEMENTED */
|
|
2733
|
+
4: "source-in",
|
|
2734
|
+
/* 0x5 NOT IMPLEMENTED */
|
|
2735
|
+
6: "source-atop",
|
|
2736
|
+
/* 0x7 NOT IMPLEMENTED */
|
|
2737
|
+
8: "source-out",
|
|
2738
|
+
9: "destination-atop",
|
|
2739
|
+
10: "xor",
|
|
2740
|
+
11: "destination-over",
|
|
2741
|
+
12: "copy",
|
|
2742
|
+
/* 0xD NOT IMPLEMENTED */
|
|
2743
|
+
14: "source-over",
|
|
2744
|
+
15: "lighter"
|
|
2745
|
+
}, F = function(T, L) {
|
|
2746
|
+
T = T || 0, L = L || 0;
|
|
2747
|
+
var M = Math.ceil(T / l) * l, k = Math.ceil(L / l) * l;
|
|
2748
|
+
if (u.width !== M || u.height !== k) {
|
|
2749
|
+
var m = null;
|
|
2750
|
+
if (!v && u.width !== 0 && u.height !== 0) {
|
|
2751
|
+
m = document.createElement("canvas"), m.width = Math.min(t.width, T), m.height = Math.min(t.height, L);
|
|
2752
|
+
var g = m.getContext("2d");
|
|
2753
|
+
g.drawImage(
|
|
2754
|
+
u,
|
|
2755
|
+
0,
|
|
2756
|
+
0,
|
|
2757
|
+
m.width,
|
|
2758
|
+
m.height,
|
|
2759
|
+
0,
|
|
2760
|
+
0,
|
|
2761
|
+
m.width,
|
|
2762
|
+
m.height
|
|
2763
|
+
);
|
|
2764
|
+
}
|
|
2765
|
+
var s = i.globalCompositeOperation;
|
|
2766
|
+
u.width = M, u.height = k, m && i.drawImage(
|
|
2767
|
+
m,
|
|
2768
|
+
0,
|
|
2769
|
+
0,
|
|
2770
|
+
m.width,
|
|
2771
|
+
m.height,
|
|
2772
|
+
0,
|
|
2773
|
+
0,
|
|
2774
|
+
m.width,
|
|
2775
|
+
m.height
|
|
2776
|
+
), i.globalCompositeOperation = s, d = 0, i.save();
|
|
2777
|
+
} else
|
|
2778
|
+
t.reset();
|
|
2779
|
+
t.width = T, t.height = L;
|
|
2780
|
+
};
|
|
2781
|
+
function I(E, T, L, M) {
|
|
2782
|
+
var k = L + E, m = M + T, g;
|
|
2783
|
+
k > t.width ? g = k : g = t.width;
|
|
2784
|
+
var s;
|
|
2785
|
+
m > t.height ? s = m : s = t.height, t.resize(g, s);
|
|
2786
|
+
}
|
|
2787
|
+
this.autosize = !1, this.width = r, this.height = e, this.getCanvas = function() {
|
|
2788
|
+
return u;
|
|
2789
|
+
}, this.toCanvas = function() {
|
|
2790
|
+
var T = document.createElement("canvas");
|
|
2791
|
+
T.width = t.width, T.height = t.height;
|
|
2792
|
+
var L = T.getContext("2d");
|
|
2793
|
+
return L.drawImage(t.getCanvas(), 0, 0), T;
|
|
2794
|
+
}, this.resize = function(E, T) {
|
|
2795
|
+
(E !== t.width || T !== t.height) && F(E, T);
|
|
2796
|
+
}, this.drawImage = function(E, T, L) {
|
|
2797
|
+
t.autosize && I(E, T, L.width, L.height), i.drawImage(L, E, T), v = !1;
|
|
2798
|
+
}, this.transfer = function(E, T, L, M, k, m, g, s) {
|
|
2799
|
+
var f = E.getCanvas();
|
|
2800
|
+
if (!(T >= f.width || L >= f.height) && (T + M > f.width && (M = f.width - T), L + k > f.height && (k = f.height - L), !(M === 0 || k === 0))) {
|
|
2801
|
+
t.autosize && I(m, g, M, k);
|
|
2802
|
+
for (var y = E.getCanvas().getContext("2d").getImageData(T, L, M, k), S = i.getImageData(m, g, M, k), C = 0; C < M * k * 4; C += 4) {
|
|
2803
|
+
var _ = new n.Layer.Pixel(
|
|
2804
|
+
y.data[C],
|
|
2805
|
+
y.data[C + 1],
|
|
2806
|
+
y.data[C + 2],
|
|
2807
|
+
y.data[C + 3]
|
|
2808
|
+
), x = new n.Layer.Pixel(
|
|
2809
|
+
S.data[C],
|
|
2810
|
+
S.data[C + 1],
|
|
2811
|
+
S.data[C + 2],
|
|
2812
|
+
S.data[C + 3]
|
|
2813
|
+
);
|
|
2814
|
+
s(_, x), S.data[C] = x.red, S.data[C + 1] = x.green, S.data[C + 2] = x.blue, S.data[C + 3] = x.alpha;
|
|
2815
|
+
}
|
|
2816
|
+
i.putImageData(S, m, g), v = !1;
|
|
2817
|
+
}
|
|
2818
|
+
}, this.put = function(E, T, L, M, k, m, g) {
|
|
2819
|
+
var s = E.getCanvas();
|
|
2820
|
+
if (!(T >= s.width || L >= s.height) && (T + M > s.width && (M = s.width - T), L + k > s.height && (k = s.height - L), !(M === 0 || k === 0))) {
|
|
2821
|
+
t.autosize && I(m, g, M, k);
|
|
2822
|
+
var f = E.getCanvas().getContext("2d").getImageData(T, L, M, k);
|
|
2823
|
+
i.putImageData(f, m, g), v = !1;
|
|
2824
|
+
}
|
|
2825
|
+
}, this.copy = function(E, T, L, M, k, m, g) {
|
|
2826
|
+
var s = E.getCanvas();
|
|
2827
|
+
T >= s.width || L >= s.height || (T + M > s.width && (M = s.width - T), L + k > s.height && (k = s.height - L), !(M === 0 || k === 0) && (t.autosize && I(m, g, M, k), i.drawImage(s, T, L, M, k, m, g, M, k), v = !1));
|
|
2828
|
+
}, this.moveTo = function(E, T) {
|
|
2829
|
+
p && (i.beginPath(), p = !1), t.autosize && I(E, T, 0, 0), i.moveTo(E, T);
|
|
2830
|
+
}, this.lineTo = function(E, T) {
|
|
2831
|
+
p && (i.beginPath(), p = !1), t.autosize && I(E, T, 0, 0), i.lineTo(E, T);
|
|
2832
|
+
}, this.arc = function(E, T, L, M, k, m) {
|
|
2833
|
+
p && (i.beginPath(), p = !1), t.autosize && I(E, T, 0, 0), i.arc(E, T, L, M, k, m);
|
|
2834
|
+
}, this.curveTo = function(E, T, L, M, k, m) {
|
|
2835
|
+
p && (i.beginPath(), p = !1), t.autosize && I(k, m, 0, 0), i.bezierCurveTo(E, T, L, M, k, m);
|
|
2836
|
+
}, this.close = function() {
|
|
2837
|
+
i.closePath(), p = !0;
|
|
2838
|
+
}, this.rect = function(E, T, L, M) {
|
|
2839
|
+
p && (i.beginPath(), p = !1), t.autosize && I(E, T, L, M), i.rect(E, T, L, M);
|
|
2840
|
+
}, this.clip = function() {
|
|
2841
|
+
i.clip(), p = !0;
|
|
2842
|
+
}, this.strokeColor = function(E, T, L, M, k, m, g) {
|
|
2843
|
+
i.lineCap = E, i.lineJoin = T, i.lineWidth = L, i.strokeStyle = "rgba(" + M + "," + k + "," + m + "," + g / 255 + ")", i.stroke(), v = !1, p = !0;
|
|
2844
|
+
}, this.fillColor = function(E, T, L, M) {
|
|
2845
|
+
i.fillStyle = "rgba(" + E + "," + T + "," + L + "," + M / 255 + ")", i.fill(), v = !1, p = !0;
|
|
2846
|
+
}, this.strokeLayer = function(E, T, L, M) {
|
|
2847
|
+
i.lineCap = E, i.lineJoin = T, i.lineWidth = L, i.strokeStyle = i.createPattern(
|
|
2848
|
+
M.getCanvas(),
|
|
2849
|
+
"repeat"
|
|
2850
|
+
), i.stroke(), v = !1, p = !0;
|
|
2851
|
+
}, this.fillLayer = function(E) {
|
|
2852
|
+
i.fillStyle = i.createPattern(
|
|
2853
|
+
E.getCanvas(),
|
|
2854
|
+
"repeat"
|
|
2855
|
+
), i.fill(), v = !1, p = !0;
|
|
2856
|
+
}, this.push = function() {
|
|
2857
|
+
i.save(), d++;
|
|
2858
|
+
}, this.pop = function() {
|
|
2859
|
+
d > 0 && (i.restore(), d--);
|
|
2860
|
+
}, this.reset = function() {
|
|
2861
|
+
for (; d > 0; )
|
|
2862
|
+
i.restore(), d--;
|
|
2863
|
+
i.restore(), i.save(), i.beginPath(), p = !1;
|
|
2864
|
+
}, this.setTransform = function(E, T, L, M, k, m) {
|
|
2865
|
+
i.setTransform(
|
|
2866
|
+
E,
|
|
2867
|
+
T,
|
|
2868
|
+
L,
|
|
2869
|
+
M,
|
|
2870
|
+
k,
|
|
2871
|
+
m
|
|
2872
|
+
/*0, 0, 1*/
|
|
2873
|
+
);
|
|
2874
|
+
}, this.transform = function(E, T, L, M, k, m) {
|
|
2875
|
+
i.transform(
|
|
2876
|
+
E,
|
|
2877
|
+
T,
|
|
2878
|
+
L,
|
|
2879
|
+
M,
|
|
2880
|
+
k,
|
|
2881
|
+
m
|
|
2882
|
+
/*0, 0, 1*/
|
|
2883
|
+
);
|
|
2884
|
+
}, this.setChannelMask = function(E) {
|
|
2885
|
+
i.globalCompositeOperation = c[E];
|
|
2886
|
+
}, this.setMiterLimit = function(E) {
|
|
2887
|
+
i.miterLimit = E;
|
|
2888
|
+
}, F(r, e), u.style.zIndex = -1;
|
|
2889
|
+
};
|
|
2890
|
+
n.Layer.ROUT = 2;
|
|
2891
|
+
n.Layer.ATOP = 6;
|
|
2892
|
+
n.Layer.XOR = 10;
|
|
2893
|
+
n.Layer.ROVER = 11;
|
|
2894
|
+
n.Layer.OVER = 14;
|
|
2895
|
+
n.Layer.PLUS = 15;
|
|
2896
|
+
n.Layer.RIN = 1;
|
|
2897
|
+
n.Layer.IN = 4;
|
|
2898
|
+
n.Layer.OUT = 8;
|
|
2899
|
+
n.Layer.RATOP = 9;
|
|
2900
|
+
n.Layer.SRC = 12;
|
|
2901
|
+
n.Layer.Pixel = function(r, e, t, l) {
|
|
2902
|
+
this.red = r, this.green = e, this.blue = t, this.alpha = l;
|
|
2903
|
+
};
|
|
2904
|
+
var n = n || {};
|
|
2905
|
+
n.Mouse = function(e) {
|
|
2906
|
+
n.Mouse.Event.Target.call(this);
|
|
2907
|
+
var t = this;
|
|
2908
|
+
this.touchMouseThreshold = 3, this.scrollThreshold = 53, this.PIXELS_PER_LINE = 18, this.PIXELS_PER_PAGE = this.PIXELS_PER_LINE * 16;
|
|
2909
|
+
var l = [
|
|
2910
|
+
n.Mouse.State.Buttons.LEFT,
|
|
2911
|
+
n.Mouse.State.Buttons.MIDDLE,
|
|
2912
|
+
n.Mouse.State.Buttons.RIGHT
|
|
2913
|
+
], u = 0, i = 0;
|
|
2914
|
+
e.addEventListener("contextmenu", function(c) {
|
|
2915
|
+
n.Event.DOMEvent.cancelEvent(c);
|
|
2916
|
+
}, !1), e.addEventListener("mousemove", function(c) {
|
|
2917
|
+
if (u) {
|
|
2918
|
+
n.Event.DOMEvent.cancelEvent(c), u--;
|
|
2919
|
+
return;
|
|
2920
|
+
}
|
|
2921
|
+
t.move(n.Position.fromClientPosition(e, c.clientX, c.clientY), c);
|
|
2922
|
+
}, !1), e.addEventListener("mousedown", function(c) {
|
|
2923
|
+
if (u) {
|
|
2924
|
+
n.Event.DOMEvent.cancelEvent(c);
|
|
2925
|
+
return;
|
|
2926
|
+
}
|
|
2927
|
+
var F = l[c.button];
|
|
2928
|
+
F && t.press(F, c);
|
|
2929
|
+
}, !1), e.addEventListener("mouseup", function(c) {
|
|
2930
|
+
if (u) {
|
|
2931
|
+
n.Event.DOMEvent.cancelEvent(c);
|
|
2932
|
+
return;
|
|
2933
|
+
}
|
|
2934
|
+
var F = l[c.button];
|
|
2935
|
+
F && t.release(F, c);
|
|
2936
|
+
}, !1), e.addEventListener("mouseout", function(c) {
|
|
2937
|
+
c || (c = window.event);
|
|
2938
|
+
for (var F = c.relatedTarget || c.toElement; F; ) {
|
|
2939
|
+
if (F === e)
|
|
2940
|
+
return;
|
|
2941
|
+
F = F.parentNode;
|
|
2942
|
+
}
|
|
2943
|
+
t.reset(c), t.out(c);
|
|
2944
|
+
}, !1), e.addEventListener("selectstart", function(c) {
|
|
2945
|
+
n.Event.DOMEvent.cancelEvent(c);
|
|
2946
|
+
}, !1);
|
|
2947
|
+
function v() {
|
|
2948
|
+
u = t.touchMouseThreshold;
|
|
2949
|
+
}
|
|
2950
|
+
e.addEventListener("touchmove", v, !1), e.addEventListener("touchstart", v, !1), e.addEventListener("touchend", v, !1);
|
|
2951
|
+
function p(c) {
|
|
2952
|
+
var F = c.deltaY || -c.wheelDeltaY || -c.wheelDelta;
|
|
2953
|
+
if (F ? c.deltaMode === 1 ? F = c.deltaY * t.PIXELS_PER_LINE : c.deltaMode === 2 && (F = c.deltaY * t.PIXELS_PER_PAGE) : F = c.detail * t.PIXELS_PER_LINE, i += F, i <= -t.scrollThreshold) {
|
|
2954
|
+
do
|
|
2955
|
+
t.click(n.Mouse.State.Buttons.UP), i += t.scrollThreshold;
|
|
2956
|
+
while (i <= -t.scrollThreshold);
|
|
2957
|
+
i = 0;
|
|
2958
|
+
}
|
|
2959
|
+
if (i >= t.scrollThreshold) {
|
|
2960
|
+
do
|
|
2961
|
+
t.click(n.Mouse.State.Buttons.DOWN), i -= t.scrollThreshold;
|
|
2962
|
+
while (i >= t.scrollThreshold);
|
|
2963
|
+
i = 0;
|
|
2964
|
+
}
|
|
2965
|
+
n.Event.DOMEvent.cancelEvent(c);
|
|
2966
|
+
}
|
|
2967
|
+
e.addEventListener("DOMMouseScroll", p, !1), e.addEventListener("mousewheel", p, !1), e.addEventListener("wheel", p, !1);
|
|
2968
|
+
var d = function() {
|
|
2969
|
+
var c = document.createElement("div");
|
|
2970
|
+
if (!("cursor" in c.style))
|
|
2971
|
+
return !1;
|
|
2972
|
+
try {
|
|
2973
|
+
c.style.cursor = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX///+nxBvIAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==) 0 0, auto";
|
|
2974
|
+
} catch {
|
|
2975
|
+
return !1;
|
|
2976
|
+
}
|
|
2977
|
+
return /\burl\([^()]*\)\s+0\s+0\b/.test(c.style.cursor || "");
|
|
2978
|
+
}();
|
|
2979
|
+
this.setCursor = function(c, F, I) {
|
|
2980
|
+
if (d) {
|
|
2981
|
+
var E = c.toDataURL("image/png");
|
|
2982
|
+
return e.style.cursor = "url(" + E + ") " + F + " " + I + ", auto", !0;
|
|
2983
|
+
}
|
|
2984
|
+
return !1;
|
|
2985
|
+
};
|
|
2986
|
+
};
|
|
2987
|
+
n.Mouse.State = function(e) {
|
|
2988
|
+
var t = function(u, i, v, p, d, c, F) {
|
|
2989
|
+
return {
|
|
2990
|
+
x: u,
|
|
2991
|
+
y: i,
|
|
2992
|
+
left: v,
|
|
2993
|
+
middle: p,
|
|
2994
|
+
right: d,
|
|
2995
|
+
up: c,
|
|
2996
|
+
down: F
|
|
2997
|
+
};
|
|
2998
|
+
};
|
|
2999
|
+
arguments.length > 1 ? e = t.apply(this, arguments) : e = e || {}, n.Position.call(this, e), this.left = e.left || !1, this.middle = e.middle || !1, this.right = e.right || !1, this.up = e.up || !1, this.down = e.down || !1;
|
|
3000
|
+
};
|
|
3001
|
+
n.Mouse.State.Buttons = {
|
|
3002
|
+
/**
|
|
3003
|
+
* The name of the {@link Guacamole.Mouse.State} property representing the
|
|
3004
|
+
* left mouse button.
|
|
3005
|
+
*
|
|
3006
|
+
* @constant
|
|
3007
|
+
* @type {!string}
|
|
3008
|
+
*/
|
|
3009
|
+
LEFT: "left",
|
|
3010
|
+
/**
|
|
3011
|
+
* The name of the {@link Guacamole.Mouse.State} property representing the
|
|
3012
|
+
* middle mouse button.
|
|
3013
|
+
*
|
|
3014
|
+
* @constant
|
|
3015
|
+
* @type {!string}
|
|
3016
|
+
*/
|
|
3017
|
+
MIDDLE: "middle",
|
|
3018
|
+
/**
|
|
3019
|
+
* The name of the {@link Guacamole.Mouse.State} property representing the
|
|
3020
|
+
* right mouse button.
|
|
3021
|
+
*
|
|
3022
|
+
* @constant
|
|
3023
|
+
* @type {!string}
|
|
3024
|
+
*/
|
|
3025
|
+
RIGHT: "right",
|
|
3026
|
+
/**
|
|
3027
|
+
* The name of the {@link Guacamole.Mouse.State} property representing the
|
|
3028
|
+
* up mouse button (the fourth mouse button, clicked when the mouse scroll
|
|
3029
|
+
* wheel is scrolled up).
|
|
3030
|
+
*
|
|
3031
|
+
* @constant
|
|
3032
|
+
* @type {!string}
|
|
3033
|
+
*/
|
|
3034
|
+
UP: "up",
|
|
3035
|
+
/**
|
|
3036
|
+
* The name of the {@link Guacamole.Mouse.State} property representing the
|
|
3037
|
+
* down mouse button (the fifth mouse button, clicked when the mouse scroll
|
|
3038
|
+
* wheel is scrolled up).
|
|
3039
|
+
*
|
|
3040
|
+
* @constant
|
|
3041
|
+
* @type {!string}
|
|
3042
|
+
*/
|
|
3043
|
+
DOWN: "down"
|
|
3044
|
+
};
|
|
3045
|
+
n.Mouse.Event = function(e, t, l) {
|
|
3046
|
+
n.Event.DOMEvent.call(this, e, l);
|
|
3047
|
+
var u = "on" + this.type;
|
|
3048
|
+
this.state = t, this.invokeLegacyHandler = function(v) {
|
|
3049
|
+
v[u] && (this.preventDefault(), this.stopPropagation(), v[u](this.state));
|
|
3050
|
+
};
|
|
3051
|
+
};
|
|
3052
|
+
n.Mouse.Event.Target = function() {
|
|
3053
|
+
n.Event.Target.call(this), this.currentState = new n.Mouse.State(), this.press = function(t, l) {
|
|
3054
|
+
this.currentState[t] || (this.currentState[t] = !0, this.dispatch(new n.Mouse.Event("mousedown", this.currentState, l)));
|
|
3055
|
+
}, this.release = function(t, l) {
|
|
3056
|
+
this.currentState[t] && (this.currentState[t] = !1, this.dispatch(new n.Mouse.Event("mouseup", this.currentState, l)));
|
|
3057
|
+
}, this.click = function(t, l) {
|
|
3058
|
+
this.press(t, l), this.release(t, l);
|
|
3059
|
+
}, this.move = function(t, l) {
|
|
3060
|
+
(this.currentState.x !== t.x || this.currentState.y !== t.y) && (this.currentState.x = t.x, this.currentState.y = t.y, this.dispatch(new n.Mouse.Event("mousemove", this.currentState, l)));
|
|
3061
|
+
}, this.out = function(t) {
|
|
3062
|
+
this.dispatch(new n.Mouse.Event("mouseout", this.currentState, t));
|
|
3063
|
+
}, this.reset = function(t) {
|
|
3064
|
+
for (var l in n.Mouse.State.Buttons)
|
|
3065
|
+
this.release(n.Mouse.State.Buttons[l], t);
|
|
3066
|
+
};
|
|
3067
|
+
};
|
|
3068
|
+
n.Mouse.Touchpad = function(e) {
|
|
3069
|
+
n.Mouse.Event.Target.call(this);
|
|
3070
|
+
var t = this;
|
|
3071
|
+
this.scrollThreshold = 20 * (window.devicePixelRatio || 1), this.clickTimingThreshold = 250, this.clickMoveThreshold = 10 * (window.devicePixelRatio || 1), this.currentState = new n.Mouse.State();
|
|
3072
|
+
var l = 0, u = 0, i = 0, v = 0, p = 0, d = {
|
|
3073
|
+
1: "left",
|
|
3074
|
+
2: "right",
|
|
3075
|
+
3: "middle"
|
|
3076
|
+
}, c = !1, F = null;
|
|
3077
|
+
e.addEventListener("touchend", function(I) {
|
|
3078
|
+
if (I.preventDefault(), c && I.touches.length === 0) {
|
|
3079
|
+
var E = (/* @__PURE__ */ new Date()).getTime(), T = d[l];
|
|
3080
|
+
t.currentState[T] && (t.release(T, I), F && (window.clearTimeout(F), F = null)), E - v <= t.clickTimingThreshold && p < t.clickMoveThreshold && (t.press(T, I), F = window.setTimeout(function() {
|
|
3081
|
+
t.release(T, I), c = !1;
|
|
3082
|
+
}, t.clickTimingThreshold)), F || (c = !1);
|
|
3083
|
+
}
|
|
3084
|
+
}, !1), e.addEventListener("touchstart", function(I) {
|
|
3085
|
+
if (I.preventDefault(), l = Math.min(I.touches.length, 3), F && (window.clearTimeout(F), F = null), !c) {
|
|
3086
|
+
c = !0;
|
|
3087
|
+
var E = I.touches[0];
|
|
3088
|
+
u = E.clientX, i = E.clientY, v = (/* @__PURE__ */ new Date()).getTime(), p = 0;
|
|
3089
|
+
}
|
|
3090
|
+
}, !1), e.addEventListener("touchmove", function(I) {
|
|
3091
|
+
I.preventDefault();
|
|
3092
|
+
var E = I.touches[0], T = E.clientX - u, L = E.clientY - i;
|
|
3093
|
+
if (p += Math.abs(T) + Math.abs(L), l === 1) {
|
|
3094
|
+
var M = p / ((/* @__PURE__ */ new Date()).getTime() - v), k = 1 + M, m = new n.Position(t.currentState);
|
|
3095
|
+
m.x += T * k, m.y += L * k, m.x = Math.min(Math.max(0, m.x), e.offsetWidth - 1), m.y = Math.min(Math.max(0, m.y), e.offsetHeight - 1), t.move(m, I), u = E.clientX, i = E.clientY;
|
|
3096
|
+
} else if (l === 2 && Math.abs(L) >= t.scrollThreshold) {
|
|
3097
|
+
var g;
|
|
3098
|
+
L > 0 ? g = "down" : g = "up", t.click(g, I), u = E.clientX, i = E.clientY;
|
|
3099
|
+
}
|
|
3100
|
+
}, !1);
|
|
3101
|
+
};
|
|
3102
|
+
n.Mouse.Touchscreen = function(e) {
|
|
3103
|
+
n.Mouse.Event.Target.call(this);
|
|
3104
|
+
var t = this, l = !1, u = null, i = null, v = null, p = null;
|
|
3105
|
+
this.scrollThreshold = 20 * (window.devicePixelRatio || 1), this.clickTimingThreshold = 250, this.clickMoveThreshold = 16 * (window.devicePixelRatio || 1), this.longPressThreshold = 500;
|
|
3106
|
+
function d(I) {
|
|
3107
|
+
var E = I.touches[0] || I.changedTouches[0], T = E.clientX - u, L = E.clientY - i;
|
|
3108
|
+
return Math.sqrt(T * T + L * L) >= t.clickMoveThreshold;
|
|
3109
|
+
}
|
|
3110
|
+
function c(I) {
|
|
3111
|
+
var E = I.touches[0];
|
|
3112
|
+
l = !0, u = E.clientX, i = E.clientY;
|
|
3113
|
+
}
|
|
3114
|
+
function F() {
|
|
3115
|
+
window.clearTimeout(v), window.clearTimeout(p), l = !1;
|
|
3116
|
+
}
|
|
3117
|
+
e.addEventListener("touchend", function(I) {
|
|
3118
|
+
if (l) {
|
|
3119
|
+
if (I.touches.length !== 0 || I.changedTouches.length !== 1) {
|
|
3120
|
+
F();
|
|
3121
|
+
return;
|
|
3122
|
+
}
|
|
3123
|
+
if (window.clearTimeout(p), t.release(n.Mouse.State.Buttons.LEFT, I), !d(I) && (I.preventDefault(), !t.currentState.left)) {
|
|
3124
|
+
var E = I.changedTouches[0];
|
|
3125
|
+
t.move(n.Position.fromClientPosition(e, E.clientX, E.clientY)), t.press(n.Mouse.State.Buttons.LEFT, I), v = window.setTimeout(function() {
|
|
3126
|
+
t.release(n.Mouse.State.Buttons.LEFT, I), F();
|
|
3127
|
+
}, t.clickTimingThreshold);
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
}, !1), e.addEventListener("touchstart", function(I) {
|
|
3131
|
+
if (I.touches.length !== 1) {
|
|
3132
|
+
F();
|
|
3133
|
+
return;
|
|
3134
|
+
}
|
|
3135
|
+
I.preventDefault(), c(I), window.clearTimeout(v), p = window.setTimeout(function() {
|
|
3136
|
+
var E = I.touches[0];
|
|
3137
|
+
t.move(n.Position.fromClientPosition(e, E.clientX, E.clientY)), t.click(n.Mouse.State.Buttons.RIGHT, I), F();
|
|
3138
|
+
}, t.longPressThreshold);
|
|
3139
|
+
}, !1), e.addEventListener("touchmove", function(I) {
|
|
3140
|
+
if (l) {
|
|
3141
|
+
if (d(I) && window.clearTimeout(p), I.touches.length !== 1) {
|
|
3142
|
+
F();
|
|
3143
|
+
return;
|
|
3144
|
+
}
|
|
3145
|
+
if (t.currentState.left) {
|
|
3146
|
+
I.preventDefault();
|
|
3147
|
+
var E = I.touches[0];
|
|
3148
|
+
t.move(n.Position.fromClientPosition(e, E.clientX, E.clientY), I);
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
}, !1);
|
|
3152
|
+
};
|
|
3153
|
+
var n = n || {}, n = n || {};
|
|
3154
|
+
n.Object = function(e, t) {
|
|
3155
|
+
var l = this, u = {}, i = function(d) {
|
|
3156
|
+
var c = u[d];
|
|
3157
|
+
if (!c)
|
|
3158
|
+
return null;
|
|
3159
|
+
var F = c.shift();
|
|
3160
|
+
return c.length === 0 && delete u[d], F;
|
|
3161
|
+
}, v = function(d, c) {
|
|
3162
|
+
var F = u[d];
|
|
3163
|
+
F || (F = [], u[d] = F), F.push(c);
|
|
3164
|
+
};
|
|
3165
|
+
this.index = t, this.onbody = function(d, c, F) {
|
|
3166
|
+
var I = i(F);
|
|
3167
|
+
I && I(d, c);
|
|
3168
|
+
}, this.onundefine = null, this.requestInputStream = function(d, c) {
|
|
3169
|
+
c && v(d, c), e.requestObjectInputStream(l.index, d);
|
|
3170
|
+
}, this.createOutputStream = function(d, c) {
|
|
3171
|
+
return e.createObjectOutputStream(l.index, d, c);
|
|
3172
|
+
};
|
|
3173
|
+
};
|
|
3174
|
+
n.Object.ROOT_STREAM = "/";
|
|
3175
|
+
n.Object.STREAM_INDEX_MIMETYPE = "application/vnd.glyptodon.guacamole.stream-index+json";
|
|
3176
|
+
var n = n || {};
|
|
3177
|
+
n.OnScreenKeyboard = function(r) {
|
|
3178
|
+
var e = this, t = {}, l = {}, u = [], i = function(s, f) {
|
|
3179
|
+
s.classList ? s.classList.add(f) : s.className += " " + f;
|
|
3180
|
+
}, v = function(s, f) {
|
|
3181
|
+
s.classList ? s.classList.remove(f) : s.className = s.className.replace(
|
|
3182
|
+
/([^ ]+)[ ]*/g,
|
|
3183
|
+
function(S, C) {
|
|
3184
|
+
return C === f ? "" : S;
|
|
3185
|
+
}
|
|
3186
|
+
);
|
|
3187
|
+
}, p = 0, d = function(s, f, y, S) {
|
|
3188
|
+
this.width = f, this.height = y, this.scale = function(C) {
|
|
3189
|
+
s.style.width = f * C + "px", s.style.height = y * C + "px", S && (s.style.lineHeight = y * C + "px", s.style.fontSize = C + "px");
|
|
3190
|
+
};
|
|
3191
|
+
}, c = function(s) {
|
|
3192
|
+
for (var f = 0; f < s.length; f++) {
|
|
3193
|
+
var y = s[f];
|
|
3194
|
+
if (!(y in t))
|
|
3195
|
+
return !1;
|
|
3196
|
+
}
|
|
3197
|
+
return !0;
|
|
3198
|
+
}, F = function(s) {
|
|
3199
|
+
var f = e.keys[s];
|
|
3200
|
+
if (!f)
|
|
3201
|
+
return null;
|
|
3202
|
+
for (var y = f.length - 1; y >= 0; y--) {
|
|
3203
|
+
var S = f[y];
|
|
3204
|
+
if (c(S.requires))
|
|
3205
|
+
return S;
|
|
3206
|
+
}
|
|
3207
|
+
return null;
|
|
3208
|
+
}, I = function(s, f) {
|
|
3209
|
+
if (!l[s]) {
|
|
3210
|
+
i(f, "guac-keyboard-pressed");
|
|
3211
|
+
var y = F(s);
|
|
3212
|
+
if (y.modifier) {
|
|
3213
|
+
var S = "guac-keyboard-modifier-" + k(y.modifier), C = t[y.modifier];
|
|
3214
|
+
C === void 0 ? (i(T, S), t[y.modifier] = y.keysym, y.keysym && e.onkeydown && e.onkeydown(y.keysym)) : (v(T, S), delete t[y.modifier], C && e.onkeyup && e.onkeyup(C));
|
|
3215
|
+
} else e.onkeydown && e.onkeydown(y.keysym);
|
|
3216
|
+
l[s] = !0;
|
|
3217
|
+
}
|
|
3218
|
+
}, E = function(s, f) {
|
|
3219
|
+
if (l[s]) {
|
|
3220
|
+
v(f, "guac-keyboard-pressed");
|
|
3221
|
+
var y = F(s);
|
|
3222
|
+
!y.modifier && e.onkeyup && e.onkeyup(y.keysym), l[s] = !1;
|
|
3223
|
+
}
|
|
3224
|
+
}, T = document.createElement("div");
|
|
3225
|
+
T.className = "guac-keyboard", T.onselectstart = T.onmousemove = T.onmouseup = T.onmousedown = function(s) {
|
|
3226
|
+
return p && p--, s.stopPropagation(), !1;
|
|
3227
|
+
}, this.touchMouseThreshold = 3, this.onkeydown = null, this.onkeyup = null, this.layout = new n.OnScreenKeyboard.Layout(r), this.getElement = function() {
|
|
3228
|
+
return T;
|
|
3229
|
+
}, this.resize = function(g) {
|
|
3230
|
+
for (var s = Math.floor(g * 10 / e.layout.width) / 10, f = 0; f < u.length; f++) {
|
|
3231
|
+
var y = u[f];
|
|
3232
|
+
y.scale(s);
|
|
3233
|
+
}
|
|
3234
|
+
};
|
|
3235
|
+
var L = function(s, f) {
|
|
3236
|
+
if (f instanceof Array) {
|
|
3237
|
+
for (var y = [], S = 0; S < f.length; S++)
|
|
3238
|
+
y.push(new n.OnScreenKeyboard.Key(f[S], s));
|
|
3239
|
+
return y;
|
|
3240
|
+
}
|
|
3241
|
+
return typeof f == "number" ? [new n.OnScreenKeyboard.Key({
|
|
3242
|
+
name: s,
|
|
3243
|
+
keysym: f
|
|
3244
|
+
})] : typeof f == "string" ? [new n.OnScreenKeyboard.Key({
|
|
3245
|
+
name: s,
|
|
3246
|
+
title: f
|
|
3247
|
+
})] : [new n.OnScreenKeyboard.Key(f, s)];
|
|
3248
|
+
}, M = function(s) {
|
|
3249
|
+
var f = {};
|
|
3250
|
+
for (var y in r.keys)
|
|
3251
|
+
f[y] = L(y, s[y]);
|
|
3252
|
+
return f;
|
|
3253
|
+
};
|
|
3254
|
+
this.keys = M(r.keys);
|
|
3255
|
+
var k = function(s) {
|
|
3256
|
+
var f = s.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[^A-Za-z0-9]+/g, "-").toLowerCase();
|
|
3257
|
+
return f;
|
|
3258
|
+
}, m = function g(s, f, y) {
|
|
3259
|
+
var S, C = document.createElement("div");
|
|
3260
|
+
if (y && i(C, "guac-keyboard-" + k(y)), f instanceof Array)
|
|
3261
|
+
for (i(C, "guac-keyboard-group"), S = 0; S < f.length; S++)
|
|
3262
|
+
g(C, f[S]);
|
|
3263
|
+
else if (f instanceof Object) {
|
|
3264
|
+
i(C, "guac-keyboard-group");
|
|
3265
|
+
var _ = Object.keys(f).sort();
|
|
3266
|
+
for (S = 0; S < _.length; S++) {
|
|
3267
|
+
var y = _[S];
|
|
3268
|
+
g(C, f[y], y);
|
|
3269
|
+
}
|
|
3270
|
+
} else if (typeof f == "number")
|
|
3271
|
+
i(C, "guac-keyboard-gap"), u.push(new d(C, f, f));
|
|
3272
|
+
else if (typeof f == "string") {
|
|
3273
|
+
var x = f;
|
|
3274
|
+
x.length === 1 && (x = "0x" + x.charCodeAt(0).toString(16)), i(C, "guac-keyboard-key-container");
|
|
3275
|
+
var O = document.createElement("div");
|
|
3276
|
+
O.className = "guac-keyboard-key guac-keyboard-key-" + k(x);
|
|
3277
|
+
var a = e.keys[f];
|
|
3278
|
+
if (a)
|
|
3279
|
+
for (S = 0; S < a.length; S++) {
|
|
3280
|
+
var o = a[S], h = document.createElement("div");
|
|
3281
|
+
h.className = "guac-keyboard-cap", h.textContent = o.title;
|
|
3282
|
+
for (var b = 0; b < o.requires.length; b++) {
|
|
3283
|
+
var P = o.requires[b];
|
|
3284
|
+
i(h, "guac-keyboard-requires-" + k(P)), i(O, "guac-keyboard-uses-" + k(P));
|
|
3285
|
+
}
|
|
3286
|
+
O.appendChild(h);
|
|
3287
|
+
}
|
|
3288
|
+
C.appendChild(O), u.push(new d(C, e.layout.keyWidths[f] || 1, 1, !0));
|
|
3289
|
+
var A = function(B) {
|
|
3290
|
+
B.preventDefault(), p = e.touchMouseThreshold, I(f, O);
|
|
3291
|
+
}, D = function(B) {
|
|
3292
|
+
B.preventDefault(), p = e.touchMouseThreshold, E(f, O);
|
|
3293
|
+
}, R = function(B) {
|
|
3294
|
+
B.preventDefault(), p === 0 && I(f, O);
|
|
3295
|
+
}, w = function(B) {
|
|
3296
|
+
B.preventDefault(), p === 0 && E(f, O);
|
|
3297
|
+
};
|
|
3298
|
+
O.addEventListener("touchstart", A, !0), O.addEventListener("touchend", D, !0), O.addEventListener("mousedown", R, !0), O.addEventListener("mouseup", w, !0), O.addEventListener("mouseout", w, !0);
|
|
3299
|
+
}
|
|
3300
|
+
s.appendChild(C);
|
|
3301
|
+
};
|
|
3302
|
+
m(T, r.layout);
|
|
3303
|
+
};
|
|
3304
|
+
n.OnScreenKeyboard.Layout = function(r) {
|
|
3305
|
+
this.language = r.language, this.type = r.type, this.keys = r.keys, this.layout = r.layout, this.width = r.width, this.keyWidths = r.keyWidths || {};
|
|
3306
|
+
};
|
|
3307
|
+
n.OnScreenKeyboard.Key = function(r, e) {
|
|
3308
|
+
this.name = e || r.name, this.title = r.title || this.name, this.keysym = r.keysym || function(l) {
|
|
3309
|
+
if (!l || l.length !== 1)
|
|
3310
|
+
return null;
|
|
3311
|
+
var u = l.charCodeAt(0);
|
|
3312
|
+
return u >= 0 && u <= 255 ? u : u >= 256 && u <= 1114111 ? 16777216 | u : null;
|
|
3313
|
+
}(this.title), this.modifier = r.modifier, this.requires = r.requires || [];
|
|
3314
|
+
};
|
|
3315
|
+
var n = n || {};
|
|
3316
|
+
n.OutputStream = function(r, e) {
|
|
3317
|
+
var t = this;
|
|
3318
|
+
this.index = e, this.onack = null, this.sendBlob = function(l) {
|
|
3319
|
+
r.sendBlob(t.index, l);
|
|
3320
|
+
}, this.sendEnd = function() {
|
|
3321
|
+
r.endStream(t.index);
|
|
3322
|
+
};
|
|
3323
|
+
};
|
|
3324
|
+
var n = n || {};
|
|
3325
|
+
n.Parser = function() {
|
|
3326
|
+
var r = this, e = "", t = [], l = -1, u = 0;
|
|
3327
|
+
this.receive = function(i) {
|
|
3328
|
+
for (u > 4096 && l >= u && (e = e.substring(u), l -= u, u = 0), e += i; l < e.length; ) {
|
|
3329
|
+
if (l >= u) {
|
|
3330
|
+
var v = e.substring(u, l), p = e.substring(l, l + 1);
|
|
3331
|
+
if (t.push(v), p == ";") {
|
|
3332
|
+
var d = t.shift();
|
|
3333
|
+
r.oninstruction != null && r.oninstruction(d, t), t.length = 0;
|
|
3334
|
+
} else if (p != ",")
|
|
3335
|
+
throw new Error("Illegal terminator.");
|
|
3336
|
+
u = l + 1;
|
|
3337
|
+
}
|
|
3338
|
+
var c = e.indexOf(".", u);
|
|
3339
|
+
if (c != -1) {
|
|
3340
|
+
var F = parseInt(e.substring(l + 1, c));
|
|
3341
|
+
if (isNaN(F))
|
|
3342
|
+
throw new Error("Non-numeric character in element length.");
|
|
3343
|
+
u = c + 1, l = u + F;
|
|
3344
|
+
} else {
|
|
3345
|
+
u = e.length;
|
|
3346
|
+
break;
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
}, this.oninstruction = null;
|
|
3350
|
+
};
|
|
3351
|
+
var n = n || {};
|
|
3352
|
+
n.Position = function(e) {
|
|
3353
|
+
e = e || {}, this.x = e.x || 0, this.y = e.y || 0, this.fromClientPosition = function(l, u, i) {
|
|
3354
|
+
this.x = u - l.offsetLeft, this.y = i - l.offsetTop;
|
|
3355
|
+
for (var v = l.offsetParent; v && v !== document.body; )
|
|
3356
|
+
this.x -= v.offsetLeft - v.scrollLeft, this.y -= v.offsetTop - v.scrollTop, v = v.offsetParent;
|
|
3357
|
+
if (v) {
|
|
3358
|
+
var p = document.body.scrollLeft || document.documentElement.scrollLeft, d = document.body.scrollTop || document.documentElement.scrollTop;
|
|
3359
|
+
this.x -= v.offsetLeft - p, this.y -= v.offsetTop - d;
|
|
3360
|
+
}
|
|
3361
|
+
};
|
|
3362
|
+
};
|
|
3363
|
+
n.Position.fromClientPosition = function(e, t, l) {
|
|
3364
|
+
var u = new n.Position();
|
|
3365
|
+
return u.fromClientPosition(e, t, l), u;
|
|
3366
|
+
};
|
|
3367
|
+
var n = n || {};
|
|
3368
|
+
n.RawAudioFormat = function(e) {
|
|
3369
|
+
this.bytesPerSample = e.bytesPerSample, this.channels = e.channels, this.rate = e.rate;
|
|
3370
|
+
};
|
|
3371
|
+
n.RawAudioFormat.parse = function(e) {
|
|
3372
|
+
var t, l = null, u = 1;
|
|
3373
|
+
if (e.substring(0, 9) === "audio/L8;")
|
|
3374
|
+
e = e.substring(9), t = 1;
|
|
3375
|
+
else if (e.substring(0, 10) === "audio/L16;")
|
|
3376
|
+
e = e.substring(10), t = 2;
|
|
3377
|
+
else
|
|
3378
|
+
return null;
|
|
3379
|
+
for (var i = e.split(","), v = 0; v < i.length; v++) {
|
|
3380
|
+
var p = i[v], d = p.indexOf("=");
|
|
3381
|
+
if (d === -1)
|
|
3382
|
+
return null;
|
|
3383
|
+
var c = p.substring(0, d), F = p.substring(d + 1);
|
|
3384
|
+
switch (c) {
|
|
3385
|
+
case "channels":
|
|
3386
|
+
u = parseInt(F);
|
|
3387
|
+
break;
|
|
3388
|
+
case "rate":
|
|
3389
|
+
l = parseInt(F);
|
|
3390
|
+
break;
|
|
3391
|
+
default:
|
|
3392
|
+
return null;
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
return l === null ? null : new n.RawAudioFormat({
|
|
3396
|
+
bytesPerSample: t,
|
|
3397
|
+
channels: u,
|
|
3398
|
+
rate: l
|
|
3399
|
+
});
|
|
3400
|
+
};
|
|
3401
|
+
var n = n || {};
|
|
3402
|
+
n.SessionRecording = function(e) {
|
|
3403
|
+
var t = this, l, u = null, i = 262144, v = 16384, p = 5e3, d = [], c = 0, F = new n.SessionRecording._PlaybackTunnel(), I = new n.Client(F), E = -1, T = null, L = null, M = null, k = 0, m = 0, g = !1, s = null, f = function(D, R, w) {
|
|
3404
|
+
if (!(g && D === l)) {
|
|
3405
|
+
var W = new n.Parser();
|
|
3406
|
+
W.oninstruction = R;
|
|
3407
|
+
var B = 0, z = new FileReader(), U = function() {
|
|
3408
|
+
if (!(g && D === l)) {
|
|
3409
|
+
if (z.readyState === 2)
|
|
3410
|
+
try {
|
|
3411
|
+
W.receive(z.result);
|
|
3412
|
+
} catch (J) {
|
|
3413
|
+
t.onerror && t.onerror(J.message);
|
|
3414
|
+
return;
|
|
3415
|
+
}
|
|
3416
|
+
if (B >= D.size)
|
|
3417
|
+
w && w();
|
|
3418
|
+
else {
|
|
3419
|
+
var Q = D.slice(B, B + i);
|
|
3420
|
+
B += Q.size, z.readAsText(Q);
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
};
|
|
3424
|
+
z.onload = U, U();
|
|
3425
|
+
}
|
|
3426
|
+
}, y = function(D) {
|
|
3427
|
+
for (var R = D.length, w = R + 3; R >= 10; )
|
|
3428
|
+
w++, R = Math.floor(R / 10);
|
|
3429
|
+
return w;
|
|
3430
|
+
};
|
|
3431
|
+
I.connect(), I.getDisplay().showCursor(!1);
|
|
3432
|
+
var S = function(D, R) {
|
|
3433
|
+
m += y(D);
|
|
3434
|
+
for (var w = 0; w < R.length; w++)
|
|
3435
|
+
m += y(R[w]);
|
|
3436
|
+
if (D === "sync") {
|
|
3437
|
+
var W = parseInt(R[0]), B = new n.SessionRecording._Frame(W, k, m);
|
|
3438
|
+
d.push(B), k = m, (d.length === 1 || m - d[c].start >= v && W - d[c].timestamp >= p) && (B.keyframe = !0, c = d.length - 1), t.onprogress && t.onprogress(t.getDuration(), m);
|
|
3439
|
+
}
|
|
3440
|
+
}, C = function() {
|
|
3441
|
+
t.onload && t.onload();
|
|
3442
|
+
};
|
|
3443
|
+
if (e instanceof Blob)
|
|
3444
|
+
f(l, S, C);
|
|
3445
|
+
else {
|
|
3446
|
+
u = e, l = new Blob();
|
|
3447
|
+
var _ = !1, x = "";
|
|
3448
|
+
u.oninstruction = function(D, R) {
|
|
3449
|
+
x += D.length + "." + D, R.forEach(function(W) {
|
|
3450
|
+
x += "," + W.length + "." + W;
|
|
3451
|
+
}), x += ";", x.length >= i && (l = new Blob([l, x]), x = ""), S(D, R);
|
|
3452
|
+
}, u.onerror = function(D) {
|
|
3453
|
+
_ = !0, t.onerror && t.onerror(D.message);
|
|
3454
|
+
}, u.onstatechange = function(D) {
|
|
3455
|
+
D === n.Tunnel.State.CLOSED && (x.length && (l = new Blob([l, x]), x = ""), _ || C());
|
|
3456
|
+
};
|
|
3457
|
+
}
|
|
3458
|
+
var O = function(D) {
|
|
3459
|
+
return d.length === 0 ? 0 : D - d[0].timestamp;
|
|
3460
|
+
}, a = function A(D, R, w) {
|
|
3461
|
+
if (D === R)
|
|
3462
|
+
return D;
|
|
3463
|
+
var W = Math.floor((D + R) / 2), B = O(d[W].timestamp);
|
|
3464
|
+
return w < B && W > D ? A(D, W - 1, w) : w > B && W < R ? A(W + 1, R, w) : W;
|
|
3465
|
+
}, o = function(D, R) {
|
|
3466
|
+
var w = d[D];
|
|
3467
|
+
f(l.slice(w.start, w.end), function(B, z) {
|
|
3468
|
+
F.receiveInstruction(B, z);
|
|
3469
|
+
}, function() {
|
|
3470
|
+
w.keyframe && !w.clientState && I.exportState(function(z) {
|
|
3471
|
+
w.clientState = new Blob([JSON.stringify(z)]);
|
|
3472
|
+
}), E = D, R && R();
|
|
3473
|
+
});
|
|
3474
|
+
}, h = function(D, R, w) {
|
|
3475
|
+
b();
|
|
3476
|
+
for (var W = M = {
|
|
3477
|
+
aborted: !1
|
|
3478
|
+
}, B = D, z = function Q() {
|
|
3479
|
+
t.onseek && E > B && t.onseek(
|
|
3480
|
+
O(d[E].timestamp),
|
|
3481
|
+
E - B,
|
|
3482
|
+
D - B
|
|
3483
|
+
), !W.aborted && (E < D ? o(E + 1, Q) : R());
|
|
3484
|
+
}, U = function() {
|
|
3485
|
+
var J = w ? Math.max(w - (/* @__PURE__ */ new Date()).getTime(), 0) : 0;
|
|
3486
|
+
J ? window.setTimeout(z, J) : z();
|
|
3487
|
+
}; B >= 0; B--) {
|
|
3488
|
+
var H = d[B];
|
|
3489
|
+
if (B === E)
|
|
3490
|
+
break;
|
|
3491
|
+
if (H.clientState) {
|
|
3492
|
+
H.clientState.text().then(function(J) {
|
|
3493
|
+
I.importState(JSON.parse(J)), E = B, U();
|
|
3494
|
+
});
|
|
3495
|
+
return;
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
U();
|
|
3499
|
+
}, b = function() {
|
|
3500
|
+
M && (M.aborted = !0, M = null);
|
|
3501
|
+
}, P = function A() {
|
|
3502
|
+
if (E + 1 < d.length) {
|
|
3503
|
+
var D = d[E + 1], R = D.timestamp - T + L;
|
|
3504
|
+
h(E + 1, function() {
|
|
3505
|
+
A();
|
|
3506
|
+
}, R);
|
|
3507
|
+
} else
|
|
3508
|
+
t.pause();
|
|
3509
|
+
};
|
|
3510
|
+
this.onload = null, this.onerror = null, this.onabort = null, this.onprogress = null, this.onplay = null, this.onpause = null, this.onseek = null, this.connect = function(D) {
|
|
3511
|
+
u && u.connect(D);
|
|
3512
|
+
}, this.disconnect = function() {
|
|
3513
|
+
u && u.disconnect();
|
|
3514
|
+
}, this.abort = function() {
|
|
3515
|
+
g || (g = !0, t.onabort && t.onabort(), u && u.disconnect());
|
|
3516
|
+
}, this.getDisplay = function() {
|
|
3517
|
+
return I.getDisplay();
|
|
3518
|
+
}, this.isPlaying = function() {
|
|
3519
|
+
return !!T;
|
|
3520
|
+
}, this.getPosition = function() {
|
|
3521
|
+
return E === -1 ? 0 : O(d[E].timestamp);
|
|
3522
|
+
}, this.getDuration = function() {
|
|
3523
|
+
return d.length === 0 ? 0 : O(d[d.length - 1].timestamp);
|
|
3524
|
+
}, this.play = function() {
|
|
3525
|
+
if (!t.isPlaying() && E + 1 < d.length) {
|
|
3526
|
+
t.onplay && t.onplay();
|
|
3527
|
+
var D = d[E + 1];
|
|
3528
|
+
T = D.timestamp, L = (/* @__PURE__ */ new Date()).getTime(), P();
|
|
3529
|
+
}
|
|
3530
|
+
}, this.seek = function(D, R) {
|
|
3531
|
+
if (d.length !== 0) {
|
|
3532
|
+
t.cancel();
|
|
3533
|
+
var w = t.isPlaying();
|
|
3534
|
+
t.pause(), s = function() {
|
|
3535
|
+
s = null, w && (t.play(), w = null), R && R();
|
|
3536
|
+
}, h(a(0, d.length - 1, D), s);
|
|
3537
|
+
}
|
|
3538
|
+
}, this.cancel = function() {
|
|
3539
|
+
s && (b(), s());
|
|
3540
|
+
}, this.pause = function() {
|
|
3541
|
+
b(), t.isPlaying() && (t.onpause && t.onpause(), T = null, L = null);
|
|
3542
|
+
};
|
|
3543
|
+
};
|
|
3544
|
+
n.SessionRecording._Frame = function(e, t, l) {
|
|
3545
|
+
this.keyframe = !1, this.timestamp = e, this.start = t, this.end = l, this.clientState = null;
|
|
3546
|
+
};
|
|
3547
|
+
n.SessionRecording._PlaybackTunnel = function() {
|
|
3548
|
+
var e = this;
|
|
3549
|
+
this.connect = function(l) {
|
|
3550
|
+
}, this.sendMessage = function(l) {
|
|
3551
|
+
}, this.disconnect = function() {
|
|
3552
|
+
}, this.receiveInstruction = function(l, u) {
|
|
3553
|
+
e.oninstruction && e.oninstruction(l, u);
|
|
3554
|
+
};
|
|
3555
|
+
};
|
|
3556
|
+
var n = n || {};
|
|
3557
|
+
n.Status = function(r, e) {
|
|
3558
|
+
var t = this;
|
|
3559
|
+
this.code = r, this.message = e, this.isError = function() {
|
|
3560
|
+
return t.code < 0 || t.code > 255;
|
|
3561
|
+
};
|
|
3562
|
+
};
|
|
3563
|
+
n.Status.Code = {
|
|
3564
|
+
/**
|
|
3565
|
+
* The operation succeeded.
|
|
3566
|
+
*
|
|
3567
|
+
* @type {!number}
|
|
3568
|
+
*/
|
|
3569
|
+
SUCCESS: 0,
|
|
3570
|
+
/**
|
|
3571
|
+
* The requested operation is unsupported.
|
|
3572
|
+
*
|
|
3573
|
+
* @type {!number}
|
|
3574
|
+
*/
|
|
3575
|
+
UNSUPPORTED: 256,
|
|
3576
|
+
/**
|
|
3577
|
+
* The operation could not be performed due to an internal failure.
|
|
3578
|
+
*
|
|
3579
|
+
* @type {!number}
|
|
3580
|
+
*/
|
|
3581
|
+
SERVER_ERROR: 512,
|
|
3582
|
+
/**
|
|
3583
|
+
* The operation could not be performed as the server is busy.
|
|
3584
|
+
*
|
|
3585
|
+
* @type {!number}
|
|
3586
|
+
*/
|
|
3587
|
+
SERVER_BUSY: 513,
|
|
3588
|
+
/**
|
|
3589
|
+
* The operation could not be performed because the upstream server is not
|
|
3590
|
+
* responding.
|
|
3591
|
+
*
|
|
3592
|
+
* @type {!number}
|
|
3593
|
+
*/
|
|
3594
|
+
UPSTREAM_TIMEOUT: 514,
|
|
3595
|
+
/**
|
|
3596
|
+
* The operation was unsuccessful due to an error or otherwise unexpected
|
|
3597
|
+
* condition of the upstream server.
|
|
3598
|
+
*
|
|
3599
|
+
* @type {!number}
|
|
3600
|
+
*/
|
|
3601
|
+
UPSTREAM_ERROR: 515,
|
|
3602
|
+
/**
|
|
3603
|
+
* The operation could not be performed as the requested resource does not
|
|
3604
|
+
* exist.
|
|
3605
|
+
*
|
|
3606
|
+
* @type {!number}
|
|
3607
|
+
*/
|
|
3608
|
+
RESOURCE_NOT_FOUND: 516,
|
|
3609
|
+
/**
|
|
3610
|
+
* The operation could not be performed as the requested resource is
|
|
3611
|
+
* already in use.
|
|
3612
|
+
*
|
|
3613
|
+
* @type {!number}
|
|
3614
|
+
*/
|
|
3615
|
+
RESOURCE_CONFLICT: 517,
|
|
3616
|
+
/**
|
|
3617
|
+
* The operation could not be performed as the requested resource is now
|
|
3618
|
+
* closed.
|
|
3619
|
+
*
|
|
3620
|
+
* @type {!number}
|
|
3621
|
+
*/
|
|
3622
|
+
RESOURCE_CLOSED: 518,
|
|
3623
|
+
/**
|
|
3624
|
+
* The operation could not be performed because the upstream server does
|
|
3625
|
+
* not appear to exist.
|
|
3626
|
+
*
|
|
3627
|
+
* @type {!number}
|
|
3628
|
+
*/
|
|
3629
|
+
UPSTREAM_NOT_FOUND: 519,
|
|
3630
|
+
/**
|
|
3631
|
+
* The operation could not be performed because the upstream server is not
|
|
3632
|
+
* available to service the request.
|
|
3633
|
+
*
|
|
3634
|
+
* @type {!number}
|
|
3635
|
+
*/
|
|
3636
|
+
UPSTREAM_UNAVAILABLE: 520,
|
|
3637
|
+
/**
|
|
3638
|
+
* The session within the upstream server has ended because it conflicted
|
|
3639
|
+
* with another session.
|
|
3640
|
+
*
|
|
3641
|
+
* @type {!number}
|
|
3642
|
+
*/
|
|
3643
|
+
SESSION_CONFLICT: 521,
|
|
3644
|
+
/**
|
|
3645
|
+
* The session within the upstream server has ended because it appeared to
|
|
3646
|
+
* be inactive.
|
|
3647
|
+
*
|
|
3648
|
+
* @type {!number}
|
|
3649
|
+
*/
|
|
3650
|
+
SESSION_TIMEOUT: 522,
|
|
3651
|
+
/**
|
|
3652
|
+
* The session within the upstream server has been forcibly terminated.
|
|
3653
|
+
*
|
|
3654
|
+
* @type {!number}
|
|
3655
|
+
*/
|
|
3656
|
+
SESSION_CLOSED: 523,
|
|
3657
|
+
/**
|
|
3658
|
+
* The operation could not be performed because bad parameters were given.
|
|
3659
|
+
*
|
|
3660
|
+
* @type {!number}
|
|
3661
|
+
*/
|
|
3662
|
+
CLIENT_BAD_REQUEST: 768,
|
|
3663
|
+
/**
|
|
3664
|
+
* Permission was denied to perform the operation, as the user is not yet
|
|
3665
|
+
* authorized (not yet logged in, for example).
|
|
3666
|
+
*
|
|
3667
|
+
* @type {!number}
|
|
3668
|
+
*/
|
|
3669
|
+
CLIENT_UNAUTHORIZED: 769,
|
|
3670
|
+
/**
|
|
3671
|
+
* Permission was denied to perform the operation, and this permission will
|
|
3672
|
+
* not be granted even if the user is authorized.
|
|
3673
|
+
*
|
|
3674
|
+
* @type {!number}
|
|
3675
|
+
*/
|
|
3676
|
+
CLIENT_FORBIDDEN: 771,
|
|
3677
|
+
/**
|
|
3678
|
+
* The client took too long to respond.
|
|
3679
|
+
*
|
|
3680
|
+
* @type {!number}
|
|
3681
|
+
*/
|
|
3682
|
+
CLIENT_TIMEOUT: 776,
|
|
3683
|
+
/**
|
|
3684
|
+
* The client sent too much data.
|
|
3685
|
+
*
|
|
3686
|
+
* @type {!number}
|
|
3687
|
+
*/
|
|
3688
|
+
CLIENT_OVERRUN: 781,
|
|
3689
|
+
/**
|
|
3690
|
+
* The client sent data of an unsupported or unexpected type.
|
|
3691
|
+
*
|
|
3692
|
+
* @type {!number}
|
|
3693
|
+
*/
|
|
3694
|
+
CLIENT_BAD_TYPE: 783,
|
|
3695
|
+
/**
|
|
3696
|
+
* The operation failed because the current client is already using too
|
|
3697
|
+
* many resources.
|
|
3698
|
+
*
|
|
3699
|
+
* @type {!number}
|
|
3700
|
+
*/
|
|
3701
|
+
CLIENT_TOO_MANY: 797
|
|
3702
|
+
};
|
|
3703
|
+
n.Status.Code.fromHTTPCode = function(e) {
|
|
3704
|
+
switch (e) {
|
|
3705
|
+
case 400:
|
|
3706
|
+
return n.Status.Code.CLIENT_BAD_REQUEST;
|
|
3707
|
+
case 403:
|
|
3708
|
+
return n.Status.Code.CLIENT_FORBIDDEN;
|
|
3709
|
+
case 404:
|
|
3710
|
+
return n.Status.Code.RESOURCE_NOT_FOUND;
|
|
3711
|
+
case 429:
|
|
3712
|
+
return n.Status.Code.CLIENT_TOO_MANY;
|
|
3713
|
+
case 503:
|
|
3714
|
+
return n.Status.Code.SERVER_BUSY;
|
|
3715
|
+
}
|
|
3716
|
+
return n.Status.Code.SERVER_ERROR;
|
|
3717
|
+
};
|
|
3718
|
+
n.Status.Code.fromWebSocketCode = function(e) {
|
|
3719
|
+
switch (e) {
|
|
3720
|
+
case 1e3:
|
|
3721
|
+
return n.Status.Code.SUCCESS;
|
|
3722
|
+
case 1006:
|
|
3723
|
+
case 1015:
|
|
3724
|
+
return n.Status.Code.UPSTREAM_NOT_FOUND;
|
|
3725
|
+
case 1001:
|
|
3726
|
+
case 1012:
|
|
3727
|
+
case 1013:
|
|
3728
|
+
case 1014:
|
|
3729
|
+
return n.Status.Code.UPSTREAM_UNAVAILABLE;
|
|
3730
|
+
}
|
|
3731
|
+
return n.Status.Code.SERVER_ERROR;
|
|
3732
|
+
};
|
|
3733
|
+
var n = n || {};
|
|
3734
|
+
n.StringReader = function(r) {
|
|
3735
|
+
var e = this, t = new n.UTF8Parser(), l = new n.ArrayBufferReader(r);
|
|
3736
|
+
l.ondata = function(u) {
|
|
3737
|
+
var i = t.decode(u);
|
|
3738
|
+
e.ontext && e.ontext(i);
|
|
3739
|
+
}, l.onend = function() {
|
|
3740
|
+
e.onend && e.onend();
|
|
3741
|
+
}, this.ontext = null, this.onend = null;
|
|
3742
|
+
};
|
|
3743
|
+
var n = n || {};
|
|
3744
|
+
n.StringWriter = function(r) {
|
|
3745
|
+
var e = this, t = new n.ArrayBufferWriter(r), l = new Uint8Array(8192), u = 0;
|
|
3746
|
+
t.onack = function(d) {
|
|
3747
|
+
e.onack && e.onack(d);
|
|
3748
|
+
};
|
|
3749
|
+
function i(d) {
|
|
3750
|
+
if (u + d >= l.length) {
|
|
3751
|
+
var c = new Uint8Array((u + d) * 2);
|
|
3752
|
+
c.set(l), l = c;
|
|
3753
|
+
}
|
|
3754
|
+
u += d;
|
|
3755
|
+
}
|
|
3756
|
+
function v(d) {
|
|
3757
|
+
var c, F;
|
|
3758
|
+
if (d <= 127)
|
|
3759
|
+
c = 0, F = 1;
|
|
3760
|
+
else if (d <= 2047)
|
|
3761
|
+
c = 192, F = 2;
|
|
3762
|
+
else if (d <= 65535)
|
|
3763
|
+
c = 224, F = 3;
|
|
3764
|
+
else if (d <= 2097151)
|
|
3765
|
+
c = 240, F = 4;
|
|
3766
|
+
else {
|
|
3767
|
+
v(65533);
|
|
3768
|
+
return;
|
|
3769
|
+
}
|
|
3770
|
+
i(F);
|
|
3771
|
+
for (var I = u - 1, E = 1; E < F; E++)
|
|
3772
|
+
l[I--] = 128 | d & 63, d >>= 6;
|
|
3773
|
+
l[I] = c | d;
|
|
3774
|
+
}
|
|
3775
|
+
function p(d) {
|
|
3776
|
+
for (var c = 0; c < d.length; c++) {
|
|
3777
|
+
var F = d.charCodeAt(c);
|
|
3778
|
+
v(F);
|
|
3779
|
+
}
|
|
3780
|
+
if (u > 0) {
|
|
3781
|
+
var I = l.subarray(0, u);
|
|
3782
|
+
return u = 0, I;
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
this.sendText = function(d) {
|
|
3786
|
+
d.length && t.sendData(p(d));
|
|
3787
|
+
}, this.sendEnd = function() {
|
|
3788
|
+
t.sendEnd();
|
|
3789
|
+
}, this.onack = null;
|
|
3790
|
+
};
|
|
3791
|
+
var n = n || {};
|
|
3792
|
+
n.Touch = function(e) {
|
|
3793
|
+
n.Event.Target.call(this);
|
|
3794
|
+
var t = this, l = Math.floor(16 * window.devicePixelRatio);
|
|
3795
|
+
this.touches = {}, this.activeTouches = 0, e.addEventListener("touchstart", function(i) {
|
|
3796
|
+
for (var v = 0; v < i.changedTouches.length; v++) {
|
|
3797
|
+
var p = i.changedTouches[v], d = p.identifier;
|
|
3798
|
+
if (!t.touches[d]) {
|
|
3799
|
+
var c = t.touches[d] = new n.Touch.State({
|
|
3800
|
+
id: d,
|
|
3801
|
+
radiusX: p.radiusX || l,
|
|
3802
|
+
radiusY: p.radiusY || l,
|
|
3803
|
+
angle: p.angle || 0,
|
|
3804
|
+
force: p.force || 1
|
|
3805
|
+
/* Within JavaScript changedTouch events, a force of 0.0 indicates the device does not support reporting changedTouch force */
|
|
3806
|
+
});
|
|
3807
|
+
t.activeTouches++, c.fromClientPosition(e, p.clientX, p.clientY), t.dispatch(new n.Touch.Event("touchmove", i, c));
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
}, !1), e.addEventListener("touchmove", function(i) {
|
|
3811
|
+
for (var v = 0; v < i.changedTouches.length; v++) {
|
|
3812
|
+
var p = i.changedTouches[v], d = p.identifier, c = t.touches[d];
|
|
3813
|
+
c && (p.force && (c.force = p.force), c.angle = p.angle || 0, c.radiusX = p.radiusX || l, c.radiusY = p.radiusY || l, c.fromClientPosition(e, p.clientX, p.clientY), t.dispatch(new n.Touch.Event("touchmove", i, c)));
|
|
3814
|
+
}
|
|
3815
|
+
}, !1), e.addEventListener("touchend", function(i) {
|
|
3816
|
+
for (var v = 0; v < i.changedTouches.length; v++) {
|
|
3817
|
+
var p = i.changedTouches[v], d = p.identifier, c = t.touches[d];
|
|
3818
|
+
c && (delete t.touches[d], t.activeTouches--, c.force = 0, c.fromClientPosition(e, p.clientX, p.clientY), t.dispatch(new n.Touch.Event("touchend", i, c)));
|
|
3819
|
+
}
|
|
3820
|
+
}, !1);
|
|
3821
|
+
};
|
|
3822
|
+
n.Touch.State = function(e) {
|
|
3823
|
+
e = e || {}, n.Position.call(this, e), this.id = e.id || 0, this.radiusX = e.radiusX || 0, this.radiusY = e.radiusY || 0, this.angle = e.angle || 0, this.force = e.force || 1;
|
|
3824
|
+
};
|
|
3825
|
+
n.Touch.Event = function(e, t, l) {
|
|
3826
|
+
n.Event.DOMEvent.call(this, e, [t]), this.state = l;
|
|
3827
|
+
};
|
|
3828
|
+
var n = n || {};
|
|
3829
|
+
n.Tunnel = function() {
|
|
3830
|
+
this.connect = function(r) {
|
|
3831
|
+
}, this.disconnect = function() {
|
|
3832
|
+
}, this.sendMessage = function(r) {
|
|
3833
|
+
}, this.setState = function(r) {
|
|
3834
|
+
r !== this.state && (this.state = r, this.onstatechange && this.onstatechange(r));
|
|
3835
|
+
}, this.setUUID = function(e) {
|
|
3836
|
+
this.uuid = e, this.onuuid && this.onuuid(e);
|
|
3837
|
+
}, this.isConnected = function() {
|
|
3838
|
+
return this.state === n.Tunnel.State.OPEN || this.state === n.Tunnel.State.UNSTABLE;
|
|
3839
|
+
}, this.state = n.Tunnel.State.CLOSED, this.receiveTimeout = 15e3, this.unstableThreshold = 1500, this.uuid = null, this.onuuid = null, this.onerror = null, this.onstatechange = null, this.oninstruction = null;
|
|
3840
|
+
};
|
|
3841
|
+
n.Tunnel.INTERNAL_DATA_OPCODE = "";
|
|
3842
|
+
n.Tunnel.State = {
|
|
3843
|
+
/**
|
|
3844
|
+
* A connection is in pending. It is not yet known whether connection was
|
|
3845
|
+
* successful.
|
|
3846
|
+
*
|
|
3847
|
+
* @type {!number}
|
|
3848
|
+
*/
|
|
3849
|
+
CONNECTING: 0,
|
|
3850
|
+
/**
|
|
3851
|
+
* Connection was successful, and data is being received.
|
|
3852
|
+
*
|
|
3853
|
+
* @type {!number}
|
|
3854
|
+
*/
|
|
3855
|
+
OPEN: 1,
|
|
3856
|
+
/**
|
|
3857
|
+
* The connection is closed. Connection may not have been successful, the
|
|
3858
|
+
* tunnel may have been explicitly closed by either side, or an error may
|
|
3859
|
+
* have occurred.
|
|
3860
|
+
*
|
|
3861
|
+
* @type {!number}
|
|
3862
|
+
*/
|
|
3863
|
+
CLOSED: 2,
|
|
3864
|
+
/**
|
|
3865
|
+
* The connection is open, but communication through the tunnel appears to
|
|
3866
|
+
* be disrupted, and the connection may close as a result.
|
|
3867
|
+
*
|
|
3868
|
+
* @type {!number}
|
|
3869
|
+
*/
|
|
3870
|
+
UNSTABLE: 3
|
|
3871
|
+
};
|
|
3872
|
+
n.HTTPTunnel = function(r, e, t) {
|
|
3873
|
+
var l = this, u = r + "?connect", i = r + "?read:", v = r + "?write:", p = 1, d = 0, c = p, F = !1, I = "", E = !!e, T = null, L = null, M = null, k = 500, m = t || {}, g = "Guacamole-Tunnel-Token", s = null;
|
|
3874
|
+
function f(o, h) {
|
|
3875
|
+
for (var b in h)
|
|
3876
|
+
o.setRequestHeader(b, h[b]);
|
|
3877
|
+
}
|
|
3878
|
+
var y = function() {
|
|
3879
|
+
window.clearTimeout(T), window.clearTimeout(L), l.state === n.Tunnel.State.UNSTABLE && l.setState(n.Tunnel.State.OPEN), T = window.setTimeout(function() {
|
|
3880
|
+
S(new n.Status(n.Status.Code.UPSTREAM_TIMEOUT, "Server timeout."));
|
|
3881
|
+
}, l.receiveTimeout), L = window.setTimeout(function() {
|
|
3882
|
+
l.setState(n.Tunnel.State.UNSTABLE);
|
|
3883
|
+
}, l.unstableThreshold);
|
|
3884
|
+
};
|
|
3885
|
+
function S(o) {
|
|
3886
|
+
window.clearTimeout(T), window.clearTimeout(L), window.clearInterval(M), l.state !== n.Tunnel.State.CLOSED && (o.code !== n.Status.Code.SUCCESS && l.onerror && (l.state === n.Tunnel.State.CONNECTING || o.code !== n.Status.Code.RESOURCE_NOT_FOUND) && l.onerror(o), F = !1, l.setState(n.Tunnel.State.CLOSED));
|
|
3887
|
+
}
|
|
3888
|
+
this.sendMessage = function() {
|
|
3889
|
+
if (!l.isConnected() || arguments.length === 0)
|
|
3890
|
+
return;
|
|
3891
|
+
function o(P) {
|
|
3892
|
+
var A = new String(P);
|
|
3893
|
+
return A.length + "." + A;
|
|
3894
|
+
}
|
|
3895
|
+
for (var h = o(arguments[0]), b = 1; b < arguments.length; b++)
|
|
3896
|
+
h += "," + o(arguments[b]);
|
|
3897
|
+
h += ";", I += h, F || C();
|
|
3898
|
+
};
|
|
3899
|
+
function C() {
|
|
3900
|
+
if (l.isConnected())
|
|
3901
|
+
if (I.length > 0) {
|
|
3902
|
+
F = !0;
|
|
3903
|
+
var o = new XMLHttpRequest();
|
|
3904
|
+
o.open("POST", v + l.uuid), o.withCredentials = E, f(o, m), o.setRequestHeader("Content-type", "application/octet-stream"), o.setRequestHeader(g, s), o.onreadystatechange = function() {
|
|
3905
|
+
o.readyState === 4 && (y(), o.status !== 200 ? _(o) : C());
|
|
3906
|
+
}, o.send(I), I = "";
|
|
3907
|
+
} else
|
|
3908
|
+
F = !1;
|
|
3909
|
+
}
|
|
3910
|
+
function _(o) {
|
|
3911
|
+
var h = parseInt(o.getResponseHeader("Guacamole-Status-Code"));
|
|
3912
|
+
if (h) {
|
|
3913
|
+
var b = o.getResponseHeader("Guacamole-Error-Message");
|
|
3914
|
+
S(new n.Status(h, b));
|
|
3915
|
+
} else o.status ? S(new n.Status(
|
|
3916
|
+
n.Status.Code.fromHTTPCode(o.status),
|
|
3917
|
+
o.statusText
|
|
3918
|
+
)) : S(new n.Status(n.Status.Code.UPSTREAM_NOT_FOUND));
|
|
3919
|
+
}
|
|
3920
|
+
function x(o) {
|
|
3921
|
+
var h = null, b = null, P = 0, A = -1, D = 0, R = new Array();
|
|
3922
|
+
function w() {
|
|
3923
|
+
if (!l.isConnected()) {
|
|
3924
|
+
h !== null && clearInterval(h);
|
|
3925
|
+
return;
|
|
3926
|
+
}
|
|
3927
|
+
if (!(o.readyState < 2)) {
|
|
3928
|
+
var W;
|
|
3929
|
+
try {
|
|
3930
|
+
W = o.status;
|
|
3931
|
+
} catch {
|
|
3932
|
+
W = 200;
|
|
3933
|
+
}
|
|
3934
|
+
if (!b && W === 200 && (b = a()), o.readyState === 3 || o.readyState === 4) {
|
|
3935
|
+
if (y(), c === p && (o.readyState === 3 && !h ? h = setInterval(w, 30) : o.readyState === 4 && h && clearInterval(h)), o.status === 0) {
|
|
3936
|
+
l.disconnect();
|
|
3937
|
+
return;
|
|
3938
|
+
} else if (o.status !== 200) {
|
|
3939
|
+
_(o);
|
|
3940
|
+
return;
|
|
3941
|
+
}
|
|
3942
|
+
var B;
|
|
3943
|
+
try {
|
|
3944
|
+
B = o.responseText;
|
|
3945
|
+
} catch {
|
|
3946
|
+
return;
|
|
3947
|
+
}
|
|
3948
|
+
for (; A < B.length; ) {
|
|
3949
|
+
if (A >= D) {
|
|
3950
|
+
var z = B.substring(D, A), U = B.substring(A, A + 1);
|
|
3951
|
+
if (R.push(z), U === ";") {
|
|
3952
|
+
var H = R.shift();
|
|
3953
|
+
l.oninstruction && l.oninstruction(H, R), R.length = 0;
|
|
3954
|
+
}
|
|
3955
|
+
D = A + 1;
|
|
3956
|
+
}
|
|
3957
|
+
var Q = B.indexOf(".", D);
|
|
3958
|
+
if (Q !== -1) {
|
|
3959
|
+
var J = parseInt(B.substring(A + 1, Q));
|
|
3960
|
+
if (J === 0) {
|
|
3961
|
+
h && clearInterval(h), o.onreadystatechange = null, o.abort(), b && x(b);
|
|
3962
|
+
break;
|
|
3963
|
+
}
|
|
3964
|
+
D = Q + 1, A = D + J;
|
|
3965
|
+
} else {
|
|
3966
|
+
D = B.length;
|
|
3967
|
+
break;
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
c === p ? o.onreadystatechange = function() {
|
|
3974
|
+
o.readyState === 3 && (P++, P >= 2 && (c = d, o.onreadystatechange = w)), w();
|
|
3975
|
+
} : o.onreadystatechange = w, w();
|
|
3976
|
+
}
|
|
3977
|
+
var O = 0;
|
|
3978
|
+
function a() {
|
|
3979
|
+
var o = new XMLHttpRequest();
|
|
3980
|
+
return o.open("GET", i + l.uuid + ":" + O++), o.setRequestHeader(g, s), o.withCredentials = E, f(o, m), o.send(null), o;
|
|
3981
|
+
}
|
|
3982
|
+
this.connect = function(o) {
|
|
3983
|
+
y(), l.setState(n.Tunnel.State.CONNECTING);
|
|
3984
|
+
var h = new XMLHttpRequest();
|
|
3985
|
+
h.onreadystatechange = function() {
|
|
3986
|
+
if (h.readyState === 4) {
|
|
3987
|
+
if (h.status !== 200) {
|
|
3988
|
+
_(h);
|
|
3989
|
+
return;
|
|
3990
|
+
}
|
|
3991
|
+
if (y(), l.setUUID(h.responseText), s = h.getResponseHeader(g), !s) {
|
|
3992
|
+
S(new n.Status(n.Status.Code.UPSTREAM_NOT_FOUND));
|
|
3993
|
+
return;
|
|
3994
|
+
}
|
|
3995
|
+
l.setState(n.Tunnel.State.OPEN), M = setInterval(function() {
|
|
3996
|
+
l.sendMessage("nop");
|
|
3997
|
+
}, k), x(a());
|
|
3998
|
+
}
|
|
3999
|
+
}, h.open("POST", u, !0), h.withCredentials = E, f(h, m), h.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"), h.send(o);
|
|
4000
|
+
}, this.disconnect = function() {
|
|
4001
|
+
S(new n.Status(n.Status.Code.SUCCESS, "Manually closed."));
|
|
4002
|
+
};
|
|
4003
|
+
};
|
|
4004
|
+
n.HTTPTunnel.prototype = new n.Tunnel();
|
|
4005
|
+
n.WebSocketTunnel = function(r) {
|
|
4006
|
+
var e = this, t = null, l = null, u = null, i = null, v = {
|
|
4007
|
+
"http:": "ws:",
|
|
4008
|
+
"https:": "wss:"
|
|
4009
|
+
}, p = 500, d = 0;
|
|
4010
|
+
if (r.substring(0, 3) !== "ws:" && r.substring(0, 4) !== "wss:") {
|
|
4011
|
+
var c = v[window.location.protocol];
|
|
4012
|
+
if (r.substring(0, 1) === "/")
|
|
4013
|
+
r = c + "//" + window.location.host + r;
|
|
4014
|
+
else {
|
|
4015
|
+
var F = window.location.pathname.lastIndexOf("/"), I = window.location.pathname.substring(0, F + 1);
|
|
4016
|
+
r = c + "//" + window.location.host + I + r;
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
var E = function() {
|
|
4020
|
+
var k = (/* @__PURE__ */ new Date()).getTime();
|
|
4021
|
+
e.sendMessage(n.Tunnel.INTERNAL_DATA_OPCODE, "ping", k), d = k;
|
|
4022
|
+
}, T = function() {
|
|
4023
|
+
window.clearTimeout(l), window.clearTimeout(u), window.clearTimeout(i), e.state === n.Tunnel.State.UNSTABLE && e.setState(n.Tunnel.State.OPEN), l = window.setTimeout(function() {
|
|
4024
|
+
L(new n.Status(n.Status.Code.UPSTREAM_TIMEOUT, "Server timeout."));
|
|
4025
|
+
}, e.receiveTimeout), u = window.setTimeout(function() {
|
|
4026
|
+
e.setState(n.Tunnel.State.UNSTABLE);
|
|
4027
|
+
}, e.unstableThreshold);
|
|
4028
|
+
var k = (/* @__PURE__ */ new Date()).getTime(), m = Math.max(d + p - k, 0);
|
|
4029
|
+
m > 0 ? i = window.setTimeout(E, m) : E();
|
|
4030
|
+
};
|
|
4031
|
+
function L(M) {
|
|
4032
|
+
window.clearTimeout(l), window.clearTimeout(u), window.clearTimeout(i), e.state !== n.Tunnel.State.CLOSED && (M.code !== n.Status.Code.SUCCESS && e.onerror && e.onerror(M), e.setState(n.Tunnel.State.CLOSED), t.close());
|
|
4033
|
+
}
|
|
4034
|
+
this.sendMessage = function(M) {
|
|
4035
|
+
if (!e.isConnected() || arguments.length === 0)
|
|
4036
|
+
return;
|
|
4037
|
+
function k(s) {
|
|
4038
|
+
var f = new String(s);
|
|
4039
|
+
return f.length + "." + f;
|
|
4040
|
+
}
|
|
4041
|
+
for (var m = k(arguments[0]), g = 1; g < arguments.length; g++)
|
|
4042
|
+
m += "," + k(arguments[g]);
|
|
4043
|
+
m += ";", t.send(m);
|
|
4044
|
+
}, this.connect = function(M) {
|
|
4045
|
+
T(), e.setState(n.Tunnel.State.CONNECTING), t = new WebSocket(r + "?" + M, "guacamole"), t.onopen = function(k) {
|
|
4046
|
+
T();
|
|
4047
|
+
}, t.onclose = function(k) {
|
|
4048
|
+
k.reason ? L(new n.Status(parseInt(k.reason), k.reason)) : k.code ? L(new n.Status(n.Status.Code.fromWebSocketCode(k.code))) : L(new n.Status(n.Status.Code.UPSTREAM_NOT_FOUND));
|
|
4049
|
+
}, t.onmessage = function(k) {
|
|
4050
|
+
T();
|
|
4051
|
+
var m = k.data, g = 0, s, f = [];
|
|
4052
|
+
do {
|
|
4053
|
+
var y = m.indexOf(".", g);
|
|
4054
|
+
if (y !== -1) {
|
|
4055
|
+
var S = parseInt(m.substring(s + 1, y));
|
|
4056
|
+
g = y + 1, s = g + S;
|
|
4057
|
+
} else
|
|
4058
|
+
L(new n.Status(n.Status.Code.SERVER_ERROR, "Incomplete instruction."));
|
|
4059
|
+
var C = m.substring(g, s), _ = m.substring(s, s + 1);
|
|
4060
|
+
if (f.push(C), _ === ";") {
|
|
4061
|
+
var x = f.shift();
|
|
4062
|
+
e.uuid === null && (x === n.Tunnel.INTERNAL_DATA_OPCODE && f.length === 1 && e.setUUID(f[0]), e.setState(n.Tunnel.State.OPEN)), x !== n.Tunnel.INTERNAL_DATA_OPCODE && e.oninstruction && e.oninstruction(x, f), f.length = 0;
|
|
4063
|
+
}
|
|
4064
|
+
g = s + 1;
|
|
4065
|
+
} while (g < m.length);
|
|
4066
|
+
};
|
|
4067
|
+
}, this.disconnect = function() {
|
|
4068
|
+
L(new n.Status(n.Status.Code.SUCCESS, "Manually closed."));
|
|
4069
|
+
};
|
|
4070
|
+
};
|
|
4071
|
+
n.WebSocketTunnel.prototype = new n.Tunnel();
|
|
4072
|
+
n.ChainedTunnel = function(r) {
|
|
4073
|
+
for (var e = this, t, l = [], u = null, i = 0; i < arguments.length; i++)
|
|
4074
|
+
l.push(arguments[i]);
|
|
4075
|
+
function v(p) {
|
|
4076
|
+
e.disconnect = p.disconnect, e.sendMessage = p.sendMessage;
|
|
4077
|
+
var d = function(I) {
|
|
4078
|
+
if (I && I.code === n.Status.Code.UPSTREAM_TIMEOUT)
|
|
4079
|
+
return l = [], null;
|
|
4080
|
+
var E = l.shift();
|
|
4081
|
+
return E && (p.onerror = null, p.oninstruction = null, p.onstatechange = null, v(E)), E;
|
|
4082
|
+
};
|
|
4083
|
+
function c() {
|
|
4084
|
+
p.onstatechange = e.onstatechange, p.oninstruction = e.oninstruction, p.onerror = e.onerror, p.uuid && e.setUUID(p.uuid), p.onuuid = function(I) {
|
|
4085
|
+
e.setUUID(I);
|
|
4086
|
+
}, u = p;
|
|
4087
|
+
}
|
|
4088
|
+
p.onstatechange = function(F) {
|
|
4089
|
+
switch (F) {
|
|
4090
|
+
case n.Tunnel.State.OPEN:
|
|
4091
|
+
c(), e.onstatechange && e.onstatechange(F);
|
|
4092
|
+
break;
|
|
4093
|
+
case n.Tunnel.State.CLOSED:
|
|
4094
|
+
!d() && e.onstatechange && e.onstatechange(F);
|
|
4095
|
+
break;
|
|
4096
|
+
}
|
|
4097
|
+
}, p.oninstruction = function(F, I) {
|
|
4098
|
+
c(), e.oninstruction && e.oninstruction(F, I);
|
|
4099
|
+
}, p.onerror = function(F) {
|
|
4100
|
+
!d(F) && e.onerror && e.onerror(F);
|
|
4101
|
+
}, p.connect(t);
|
|
4102
|
+
}
|
|
4103
|
+
this.connect = function(p) {
|
|
4104
|
+
t = p;
|
|
4105
|
+
var d = u || l.shift();
|
|
4106
|
+
d ? v(d) : e.onerror && e.onerror(n.Status.Code.SERVER_ERROR, "No tunnels to try.");
|
|
4107
|
+
};
|
|
4108
|
+
};
|
|
4109
|
+
n.ChainedTunnel.prototype = new n.Tunnel();
|
|
4110
|
+
n.StaticHTTPTunnel = function(e, t, l) {
|
|
4111
|
+
var u = this, i = null, v = l || {};
|
|
4112
|
+
this.size = null, this.sendMessage = function(d) {
|
|
4113
|
+
}, this.connect = function(d) {
|
|
4114
|
+
u.disconnect(), u.setState(n.Tunnel.State.CONNECTING);
|
|
4115
|
+
var c = new n.Parser(), F = new n.UTF8Parser();
|
|
4116
|
+
c.oninstruction = function(E, T) {
|
|
4117
|
+
u.oninstruction && u.oninstruction(E, T);
|
|
4118
|
+
}, i = new AbortController(), fetch(e, {
|
|
4119
|
+
headers: v,
|
|
4120
|
+
credentials: t ? "include" : "same-origin",
|
|
4121
|
+
signal: i.signal
|
|
4122
|
+
}).then(function(E) {
|
|
4123
|
+
if (!E.ok) {
|
|
4124
|
+
u.onerror && u.onerror(new n.Status(
|
|
4125
|
+
n.Status.Code.fromHTTPCode(E.status),
|
|
4126
|
+
E.statusText
|
|
4127
|
+
)), u.disconnect();
|
|
4128
|
+
return;
|
|
4129
|
+
}
|
|
4130
|
+
u.size = E.headers.get("Content-Length"), u.setState(n.Tunnel.State.OPEN);
|
|
4131
|
+
var T = E.body.getReader(), L = function M(k) {
|
|
4132
|
+
if (k.done) {
|
|
4133
|
+
u.disconnect();
|
|
4134
|
+
return;
|
|
4135
|
+
}
|
|
4136
|
+
c.receive(F.decode(k.value)), T.read().then(M);
|
|
4137
|
+
};
|
|
4138
|
+
T.read().then(L);
|
|
4139
|
+
});
|
|
4140
|
+
}, this.disconnect = function() {
|
|
4141
|
+
i && (i.abort(), i = null), u.setState(n.Tunnel.State.CLOSED);
|
|
4142
|
+
};
|
|
4143
|
+
};
|
|
4144
|
+
n.StaticHTTPTunnel.prototype = new n.Tunnel();
|
|
4145
|
+
var n = n || {};
|
|
4146
|
+
n.UTF8Parser = function() {
|
|
4147
|
+
var e = 0, t = 0;
|
|
4148
|
+
this.decode = function(u) {
|
|
4149
|
+
for (var i = "", v = new Uint8Array(u), p = 0; p < v.length; p++) {
|
|
4150
|
+
var d = v[p];
|
|
4151
|
+
e === 0 ? (d | 127) === 127 ? i += String.fromCharCode(d) : (d | 31) === 223 ? (t = d & 31, e = 1) : (d | 15) === 239 ? (t = d & 15, e = 2) : (d | 7) === 247 ? (t = d & 7, e = 3) : i += "�" : (d | 63) === 191 ? (t = t << 6 | d & 63, e--, e === 0 && (i += String.fromCharCode(t))) : (e = 0, i += "�");
|
|
4152
|
+
}
|
|
4153
|
+
return i;
|
|
4154
|
+
};
|
|
4155
|
+
};
|
|
4156
|
+
var n = n || {};
|
|
4157
|
+
n.API_VERSION = "1.5.0";
|
|
4158
|
+
var n = n || {};
|
|
4159
|
+
n.VideoPlayer = function() {
|
|
4160
|
+
this.sync = function() {
|
|
4161
|
+
};
|
|
4162
|
+
};
|
|
4163
|
+
n.VideoPlayer.isSupportedType = function(e) {
|
|
4164
|
+
return !1;
|
|
4165
|
+
};
|
|
4166
|
+
n.VideoPlayer.getSupportedTypes = function() {
|
|
4167
|
+
return [];
|
|
4168
|
+
};
|
|
4169
|
+
n.VideoPlayer.getInstance = function(e, t, l) {
|
|
4170
|
+
return null;
|
|
4171
|
+
};
|
|
4172
|
+
const Ie = n, At = {
|
|
4173
|
+
ref: "screenContainerRef",
|
|
4174
|
+
class: "screen-container"
|
|
4175
|
+
}, Lt = {
|
|
4176
|
+
ref: "screenRef",
|
|
4177
|
+
class: "screen"
|
|
4178
|
+
}, Mt = {
|
|
4179
|
+
key: 0,
|
|
4180
|
+
class: "request-control-overlay"
|
|
4181
|
+
}, Ot = {
|
|
4182
|
+
key: 1,
|
|
4183
|
+
class: "control-denied-overlay"
|
|
4184
|
+
}, Pt = { class: "control-denied-text" }, Dt = /* @__PURE__ */ Ce({
|
|
4185
|
+
__name: "WebControlForRIGOLOS",
|
|
4186
|
+
props: {
|
|
4187
|
+
wsUrl: { default: void 0 },
|
|
4188
|
+
screenWidth: { default: void 0 },
|
|
4189
|
+
screenHeight: { default: void 0 }
|
|
4190
|
+
},
|
|
4191
|
+
setup(r) {
|
|
4192
|
+
const e = Le(), t = r, l = K(null), u = K(null), i = K(null), v = K(!1), p = K(!1), d = K(""), c = K(null), F = K(!0), I = K(!1), E = K("");
|
|
4193
|
+
let T = null, L = null, M = null, k = null;
|
|
4194
|
+
const m = K(t.screenWidth || 1920), g = K(t.screenHeight || 1080), s = K({}), f = K({}), y = [1e3, 2e3, 4e3];
|
|
4195
|
+
let S = 0, C = null;
|
|
4196
|
+
const _ = fe(() => t.wsUrl || `ws://${window.location.hostname}/ws`);
|
|
4197
|
+
function x() {
|
|
4198
|
+
if (!l.value || !u.value) return;
|
|
4199
|
+
const z = m.value, U = g.value;
|
|
4200
|
+
if (!Number.isFinite(z) || !Number.isFinite(U) || z <= 0 || U <= 0) return;
|
|
4201
|
+
const H = l.value.parentElement;
|
|
4202
|
+
if (!H) return;
|
|
4203
|
+
const Q = H.getBoundingClientRect(), J = window.getComputedStyle(H), Z = parseFloat(J.paddingLeft) || 0, ne = parseFloat(J.paddingRight) || 0, ee = parseFloat(J.paddingTop) || 0, ae = parseFloat(J.paddingBottom) || 0, le = Q.width - Z - ne, pe = Q.height - ee - ae;
|
|
4204
|
+
if (le === 0 || pe === 0) return;
|
|
4205
|
+
const Se = le / z, ue = pe / U, G = Math.min(Se, ue), $ = Math.floor(z * G), V = Math.floor(U * G);
|
|
4206
|
+
f.value = {
|
|
4207
|
+
width: `${$}px`,
|
|
4208
|
+
height: `${V}px`
|
|
4209
|
+
}, s.value = {
|
|
4210
|
+
width: `${$}px`,
|
|
4211
|
+
height: `${V}px`
|
|
4212
|
+
}, M && M.getDisplay().scale($ / z);
|
|
4213
|
+
}
|
|
4214
|
+
function O() {
|
|
4215
|
+
k && (k.onkeydown = null, k.onkeyup = null, k = null), M && (M.disconnect(), M = null), u.value && u.value.replaceChildren();
|
|
4216
|
+
}
|
|
4217
|
+
function a() {
|
|
4218
|
+
var ne;
|
|
4219
|
+
if (O(), !u.value || !((ne = c.value) != null && ne.has_control)) return;
|
|
4220
|
+
const z = `${_.value}/tunnel`;
|
|
4221
|
+
Y.info("Starting Guacamole tunnel:", z);
|
|
4222
|
+
const U = new Ie.WebSocketTunnel(z), H = new Ie.Client(U);
|
|
4223
|
+
H.onerror = (ee) => {
|
|
4224
|
+
Y.error("Guacamole error:", ee), d.value = e.connection.connectionError;
|
|
4225
|
+
}, H.onstatechange = (ee) => {
|
|
4226
|
+
ee === Ie.Client.State.CONNECTED && (d.value = "");
|
|
4227
|
+
};
|
|
4228
|
+
const Q = H.getDisplay();
|
|
4229
|
+
Q.onresize = (ee, ae) => {
|
|
4230
|
+
!Number.isFinite(ee) || !Number.isFinite(ae) || ee <= 0 || ae <= 0 || (m.value = ee, g.value = ae, Fe(() => x()));
|
|
4231
|
+
}, u.value.appendChild(Q.getElement()), new Ie.Mouse(H.getDisplay().getElement()).onEach(
|
|
4232
|
+
["mousedown", "mousemove", "mouseup"],
|
|
4233
|
+
(ee) => {
|
|
4234
|
+
H.sendMouseState(ee.state, !0);
|
|
4235
|
+
}
|
|
4236
|
+
);
|
|
4237
|
+
const Z = new Ie.Keyboard(u.value);
|
|
4238
|
+
Z.onkeydown = (ee) => {
|
|
4239
|
+
H.sendKeyEvent(1, ee);
|
|
4240
|
+
}, Z.onkeyup = (ee) => {
|
|
4241
|
+
H.sendKeyEvent(0, ee);
|
|
4242
|
+
}, M = H, k = Z, H.connect("");
|
|
4243
|
+
}
|
|
4244
|
+
function o() {
|
|
4245
|
+
var z;
|
|
4246
|
+
(z = u.value) == null || z.focus();
|
|
4247
|
+
}
|
|
4248
|
+
rt(
|
|
4249
|
+
() => {
|
|
4250
|
+
var z;
|
|
4251
|
+
return (z = c.value) == null ? void 0 : z.has_control;
|
|
4252
|
+
},
|
|
4253
|
+
async (z) => {
|
|
4254
|
+
z ? (await Fe(), a(), x()) : O();
|
|
4255
|
+
}
|
|
4256
|
+
);
|
|
4257
|
+
function h() {
|
|
4258
|
+
var z;
|
|
4259
|
+
((z = i.value) == null ? void 0 : z.readyState) === WebSocket.OPEN && i.value.send(JSON.stringify({ type: "get_control_status" }));
|
|
4260
|
+
}
|
|
4261
|
+
function b() {
|
|
4262
|
+
var z;
|
|
4263
|
+
((z = i.value) == null ? void 0 : z.readyState) === WebSocket.OPEN && (Y.info("Requesting control..."), I.value = !0, i.value.send(JSON.stringify({ type: "request_control" })));
|
|
4264
|
+
}
|
|
4265
|
+
function P(z) {
|
|
4266
|
+
E.value = z, T && clearTimeout(T), T = window.setTimeout(() => {
|
|
4267
|
+
E.value = "", T = null;
|
|
4268
|
+
}, 3e3);
|
|
4269
|
+
}
|
|
4270
|
+
function A(z) {
|
|
4271
|
+
try {
|
|
4272
|
+
const U = JSON.parse(z.data);
|
|
4273
|
+
switch (U.type) {
|
|
4274
|
+
case "connected":
|
|
4275
|
+
Y.info("Server connection confirmed"), h(), b();
|
|
4276
|
+
break;
|
|
4277
|
+
case "control_status":
|
|
4278
|
+
c.value = {
|
|
4279
|
+
has_control: U.has_control || !1,
|
|
4280
|
+
current_controller_ip: U.current_controller_ip || null,
|
|
4281
|
+
current_controller_connection_id: U.current_controller_connection_id || null
|
|
4282
|
+
}, F.value = !1, U.has_control && (I.value = !1, L && (clearTimeout(L), L = null));
|
|
4283
|
+
break;
|
|
4284
|
+
case "control_denied":
|
|
4285
|
+
Y.warn("Control denied:", U.message), I.value = !1, L && (clearTimeout(L), L = null), P(U.message || e.control.noPermission);
|
|
4286
|
+
break;
|
|
4287
|
+
case "server_shutdown":
|
|
4288
|
+
d.value = e.connection.serverShuttingDown;
|
|
4289
|
+
break;
|
|
4290
|
+
default:
|
|
4291
|
+
Y.info("Unknown message type:", U.type);
|
|
4292
|
+
}
|
|
4293
|
+
} catch (U) {
|
|
4294
|
+
Y.error("Error parsing WebSocket message:", U);
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
function D(z = !1) {
|
|
4298
|
+
var U;
|
|
4299
|
+
if (((U = i.value) == null ? void 0 : U.readyState) !== WebSocket.OPEN) {
|
|
4300
|
+
z || (v.value = !0, d.value = "");
|
|
4301
|
+
try {
|
|
4302
|
+
i.value = new WebSocket(_.value), i.value.onopen = () => {
|
|
4303
|
+
v.value = !1, p.value = !0, I.value = !0, S = 0, L && clearTimeout(L), L = window.setTimeout(() => {
|
|
4304
|
+
I.value = !1;
|
|
4305
|
+
}, 3e3);
|
|
4306
|
+
}, i.value.onmessage = A, i.value.onclose = (H) => {
|
|
4307
|
+
p.value = !1, v.value = !1, F.value = !0, I.value = !1, O(), H.code !== 1e3 && R();
|
|
4308
|
+
}, i.value.onerror = () => {
|
|
4309
|
+
v.value = !1, O(), R();
|
|
4310
|
+
};
|
|
4311
|
+
} catch (H) {
|
|
4312
|
+
Y.error("Failed to create WebSocket:", H), v.value = !1, d.value = e.connection.cannotCreateConnection;
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
}
|
|
4316
|
+
function R() {
|
|
4317
|
+
if (C && (clearTimeout(C), C = null), S >= y.length) {
|
|
4318
|
+
d.value = e.connection.tooManyRetries;
|
|
4319
|
+
return;
|
|
4320
|
+
}
|
|
4321
|
+
C = window.setTimeout(() => {
|
|
4322
|
+
C = null, S++, Y.info(
|
|
4323
|
+
`Attempting to reconnect (${S}/${y.length})`
|
|
4324
|
+
), D(!0);
|
|
4325
|
+
}, y[S]);
|
|
4326
|
+
}
|
|
4327
|
+
function w() {
|
|
4328
|
+
S = 0, d.value = "", D();
|
|
4329
|
+
}
|
|
4330
|
+
let W = null;
|
|
4331
|
+
function B() {
|
|
4332
|
+
C && (clearTimeout(C), C = null), T && (clearTimeout(T), T = null), L && (clearTimeout(L), L = null), O(), i.value && (i.value.close(1e3, "Component unmounted"), i.value = null), W && (W.disconnect(), W = null), window.removeEventListener("resize", x);
|
|
4333
|
+
}
|
|
4334
|
+
return ke(async () => {
|
|
4335
|
+
var z;
|
|
4336
|
+
x(), D(), await Fe(), (z = l.value) != null && z.parentElement && (W = new ResizeObserver(() => {
|
|
4337
|
+
x();
|
|
4338
|
+
}), W.observe(l.value.parentElement)), window.addEventListener("resize", x);
|
|
4339
|
+
}), Ae(() => {
|
|
4340
|
+
B();
|
|
4341
|
+
}), (z, U) => {
|
|
4342
|
+
var H;
|
|
4343
|
+
return re(), ve("div", {
|
|
4344
|
+
ref_key: "webControlRef",
|
|
4345
|
+
ref: l,
|
|
4346
|
+
class: "web-control",
|
|
4347
|
+
style: he(f.value)
|
|
4348
|
+
}, [
|
|
4349
|
+
te("div", At, [
|
|
4350
|
+
te("div", Lt, [
|
|
4351
|
+
te("div", {
|
|
4352
|
+
ref_key: "displayHostRef",
|
|
4353
|
+
ref: u,
|
|
4354
|
+
tabindex: "0",
|
|
4355
|
+
class: at(["display-host", {
|
|
4356
|
+
"has-control": (H = c.value) == null ? void 0 : H.has_control,
|
|
4357
|
+
"no-control": c.value && !c.value.has_control
|
|
4358
|
+
}]),
|
|
4359
|
+
style: he(s.value),
|
|
4360
|
+
onClick: o
|
|
4361
|
+
}, null, 6),
|
|
4362
|
+
Oe(Pe, {
|
|
4363
|
+
"is-connecting": v.value,
|
|
4364
|
+
"connection-error": d.value,
|
|
4365
|
+
onRetry: w
|
|
4366
|
+
}, null, 8, ["is-connecting", "connection-error"]),
|
|
4367
|
+
p.value && !F.value && !I.value && c.value && !c.value.has_control && !E.value ? (re(), ve("div", Mt, [
|
|
4368
|
+
te("button", {
|
|
4369
|
+
class: "request-control-btn",
|
|
4370
|
+
onClick: b
|
|
4371
|
+
}, Re(me(e).control.requestControl), 1)
|
|
4372
|
+
])) : be("", !0),
|
|
4373
|
+
E.value ? (re(), ve("div", Ot, [
|
|
4374
|
+
U[0] || (U[0] = te("div", { class: "control-denied-icon" }, "🚫", -1)),
|
|
4375
|
+
te("div", Pt, Re(E.value), 1)
|
|
4376
|
+
])) : be("", !0)
|
|
4377
|
+
], 512)
|
|
4378
|
+
], 512)
|
|
4379
|
+
], 4);
|
|
4380
|
+
};
|
|
4381
|
+
}
|
|
4382
|
+
}), Nt = /* @__PURE__ */ Ee(Dt, [["__scopeId", "data-v-3c38015d"]]), Ut = 100, Je = 5, Wt = 400, Bt = /* @__PURE__ */ Ce({
|
|
4383
|
+
__name: "WebControlForRIGOLQT",
|
|
4384
|
+
props: {
|
|
4385
|
+
wsUrl: { default: void 0 },
|
|
4386
|
+
canvasWidth: { default: 1024 },
|
|
4387
|
+
canvasHeight: { default: 600 }
|
|
4388
|
+
},
|
|
4389
|
+
setup(r) {
|
|
4390
|
+
const e = Le(), t = r, l = K(), u = K(), i = K(), v = K(null), p = K(!1), d = K(!1), c = K(""), F = K(null), I = K({}), E = K({}), T = K(""), L = K(0), M = K(0), k = K(0), m = K(null), g = K(!1), s = K(!1), f = K(0), y = {
|
|
4391
|
+
LEFT_DOWN: 0,
|
|
4392
|
+
LEFT_UP: 1,
|
|
4393
|
+
MOUSE_MOVE: 2
|
|
4394
|
+
}, S = fe(() => {
|
|
4395
|
+
if (!t.wsUrl)
|
|
4396
|
+
return Y.error("[WebControlRIGOLQT] wsUrl is required but not provided"), "";
|
|
4397
|
+
try {
|
|
4398
|
+
const U = new URL(t.wsUrl);
|
|
4399
|
+
return `${U.protocol === "wss:" ? "https:" : "http:"}//${U.hostname}`;
|
|
4400
|
+
} catch (U) {
|
|
4401
|
+
return Y.error(
|
|
4402
|
+
"[WebControlRIGOLQT] Failed to parse wsUrl:",
|
|
4403
|
+
t.wsUrl,
|
|
4404
|
+
U
|
|
4405
|
+
), "";
|
|
4406
|
+
}
|
|
4407
|
+
}), C = () => {
|
|
4408
|
+
if (!l.value || !i.value) return;
|
|
4409
|
+
const U = l.value.parentElement;
|
|
4410
|
+
if (!U) return;
|
|
4411
|
+
const H = U.getBoundingClientRect(), Q = window.getComputedStyle(U), J = parseFloat(Q.paddingLeft) || 0, Z = parseFloat(Q.paddingRight) || 0, ne = parseFloat(Q.paddingTop) || 0, ee = parseFloat(Q.paddingBottom) || 0, ae = H.width - J - Z, le = H.height - ne - ee;
|
|
4412
|
+
if (ae === 0 || le === 0) return;
|
|
4413
|
+
const pe = ae / t.canvasWidth, Se = le / t.canvasHeight, ue = Math.min(pe, Se), G = t.canvasWidth * ue, $ = t.canvasHeight * ue;
|
|
4414
|
+
I.value = {
|
|
4415
|
+
width: `${ae}px`,
|
|
4416
|
+
height: `${le}px`
|
|
4417
|
+
}, E.value = {
|
|
4418
|
+
width: `${G}px`,
|
|
4419
|
+
height: `${$}px`
|
|
4420
|
+
};
|
|
4421
|
+
}, _ = () => {
|
|
4422
|
+
var U;
|
|
4423
|
+
if (((U = v.value) == null ? void 0 : U.readyState) !== WebSocket.OPEN) {
|
|
4424
|
+
p.value = !0, c.value = "";
|
|
4425
|
+
try {
|
|
4426
|
+
if (!t.wsUrl) {
|
|
4427
|
+
Y.error("[WebControlRIGOLQT] wsUrl prop is required"), c.value = e.connection.wsUrlNotConfigured, p.value = !1;
|
|
4428
|
+
return;
|
|
4429
|
+
}
|
|
4430
|
+
Y.info(`[WebControlRIGOLQT] Connecting to ${t.wsUrl}`), v.value = new WebSocket(t.wsUrl + "/tcp_proxy"), v.value.onopen = () => {
|
|
4431
|
+
Y.info("[WebControlRIGOLQT] WebSocket connected"), p.value = !1, d.value = !0, h(), a();
|
|
4432
|
+
}, v.value.onmessage = (H) => {
|
|
4433
|
+
x(H);
|
|
4434
|
+
}, v.value.onclose = (H) => {
|
|
4435
|
+
Y.info(
|
|
4436
|
+
"[WebControlRIGOLQT] WebSocket closed:",
|
|
4437
|
+
H.code,
|
|
4438
|
+
H.reason
|
|
4439
|
+
), d.value = !1, p.value = !1, o();
|
|
4440
|
+
}, v.value.onerror = (H) => {
|
|
4441
|
+
Y.error("[WebControlRIGOLQT] WebSocket error:", H), p.value = !1, c.value = e.connection.connectionError, o();
|
|
4442
|
+
};
|
|
4443
|
+
} catch (H) {
|
|
4444
|
+
Y.error("[WebControlRIGOLQT] Failed to create WebSocket:", H), p.value = !1, c.value = e.connection.cannotCreateConnection;
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
}, x = (U) => {
|
|
4448
|
+
const H = U.data;
|
|
4449
|
+
k.value = 0, H.indexOf("/img") === 0 ? (T.value = S.value + H, L.value = 0, M.value = 0, b()) : H.indexOf("ready") === 0 ? P() : H.indexOf("snaping") === 0 ? b() : (Y.info("[WebControlRIGOLQT] Response:", H), h());
|
|
4450
|
+
}, O = () => {
|
|
4451
|
+
c.value = "", _();
|
|
4452
|
+
}, a = () => {
|
|
4453
|
+
m.value || (m.value = window.setInterval(() => {
|
|
4454
|
+
k.value++, k.value >= 3 && k.value < 10 ? h() : k.value >= 10 && (Y.info("[WebControlRIGOLQT] Watchdog timeout, reconnecting..."), v.value && (v.value.close(), v.value = null), k.value = 0, _());
|
|
4455
|
+
}, Wt));
|
|
4456
|
+
}, o = () => {
|
|
4457
|
+
m.value && (clearInterval(m.value), m.value = null);
|
|
4458
|
+
}, h = () => {
|
|
4459
|
+
!v.value || v.value.readyState !== WebSocket.OPEN || (v.value.send(`:DISP:PULL? SNAP
|
|
4460
|
+
`), L.value = 0);
|
|
4461
|
+
}, b = () => {
|
|
4462
|
+
!v.value || v.value.readyState !== WebSocket.OPEN || (L.value++, L.value >= Ut ? h() : v.value.send(`:DISP:ready?
|
|
4463
|
+
`));
|
|
4464
|
+
}, P = () => {
|
|
4465
|
+
if (!i.value || !F.value || !T.value) {
|
|
4466
|
+
Y.warn("[WebControlRIGOLQT] Canvas or URL not ready"), setTimeout(() => b(), 80);
|
|
4467
|
+
return;
|
|
4468
|
+
}
|
|
4469
|
+
const U = new Image();
|
|
4470
|
+
U.onload = () => {
|
|
4471
|
+
M.value = 0, F.value && i.value && (F.value.clearRect(
|
|
4472
|
+
0,
|
|
4473
|
+
0,
|
|
4474
|
+
i.value.width,
|
|
4475
|
+
i.value.height
|
|
4476
|
+
), F.value.drawImage(
|
|
4477
|
+
U,
|
|
4478
|
+
0,
|
|
4479
|
+
0,
|
|
4480
|
+
t.canvasWidth,
|
|
4481
|
+
t.canvasHeight
|
|
4482
|
+
)), setTimeout(() => {
|
|
4483
|
+
h();
|
|
4484
|
+
}, 80);
|
|
4485
|
+
}, U.onerror = (H) => {
|
|
4486
|
+
M.value++, Y.error(
|
|
4487
|
+
`[WebControlRIGOLQT] Failed to load image (${M.value}/${Je}):`,
|
|
4488
|
+
T.value,
|
|
4489
|
+
H
|
|
4490
|
+
), M.value >= Je ? (Y.warn(
|
|
4491
|
+
"[WebControlRIGOLQT] Too many image load errors, fetching new image"
|
|
4492
|
+
), M.value = 0, h()) : setTimeout(() => b(), 100);
|
|
4493
|
+
}, U.src = T.value;
|
|
4494
|
+
}, A = (U, H, Q) => {
|
|
4495
|
+
if (!v.value || v.value.readyState !== WebSocket.OPEN) return;
|
|
4496
|
+
const J = `:syst:touch ${U},${H},${Q}
|
|
4497
|
+
`;
|
|
4498
|
+
v.value.send(J);
|
|
4499
|
+
}, D = (U, H) => {
|
|
4500
|
+
if (!i.value) return { x: 0, y: 0 };
|
|
4501
|
+
const Q = i.value.getBoundingClientRect(), J = t.canvasWidth / Q.width, Z = t.canvasHeight / Q.height;
|
|
4502
|
+
return {
|
|
4503
|
+
x: Math.round(U * J),
|
|
4504
|
+
y: Math.round(H * Z)
|
|
4505
|
+
};
|
|
4506
|
+
}, R = (U) => {
|
|
4507
|
+
if (!i.value || !d.value || U.button !== 0) return;
|
|
4508
|
+
g.value = !0, s.value = !1, f.value = 0;
|
|
4509
|
+
const H = i.value.getBoundingClientRect(), Q = U.clientX - H.left, J = U.clientY - H.top, Z = D(Q, J);
|
|
4510
|
+
A(y.LEFT_DOWN, Z.x, Z.y);
|
|
4511
|
+
}, w = (U) => {
|
|
4512
|
+
if (!i.value || !d.value || !g.value) return;
|
|
4513
|
+
const H = i.value.getBoundingClientRect(), Q = U.clientX - H.left, J = U.clientY - H.top;
|
|
4514
|
+
if (s.value || (s.value = !0), s.value && f.value === 0) {
|
|
4515
|
+
const Z = D(Q, J);
|
|
4516
|
+
A(y.MOUSE_MOVE, Z.x, Z.y), f.value = 1;
|
|
4517
|
+
}
|
|
4518
|
+
}, W = (U) => {
|
|
4519
|
+
if (!i.value || !d.value || !g.value) return;
|
|
4520
|
+
g.value = !1;
|
|
4521
|
+
const H = i.value.getBoundingClientRect(), Q = U.clientX - H.left, J = U.clientY - H.top, Z = D(Q, J);
|
|
4522
|
+
f.value === 1 && A(y.LEFT_DOWN, Z.x, Z.y), A(y.LEFT_UP, Z.x, Z.y), f.value = 0, s.value = !1;
|
|
4523
|
+
}, B = () => {
|
|
4524
|
+
g.value && d.value && i.value && (g.value = !1, s.value = !1, f.value = 0);
|
|
4525
|
+
};
|
|
4526
|
+
let z = null;
|
|
4527
|
+
return ke(async () => {
|
|
4528
|
+
var U;
|
|
4529
|
+
await Fe(), i.value && (i.value.width = t.canvasWidth, i.value.height = t.canvasHeight, F.value = i.value.getContext("2d"), F.value && (F.value.fillStyle = "#000000", F.value.fillRect(0, 0, t.canvasWidth, t.canvasHeight))), C(), (U = l.value) != null && U.parentElement && (z = new ResizeObserver(() => {
|
|
4530
|
+
C();
|
|
4531
|
+
}), z.observe(l.value.parentElement)), window.addEventListener("resize", C), _();
|
|
4532
|
+
}), Ae(() => {
|
|
4533
|
+
window.removeEventListener("resize", C), z && (z.disconnect(), z = null), o(), v.value && (v.value.close(1e3), v.value = null);
|
|
4534
|
+
}), (U, H) => (re(), ve("div", {
|
|
4535
|
+
ref_key: "webControlRef",
|
|
4536
|
+
ref: l,
|
|
4537
|
+
class: "web-control-rigol-qt",
|
|
4538
|
+
style: he(I.value)
|
|
4539
|
+
}, [
|
|
4540
|
+
te("div", {
|
|
4541
|
+
ref_key: "screenContainerRef",
|
|
4542
|
+
ref: u,
|
|
4543
|
+
class: "screen-container"
|
|
4544
|
+
}, [
|
|
4545
|
+
te("canvas", {
|
|
4546
|
+
id: "rigol-qt-canvas",
|
|
4547
|
+
ref_key: "canvasRef",
|
|
4548
|
+
ref: i,
|
|
4549
|
+
class: "screen-canvas",
|
|
4550
|
+
style: he(E.value),
|
|
4551
|
+
onMousedown: R,
|
|
4552
|
+
onMouseup: W,
|
|
4553
|
+
onMousemove: w,
|
|
4554
|
+
onMouseleave: B
|
|
4555
|
+
}, null, 36),
|
|
4556
|
+
Oe(Pe, {
|
|
4557
|
+
"is-connecting": p.value,
|
|
4558
|
+
"connection-error": c.value,
|
|
4559
|
+
onRetry: O
|
|
4560
|
+
}, null, 8, ["is-connecting", "connection-error"])
|
|
4561
|
+
], 512)
|
|
4562
|
+
], 4));
|
|
4563
|
+
}
|
|
4564
|
+
}), zt = /* @__PURE__ */ Ee(Bt, [["__scopeId", "data-v-eb09f730"]]), Ht = { class: "r-web-control" }, Gt = /* @__PURE__ */ Ce({
|
|
4565
|
+
name: "RWebControl",
|
|
4566
|
+
__name: "RWebControl",
|
|
4567
|
+
props: {
|
|
4568
|
+
version: {},
|
|
4569
|
+
connectionUrl: { default: "" },
|
|
4570
|
+
screenWidth: { default: void 0 },
|
|
4571
|
+
screenHeight: { default: void 0 }
|
|
4572
|
+
},
|
|
4573
|
+
setup(r) {
|
|
4574
|
+
const e = je(it, null), t = fe(() => {
|
|
4575
|
+
const u = e ? me(e) : void 0;
|
|
4576
|
+
return lt(u);
|
|
4577
|
+
}), l = fe(
|
|
4578
|
+
() => ut(t.value)
|
|
4579
|
+
);
|
|
4580
|
+
return ot(Ze, {
|
|
4581
|
+
get locale() {
|
|
4582
|
+
return l.value;
|
|
4583
|
+
}
|
|
4584
|
+
}), (u, i) => (re(), ve("div", Ht, [
|
|
4585
|
+
r.version === me(xe).RIGOL_OS ? (re(), _e(Nt, {
|
|
4586
|
+
key: 0,
|
|
4587
|
+
"ws-url": r.connectionUrl,
|
|
4588
|
+
"screen-width": r.screenWidth,
|
|
4589
|
+
"screen-height": r.screenHeight
|
|
4590
|
+
}, null, 8, ["ws-url", "screen-width", "screen-height"])) : r.version === me(xe).ANDROID ? (re(), _e(wt, {
|
|
4591
|
+
key: 1,
|
|
4592
|
+
"base-url": r.connectionUrl,
|
|
4593
|
+
"device-screen-width": r.screenWidth,
|
|
4594
|
+
"device-screen-height": r.screenHeight
|
|
4595
|
+
}, null, 8, ["base-url", "device-screen-width", "device-screen-height"])) : r.version === me(xe).RAW_H5 || r.version === me(xe).URL ? (re(), _e(xt, {
|
|
4596
|
+
key: 2,
|
|
4597
|
+
src: r.connectionUrl
|
|
4598
|
+
}, null, 8, ["src"])) : r.version === me(xe).TINA_LINUX ? (re(), _e(kt, {
|
|
4599
|
+
key: 3,
|
|
4600
|
+
"ws-url": r.connectionUrl,
|
|
4601
|
+
"canvas-width": r.screenWidth,
|
|
4602
|
+
"canvas-height": r.screenHeight
|
|
4603
|
+
}, null, 8, ["ws-url", "canvas-width", "canvas-height"])) : r.version === me(xe).RIGOL_QT ? (re(), _e(zt, {
|
|
4604
|
+
key: 4,
|
|
4605
|
+
"ws-url": r.connectionUrl,
|
|
4606
|
+
"canvas-width": r.screenWidth,
|
|
4607
|
+
"canvas-height": r.screenHeight
|
|
4608
|
+
}, null, 8, ["ws-url", "canvas-width", "canvas-height"])) : be("", !0)
|
|
4609
|
+
]));
|
|
4610
|
+
}
|
|
4611
|
+
}), Kt = /* @__PURE__ */ Ee(Gt, [["__scopeId", "data-v-f9c1f0d9"]]), Vt = st(Kt, "RWebControl");
|
|
4612
|
+
export {
|
|
4613
|
+
Vt as RWebControl,
|
|
4614
|
+
xe as WebControlVersion,
|
|
4615
|
+
$t as parseControlPanelResolution,
|
|
4616
|
+
ut as resolveWebControlLocaleFromGlobal
|
|
4617
|
+
};
|