orgo-vnc
Version:
Embed cloud desktops in your React app
1,262 lines (1,252 loc) • 683 kB
JavaScript
"use client";
import {
__commonJS,
__toESM
} from "./chunk-3QS3WKRC.mjs";
// node_modules/@novnc/novnc/lib/util/int.js
var require_int = __commonJS({
"node_modules/@novnc/novnc/lib/util/int.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toSigned32bit = toSigned32bit;
exports.toUnsigned32bit = toUnsigned32bit;
function toUnsigned32bit(toConvert) {
return toConvert >>> 0;
}
function toSigned32bit(toConvert) {
return toConvert | 0;
}
}
});
// node_modules/@novnc/novnc/lib/util/logging.js
var require_logging = __commonJS({
"node_modules/@novnc/novnc/lib/util/logging.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Warn = exports.Info = exports.Error = exports.Debug = void 0;
exports.getLogging = getLogging;
exports.initLogging = initLogging;
var _logLevel = "warn";
var Debug = exports.Debug = function Debug2() {
};
var Info = exports.Info = function Info2() {
};
var Warn = exports.Warn = function Warn2() {
};
var Error2 = exports.Error = function Error3() {
};
function initLogging(level) {
if (typeof level === "undefined") {
level = _logLevel;
} else {
_logLevel = level;
}
exports.Debug = Debug = exports.Info = Info = exports.Warn = Warn = exports.Error = Error2 = function Error3() {
};
if (typeof window.console !== "undefined") {
switch (level) {
case "debug":
exports.Debug = Debug = console.debug.bind(window.console);
case "info":
exports.Info = Info = console.info.bind(window.console);
case "warn":
exports.Warn = Warn = console.warn.bind(window.console);
case "error":
exports.Error = Error2 = console.error.bind(window.console);
case "none":
break;
default:
throw new window.Error("invalid logging type '" + level + "'");
}
}
}
function getLogging() {
return _logLevel;
}
initLogging();
}
});
// node_modules/@novnc/novnc/lib/util/strings.js
var require_strings = __commonJS({
"node_modules/@novnc/novnc/lib/util/strings.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.decodeUTF8 = decodeUTF8;
exports.encodeUTF8 = encodeUTF8;
function decodeUTF8(utf8string) {
var allowLatin1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
try {
return decodeURIComponent(escape(utf8string));
} catch (e) {
if (e instanceof URIError) {
if (allowLatin1) {
return utf8string;
}
}
throw e;
}
}
function encodeUTF8(DOMString) {
return unescape(encodeURIComponent(DOMString));
}
}
});
// node_modules/@novnc/novnc/lib/base64.js
var require_base64 = __commonJS({
"node_modules/@novnc/novnc/lib/base64.js"(exports) {
"use strict";
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var Log = _interopRequireWildcard(require_logging());
function _getRequireWildcardCache(e) {
if ("function" != typeof WeakMap) return null;
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
return e2 ? t : r;
})(e);
}
function _interopRequireWildcard(e, r) {
if (!r && e && e.__esModule) return e;
if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e };
var t = _getRequireWildcardCache(r);
if (t && t.has(e)) return t.get(e);
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
}
return n["default"] = e, t && t.set(e, n), n;
}
var _default = exports["default"] = {
/* Convert data (an array of integers) to a Base64 string. */
toBase64Table: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),
base64Pad: "=",
encode: function encode(data) {
"use strict";
var result = "";
var length = data.length;
var lengthpad = length % 3;
for (var i = 0; i < length - 2; i += 3) {
result += this.toBase64Table[data[i] >> 2];
result += this.toBase64Table[((data[i] & 3) << 4) + (data[i + 1] >> 4)];
result += this.toBase64Table[((data[i + 1] & 15) << 2) + (data[i + 2] >> 6)];
result += this.toBase64Table[data[i + 2] & 63];
}
var j = length - lengthpad;
if (lengthpad === 2) {
result += this.toBase64Table[data[j] >> 2];
result += this.toBase64Table[((data[j] & 3) << 4) + (data[j + 1] >> 4)];
result += this.toBase64Table[(data[j + 1] & 15) << 2];
result += this.toBase64Table[64];
} else if (lengthpad === 1) {
result += this.toBase64Table[data[j] >> 2];
result += this.toBase64Table[(data[j] & 3) << 4];
result += this.toBase64Table[64];
result += this.toBase64Table[64];
}
return result;
},
/* Convert Base64 data to a string */
/* eslint-disable comma-spacing */
toBinaryTable: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1],
/* eslint-enable comma-spacing */
decode: function decode(data) {
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
var dataLength = data.indexOf("=") - offset;
if (dataLength < 0) {
dataLength = data.length - offset;
}
var resultLength = (dataLength >> 2) * 3 + Math.floor(dataLength % 4 / 1.5);
var result = new Array(resultLength);
var leftbits = 0;
var leftdata = 0;
for (var idx = 0, i = offset; i < data.length; i++) {
var c = this.toBinaryTable[data.charCodeAt(i) & 127];
var padding = data.charAt(i) === this.base64Pad;
if (c === -1) {
Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
continue;
}
leftdata = leftdata << 6 | c;
leftbits += 6;
if (leftbits >= 8) {
leftbits -= 8;
if (!padding) {
result[idx++] = leftdata >> leftbits & 255;
}
leftdata &= (1 << leftbits) - 1;
}
}
if (leftbits) {
var err = new Error("Corrupted base64 string");
err.name = "Base64-Error";
throw err;
}
return result;
}
};
}
});
// node_modules/@novnc/novnc/lib/util/browser.js
var require_browser = __commonJS({
"node_modules/@novnc/novnc/lib/util/browser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.hasScrollbarGutter = exports.dragThreshold = void 0;
exports.isAndroid = isAndroid;
exports.isBlink = isBlink;
exports.isChrome = isChrome;
exports.isChromeOS = isChromeOS;
exports.isChromium = isChromium;
exports.isEdge = isEdge;
exports.isFirefox = isFirefox;
exports.isGecko = isGecko;
exports.isIOS = isIOS;
exports.isMac = isMac;
exports.isOpera = isOpera;
exports.isSafari = isSafari;
exports.isTouchDevice = void 0;
exports.isWebKit = isWebKit;
exports.isWindows = isWindows;
exports.supportsWebCodecsH264Decode = exports.supportsCursorURIs = void 0;
var Log = _interopRequireWildcard(require_logging());
var _base = _interopRequireDefault(require_base64());
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { "default": e };
}
function _getRequireWildcardCache(e) {
if ("function" != typeof WeakMap) return null;
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
return e2 ? t : r;
})(e);
}
function _interopRequireWildcard(e, r) {
if (!r && e && e.__esModule) return e;
if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e };
var t = _getRequireWildcardCache(r);
if (t && t.has(e)) return t.get(e);
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
}
return n["default"] = e, t && t.set(e, n), n;
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
function _regeneratorRuntime() {
"use strict";
_regeneratorRuntime = function _regeneratorRuntime2() {
return e;
};
var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) {
t2[e2] = r2.value;
}, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag";
function define(t2, e2, r2) {
return Object.defineProperty(t2, e2, { value: r2, enumerable: true, configurable: true, writable: true }), t2[e2];
}
try {
define({}, "");
} catch (t2) {
define = function define2(t3, e2, r2) {
return t3[e2] = r2;
};
}
function wrap(t2, e2, r2, n2) {
var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []);
return o(a2, "_invoke", { value: makeInvokeMethod(t2, r2, c2) }), a2;
}
function tryCatch(t2, e2, r2) {
try {
return { type: "normal", arg: t2.call(e2, r2) };
} catch (t3) {
return { type: "throw", arg: t3 };
}
}
e.wrap = wrap;
var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {};
function Generator() {
}
function GeneratorFunction() {
}
function GeneratorFunctionPrototype() {
}
var p = {};
define(p, a, function() {
return this;
});
var d = Object.getPrototypeOf, v = d && d(d(values([])));
v && v !== r && n.call(v, a) && (p = v);
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
function defineIteratorMethods(t2) {
["next", "throw", "return"].forEach(function(e2) {
define(t2, e2, function(t3) {
return this._invoke(e2, t3);
});
});
}
function AsyncIterator(t2, e2) {
function invoke(r3, o2, i2, a2) {
var c2 = tryCatch(t2[r3], t2, o2);
if ("throw" !== c2.type) {
var u2 = c2.arg, h2 = u2.value;
return h2 && "object" == _typeof(h2) && n.call(h2, "__await") ? e2.resolve(h2.__await).then(function(t3) {
invoke("next", t3, i2, a2);
}, function(t3) {
invoke("throw", t3, i2, a2);
}) : e2.resolve(h2).then(function(t3) {
u2.value = t3, i2(u2);
}, function(t3) {
return invoke("throw", t3, i2, a2);
});
}
a2(c2.arg);
}
var r2;
o(this, "_invoke", { value: function value(t3, n2) {
function callInvokeWithMethodAndArg() {
return new e2(function(e3, r3) {
invoke(t3, n2, e3, r3);
});
}
return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
} });
}
function makeInvokeMethod(e2, r2, n2) {
var o2 = h;
return function(i2, a2) {
if (o2 === f) throw Error("Generator is already running");
if (o2 === s) {
if ("throw" === i2) throw a2;
return { value: t, done: true };
}
for (n2.method = i2, n2.arg = a2; ; ) {
var c2 = n2.delegate;
if (c2) {
var u2 = maybeInvokeDelegate(c2, n2);
if (u2) {
if (u2 === y) continue;
return u2;
}
}
if ("next" === n2.method) n2.sent = n2._sent = n2.arg;
else if ("throw" === n2.method) {
if (o2 === h) throw o2 = s, n2.arg;
n2.dispatchException(n2.arg);
} else "return" === n2.method && n2.abrupt("return", n2.arg);
o2 = f;
var p2 = tryCatch(e2, r2, n2);
if ("normal" === p2.type) {
if (o2 = n2.done ? s : l, p2.arg === y) continue;
return { value: p2.arg, done: n2.done };
}
"throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg);
}
};
}
function maybeInvokeDelegate(e2, r2) {
var n2 = r2.method, o2 = e2.iterator[n2];
if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator["return"] && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y;
var i2 = tryCatch(o2, e2.iterator, r2.arg);
if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y;
var a2 = i2.arg;
return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y);
}
function pushTryEntry(t2) {
var e2 = { tryLoc: t2[0] };
1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2);
}
function resetTryEntry(t2) {
var e2 = t2.completion || {};
e2.type = "normal", delete e2.arg, t2.completion = e2;
}
function Context(t2) {
this.tryEntries = [{ tryLoc: "root" }], t2.forEach(pushTryEntry, this), this.reset(true);
}
function values(e2) {
if (e2 || "" === e2) {
var r2 = e2[a];
if (r2) return r2.call(e2);
if ("function" == typeof e2.next) return e2;
if (!isNaN(e2.length)) {
var o2 = -1, i2 = function next() {
for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next;
return next.value = t, next.done = true, next;
};
return i2.next = i2;
}
}
throw new TypeError(_typeof(e2) + " is not iterable");
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: true }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) {
var e2 = "function" == typeof t2 && t2.constructor;
return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name));
}, e.mark = function(t2) {
return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2;
}, e.awrap = function(t2) {
return { __await: t2 };
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function() {
return this;
}), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) {
void 0 === i2 && (i2 = Promise);
var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2);
return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) {
return t3.done ? t3.value : a2.next();
});
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function() {
return this;
}), define(g, "toString", function() {
return "[object Generator]";
}), e.keys = function(t2) {
var e2 = Object(t2), r2 = [];
for (var n2 in e2) r2.push(n2);
return r2.reverse(), function next() {
for (; r2.length; ) {
var t3 = r2.pop();
if (t3 in e2) return next.value = t3, next.done = false, next;
}
return next.done = true, next;
};
}, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e2) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t);
}, stop: function stop() {
this.done = true;
var t2 = this.tryEntries[0].completion;
if ("throw" === t2.type) throw t2.arg;
return this.rval;
}, dispatchException: function dispatchException(e2) {
if (this.done) throw e2;
var r2 = this;
function handle(n2, o3) {
return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3;
}
for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) {
var i2 = this.tryEntries[o2], a2 = i2.completion;
if ("root" === i2.tryLoc) return handle("end");
if (i2.tryLoc <= this.prev) {
var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc");
if (c2 && u2) {
if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true);
if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc);
} else if (c2) {
if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true);
} else {
if (!u2) throw Error("try statement without catch or finally");
if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc);
}
}
}
}, abrupt: function abrupt(t2, e2) {
for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) {
var o2 = this.tryEntries[r2];
if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) {
var i2 = o2;
break;
}
}
i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null);
var a2 = i2 ? i2.completion : {};
return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2);
}, complete: function complete(t2, e2) {
if ("throw" === t2.type) throw t2.arg;
return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y;
}, finish: function finish(t2) {
for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
var r2 = this.tryEntries[e2];
if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y;
}
}, "catch": function _catch(t2) {
for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
var r2 = this.tryEntries[e2];
if (r2.tryLoc === t2) {
var n2 = r2.completion;
if ("throw" === n2.type) {
var o2 = n2.arg;
resetTryEntry(r2);
}
return o2;
}
}
throw Error("illegal catch attempt");
}, delegateYield: function delegateYield(e2, r2, n2) {
return this.delegate = { iterator: values(e2), resultName: r2, nextLoc: n2 }, "next" === this.method && (this.arg = t), y;
} }, e;
}
function asyncGeneratorStep(n, t, e, r, o, a, c) {
try {
var i = n[a](c), u = i.value;
} catch (n2) {
return void e(n2);
}
i.done ? t(u) : Promise.resolve(u).then(r, o);
}
function _asyncToGenerator(n) {
return function() {
var t = this, e = arguments;
return new Promise(function(r, o) {
var a = n.apply(t, e);
function _next(n2) {
asyncGeneratorStep(a, r, o, _next, _throw, "next", n2);
}
function _throw(n2) {
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2);
}
_next(void 0);
});
};
}
var isTouchDevice = exports.isTouchDevice = "ontouchstart" in document.documentElement || // required for Chrome debugger
document.ontouchstart !== void 0 || // required for MS Surface
navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
window.addEventListener("touchstart", function onFirstTouch() {
exports.isTouchDevice = isTouchDevice = true;
window.removeEventListener("touchstart", onFirstTouch, false);
}, false);
var dragThreshold = exports.dragThreshold = 10 * (window.devicePixelRatio || 1);
var _supportsCursorURIs = false;
try {
target = document.createElement("canvas");
target.style.cursor = 'url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default';
if (target.style.cursor.indexOf("url") === 0) {
Log.Info("Data URI scheme cursor supported");
_supportsCursorURIs = true;
} else {
Log.Warn("Data URI scheme cursor not supported");
}
} catch (exc) {
Log.Error("Data URI scheme cursor test exception: " + exc);
}
var target;
var supportsCursorURIs = exports.supportsCursorURIs = _supportsCursorURIs;
var _hasScrollbarGutter = true;
try {
container = document.createElement("div");
container.style.visibility = "hidden";
container.style.overflow = "scroll";
document.body.appendChild(container);
child = document.createElement("div");
container.appendChild(child);
scrollbarWidth = container.offsetWidth - child.offsetWidth;
container.parentNode.removeChild(container);
_hasScrollbarGutter = scrollbarWidth != 0;
} catch (exc) {
Log.Error("Scrollbar test exception: " + exc);
}
var container;
var child;
var scrollbarWidth;
var hasScrollbarGutter = exports.hasScrollbarGutter = _hasScrollbarGutter;
var supportsWebCodecsH264Decode = exports.supportsWebCodecsH264Decode = false;
function _checkWebCodecsH264DecodeSupport() {
return _checkWebCodecsH264DecodeSupport2.apply(this, arguments);
}
function _checkWebCodecsH264DecodeSupport2() {
_checkWebCodecsH264DecodeSupport2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
var config, support, data, gotframe, _error, decoder, chunk;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if ("VideoDecoder" in window) {
_context.next = 2;
break;
}
return _context.abrupt("return", false);
case 2:
config = {
codec: "avc1.42401f",
codedWidth: 1920,
codedHeight: 1080,
optimizeForLatency: true
};
_context.next = 5;
return VideoDecoder.isConfigSupported(config);
case 5:
support = _context.sent;
if (support.supported) {
_context.next = 8;
break;
}
return _context.abrupt("return", false);
case 8:
data = new Uint8Array(_base["default"].decode("AAAAAWdCwBTZnpuAgICgAAADACAAAAZB4oVNAAAAAWjJYyyAAAABBgX//4HcRem95tlIt5Ys2CDZI+7veDI2NCAtIGNvcmUgMTY0IHIzMTA4IDMxZTE5ZjkgLSBILjI2NC9NUEVHLTQgQVZDIGNvZGVjIC0gQ29weWxlZnQgMjAwMy0yMDIzIC0gaHR0cDovL3d3dy52aWRlb2xhbi5vcmcveDI2NC5odG1sIC0gb3B0aW9uczogY2FiYWM9MCByZWY9NSBkZWJsb2NrPTE6MDowIGFuYWx5c2U9MHgxOjB4MTExIG1lPWhleCBzdWJtZT04IHBzeT0xIHBzeV9yZD0xLjAwOjAuMDAgbWl4ZWRfcmVmPTEgbWVfcmFuZ2U9MTYgY2hyb21hX21lPTEgdHJlbGxpcz0yIDh4OGRjdD0wIGNxbT0wIGRlYWR6b25lPTIxLDExIGZhc3RfcHNraXA9MSBjaHJvbWFfcXBfb2Zmc2V0PS0yIHRocmVhZHM9MSBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTAgd2VpZ2h0cD0wIGtleWludD1pbmZpbml0ZSBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NTAgcmM9YWJyIG1idHJlZT0xIGJpdHJhdGU9NDAwIHJhdGV0b2w9MS4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAABZYiEBrxmKAAPVccAAS044AA5DRJMnkycJk4TPw=="));
gotframe = false;
_error = null;
decoder = new VideoDecoder({
output: function output(frame) {
gotframe = true;
},
error: function error(e) {
_error = e;
}
});
chunk = new EncodedVideoChunk({
timestamp: 0,
type: "key",
data
});
decoder.configure(config);
decoder.decode(chunk);
_context.prev = 15;
_context.next = 18;
return decoder.flush();
case 18:
_context.next = 23;
break;
case 20:
_context.prev = 20;
_context.t0 = _context["catch"](15);
_error = _context.t0;
case 23:
if (gotframe) {
_context.next = 25;
break;
}
return _context.abrupt("return", false);
case 25:
if (!(_error !== null)) {
_context.next = 27;
break;
}
return _context.abrupt("return", false);
case 27:
return _context.abrupt("return", true);
case 28:
case "end":
return _context.stop();
}
}, _callee, null, [[15, 20]]);
}));
return _checkWebCodecsH264DecodeSupport2.apply(this, arguments);
}
_checkWebCodecsH264DecodeSupport().then(function(result) {
exports.supportsWebCodecsH264Decode = supportsWebCodecsH264Decode = result;
});
function isMac() {
return !!/mac/i.exec(navigator.platform);
}
function isWindows() {
return !!/win/i.exec(navigator.platform);
}
function isIOS() {
return !!/ipad/i.exec(navigator.platform) || !!/iphone/i.exec(navigator.platform) || !!/ipod/i.exec(navigator.platform);
}
function isAndroid() {
return !!navigator.userAgent.match("Android ");
}
function isChromeOS() {
return !!navigator.userAgent.match(" CrOS ");
}
function isSafari() {
return !!navigator.userAgent.match("Safari/...") && !navigator.userAgent.match("Chrome/...") && !navigator.userAgent.match("Chromium/...") && !navigator.userAgent.match("Epiphany/...");
}
function isFirefox() {
return !!navigator.userAgent.match("Firefox/...") && !navigator.userAgent.match("Seamonkey/...");
}
function isChrome() {
return !!navigator.userAgent.match("Chrome/...") && !navigator.userAgent.match("Chromium/...") && !navigator.userAgent.match("Edg/...") && !navigator.userAgent.match("OPR/...");
}
function isChromium() {
return !!navigator.userAgent.match("Chromium/...");
}
function isOpera() {
return !!navigator.userAgent.match("OPR/...");
}
function isEdge() {
return !!navigator.userAgent.match("Edg/...");
}
function isGecko() {
return !!navigator.userAgent.match("Gecko/...");
}
function isWebKit() {
return !!navigator.userAgent.match("AppleWebKit/...") && !navigator.userAgent.match("Chrome/...");
}
function isBlink() {
return !!navigator.userAgent.match("Chrome/...");
}
}
});
// node_modules/@novnc/novnc/lib/util/element.js
var require_element = __commonJS({
"node_modules/@novnc/novnc/lib/util/element.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clientToElement = clientToElement;
function clientToElement(x, y, elem) {
var bounds = elem.getBoundingClientRect();
var pos = {
x: 0,
y: 0
};
if (x < bounds.left) {
pos.x = 0;
} else if (x >= bounds.right) {
pos.x = bounds.width - 1;
} else {
pos.x = x - bounds.left;
}
if (y < bounds.top) {
pos.y = 0;
} else if (y >= bounds.bottom) {
pos.y = bounds.height - 1;
} else {
pos.y = y - bounds.top;
}
return pos;
}
}
});
// node_modules/@novnc/novnc/lib/util/events.js
var require_events = __commonJS({
"node_modules/@novnc/novnc/lib/util/events.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPointerEvent = getPointerEvent;
exports.releaseCapture = releaseCapture;
exports.setCapture = setCapture;
exports.stopEvent = stopEvent;
function getPointerEvent(e) {
return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e;
}
function stopEvent(e) {
e.stopPropagation();
e.preventDefault();
}
var _captureRecursion = false;
var _elementForUnflushedEvents = null;
document.captureElement = null;
function _captureProxy(e) {
if (_captureRecursion) return;
var newEv = new e.constructor(e.type, e);
_captureRecursion = true;
if (document.captureElement) {
document.captureElement.dispatchEvent(newEv);
} else {
_elementForUnflushedEvents.dispatchEvent(newEv);
}
_captureRecursion = false;
e.stopPropagation();
if (newEv.defaultPrevented) {
e.preventDefault();
}
if (e.type === "mouseup") {
releaseCapture();
}
}
function _capturedElemChanged() {
var proxyElem = document.getElementById("noVNC_mouse_capture_elem");
proxyElem.style.cursor = window.getComputedStyle(document.captureElement).cursor;
}
var _captureObserver = new MutationObserver(_capturedElemChanged);
function setCapture(target) {
if (target.setCapture) {
target.setCapture();
document.captureElement = target;
} else {
releaseCapture();
var proxyElem = document.getElementById("noVNC_mouse_capture_elem");
if (proxyElem === null) {
proxyElem = document.createElement("div");
proxyElem.id = "noVNC_mouse_capture_elem";
proxyElem.style.position = "fixed";
proxyElem.style.top = "0px";
proxyElem.style.left = "0px";
proxyElem.style.width = "100%";
proxyElem.style.height = "100%";
proxyElem.style.zIndex = 1e4;
proxyElem.style.display = "none";
document.body.appendChild(proxyElem);
proxyElem.addEventListener("contextmenu", _captureProxy);
proxyElem.addEventListener("mousemove", _captureProxy);
proxyElem.addEventListener("mouseup", _captureProxy);
}
document.captureElement = target;
_captureObserver.observe(target, {
attributes: true
});
_capturedElemChanged();
proxyElem.style.display = "";
window.addEventListener("mousemove", _captureProxy);
window.addEventListener("mouseup", _captureProxy);
}
}
function releaseCapture() {
if (document.releaseCapture) {
document.releaseCapture();
document.captureElement = null;
} else {
if (!document.captureElement) {
return;
}
_elementForUnflushedEvents = document.captureElement;
document.captureElement = null;
_captureObserver.disconnect();
var proxyElem = document.getElementById("noVNC_mouse_capture_elem");
proxyElem.style.display = "none";
window.removeEventListener("mousemove", _captureProxy);
window.removeEventListener("mouseup", _captureProxy);
}
}
}
});
// node_modules/@novnc/novnc/lib/util/eventtarget.js
var require_eventtarget = __commonJS({
"node_modules/@novnc/novnc/lib/util/eventtarget.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: false }), e;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var EventTargetMixin = exports["default"] = /* @__PURE__ */ (function() {
function EventTargetMixin2() {
_classCallCheck(this, EventTargetMixin2);
this._listeners = /* @__PURE__ */ new Map();
}
return _createClass(EventTargetMixin2, [{
key: "addEventListener",
value: function addEventListener(type, callback) {
if (!this._listeners.has(type)) {
this._listeners.set(type, /* @__PURE__ */ new Set());
}
this._listeners.get(type).add(callback);
}
}, {
key: "removeEventListener",
value: function removeEventListener(type, callback) {
if (this._listeners.has(type)) {
this._listeners.get(type)["delete"](callback);
}
}
}, {
key: "dispatchEvent",
value: function dispatchEvent(event) {
var _this = this;
if (!this._listeners.has(event.type)) {
return true;
}
this._listeners.get(event.type).forEach(function(callback) {
return callback.call(_this, event);
});
return !event.defaultPrevented;
}
}]);
})();
}
});
// node_modules/@novnc/novnc/lib/display.js
var require_display = __commonJS({
"node_modules/@novnc/novnc/lib/display.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var Log = _interopRequireWildcard(require_logging());
var _base = _interopRequireDefault(require_base64());
var _int = require_int();
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { "default": e };
}
function _getRequireWildcardCache(e) {
if ("function" != typeof WeakMap) return null;
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
return e2 ? t : r;
})(e);
}
function _interopRequireWildcard(e, r) {
if (!r && e && e.__esModule) return e;
if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e };
var t = _getRequireWildcardCache(r);
if (t && t.has(e)) return t.get(e);
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
}
return n["default"] = e, t && t.set(e, n), n;
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: false }), e;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Display = exports["default"] = /* @__PURE__ */ (function() {
function Display2(target) {
_classCallCheck(this, Display2);
this._drawCtx = null;
this._renderQ = [];
this._flushPromise = null;
this._fbWidth = 0;
this._fbHeight = 0;
this._prevDrawStyle = "";
Log.Debug(">> Display.constructor");
this._target = target;
if (!this._target) {
throw new Error("Target must be set");
}
if (typeof this._target === "string") {
throw new Error("target must be a DOM element");
}
if (!this._target.getContext) {
throw new Error("no getContext method");
}
this._targetCtx = this._target.getContext("2d");
this._viewportLoc = {
"x": 0,
"y": 0,
"w": this._target.width,
"h": this._target.height
};
this._backbuffer = document.createElement("canvas");
this._drawCtx = this._backbuffer.getContext("2d");
this._damageBounds = {
left: 0,
top: 0,
right: this._backbuffer.width,
bottom: this._backbuffer.height
};
Log.Debug("User Agent: " + navigator.userAgent);
Log.Debug("<< Display.constructor");
this._scale = 1;
this._clipViewport = false;
}
return _createClass(Display2, [{
key: "scale",
get: function get() {
return this._scale;
},
set: function set(scale) {
this._rescale(scale);
}
}, {
key: "clipViewport",
get: function get() {
return this._clipViewport;
},
set: function set(viewport) {
this._clipViewport = viewport;
var vp = this._viewportLoc;
this.viewportChangeSize(vp.w, vp.h);
this.viewportChangePos(0, 0);
}
}, {
key: "width",
get: function get() {
return this._fbWidth;
}
}, {
key: "height",
get: function get() {
return this._fbHeight;
}
// ===== PUBLIC METHODS =====
}, {
key: "viewportChangePos",
value: function viewportChangePos(deltaX, deltaY) {
var vp = this._viewportLoc;
deltaX = Math.floor(deltaX);
deltaY = Math.floor(deltaY);
if (!this._clipViewport) {
deltaX = -vp.w;
deltaY = -vp.h;
}
var vx2 = vp.x + vp.w - 1;
var vy2 = vp.y + vp.h - 1;
if (deltaX < 0 && vp.x + deltaX < 0) {
deltaX = -vp.x;
}
if (vx2 + deltaX >= this._fbWidth) {
deltaX -= vx2 + deltaX - this._fbWidth + 1;
}
if (vp.y + deltaY < 0) {
deltaY = -vp.y;
}
if (vy2 + deltaY >= this._fbHeight) {
deltaY -= vy2 + deltaY - this._fbHeight + 1;
}
if (deltaX === 0 && deltaY === 0) {
return;
}
Log.Debug("viewportChange deltaX: " + deltaX + ", deltaY: " + deltaY);
vp.x += deltaX;
vp.y += deltaY;
this._damage(vp.x, vp.y, vp.w, vp.h);
this.flip();
}
}, {
key: "viewportChangeSize",
value: function viewportChangeSize(width, height) {
if (!this._clipViewport || typeof width === "undefined" || typeof height === "undefined") {
Log.Debug("Setting viewport to full display region");
width = this._fbWidth;
height = this._fbHeight;
}
width = Math.floor(width);
height = Math.floor(height);
if (width > this._fbWidth) {
width = this._fbWidth;
}
if (height > this._fbHeight) {
height = this._fbHeight;
}
var vp = this._viewportLoc;
if (vp.w !== width || vp.h !== height) {
vp.w = width;
vp.h = height;
var canvas = this._target;
canvas.width = width;
canvas.height = height;
this.viewportChangePos(0, 0);
this._damage(vp.x, vp.y, vp.w, vp.h);
this.flip();
this._rescale(this._scale);
}
}
}, {
key: "absX",
value: function absX(x) {
if (this._scale === 0) {
return 0;
}
return (0, _int.toSigned32bit)(x / this._scale + this._viewportLoc.x);
}
}, {
key: "absY",
value: function absY(y) {
if (this._scale === 0) {
return 0;
}
return (0, _int.toSigned32bit)(y / this._scale + this._viewportLoc.y);
}
}, {
key: "resize",
value: function resize(width, height) {
this._prevDrawStyle = "";
this._fbWidth = width;
this._fbHeight = height;
var canvas = this._backbuffer;
if (canvas.width !== width || canvas.height !== height) {
var saveImg = null;
if (canvas.width > 0 && canvas.height > 0) {
saveImg = this._drawCtx.getImageData(0, 0, canvas.width, canvas.height);
}
if (canvas.width !== width) {
canvas.width = width;
}
if (canvas.height !== height) {
canvas.height = height;
}
if (saveImg) {
this._drawCtx.putImageData(saveImg, 0, 0);
}
}
var vp = this._viewportLoc;
this.viewportChangeSize(vp.w, vp.h);
this.viewportChangePos(0, 0);
}
}, {
key: "getImageData",
value: function getImageData() {
return this._drawCtx.getImageData(0, 0, this.width, this.height);
}
}, {
key: "toDataURL",
value: function toDataURL(type, encoderOptions) {
return this._backbuffer.toDataURL(type, encoderOptions);
}
}, {
key: "toBlob",
value: function toBlob(callback, type, quality) {
return this._backbuffer.toBlob(callback, type, quality);
}
// Track what parts of the visible canvas that need updating
}, {
key: "_damage",
value: function _damage(x, y, w, h) {
if (x < this._damageBounds.left) {
this._damageBounds.left = x;
}
if (y < this._damageBounds.top) {
this._damageBounds.top = y;
}
if (x + w > this._damageBounds.right) {
this._damageBounds.right = x + w;
}
if (y + h > this._damageBounds.bottom) {
this._damageBounds.bottom = y + h;
}
}
// Update the visible canvas with the contents of the
// rendering canvas
}, {
key: "flip",
value: function flip(fromQueue) {
if (this._renderQ.length !== 0 && !fromQueue) {
this._renderQPush({
"type": "flip"
});
} else {
var x = this._damageBounds.left;
var y = this._damageBounds.top;
var w = this._damageBounds.right - x;
var h = this._damageBounds.bottom - y;
var vx = x - this._viewportLoc.x;
var vy = y - this._viewportLoc.y;
if (vx < 0) {
w += vx;
x -= vx;
vx = 0;
}
if (vy < 0) {
h += vy;
y -= vy;
vy = 0;
}
if (vx + w > this._viewportLoc.w) {
w = this._viewportLoc.w - vx;
}
if (vy + h > this._viewportLoc.h) {
h = this._viewportLoc.h - vy;
}
if (w > 0 && h > 0) {
this._targetCtx.drawImage(this._backbuffer, x, y, w, h, vx, vy, w, h);
}
this._damageBounds.left = this._damageBounds.top = 65535;
this._damageBounds.right = this._damageBounds.bottom = 0;
}
}
}, {
key: "pending",
value: function pending() {
return this._renderQ.length > 0;
}
}, {
key: "flush",
value: function flush() {
var _this = this;
if (this._renderQ.length === 0) {
return Promise.resolve();
} else {
if (this._flushPromise === null) {
this._flushPromise = new Promise(function(resolve) {
_this._flushResolve = resolve;
});
}
return this._flushPromise;
}
}
}, {
key: "fillRect",
value: function fillRect(x, y, width, height, color, fromQueue) {
if (this._renderQ.length !== 0 && !fromQueue) {
this._renderQPush({
"type": "fill",
"x": x,
"y": y,
"width": width,
"height": height,
"color": color
});
} else {
this._setFillColor(color);
this._drawCtx.fillRect(x, y, width, height);
this._damage(x, y, width, height);
}
}
}, {
key: "copyImage",
value: function copyImage(oldX, oldY, newX, newY, w, h, fromQueue) {
if (this._renderQ.length !== 0 && !fromQueue) {
this._renderQPush({